Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The --noprep option executes %mkbuilddir which breaks %generate_buildrequires in Mock #3120

Closed
praiskup opened this issue May 22, 2024 · 5 comments

Comments

@praiskup
Copy link
Member

I hit this accidentally with rpm-build-4.19.91-1.fc41.x86_64 (not yet build in Rawhide, or already untagged, not sure). Happened to me when I was reproducing FTBFS against a Copr project that contained that pre-release version.

Mock runs, at when all the dynamic build deps are resolved and installed, rpmbuild --noprep ..., just to not necessarily re-do the same (potentially expensive) step again. The problem is that --noprep still executes the %mkbuilddir:

+ umask 022
+ cd /builddir/build/BUILD/argparse-manpage-4.5-build
+ test -d /builddir/build/BUILD/argparse-manpage-4.5-build
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w /builddir/build/BUILD/argparse-manpage-4.5-build
+ /usr/bin/rm -rf /builddir/build/BUILD/argparse-manpage-4.5-build
...

So the argparse-manpage-4.5-build directory is removed, but not recreated, because --noprep.

To Reproduce

Use the pre-release 4.19.91 version of RPM in mock chroot to build any package with %generate_buildrequires.

copr mock-config @python/python3.13 fedora-rawhide-x86_64 > /tmp/python3.13.cfg
mock -r /tmp/python3.13.cfg package-using-generate-buildrequires.src.rpm

You need Mock v5.3+ that has this optimization.

Expected behavior

The rpmbuild --noprep shouldn't execute %mkbuilddir? Have a new option --nomkbuilddir? I'm not sure.

Output

setting SOURCE_DATE_EPOCH=1716336000
Executing(%mkbuilddir): /bin/sh -e /var/tmp/rpm-tmp.J1UIqb
+ umask 022
+ cd /builddir/build/BUILD/argparse-manpage-4.5-build
+ test -d /builddir/build/BUILD/argparse-manpage-4.5-build
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w /builddir/build/BUILD/argparse-manpage-4.5-build
+ /usr/bin/rm -rf /builddir/build/BUILD/argparse-manpage-4.5-build
+ /usr/bin/mkdir -p /builddir/build/BUILD/argparse-manpage-4.5-build
+ /usr/bin/mkdir -p /builddir/build/BUILD/argparse-manpage-4.5-build/SPECPARTS
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.AMDAIv
+ umask 022
+ cd /builddir/build/BUILD/argparse-manpage-4.5-build
+ cd argparse-manpage-4.5
/var/tmp/rpm-tmp.AMDAIv: line 34: cd: argparse-manpage-4.5: No such file or directory

RPM build errors:
error: Bad exit status from /var/tmp/rpm-tmp.AMDAIv (%generate_buildrequires)

Environment

  • OS / Distribution: Fedora 40, Fedora Rawhide in-chroot
  • Version: 4.19.1.1-1 on host, 4.19.91-1.fc41 in-chroot
@praiskup
Copy link
Member Author

Corresponding line-in-Mock-code.

@hroncok
Copy link
Contributor

hroncok commented May 22, 2024

You need Mock v5.3+ that has this optimization.

Even before that, --noprep was used for the last rpmbuild round, so I assume even older mock would be impacted.

(not yet build in Rawhide, or already untagged, not sure).

Not yet built. It was built in Python 3.13 copr when pushed to distgit. In the meantime, I have removed the build.

@pmatilai
Copy link
Member

pmatilai commented May 23, 2024

My first reaction to this is: "we have --noprep? 😳 "
I mean, in my 20+ years of life around rpm I must've seen that option somewhere but I had absolutely norecollection it existed. Much less that anybody would be using it.

I can see why mock would use such a thing, but I'm not really comfortable with that (or the option itself) because it seems that mock is now driving the build and not rpmbuild. And this means any changes to rpmbuild are even more difficult than they are otherwise.

That said, I'm not exactly surprised that %mkbuilddir breaks something because it is quite a big change. Lets see what we can do about it, on the outset --noprep disabling %mkbuilddir seems reasonable but I'm only halfway into my first coffee...

@pmatilai
Copy link
Member

One takeaway from this is that we need some tests that mimick what mock does.

@pmatilai
Copy link
Member

Okay #3121 has closer details + reproducer info, closing this as a dupe despite being the earlier one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants