14

The good old rpm while building package in steps simply kept the content of the BuildRoot -- it was very useful for me, because if some piece of software was difficult to create, I could check BuildRoot if everything is OK.

Now, with all "improved" rpm -- the content of BuildRoot is deleted automatically, so I cannot really dive into it (installing step is not that long).

One hack I know of would be adding some kind of sleep at the end of install stage to rpm spec. But this is ugly.

So -- QUESTION -- how to keep the content of BuildRoot in nice way -- in other words, how to disable auto delete once and for good?

greenoldman
  • 6,176

4 Answers4

9

Just add

    %define __spec_install_pre /bin/true

on top of the .spec file

domusofsail
  • 91
  • 1
  • 2
8

Have you tried using rpmbuild -bi in testing, so that the you get everything built up through the %install phase? That should show you what's going on without automatically cleaning afterwards.

Then when you're satisfied, build as normal.

mattdm
  • 40,245
4

Try adding a dummy %clean to the spec file. Something like:

%clean
echo NOOP
Michael Mrozek
  • 93,103
  • 40
  • 240
  • 233
iFred
  • 41
  • doesn't work, because BUILDROOT is deleted at the beginning of %install - it is part of the initialization of %install. – smcg Sep 16 '14 at 18:58
  • If the goal is to keep buildroot after the build, for investigation, then it does work. – ederag Jan 29 '18 at 08:35
0

This is annoying, I agree. If you don't mind modifying your rpm, I suggest going into the rpm source and finding out where the BuildRoot is deleted, disable that line (it is probably only one line), and recompile. The other thing I would suggest is filing a wishlist bug to restore the old behaviour, which I believe was configurable.

Question: in what version of rpm did this behavior change?

Faheem Mitha
  • 35,108
  • I don't know about the version, but change in official rpm would be tough: http://lists.rpm.org/pipermail/rpm-list/2008-December/000040.html The explanation indicates that idelogy play a huge role. Patching rpm would be possible though, thank you for the hint. Maybe I would manage revert automatic BuildRoot creating too. – greenoldman Apr 01 '11 at 10:11
  • @macias: I looked at the rpm sources on Debian (4.9.0-2), but didn't find out anything useful. However, even if the developers are not willing to change it, I expect they are willing to tell you how to do it for yourself. – Faheem Mitha Apr 01 '11 at 10:35
  • luckily the -bi switch works for this case, so I skip patching if I can -- the software list with regressions are getting longer anyway. – greenoldman Apr 02 '11 at 14:59