From 6de0ff3b3f1739639690884c5b03519b81dcfce7 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Tue, 22 May 2001 13:36:17 +0000 Subject: added arch support. --- rpmtools.pm | 27 ++++++++++++++++++++++++++- rpmtools.spec | 5 ++++- rpmtools.xs | 9 +++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/rpmtools.pm b/rpmtools.pm index 2e70cc4..b708616 100644 --- a/rpmtools.pm +++ b/rpmtools.pm @@ -1,7 +1,7 @@ package rpmtools; use strict; -use vars qw($VERSION @ISA); +use vars qw($VERSION @ISA %compat_arch); require DynaLoader; @@ -76,6 +76,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. =cut +%compat_arch = ( #- compatibilty arch mapping. + 'noarch' => undef, + 'i386' => 'noarch', + 'i486' => 'i386', + 'i586' => 'i486', + 'i686' => 'i586', + 'i786' => 'i686', + 'k6' => 'i586', + 'k7' => 'k6', + 'k8' => 'k7', + 'ppc' => 'noarch', + 'alpha' => 'noarch', + 'sparc' => 'noarch', + 'sparc32' => 'sparc', + 'sparc64' => 'sparc32', + ); + #- build an empty params struct that can be used to compute dependancies. sub new { my ($class, @tags) = @_; @@ -531,6 +548,14 @@ sub write_compss { 1; } +#- compare architecture. +sub better_arch { + my ($new, $old) = @_; + while ($new && $new ne $old) { $new = $compat_arch{$new} } + $new; +} +sub compat_arch { better_arch(arch(), $_[0]) } + #- compare a version string, make sure no deadlock can occur. #- try to return always a numerical value. sub version_compare { diff --git a/rpmtools.spec b/rpmtools.spec index 30ded7a..307caf1 100644 --- a/rpmtools.spec +++ b/rpmtools.spec @@ -1,5 +1,5 @@ %define name rpmtools -%define release 21mdk +%define release 22mdk # do not modify here, see Makefile in the CVS %define version 2.3 @@ -51,6 +51,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/perl5/man/*/* %changelog +* Tue May 22 2001 François Pons 2.3-22mdk +- added arch support. + * Mon Apr 16 2001 François Pons 2.3-21mdk - added back anti-lock patch. diff --git a/rpmtools.xs b/rpmtools.xs index 4aeebd1..c270994 100644 --- a/rpmtools.xs +++ b/rpmtools.xs @@ -2,6 +2,7 @@ #include "perl.h" #include "XSUB.h" +#include #include #include #include @@ -290,6 +291,14 @@ void callback_empty(void) {} MODULE = rpmtools PACKAGE = rpmtools +char * +arch() + CODE: + struct utsname u; + if (uname(&u) == 0) RETVAL = u.machine; else RETVAL = NULL; + OUTPUT: + RETVAL + void* db_open(prefix) char *prefix -- cgit v1.2.1