rpm-spec

Conditionally include file in an RPM

非 Y 不嫁゛ 提交于 2019-12-06 04:05:46
How can I conditionally include a file in an .rpm based on a define _foobar being set or not? The define _foobar would contain the absolute path inside the build root. The file is there. According to the documentation, I expected the following to work (note: there are more files in this %files section, but this is the gist): %files %if %{_foobar} %{_foobar} %endif which, however, gives me the error: error: parse error in expression error: /path/to/specfile:LINENO: parseExpressionBoolean returns -1 where /path/to/specfile:LINENO is the path to the .spec file and the line number of the line with

How to create RPM subpackages using the same paths for different envs?

廉价感情. 提交于 2019-12-05 18:45:25
I would like to use a rpm to build subpackages for different environments (live,testing,developer) but for the same files, so having a package called name-config-live, one called name-config-testing and one called name-config-developer and in them to have the same paths but each with the configs corresponding to the environment it's named after. as an example let's say on all environments I have a file called /etc/name.conf and on testing I want it to contain "1", on development "2" and on live "3". Is it possible to do this in the same spec since the subpackage generation only happens last

How to detect upgrade when an RPM that obsoletes another RPM is being installed

一曲冷凌霜 提交于 2019-12-05 16:29:34
RPM scriptlets are passed in $1 ( the number of packages of this name which will be left on the system when the action completes ) so they can determine whether a package upgrade or removal is occurring. For reasons outside my control, I believe the next version of the package may have a different package name than the first version. I tried to create a new package that "obsoletes" the old one and upgraded using it. However, the old package postun scriptlet still got $1 == 0 and my postun cleanup script ran. This is a bit of an edge case, because technically there are 0 packages with that name

Using Jenkins BUILD NUMBER in RPM spec file

痞子三分冷 提交于 2019-12-04 20:00:46
问题 Name: My Software Version: 1.0.5 Release: 1 Summary: This is my software Not sure if anyone has tried this before or if it is easy, but: A spec file has two unique indicators for its version: Version (which specifies software version) Release (which specifies the package's number - if you build an RPM, it's broken, and build another one, you up the 'Release' number. I'm wondering if anyone has tried, or knows how, I could use the Jenkins $BUILD_NUMBER variable to dynamically change the

RPM: loading bash script in %pre scriptlet

穿精又带淫゛_ 提交于 2019-12-04 17:03:26
I've put some common utility scripts into common.sh , which I want to use in my RPM specfile during %pre . common.sh is located in the root of the RPM package. What I was planning to do is simply call something like source common.sh , but how can I access common.sh from the RPM during %pre ? I was able to solve this using RPM macros , the following way: Before doing rpmbuild I have put common.spec into the SPECS folder. common.spec %define mymacro() (echo -n "My arg is %1 " ; sleep %1 ; echo done.) I've added %include SPECS/common.spec as the first line of my actual spec file. Usage example

How to package a .tar.gz file into rpm package

佐手、 提交于 2019-12-04 10:12:22
I worked on Redhat Linux, I have a tar.gz file. I want to package this tar.gz file to a rpm package file. In the rpm package phase, I just want to extract the tar.gz file and package all of the staff into the rpm package, when I install the rpm package in linux server, it will just simply copy all of the files into the destination folder. I have tried a lot. Here goes some code for my SPEC file, but it has problems: %prep %build pwd %install rm -rf /usr/local/sample mkdir /usr/local/sample cd %{_sourcedir} tar -xzvf sample.tar.gz -C /usr/local/sample %clean rm -rf %{buildroot} %files %defattr(

RPM spec file - Is it possible to dynamically populate a spec file variable

自古美人都是妖i 提交于 2019-12-04 08:15:23
问题 I have a spec file. I need to %define a spec variable that gets its value from a one line file on the system. For example %define path `cat /home/user/path_file` and in path_file is one line /var/www/html/hosts This partially works. I say that begins in the RPM BUILD output sometimes the value of ${path} is literally my command cat /home/user/path_file and sometimes the value is the line in the path_file (/var/www/html/hosts) as it should be? 回答1: You can define rpmbuild variables with %(cmd)

rpm & rpmbuild - using global environment variable in the %files section

本秂侑毒 提交于 2019-12-04 05:17:48
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 "/

How do I get rpmbuild to download all of the sources for a particular .spec?

旧街凉风 提交于 2019-12-03 10:45:52
问题 I am adding some sources to an existing rpm .spec file by URL and don't have them downloaded yet. Is there a way to get rpmbuild to download the sources rather than doing it manually? 回答1: The spectool utility from the rpmdevtools package can do this. Just install rpmdevtools and point spectools at the .spec like so: spectool -g -R SPECS/nginx.spec It will download any missing sources into rpm's %{_sourcedir} (usually SOURCES ) directory. 回答2: For posterity, there is another way to do it,

Build RPM to just install files

孤人 提交于 2019-12-03 09:59:19
问题 I need to build a RPM, with the sole purpose of installing a few fonts. I have read several tutorials about that, however everyone seems to suggests something different and I haven't been able to find something like a very basic setup to do that. Is it possible to just reference the files within the %files section of the spec? I tried however, rpm always tries to find the files within the tmp directory. Do I need to add a specific build step that copies everything I need to the tmp directory?