Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   RPM Package Manager (http://www.linux-archive.org/rpm-package-manager/)
-   -   canonical way to detect platform/distribution (http://www.linux-archive.org/rpm-package-manager/70241-canonical-way-detect-platform-distribution.html)

Brian Reichert 04-15-2008 05:02 PM

canonical way to detect platform/distribution
 
I'm trying to design a spec file that does different things depending
on the distribution. But, I can't see a canonical way of doing it.

My current development platform is CentOS 5.1.

On this list, and on the net, I've seen this construct

%if 0%{?fedora} > 4 || 0%{?rhel} > 4
# do stuff
%endif

or this:

%if 0%{rhel_version}%{centos_version} == 0
# do stuff
%endif

but none of these sorts of macros seem to be defined by the rpmbuild
universe.

'rpm --showrc' doesn't seem to provide any clues about distribution or
platform.

Any advice out there? Pointers welcome...

--
Brian Reichert <reichert@numachi.com>
55 Crystal Ave. #286 Daytime number: (603) 434-6842
Derry NH 03038-1725 USA BSD admin/developer at large

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

"Jeff Johnson" 04-19-2008 07:32 PM

canonical way to detect platform/distribution
 
On Tue, Apr 15, 2008 at 1:02 PM, Brian Reichert <reichert@numachi.com> wrote:

I'm trying to design a spec file that does different things depending

on the distribution. *But, I can't see a canonical way of doing it.



My current development platform is CentOS 5.1.



On this list, and on the net, I've seen this construct



*%if 0%{?fedora} > 4 || 0%{?rhel} > 4

*# do stuff

*%endif



or this:



*%if 0%{rhel_version}%{centos_version} == 0

*# do stuff

*%endif



but none of these sorts of macros seem to be defined by the rpmbuild

universe.



'rpm --showrc' doesn't seem to provide any clues about distribution or

platform.



Any advice out there? *Pointers welcome...



You likely need to install the redhat-rpm-config package, that's usually wherevendor peculier macros are supplied by RHEL.
73 de Jeff*
_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Brian Reichert 04-19-2008 07:42 PM

canonical way to detect platform/distribution
 
On Sat, Apr 19, 2008 at 03:32:26PM -0400, Jeff Johnson wrote:
> You likely need to install the redhat-rpm-config package, that's usually
> where
> vendor peculier macros are supplied by RHEL.

Thanks; I'll give that a try!

>
> 73 de Jeff

--
Brian Reichert <reichert@numachi.com>
55 Crystal Ave. #286 Daytime number: (603) 434-6842
Derry NH 03038-1725 USA BSD admin/developer at large

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

devzero2000 04-19-2008 08:17 PM

canonical way to detect platform/distribution
 
IMHO, the general problem of vendor rpm fragmentation isn't likely to be resolved
with rpm macros. But for a single distro (rhel vs suse vs mandriva vs ...) and different release of this, it is a possibility: not good in general but it's life...............


Macros if abused* are* for itself a source of incompatibility: use it carefully. I know it is not so simple but a little discipline and more QA in rpm packaging it is often necessary
if not desiderable always, AFAICT.


Regards


2008/4/19 Jeff Johnson <n3npq.jbj@gmail.com>:




On Tue, Apr 15, 2008 at 1:02 PM, Brian Reichert <reichert@numachi.com> wrote:



I'm trying to design a spec file that does different things depending

on the distribution. *But, I can't see a canonical way of doing it.



My current development platform is CentOS 5.1.



On this list, and on the net, I've seen this construct



*%if 0%{?fedora} > 4 || 0%{?rhel} > 4

*# do stuff

*%endif



or this:



*%if 0%{rhel_version}%{centos_version} == 0

*# do stuff

*%endif



but none of these sorts of macros seem to be defined by the rpmbuild

universe.



'rpm --showrc' doesn't seem to provide any clues about distribution or

platform.



Any advice out there? *Pointers welcome...



You likely need to install the redhat-rpm-config package, that's usually wherevendor peculier macros are supplied by RHEL.
73 de Jeff*



_______________________________________________

Rpm-list mailing list

Rpm-list@redhat.com

https://www.redhat.com/mailman/listinfo/rpm-list


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Michael Jennings 04-25-2008 05:44 PM

canonical way to detect platform/distribution
 
On Saturday, 19 April 2008, at 22:17:53 (+0200),
devzero2000 wrote:

> IMHO, the general problem of vendor rpm fragmentation isn't likely
> to be resolved with rpm macros. But for a single distro (rhel vs
> suse vs mandriva vs ...) and different release of this, it is a
> possibility: not good in general but it's life...............

Using standard macros is a great way to improve portability. For
example, using "%{__mkdir_p}" instead of "mkdir -p" helps packages
port to platforms that do not have GNU mkdir (since %{__mkdir_p} could
easily be defined to "mkdirhier" or some flavor of "mkinstalldirs"
instead of the GNU-specific "mkdir -p") and allows vendors like IBM or
Sun to repoint various commands independent of the value of $PATH
(e.g., %{__install} could use /usr/ucb/install instead of
/usr/bin/install).

The problems arise when packagers use non-portable macros that are
specific to their proprietary little sandboxes (e.g., %{make} on
Mandr[ai][kv][ea], %{__id_u} on Fedora, etc.). Too many vendors
couldn't care less about whether or not their packages build on other
distros, completely ignoring the plight of independent packagers and
ISVs.

Michael

--
Michael Jennings (a.k.a. KainX) http://www.kainx.org/ <mej@kainx.org>
Linux Server/Cluster Admin, LBL.gov Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
"I don't care if you win or lose, just as long as you win."
-- Vince Lombardi

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list


All times are GMT. The time now is 12:42 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.