[CentOS] RPM Spec and subpackage architecture [SOLVED]

Ross S. W. Walker rwalker at medallion.com
Thu Dec 6 22:05:19 UTC 2007


Ross S. W. Walker wrote:
> 
> Are there any RPM wizards out there that know how to specify a
> different architecture for a subpackage in a spec file?
>  
> I have a package that has a binary component and a non-binary
> component that I would like split into 2 packages one, the
> binary which is architecture dependant and the other 'noarch'.
>  
> I haven't found a spec file that does this yet :-(

Ok, well it isn't pretty, but it's the only way to do it, I am
posting a general RPM specfile template that outlines it.

Once you have the spec file created you can do an:

# rpmbuild --target=$(uname -i),noarch <specfile>

And it should build the binary and noarch.

Here's the template:
##
## Global Package Definitions
##

## Package Options

## Package Definitions

## Platform Definitions

##
## Main Package
##

## Information
Summary: <Package Summary>
Name: <Package Name, Subpackage Prefix>
Version: <Common Version>
Release: <Common Release>
License: <Common License>
Group: <Package Group>
URL: <Common Project URL>
Packager: <Common Packager>

## Sources

## Patches

## Build Definitions
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}

## Build Requirements
BuildRequires: 

## Install Requirements
Requires: %{name}-subname = %{version}-%{release}

## Description
%description
<Package Description>

##
## Subpackage
##
%ifarch noarch
%package subname

## Information
Summary: <Subpackage Summary>

## Build Requirements
BuildRequires: 

## Install Provides
Provides: %{name}-subname

## Description
%description subname
<Subpackage Description>
%endif


##
## Package Creation
##

## Preparation
%prep
<Common Prep Work>


## Build
%build
%ifnarch noarch
<Architecture Build>
%endif


## Installation
%install
%{__rm} -rf %{buildroot}
%ifnarch noarch
<Architecture Install>
%else
<No Architecture Install>
%endif


## Cleaning
%clean
%{__rm} -rf %{buildroot}


## Post-Install Script (Package)
%ifnarch noarch
%post
<Architecture Post Install Script>
%endif


## Pre-Uninstall Script (Package)
%ifnarch noarch
%preun
<Architecture Pre Uninstall Script>
%endif


## Post-Uninstall Script (Package)
%ifnarch noarch
%postun
<Architecture Post Uninstall Script>
%endif


## Post-Install Script (Subpackage)
%ifarch noarch
%post subname
<No Architecture Post Install Script>
%endif


## Pre-Uninstall Script (Subpackage)
%ifarch noarch
%preun subname
<No Architecture Pre Uninstall Script>
%endif


## Post-Uninstall Script (Subpackage)
%ifnarch noarch
%postun subname
<No Architecture Post Uninstall Script>
%endif


## File Catalog (Package)
%ifnarch noarch
%files
<Architecture File Catalog>
%endif


## File Catalog (Subpackage)
%ifarch noarch
%files subname
<No Architecture File Catalog>
%endif


## Change Log
%changelog

Hope this helps somebody.

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.




More information about the CentOS mailing list