Best practices for multi-distribution RPMs?

Stuart Gathman stuart at gathman.org
Mon Jul 14 19:53:05 UTC 2014


On 07/14/2014 02:05 PM, Daniel John FitzGerald wrote:
> Hi,
>
> I've spent considerable time lately trying to find an answer to this 
> question, but have not had much luck.  I'm working on a software 
> project that builds for both RHEL and SLES, but the required packages 
> change across systems (for instance, on RHEL we require httpd, whereas 
> on SLES its apache2-prefork).  I would like to create a single RPM for 
> all systems that conditionally changes the "Requires" tag based on 
> what distribution the RPM is being installed to, but I'm learning that 
> this is not possible.
>
> What is considered to be the best practices when creating an RPM 
> targeted for different Linux distributions?  That is, can we have "one 
> RPM to rule them all", or is it considered preferable to have a 
> different RPM generated specifically for each Linux distribution 
> supported.  Furthermore, is there any place where I can find those 
> best practices documented somewhere (ie: "written in stone" on a 
> RedHat or RPM website).
Don't do "one binary RPM to rule them all".  The only way to have a 
single binary RPM is to have a setup script in %post - and that makes 
users like me nervous, plus the files created by setup aren't tracked by 
the RPM.

Your goal should be to have one SRPM (or at least one SPEC file), and 
build for each target system.  In the SPEC file, %ifos and other 
conditionals tweak dependencies, post install processing, etc.  The 
resulting binary RPMs then install and track only the files needed for 
the target distro/OS.


More information about the Rpm-list mailing list