I am getting the following in my build log:
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.CgE2Qn
+ umask 022
+ cd /export/home/svn_checkouts/*snip*/Output/release/bin/packaging/BUILD
+ /bin/rm -rf /export/home/svn_checkouts/*snip*/Output/release/bin
+ exit 0
I'd like to avoid rpmbuild
deleting all the files in my build directory as I need them for other things after the RPM is built. Can I override this behavior?
I read that some versions of RPM support a --noclean
argument, but ours doesn't unfortunately.
By using Buildroot: in your spec file you are indicating that your package can be built (installed into and packaged from) a user-definable directory. This helps package building by normal users. RPM will use the buildroot listed in the spec file as the default buildroot.
rpmbuild is used to build both binary and source software packages. A package consists of an archive of files and meta- data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package.
Turns out I just needed to provide my own %clean
directive in the spec file and leave it blank to override the default. For some reason I didn't expect that to work. ;)
A define can conditionalize the %Clean% phase so that the same effect as --noclean
can be achieved.
%Clean
%if "%{noclean}" == ""
rm -rf $RPM_BUILD_ROOT
%endif
Called with rpmbuild --define 'noclean 1'
to disable cleaning.
For building from spec
-file, rpmbuild
has the -bi
option. It leaves the $RPM_BUILD_ROOT
as is; it does no %clean
.
-bi build through %install (%prep, %build, then install) from <specfile>
(rpmbuild --help
)
For building from SRPM
(a source RPM package; yumdownloader
will get you those), there is also --recompile
option:
--rebuild build binary package from <source package> --recompile build through %install (%prep, %build, then install) from <source package>
Finally, there is --noclean
option for rpmbuild
— but in my case (RPM version 4.11.3
) it didn't work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With