Search code examples
rpmrpmbuildrpm-spec

A way to execute external script under rpmbuild or get RPM_BUILD_ROOT variable


In the process of building an RPM we are extracting some things from an archive in a directory A. We update the rpm.spec with the list of files from that archive in the %files section passing a file with -f with all that we got from the archive.

The next step at which we fail is the step where we need to copy the extracted files to the RPM_BUILD_ROOT folder A. Is there a way to get the RPM_BUILD_ROOT value to our script so that it will copy the files where needed?

Is there other way of adding the files from an archive into an RPM?

Thanks!


Solution

  • No. RPM_BUILD_ROOT is mktempd() (made easier). You cannot predict. For good reasons.

    You want to add your files as SOURCE0, SOURCE1, SOURCE2.... and then you can do:

    %install
    cp -a %{SOURCE0} %{SOURCE1} ... %{buildroot}/some/dir