LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   OS version specific RPM packages (https://www.linuxquestions.org/questions/linux-general-1/os-version-specific-rpm-packages-4175504804/)

r0tty 05-13-2014 03:41 AM

OS version specific RPM packages
 
Hi,

This is a very general question about best practices for creating RPMs for RHEL5 or RHEL6 and how to control which are installed where. Here's the detail:

I had an RPM for installing some software on RHEL5 and that worked fine. To get it working properly on RHEL6 I had to recompile it, which also worked fine. However, I now have two versions of the RPM, one that only works on RHEL5 and one that only works on RHEL6. My questions are:

1. How do I control where these packages can be installed?
2. What's the best naming convention for the packages to make it obvious which version is installed?
3. What's the best approach to the version/release issues?

Some of my thoughts on those questions are:

1. I can't use dependencies as I don't want to trigger an OS upgrade. I could put something in the pre-exec script, but that's a little bit hidden and maybe there is a more visible way that uses integral RPM features?
2. I could incorporate el6 in package name or release, but I'm not sure which is best.
3. I could put el6 in the release name, but then if the two packages have the same name it will cause me problems deploying them.

Incidentally I am keen not to bring anything unneeded with me from RHEL5 to RHEL6, which is why I haven't included any details on how to get the RHEL5 package working on RHEL6 (I know how to do it, but don't want to). I suppose I could get the RHEL6 package working on the RHEL5 servers and thereby have just one package, but that's a lot of work for no real gain, so I'm not keen on that approach either.

Apologies for how general this question is, but thanks in advance for any assistance.

Rotty

MensaWater 05-13-2014 07:54 AM

Many packages simply have "el5" or "el6" in the name to distinguish them.

If you look at a site that offers builds for multiple versions you might get ideas.

For example Dag Wieers' site and this specific link:
http://pkgs.repoforge.org/perl-Apache-Htpasswd/

You might want to at least setup a dependency on redhat-release* package as that will let it know if it is being installed on RHEL5 or RHEL6 server. Dependencies don't trigger updates from RHEL5 to RHEL6 so far as I know.

bigrigdriver 05-13-2014 12:45 PM

There is a wealth of documentation at rpm.org relating to the creation and management of rpm packages.

Look here.

r0tty 05-21-2014 02:26 AM

Hi,

Thanks for the replies.

@MensaWater - I couldn't see how those packages worked, so I just tried installing the el5 version on an el6 server and it installed. So, I take the point of el6 being in the release name is useful, but there is no mechanism there to prevent installation.

@bigrigdriver - that's a really useful doc thanks. I went through it all, but didn't see any answers about what I was looking for. However, that was still very useful and I now conclude that there is no elegant solution to this that I have been missing.

So, I guess the answer to my original question is this:
First decide if this is one RPM or two - if it's one the RPM name will be the same and the release will differ (contain el5 or el6), but if it is two the RPM name can contain -el5 or -el6. Then through pre-exec scripts implement action based on the content of redhat-release that prevents installation on the wrong version.
Rotty


All times are GMT -5. The time now is 01:58 AM.