[Rpm-maint] [rpm-software-management/rpm] %mkbuilddir breaks the %generate_buildrequires implementation in mock (Issue #3121)

Miro Hrončok notifications at github.com
Wed May 22 13:37:13 UTC 2024


**Describe the bug**

RPM 4.20 breaks all Fedora packages with %generate_buildrequires (when built in mock, koji, etc.).

The error looks like this:

```
Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.nQJoQh
+ umask 022
+ cd /builddir/build/BUILD/python-cffi-1.16.0-build
+ cd cffi-1.16.0
/var/tmp/rpm-tmp.nQJoQh: line 34: cd: cffi-1.16.0: No such file or directory
```

**To Reproduce**
Steps to reproduce the behavior:

```
mock -r fedora-rawhide-x86_64 --addrepo 'https://download.copr.fedorainfracloud.org/results/pmatilai/rpm-snapshot/fedora-rawhide-$basearch/' init
mock -r fedora-rawhide-x86_64 --addrepo 'https://download.copr.fedorainfracloud.org/results/pmatilai/rpm-snapshot/fedora-rawhide-$basearch/' --update
mock --verbose -r fedora-rawhide-x86_64 --addrepo 'https://download.copr.fedorainfracloud.org/results/pmatilai/rpm-snapshot/fedora-rawhide-$basearch/' -Nn python-cffi-1.16.0-4.fc41.src.rpm 
```

`python-cffi-1.16.0-4.fc41.src.rpm ` was generated from the Fedora Rawhide package by `fedpkg srpm`, no changes.

**Expected behavior**

The build should work, as it did with RPM 4.19.


**Output**

```
...
DEBUG: Executing command: ['/usr/bin/systemd-nspawn', '-q', '-M', '903169f1656745f3a76286ffeebf52ee', '-D', '/var/lib/mock/fedora-rawhide-x86_64/root', '-a', '-u', 'mockbuild', '--capability=cap_ipc_lock', '--bind=/tmp/mock-resolv.not1p4a8:/etc/resolv.conf', '--bind=/dev/btrfs-control', '--bind=/dev/mapper/control', '--bind=/dev/fuse', '--bind=/dev/loop-control', '--bind=/dev/loop0', '--bind=/dev/loop1', '--bind=/dev/loop2', '--bind=/dev/loop3', '--bind=/dev/loop4', '--bind=/dev/loop5', '--bind=/dev/loop6', '--bind=/dev/loop7', '--bind=/dev/loop8', '--bind=/dev/loop9', '--bind=/dev/loop10', '--bind=/dev/loop11', '--console=pipe', '--setenv=TERM=vt100', '--setenv=SHELL=/bin/bash', '--setenv=HOME=/builddir', '--setenv=HOSTNAME=mock', '--setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin', '--setenv=PROMPT_COMMAND=printf "\\033]0;<mock-chroot>\\007"', '--setenv=PS1=<mock-chroot> \\s-\\v\\$ ', '--setenv=LANG=C.UTF-8', '--resolv-conf=off', 'bash', '--login', '-c', '/usr/bin/rpmbuild -br --noprep --noclean --target x86_64 --nodeps /builddir/build/SPECS/python-cffi.spec'] with env {'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOME': '/builddir', 'HOSTNAME': 'mock', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'PROMPT_COMMAND': 'printf "\\033]0;<mock-chroot>\\007"', 'PS1': '<mock-chroot> \\s-\\v\\$ ', 'LANG': 'C.UTF-8', 'SYSTEMD_NSPAWN_TMPFS_TMP': '0', 'SYSTEMD_SECCOMP': '0'} and shell False
Building target platforms: x86_64
Building for target x86_64
setting SOURCE_DATE_EPOCH=1706227200
Executing(%mkbuilddir): /bin/sh -e /var/tmp/rpm-tmp.rsmzU0
+ umask 022
+ cd /builddir/build/BUILD/python-cffi-1.16.0-build
+ test -d /builddir/build/BUILD/python-cffi-1.16.0-build
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w /builddir/build/BUILD/python-cffi-1.16.0-build
+ /usr/bin/rm -rf /builddir/build/BUILD/python-cffi-1.16.0-build
+ /usr/bin/mkdir -p /builddir/build/BUILD/python-cffi-1.16.0-build
+ /usr/bin/mkdir -p /builddir/build/BUILD/python-cffi-1.16.0-build/SPECPARTS
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.wyDFnL
+ umask 022
+ cd /builddir/build/BUILD/python-cffi-1.16.0-build
+ cd cffi-1.16.0
```

**Environment**
 - OS / Distribution: Fedora 41
 - Version: rpm-5.99.90-0.git16959.1.fc41 (also with 4.19.91-1.fc41 from Fedora distgit)

**Additional context**


Mock pretty much does this:

```
rpmbuild -br --noclean
rpmbuild -br --noprep --noclean (REPEAT UNTIL GOOD)
rpmbuild -ba --noprep
``` 

But the new `%mkbuilddir` section `rm`s the prepped sources:

```
Executing(%mkbuilddir): /bin/sh -e /var/tmp/rpm-tmp.rsmzU0
...
+ /usr/bin/rm -rf /builddir/build/BUILD/python-cffi-1.16.0-build
```

Hence, `--noprep` does not work the way it did (mock assumes sources are already prepped by the previous rpmbuild round).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/3121
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/issues/3121 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20240522/869f4520/attachment-0001.html>


More information about the Rpm-maint mailing list