I have been struggling for a while with this one. So I wrote a .specs file for my project and everything went fine. The rpm is built, the installation is smooth... but then I got some trouble because now, I have to use a custom global environment variable to set the install path.
This would give a %files section as such :
%files
%defattr(-,root,root)
$INSTALLPATH/Crystal/bin/Crystal.jar
Where Crystal is my project name, and INSTALLPATH is defined within env thanks to the export commandline. Then, when running buildrpm -ba Crystal.specs I have the following error:
error: File must begin with "/" : $INSTALLPATH/Crystal/bin/Crystal.jar
I have tried to define a macro inside the .rpmmacros file as such : %_installpath $INSTALLPATH
And in my specs file, when i do echo %{_installpath} I get the value I set in the .rpmmacros. But if I use it in %files:
%files
%defattr(-,root,root)
%{_installpath}/Crystal/bin/Crystal.jar
I get the same error again!
error: File must begin with "/" : $INSTALLPATH/Crystal/bin/Crystal.jar
I also tried defining a variable with the specs file and I have the same sad result. It looks like as long as my variable/macro is referencing to $INSTALL, then %files won't accept it. But I have to use this env variable!
So that's all I could think about. Anyone got a clue? Any help would be greatly appreciated.
Thanks a lot in advance!
April 22, 2022. RPM stands for revolutions per minute, and it's used as a measure of how fast any machine is operating at a given time.
An RPM package typically contains binary executables, along with relevant configuration files and documentation. The rpm program is a powerful package manager, which can be used to install, query, verify, update, erase and build software packages in the RPM format.
If the non-SI unit rpm is considered a unit of frequency, then 1 rpm = 1/60 Hz. If it instead is considered a unit of angular velocity and the word "revolution" is considered to mean 2π radians, then 1 rpm = 2π/60 rad/s.
RPM stands for "revolutions per minute." It's a measure of how fast the engine is spinning.
The %files
section does not expand shell variables. You cannot do this that way.
You have a couple options that I can see offhand. You can
generate a file with a list of your files (during %install
or what-have-you) and then use %files -f files.lst
expand $INSTALLPATH
at rpm macro definition time with:
# For RPM >= 4.7.0
%_installpath %{getenv:INSTALLPATH}
# For RPM < 4.7.0
%_installpath %{lua:print(os.getenv("INSTALLPATH"))}
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