Bug 2130349

Summary: error: %undefine: argument expected
Product: [Fedora] Fedora Reporter: Germano Massullo <germano.massullo>
Component: fedpkgAssignee: Ondřej Nosek <onosek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 36CC: copr-team, cqi, jkeating, lsedlar, maxwell, mebrown, msuchy, onosek, philip.wyett, praiskup, s, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-10-19 06:39:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Germano Massullo 2022-09-27 21:33:38 UTC
Description of problem:
mock-3.1-1.fc36.noarch is no longer working with command
fedpkg --release f38 mockbuild --srpm

Steps to Reproduce:
1.fedpkg clone darktable
2.fedpkg --release f38 mockbuild --srpm


$ fedpkg --release f38 mockbuild --srpm
Not downloading unused darktable-4.0.1.tar.xz
INFO: mock.py version 3.1 starting (python version = 3.10.6, NVR = mock-3.1-1.fc36)...
Start(bootstrap): init plugins
INFO: tmpfs initialized
INFO: selinux enabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: tmpfs initialized
INFO: selinux enabled
Finish: init plugins
INFO: Signal handler active
Start: run
Start(bootstrap): chroot init
INFO: mounting tmpfs at /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root.
INFO: reusing tmpfs at /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root.
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: enabled HW Info plugin
Mock Version: 3.1
INFO: Mock Version: 3.1
Finish(bootstrap): chroot init
Start: chroot init
INFO: mounting tmpfs at /var/lib/mock/fedora-rawhide-x86_64/root.
INFO: reusing tmpfs at /var/lib/mock/fedora-rawhide-x86_64/root.
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled package manager cache
Start: cleaning package manager metadata
Finish: cleaning package manager metadata
INFO: enabled HW Info plugin
Mock Version: 3.1
INFO: Mock Version: 3.1
Finish: chroot init
INFO: copying /home/caterpillar/canc/darktable/darktable.spec to /var/lib/mock/fedora-rawhide-x86_64/root/var/tmp
Finish: run
error: %undefine: argument expected
Could not execute mockbuild: Could not query n-v-r of darktable: Failed to execute command.

Comment 1 Maxwell G 2022-09-27 21:36:51 UTC
I'm reassigning this to fedpkg. This isn't a problem with mock directly. Also, it would probably help if you provided the output of `fedpkg --verbose --debug --release f38 mockbuild --srpm`.

I'm guessing that this is related to quoting of arguments and https://docs.pagure.org/rpkg/releases/1.65.html#set-up-bandit-scanner-for-rpkg.

Comment 2 Germano Massullo 2022-09-27 21:40:19 UTC
$ fedpkg --verbose --debug --release f38 mockbuild --srpm
Creating repo object from /home/user/folder/darktable
Could not determine the remote name: Cmd('git') failed due to: exit code(1)
  cmdline: git config --get branch.f38.remote
Falling back to default remote name 'origin'
Not downloading already downloaded darktable-4.0.1.tar.xz
Running "copyin" command: mock -r fedora-38-x86_64 --chroot --resultdir /tmp/mock_resultdiryf25ucrb --copyin /home/user/folder/darktable/darktable.spec /var/tmp
Running: mock -r fedora-38-x86_64 --chroot --resultdir /tmp/mock_resultdiryf25ucrb --copyin /home/user/folder/darktable/darktable.spec /var/tmp
INFO: mock.py version 3.1 starting (python version = 3.10.6, NVR = mock-3.1-1.fc36)...
Start(bootstrap): init plugins
INFO: tmpfs initialized
INFO: selinux enabled
Finish(bootstrap): init plugins
Start: init plugins
INFO: tmpfs initialized
INFO: selinux enabled
Finish: init plugins
INFO: Signal handler active
Start: run
Start(bootstrap): chroot init
INFO: mounting tmpfs at /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root.
INFO: reusing tmpfs at /var/lib/mock/fedora-rawhide-x86_64-bootstrap/root.
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: enabled HW Info plugin
Mock Version: 3.1
INFO: Mock Version: 3.1
Finish(bootstrap): chroot init
Start: chroot init
INFO: mounting tmpfs at /var/lib/mock/fedora-rawhide-x86_64/root.
INFO: reusing tmpfs at /var/lib/mock/fedora-rawhide-x86_64/root.
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled package manager cache
Start: cleaning package manager metadata
Finish: cleaning package manager metadata
INFO: enabled HW Info plugin
Mock Version: 3.1
INFO: Mock Version: 3.1
Finish: chroot init
INFO: copying /home/user/folder/darktable/darktable.spec to /var/lib/mock/fedora-rawhide-x86_64/root/var/tmp
Finish: run
Running "rpm" command: mock -r fedora-38-x86_64 --chroot --resultdir /tmp/mock_resultdiryf25ucrb --shell rpm --define _sourcedir /home/user/folder/darktable --define _specdir /home/user/folder/darktable --define _builddir /home/user/folder/darktable --define _srcrpmdir /home/user/folder/darktable --define _rpmdir /home/user/folder/darktable --define _rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm --define dist %{?distprefix}.fc38 --define fedora 38 --eval %undefine rhel --define fc38 1 -q --qf ??%{NAME} %{EPOCH} %{VERSION} %{RELEASE}?? --specfile /var/tmp/darktable.spec > /var/tmp/output
Running: mock -r fedora-38-x86_64 --chroot --resultdir /tmp/mock_resultdiryf25ucrb --shell rpm --define _sourcedir /home/user/folder/darktable --define _specdir /home/user/folder/darktable --define _builddir /home/user/folder/darktable --define _srcrpmdir /home/user/folder/darktable --define _rpmdir /home/user/folder/darktable --define _rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm --define dist %{?distprefix}.fc38 --define fedora 38 --eval %undefine rhel --define fc38 1 -q --qf ??%{NAME} %{EPOCH} %{VERSION} %{RELEASE}?? --specfile /var/tmp/darktable.spec > /var/tmp/output
error: %undefine: argument expected
Errors occoured while running above command to get N-V-R-E in mock.
Cleaning up mock temporary config directory: None
Could not execute mockbuild: Could not query n-v-r of darktable: Failed to execute command.
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pyrpkg/__init__.py", line 827, in load_nameverrel_mock
    self._run_command(main_cmd)
  File "/usr/lib/python3.10/site-packages/pyrpkg/__init__.py", line 1292, in _run_command
    raise rpkgError('Failed to execute command.')
pyrpkg.errors.rpkgError: Failed to execute command.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pyrpkg/cli.py", line 2409, in mockbuild
    self.cmd.load_nameverrel_mock(mockargs, self.args.root,
  File "/usr/lib/python3.10/site-packages/pyrpkg/__init__.py", line 835, in load_nameverrel_mock
    raise rpkgError('Could not query n-v-r of %s: %s'
pyrpkg.errors.rpkgError: Could not query n-v-r of darktable: Failed to execute command.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/fedpkg", line 33, in <module>
    sys.exit(load_entry_point('fedpkg==1.43', 'console_scripts', 'fedpkg')())
  File "/usr/lib/python3.10/site-packages/fedpkg/__main__.py", line 89, in main
    sys.exit(client.args.command())
  File "/usr/lib/python3.10/site-packages/pyrpkg/cli.py", line 2427, in mockbuild
    raise rpkgError(e)
pyrpkg.errors.rpkgError: Could not query n-v-r of darktable: Failed to execute command.

Comment 3 Ondřej Nosek 2022-10-05 02:08:53 UTC
Hello.
Yes, @gotmax is right - the issue was caused probably because of modifying 'rpmdefines' structure. Therefore the rpm part in the mockbuild needs escaping.
I am testing the change here:
https://pagure.io/rpkg/pull-request/636

I hope it will help (your example - darktable - was running OK).

Comment 4 Germano Massullo 2022-10-05 17:15:44 UTC
(In reply to Ondřej Nosek from comment #3)
> Hello.
> Yes, @gotmax is right - the issue was caused probably because of
> modifying 'rpmdefines' structure. Therefore the rpm part in the mockbuild
> needs escaping.
> I am testing the change here:
> https://pagure.io/rpkg/pull-request/636
> 
> I hope it will help (your example - darktable - was running OK).

I saw that the pull request was merged. When a new update will be released in bodhi? I don't have time to build the package to test teh patch.
Thank you

Comment 5 Fedora Update System 2022-10-10 20:41:26 UTC
FEDORA-2022-302ff5968f has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-302ff5968f

Comment 6 Fedora Update System 2022-10-11 12:12:47 UTC
FEDORA-2022-302ff5968f has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-302ff5968f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-302ff5968f

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2022-10-19 06:39:09 UTC
FEDORA-2022-302ff5968f has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2023-02-21 20:57:02 UTC
FEDORA-2023-9fb301a544 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-9fb301a544

Comment 9 Fedora Update System 2023-02-21 20:58:50 UTC
FEDORA-2023-9fb301a544 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.