As per this wiki, http://www.rpm.org/max-rpm/s1-rpm-inside-scripts.html .
there is a reference to the variable RPM_BUILD_ROOT , that can be possibly set, by the rpm packaging software to get a sense of where this rpm would go into.
Currently, the list of RPM_ environment variables, written are available at:
It would be useful to consider RPM_BUILD_ROOT , as well, if possible.
( May be, task.destinationDir , might be appropriate ? ) .
I thought RPM_BUILD_ROOT was used by the rpmbuild tool when constructing the rpm package, pulling specified files to be included in the rpm from that location. Can you flesh out how you propose this to be used?
Quoting the wiki,
" - This environment variable is used to hold the "build root", into which the newly built software will be installed "
In the preInstall.sh , postInstall.sh scripts of rpm, this information might be useful .
I believe that's where the built software is installed on the build machine before actually assembling the rpm. I don't think RPM_BUILD_ROOT is used at all in the RPM when installing on a destination machine.
Based off RPM_BUILD_ROOT description - ".. into which the newly built software will be installed. If no explicit build root has been specified (either by command line option, spec file tag line, or rpmrc file entry), this variable will be null." .
This seems more like a hint from the build process ( spec file / rpmrc / cmd line ) etc. about where we can figure out this particular package is getting installed. The ambiguous part about this variable is this could be null for the most part and rpm will ignore / work fine. Case in point: even today the rpm-s created by the gradle rpm plugin install fine, even if RPM_BUILD_ROOT is set null .
But, if there is a way to inject this to gradle script explicitly setting this build root information from build.gradle through some property, that in turn sets RPM_BUILD_ROOT, that will be useful for the postInstall.sh / preInstall.sh scripts to pick up the same.
Please take a look at the Inside Scripts section of the Maximum RPM documentation. The default value of RPM_BUILD_ROOT is typically /usr/src/redhat/BUILD and is used as the working directory for the prep and build scripts, which are run while the rpm file is being built, not while it's installing on the target machine.
May be, you are referring to RPM_BUILD_DIR ( when referring to, /usr/src/redhat/BUILD as default ) ? On contrast, I guess RPM_BUILD_ROOT refers to where the new software will be optional, albeit optional though .
You're correct that RPM_BUILD_ROOT and RPM_BUILD_DIR are distinct, but they're both build-time settings. Please see this Stack Overflow article.