aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-06-19 14:44:21 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-06-19 14:44:21 +0000
commit92e441cb3795aa5b8555f999911017817a6d2277 (patch)
treef29b0b811a1c34dffad7cc1c02ad9aa70b057d2d
parentd56ee13624590129c49ed2424c1ee2814837e560 (diff)
downloadperl-URPM-92e441cb3795aa5b8555f999911017817a6d2277.tar
perl-URPM-92e441cb3795aa5b8555f999911017817a6d2277.tar.gz
perl-URPM-92e441cb3795aa5b8555f999911017817a6d2277.tar.bz2
perl-URPM-92e441cb3795aa5b8555f999911017817a6d2277.tar.xz
perl-URPM-92e441cb3795aa5b8555f999911017817a6d2277.zip
- make is_arch_compat rpm 4.4.8 compliant
-rw-r--r--Makefile.PL3
-rw-r--r--URPM.xs18
-rw-r--r--t/parse.t3
3 files changed, 21 insertions, 3 deletions
diff --git a/Makefile.PL b/Makefile.PL
index 5f406d2..50975b1 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -50,6 +50,9 @@ if ($version =~ /^4\.(4\.[5-9]$|4\.\d\d|[5-9]\.|\d\d)/) {
if ($version =~ /^4\.4/ && (split(/\./, $version))[2] >= 6) {
$ccflags .= ' -DRPM_446';
}
+if ($version =~ /^4\.4/ && (split(/\./, $version))[2] >= 8) {
+ $ccflags .= ' -DRPM_448';
+}
WriteMakefile(
NAME => 'URPM',
diff --git a/URPM.xs b/URPM.xs
index cdb5f59..c7f22e4 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1334,7 +1334,10 @@ Pkg_arch(pkg)
int
Pkg_is_arch_compat(pkg)
URPM::Package pkg
+ INIT:
+ char * platform;
CODE:
+ char * arch;
read_config_files(0);
if (pkg->info) {
char *arch;
@@ -1342,11 +1345,22 @@ Pkg_is_arch_compat(pkg)
get_fullname_parts(pkg, NULL, NULL, NULL, &arch, &eos);
*eos = 0;
- RETVAL = strcmp(arch, "noarch") == 0 ? 4 : rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
+#ifdef RPM_448
+ platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
+ RETVAL = rpmPlatformScore(platform, NULL, 0);
+#else
+ RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
+#endif
*eos = '@';
+ free(platform);
} else if (pkg->h && headerIsEntry(pkg->h, RPMTAG_SOURCERPM)) {
char *arch = get_name(pkg->h, RPMTAG_ARCH);
- RETVAL = strcmp(arch, "noarch") == 0 ? 4 : rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
+#ifdef RPM_448
+ platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
+ RETVAL = rpmPlatformScore(platform, NULL, 0);
+#else
+ RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
+#endif
} else {
RETVAL = 0;
}
diff --git a/t/parse.t b/t/parse.t
index dd63d25..2a3a8fd 100644
--- a/t/parse.t
+++ b/t/parse.t
@@ -4,7 +4,7 @@
use strict;
use warnings;
-use Test::More tests => 39;
+use Test::More tests => 40;
use MDV::Packdrakeng;
use URPM;
use URPM::Build;
@@ -99,6 +99,7 @@ ok(URPM::rpmvercmp("1:1-1mdk", "2:1-1mdk") == -1, "epoch 1 vs 2 = -1");
is($pkg->get_tag(1001), '1.0');
is($pkg->get_tag(1002), '1mdk');
is($pkg->queryformat("%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}"), "test-rpm-1.0-1mdk.noarch");
+ ok($pkg->is_arch_compat(), "Arch compat works");
close $hdfh;
}