aboutsummaryrefslogtreecommitdiffstats
path: root/rpmtools.pm
diff options
context:
space:
mode:
Diffstat (limited to 'rpmtools.pm')
-rw-r--r--rpmtools.pm27
1 files changed, 26 insertions, 1 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 {