On May 21, 2007, at 6:02 PM, Tim Mooney wrote:
All-
With rpm 4.4.7 and later, rpm ignores the %clean in the spec file and
instead uses a set of macros to handle post-build cleanup of the build
system. This was discussed on the rpm devel list and is documented in
the CHANGES, and the new functionality has been working fine.
What I'm after is configuring my personal/system build default so that
- the BuildRoot is NOT removed after a successful rpmbuild
- the Build subdirectory (%_topdir/BUILD/foo-1.0) IS removed after
a successful rpmbuild, but left on an unsuccessful build.
So, will changing
%__spec_clean_body %{__rm} -rf '%{buildroot}'\
%{nil}
to
%__spec_clean_body %{__rm} -rf '%{buildsubdir}'\
%{nil}
or
%__spec_clean_body test -d '%{buildsubdir}' && %{__rm} -rf '%
{buildsubdir}'\
%{nil}
accomplish all of what I'm after? Is it "safe" to use %{buildsubdir}
in %__spec_clean_body -- will it be filled in? Also, are these macros
only executed on a successful rpmbuild?
Should, but untested.
Note that %buildsubdir is not known until %setup executes (not parsed)
that's the flaw in buildsubdir, undefined for most of a spec file parse.
AFAIK, %buildsubdir is well defined, but possibly
with odd default value if no, or multiple, %setup was present.
I could just try it, but the possibility for havok after an errant
rm -rf
has me hesitating.
So add an echo and look a bit.
Safest by far is to disable %clean entirely and manage your own build
system.
It's kinda nutty that rpmbuild is expected to clean up "stuff"
automagically. The
mechanism has never worked perfectly (consider where file manifests
end-up
with no %setup) and there are very very few packages that use %clean
in intelligent
non-default ways (when I checked before ripping %clean from spec files).
73 de Jeff
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list