rpmbuild - If condition inside the %Files section on a SPEC file

I'm kinda a new to writing spec files and building RPM's. Currently I have one RPM that is supposed to deploy some files in 1 of 2 possible directories that will vary with the OS. How can I, within the %files section, verify them? I can't use variable...I can't verify both paths because one will for sure fail...I tried to define a macro earlier in the %install section but it will be defined just once and won't be redefined on every RPM installation...what can I do here?Thanks...Read more

rpmbuild - Change file members when creating RPM updates

Our application has been packaged into a single rpm file for the past few years with the usual numbered updates. Now I'd like to separate out some of the files into a second RPM for product management purposes.Is the correct way to just remove the files from the %files section of the old .spec file and add them to the new .spec file?For example, we now have myApp.rpm built from:/usr/local/myApp+ bin/ {bunch of files here}+ config/ {bunch of files here}+ branding/So the current spec file lists everything above in its %files directive.To split b...Read more

rpmbuild - How to change %install section in spec file?

I tried to build binaries in RHEL6 using rpmbuild command.It throws file not found error during rpmbuild command execution. But In RHEL5 the same rpmbuild command is working fine. RHEL5 execution result:*Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.77266umask 022cd /usr/src/redhat/BUILDLANG=Cexport LANGunset DISPLAY*RHEL6 execution result:*Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.BeMhyHumask 022cd //rpmbuild/BUILD'[' //rpmbuild/BUILDROOT/ '!=' / ']'rm -rf //rpmbuild/BUILDROOT/++ dirname //rpmbuild/BUILDROOT/mkdir -p //rpmbuild/BUILD...Read more

rpmbuild - How to check for RedHat (RHEL) minor version in rpm spec file?

Need to differentiate a package dependency between RHEL 7.2/7.3 v/s RHEL 7.4 and above. There is rhel macro available in rpm spec file but that evaluates to 7 for all RHEL 7.x and 6 for all RHEL 6.x versions.I can possibly read /etc/redhat-release file and determine the minor version in %pre section but unclear whether that's too late to specify package dependency using Requires directive.I tried defining a macro that reads /etc/redhat-release file and then using the macro like following%define rhel_minor_version %(rhel_version_file="/etc/redha...Read more

rpmbuild - Need help understanding how to build multiple RPMs

I've been trying to understand how to build a simple RPM.I have the following repository https://github.com/integralist/simple-rpm which includes the relevant SPEC file and it works fine in generating an RPM from within a Docker container.But the issue I have is understanding how to build multiple RPMs considering I was pretty much forced to use a single ~/rpmbuild directory to house the files.Originally I created a test RPM directory structure within ~/testing-rpmbuild and when I ran the rpmbuild command it automatically created ~/rpmbuild for...Read more

rpmbuild - build Kaa node RPM package fail

I am trying to build Kaa-node Debian/RPM packages.The Debian package had built successfully.But, the RPM package build fail on Ubuntu and CentOS platform.I use follow command to build package:mvn -DskipTests -P compile-gwt,mongo-dao,mariadb-dao,cassandra,couchbase,kafka,oracle-nosql,build-rpm clean install verifyOn CentOS, it show below error message:[ERROR] Failed to execute goal org.codehaus.mojo:rpm-maven-plugin:2.1.3:attached-rpm (default) on project kaa-node: Unable to build the RPM: Error while executing process. Cannot run program "rpmbu...Read more

Preserve files/directories for rpm upgrade in .spec file(rpmbuild)

I wrote a .spec file on RHEL and I am building RPM using rpmbuild. I need ideas on how to handle the situation below.My RPM creates an empty logs directory when it installs first time within the installation folder like below /opt/MyInstallation-1.0.0-1/some executables /opt/MyInstallation-1.0.0-1/lib/carries shared objects(.so files) /opt/MyInstallation-1.0.0-1/config/carries some XML and custom configuration files(.xml, etc) /opt/MyInstallation-1.0.0-1/log--->This is where application writes logsWhen my RPM upgrades MyInstallation-1.0.0-1,...Read more

rpm spec - rpmbuild install dependency

I'm new to rpmbuild + spec files and I tried the following tutorial to build the "hello world" example.Manage to get it working, but I wanted to learn how dependencies/requires works. Therefore, I tried to duplicate another "hello world 2" example and link it as a dependency to the first in the spec file below. However I keep getting the error below. Is there a way that yum install will pick up the helloworld1 and install automatically when i yum install helloworld2 ?Any example for me learn from? SPEC FILEName: helloworld2Version: ...Read more

rpmbuild %pre does not work

"%pre – This is where code is run before the install scripts run."this section does not work for me .I got a spec file from “http://repo.andrewfarley.com/centos/specs/zabbix.spec” . every thing is ok ,but the rpm package can not create the “zabbix” user .any reply is appreciated .Thank you .OS : CentOS 5.7...Read more

rpmbuild - Specify which version of strip to use during rpm build process

I have installed an updated gcc compiler suite and binutils on my RHEL6 system. These installations do not interfere with the system versions. However, when I build a static library with rpmbuild (using my upgraded compiler), I get errors when rpmbuild executes strip. It uses the system version, installed in /usr/bin/strip, rather than my updated version. I have verified that if I run strip manually from my updated install, everything is fine. I can reproduce the error by using /usr/bin/strip. Is there a way to make rpmbuild use my custom binut...Read more

rpmbuild - %arm in RPM spec file

I am building an RPM from source tarball, patches, and a .spec file. I am doing so to add my platform-specific patch. I have read the given .spec file, and got notice that there are lines such as:%ifarch %{arm}When I saw similar lines like that, I could sometimes see a definition, for example, as follows:%global shared 0Later on, %shared is used as 0. However, I could not find the definition of %arm. I guessed that it might be pre-defined, or defined somewhere else (system-wide?). What does the %arm variable mean in a .spec file? If it is pre-d...Read more

rpmbuild - Buildrequiring a subpackage by another subpackage?

I'm trying to build an RPM of Google's protobuf, including the protobuf-python subpackage. Now, this is no problem until i want to build the python subpackage with PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp python setup.py build. This requires the protobuf header files and lib provided by the protobuf-devel package, which is built from the same .spec and source tarball.The question is, is it somehow possible to build the (-python) subpackge in such scenario using a single .spec & tarball, or must i create a separate spec?Here's the .src.rpm...Read more

Rpmbuild subpackage definition causes error in tmp file

I try to create an rpm package with some subpackages.running the rpmbuild command results in an error when preparing the first subpackage.This is the result when running rpmbuild -ba specfile:[root@RHEL510-BUILD SPECS]# rpmbuild -ba kapsch-icinga.specExecuting(%prep): /bin/sh -e /var/tmp/rpm-tmp.88616+ umask 022+ cd /usr/src/rpmbuild/BUILD+ LANG=C+ export LANG+ unset DISPLAY+ -n autoconf/var/tmp/rpm-tmp.88616: line 27: -n: command not founderror: Bad exit status from /var/tmp/rpm-tmp.88616 (%prep)I don't see any error in the spec file defined.A...Read more

rpmbuild - How are RPMs in RHEL Package named?

I see that the RPM packages are named as below , but then I am confused about how a RPM released with new patch named ?For e.g RPM packages typically have file names like foo-1.0-1.i386.rpm. The file name includes the package name (foo), version (1.0), release (1), and architecture (i386).Now I have a unix odbc installed on my box whose version is unixODBC-2.2.14-12.el6_3.x86_64 . There was a bug in unixodbc which was resolved in 2.2.14p2-1 so I am wondering which unixodbc rpm should I be looking for does 2.2.14p2-1 means unixODBC-2.2.14-21.e...Read more