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

rpmbuild --rebuild --noclean "doesn't work" #667

Closed
rwmjones opened this issue Apr 16, 2019 · 4 comments
Closed

rpmbuild --rebuild --noclean "doesn't work" #667

rwmjones opened this issue Apr 16, 2019 · 4 comments

Comments

@rwmjones
Copy link
Contributor

I'm trying to keep the build directory after a successful rpmbuild, but the obvious option of using --noclean doesn't work, it still deletes the directory:

$ rpmbuild --rebuild --noclean /home/nbdkit-1.8.0-1.el7.src.rpm
....
Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.ksxsLr
+ umask 022
+ cd /home/mm/rpmbuild/BUILD
+ rm -rf nbdkit-1.8.0
+ exit 0

Now reading the manual very closely I can see that this behaviour is documented. --noclean skips the %clean step, but if your RPM spec file doesn't have a %clean step then it does nothing, so that's correct but also totally counter-intuitive and wrong.

There was a proposal to add --skip-clean (#7) but that seems to have gone nowhere.

So I'm going to argue that --noclean is broken.

@rwmjones
Copy link
Contributor Author

This also affects recent RPM, I checked it with RPM version 4.14.2.1

@pmatilai
Copy link
Member

This seems to be in line with the manual, --rebuild is special and unlike -bb etc is not supposed to take any build-arguments:

       rpmbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs} [rpmbuild-options] SPECFILE ...

vs

       rpmbuild {--rebuild|--recompile} SOURCEPKG ...

Also later:

       There are two other ways to invoke building with rpm:

       rpmbuild --rebuild|--recompile SOURCEPKG ...

       When invoked this way, rpmbuild installs the named source package, and
       does a prep, compile and install. In addition, --rebuild builds a  new
       binary  package.  When the build has completed, the build directory is
       removed (as in --clean) and the the sources  and  spec  file  for  the
       package are removed.

So basically the bug is that --rebuild doesn't enforce the "no other options" policy.

@rwmjones
Copy link
Contributor Author

Well no, the bug is we'd like rpmbuild to be able to save the build tree in certain circumstances even when the build is successful. --noclean looks like it should do that, but doesn't, and it would be good if it DTRT.

@pmatilai
Copy link
Member

The thing is, --rebuild is the way it is on purpose. It's supposed to be the one operation you can't meddle with, and cleans up after it's done. Which it does.

rpm >= 4.13 has rpmbuild -r which allows controlling the stages for src.rpm rebuild just like -b/-t do. So if you want to save the build tree, use rpmbuild -ra --noclean instead of --rebuild.

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

2 participants