Bug 2232061

Summary: mock 5.0 fails to run without podman
Product: [Fedora] Fedora Reporter: Ralf Corsepius <rc040203>
Component: mockAssignee: Copr Team <copr-team>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 38CC: copr-team, dominik, msuchy, philip.wyett, praiskup, williams
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ralf Corsepius 2023-08-15 06:08:11 UTC
mock-5.0-1.fc38.noarch is entirely dysfunctional.


Reproducible: Always

Steps to Reproduce:


# mock -r fedora-38-x86_64 --init
INFO: mock.py version 5.0 starting (python version = 3.11.4, NVR = mock-5.0-1.fc38)...
Start(bootstrap): init plugins
INFO: selinux enabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: selinux enabled
Finish: init plugins
INFO: Signal handler active
Start: run
Start: clean chroot
Finish: clean chroot
Mock Version: 5.0
INFO: Mock Version: 5.0
Start(bootstrap): chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled package manager cache
Start(bootstrap): cleaning package manager metadata
Finish(bootstrap): cleaning package manager metadata
INFO: Using bootstrap image: registry.fedoraproject.org/fedora:38
INFO: Pulling image: registry.fedoraproject.org/fedora:38
Traceback (most recent call last):
  File "/usr/libexec/mock/mock", line 1087, in <module>
    exitStatus = main()
                 ^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/libexec/mock/mock", line 847, in main
    result = run_command(options, args, config_opts, commands, buildroot, state)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/libexec/mock/mock", line 875, in run_command
    commands.init()
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/backend.py", line 166, in init
    self.bootstrap_buildroot.initialize(**kwargs)
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/buildroot.py", line 186, in initialize
    self._init(prebuild=prebuild)
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/buildroot.py", line 234, in _init
    podman.pull_image()
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/podman.py", line 25, in pull_image
    util.do(cmd, env=self.buildroot.env)
  File "/usr/lib/python3.11/site-packages/mockbuild/util.py", line 498, in do
    return do_with_status(*args, **kargs)[0]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/trace_decorator.py", line 93, in trace
    result = func(*args, **kw)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/mockbuild/util.py", line 541, in do_with_status
    child = subprocess.Popen(
            ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib64/python3.11/subprocess.py", line 1950, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'podman'

Actual Results:  
ATM, mock on f38 is completely unusable.


Expected Results:  
Function

Comment 1 Pavel Raiskup 2023-08-15 07:04:14 UTC
Thank you for the report, Ralf.

This is currently expected failure, considering that you intentionally blocked
the "weak-dep" `Recommends: podman` during Mock installation.  You either have
to install podman, or use --no-bootstrap-image (or the
`config_opts["use_bootstrap_image"] = False` config option) with Mock 5.0:

https://rpm-software-management.github.io/mock/Release-Notes-5.0

> Expected Results:
> Function

I think we could provide some more useful error message, rather then printing
out this ugly Traceback.  Would that be OK bug resolution?

Comment 2 Ralf Corsepius 2023-08-15 08:41:29 UTC
(In reply to Pavel Raiskup from comment #1)
> Thank you for the report, Ralf.
> 
> This is currently expected failure, considering that you intentionally
> blocked
> the "weak-dep" `Recommends: podman` during Mock installation.  You either
> have
> to install podman, or use --no-bootstrap-image (or the
> `config_opts["use_bootstrap_image"] = False` config option) with Mock 5.0:
I did not explicitly block anything. I just used the defaults.

However, I do have weak-deps disabled in my dnf configurations. So, are you trying to say mock depends on a build-host's dnf configuration? This would qualify as massive design flaw, IMO.

> https://rpm-software-management.github.io/mock/Release-Notes-5.0
> 
> > Expected Results:
> > Function
> 
> I think we could provide some more useful error message, rather then printing
> out this ugly Traceback.  Would that be OK bug resolution?
No. I am expecting mock to work out of the box, without the user having to tweak anything, anywhere.

Comment 3 Dominik 'Rathann' Mierzejewski 2023-08-15 09:20:01 UTC
I'd say mock should fall back to config_opts["use_bootstrap_image"] = False without user action if podman is not installed.

And, by the way, thank you for making podman a weak dependency.