aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-05-22 13:36:17 +0000
committerFrancois Pons <fpons@mandriva.com>2001-05-22 13:36:17 +0000
commit6de0ff3b3f1739639690884c5b03519b81dcfce7 (patch)
tree1ee96a60ab1285c00612f36600e77f770b5d8431
parent2dc9f9ce082bb03b63d9007e32b06f544245a217 (diff)
downloadrpmtools-6de0ff3b3f1739639690884c5b03519b81dcfce7.tar
rpmtools-6de0ff3b3f1739639690884c5b03519b81dcfce7.tar.gz
rpmtools-6de0ff3b3f1739639690884c5b03519b81dcfce7.tar.bz2
rpmtools-6de0ff3b3f1739639690884c5b03519b81dcfce7.tar.xz
rpmtools-6de0ff3b3f1739639690884c5b03519b81dcfce7.zip
added arch support.
-rw-r--r--rpmtools.pm27
-rw-r--r--rpmtools.spec5
-rw-r--r--rpmtools.xs9
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 <fpons@mandrakesoft.com> 2.3-22mdk
+- added arch support.
+
* Mon Apr 16 2001 François Pons <fpons@mandrakesoft.com> 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 <sys/utsname.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -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