Bug 755134 - mock's --no-cleanup-after doesn't stop BUILDROOT from being emptied
Summary: mock's --no-cleanup-after doesn't stop BUILDROOT from being emptied
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 16
Hardware: All
OS: All
unspecified
low
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-19 00:17 UTC by Philip Prindeville
Modified: 2020-11-22 23:16 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-08-02 02:10:49 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 756531 0 unspecified CLOSED rpmbuild needs option to skip '%clean' phase 2021-02-22 00:41:40 UTC

Internal Links: 756531

Description Philip Prindeville 2011-11-19 00:17:22 UTC
Description of problem:

It's occasionally useful to run "mock --rebuild ..." to see what gets deposited into BUILDROOT... especially for large packages like openssl which change frequently and might modify permissions/ownerships of installed files.

In those cases, manually checking the contents of BUILDROOT with "ls" after a "mock --rebuild" would allow one to cross-check the permissions/ownership of $(INSTALL)'s in the makefiles versus the %attrib() values in the spec's %files sections.

Version-Release number of selected component (if applicable):

mock-1.1.17-1

How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Clark Williams 2011-11-19 16:37:05 UTC
Is this still failing?  I just tried a package build with --no-cleanup-after and the chroot buildroot still has all the contents of the package there. vb

Comment 2 Philip Prindeville 2011-11-19 21:42:09 UTC
(In reply to comment #1)
> Is this still failing?  I just tried a package build with --no-cleanup-after
> and the chroot buildroot still has all the contents of the package there. vb

Which exact command did you use to build so I can reproduce it?

Comment 3 Philip Prindeville 2011-11-21 06:29:36 UTC
Further clarifying, I noticed that if I ran:

% mock --update --no-cleanup-after --rebuild -r fedora-16-x86_64 clamav-0.97.3-1602.fc17.src.rpm


but I'd still need to comment out the %clean section in the RPM itself. So I guess I'm wondering how to stop rpmbuild from *both* doing the automatic clean and from running the %clean section of the .spec file.

Comment 4 Clark Williams 2011-11-21 18:20:56 UTC
Ok, I did a small test rpm of hello world:

$ mock -r fedora-15-x86_64 --no-cleanup-after rpms/hello-2.6-1.el5.src.rpm 

Went over to /var/lib/mock/fedora-15-x86_64/root/builddir/build and everything seemed to be there.

Comment 5 Philip Prindeville 2011-11-21 20:22:04 UTC
Ok, and I just did the same for fedora-16-x86_64:

...

Requires(interp): /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(post): /bin/sh info
Requires(preun): /bin/sh info
Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.14)(64bit) libc.so.6(GLIBC_2.2.5)(64bit) libc.so.6(GLIBC_2.3)(64bit) libc.so.6(GLIBC_2.3.4)(64bit) libc.so.6(GLIBC_2.4)(64bit) rtld(GNU_HASH)
Processing files: hello-debuginfo-2.6-2.fc16.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /builddir/build/BUILDROOT/hello-2.6-2.fc16.x86_64
Wrote: /builddir/build/RPMS/hello-2.6-2.fc16.x86_64.rpm
Wrote: /builddir/build/RPMS/hello-debuginfo-2.6-2.fc16.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.sDaodk
+ umask 022
+ cd /builddir/build/BUILD
+ cd hello-2.6
+ rm -rf /builddir/build/BUILDROOT/hello-2.6-2.fc16.x86_64
+ exit 0
Child returncode was: 0
LEAVE do --> 


Is what I see in the result/build.log file, and indeed looking in BUILDROOT it's empty:

[philipp@builder hello]$ ls /var/lib/mock/fedora-16-x86_64/root/builddir/build/BUILDROOT/
[philipp@builder hello]$ 

so my suggestion is that the --no-cleanup-after should inhibit the %clean section from being run.

Comment 6 Clark Williams 2011-11-23 17:17:59 UTC
(In reply to comment #5)
> 
> so my suggestion is that the --no-cleanup-after should inhibit the %clean
> section from being run.

I'm not sure of an easy way to do that using rpmbuild.

Comment 7 Philip Prindeville 2011-11-23 20:39:13 UTC
Do I need to file a bug against rpmbuild and link it?

Comment 8 Clark Williams 2011-12-03 03:36:57 UTC
It would be an RFE (request for enhancement). Not sure how much people want it but you can try.

Comment 9 Clark Williams 2012-08-02 02:10:49 UTC
Closing this as a mock bug.

Comment 10 Sergio Basto 2020-11-22 23:16:19 UTC
JFTR, this works now [1] 

mock -r fedora-33-x86_64 --no-clean --rebuild foo.src.rpm  --rpmbuild-opts=--noclean --no-cleanup-after       

[1]
https://lists.fedoraproject.org/archives/list/buildsys@lists.fedoraproject.org/message/IJ54KDCICTXU3Y6NHMH5C66SNOO6RHQL/


Note You need to log in before you can comment on or make changes to this bug.