-5

Recently I upgraded to a new version of RPM (4.8.0) and the build process for my application broke horribly, due to a change in behavior of the %install directive.

Based on some web trawling I did, I found out that the first thing the %install directive now does is to remove the build directory and create it from scratch.

Which is fine, except that my spec file already does some work in the build directory in the %prep and %build directives, which then gets trashed by the new behavior of the %install directive.

Once I found this out, the fix was easy: Just do all the work in the %install directive.

But why the change? I'm guessing that my workflow wasn't the "proper" way to do it, and earlier versions of RPM tolerated it, but now that tolerance has been removed.

So, what is the "proper" workflow? What is the intended use of the various directives?

John Gordon
  • 29,573
  • 7
  • 33
  • 58
  • 1
    you should have the basic ability to google "RPM spec file fields". – Marcus Müller Sep 08 '15 at 22:20
  • Doing things to *which* directory exactly? The working directory (`PWD`) of the `%prep` and `%build` scriplets or the `%{buildroot}`/`$RPM_BUILD_ROOT`? The buildroot, I believe, should not be touched until `%install` but the working directory of those other sections (the build directory) is fair game and should be remain as you left it at `%install` time. – Etan Reisner Sep 09 '15 at 01:44
  • @Marcus, yes of course I did some googling to find the answer myself. I found a lot of examples, but I was looking for something deeper, which is hard to search for. – John Gordon Sep 09 '15 at 16:27
  • @Etan: The `%{buildroot}` directory. Perhaps that was my issue: messing about with `%{buildroot}` before I was "supposed" to. – John Gordon Sep 09 '15 at 16:29
  • 1
    See [this page](https://fedoraproject.org/wiki/EPEL:Packaging#BuildRoot_tag) for the EPEL guidelines about `%{buildroot}` which talk about this and [this answer](http://stackoverflow.com/a/24358626/258523) for a way to see what RPM is doing under-the-covers. – Etan Reisner Sep 09 '15 at 16:37

1 Answers1

1

%prep extracts/etc. your sources files, etc. (i.e Untar)

%build builds your binaries, documentation, etc. (i.e. ./configure && make)

%install copies your installed/to-be-packaged files into the %buildroot.

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148