Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rpmbuild: how to skip generation of "debuginfo" packages (without change SPEC file ; neither .rpmmacros)

Tags:

rpmbuild

We need to (re)generated third party packages on EL7 but we don't want to change SPEC file as suggested (%define debug_package %{nil} https://www.redhat.com/archives/shrike-list/2003-April/msg00069.html) and neither changing the ~/.rpmmacros file as it is on a shared box for RPM build.

Is there any way to solve this via command line (additional parameter) with rpmbuild?

like image 737
Destroyica Avatar asked May 02 '16 12:05

Destroyica


People also ask

What is Buildroot in RPM spec file?

By using Buildroot: in your spec file you are indicating that your package can be built (installed into and packaged from) a user-definable directory. This helps package building by normal users. RPM will use the buildroot listed in the spec file as the default buildroot.

How do I find RPM specs?

or you can install the src rpm, as a user, with rpm -i myrpm. src. rpm , when the directory rpmbuild/SPECS/ will get the spec file. Download the source-rpm with yumdownloader --source yourpackagename .

How do I make a Noarch rpm?

Building the rpmMake the SPECS directory your pwd, then create the link. Run the following command to build the rpm. It should only take a moment to create the rpm if no errors occur. Check in the ~/rpmbuild/RPMS/noarch directory to verify that the new rpm exists there.


2 Answers

After many tests I found the solution. In fact, it is possible to define debug_package outside of the SPEC file, using --define. Which gives:

rpmbuild --define "debug_package %{nil}" -ba SPECS/original.spec

Result is: I don't modify the third party SPEC file and no RPM -debuginfo is generated.

like image 104
Destroyica Avatar answered Oct 07 '22 10:10

Destroyica


rpmbuild --rebuild --nodebuginfo file.src.rpm -- this still generates debuginfo rpms

Another solution:

cat /etc/rpm/macros 
%debug_package %{nil}
like image 1
Marius Avatar answered Oct 07 '22 09:10

Marius