Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to produce platform-specific and platform-independent RPM subpackages from one .spec?

Tags:

rpm

rpmbuild

I have dunno.spec file with the following structure:

Name:                   dunno
Version:                 1.0
...
BuildArch:              x86_64

%description
...
%package common
Summary:                Shared files
BuildArch:              noarch

I suppose that after I run rpmbuild -ba dunno.spec I should get two binary packages:

  • dunno-1.0.x86_64.rpm
  • dunno-common-1.0.noarch.rpm

however I get:

  • dunno-1.0.x86_64.rpm
  • dunno-common-1.0.x86_64.rpm

If I remove the line BuildArch: x86_64 from the spec, then I get

  • dunno-1.0.noarch.rpm
  • dunno-common-1.0.noarch.rpm

How to fix that?

RPM v4.4.2.3.

like image 526
dma_k Avatar asked Jan 09 '15 14:01

dma_k


2 Answers

Split the build into 2 packages, one x86_64, the other noarch.

You can do 2 builds from a single spec using %ifarch logic (but its usually easier/cleaner to use 2 spec files even if annoying).

It also hurts nothing to include platform-independent content in an x86_64 sub-package instead of a noarch sub-package.

like image 87
Jeff Johnson Avatar answered Sep 28 '22 08:09

Jeff Johnson


You could run the rpmbuild as this rpmbuild --target=x86_64,noarch ... then rpmbuild will build the package two pass for each arch.

like image 40
Ning Anzhou Avatar answered Sep 28 '22 06:09

Ning Anzhou