aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-18 16:07:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-18 16:07:19 +0000
commit285637ea4904d4eb6b87510b446999faba9db52b (patch)
treede8a3751d764440cd947e6fc2b1214f55eced2f6
parenteb7964172b2adfdb2dca493348089bbf7f26d5de (diff)
downloadperl-URPM-285637ea4904d4eb6b87510b446999faba9db52b.tar
perl-URPM-285637ea4904d4eb6b87510b446999faba9db52b.tar.gz
perl-URPM-285637ea4904d4eb6b87510b446999faba9db52b.tar.bz2
perl-URPM-285637ea4904d4eb6b87510b446999faba9db52b.tar.xz
perl-URPM-285637ea4904d4eb6b87510b446999faba9db52b.zip
- fix regression in 2.00: we can't cache the platform, cache the result of
is_arch_compat instead ie: - revert commits on URPM.xs which introduced the cache on platform - rename is_arch_compat to is_arch_compat__XS in URPM.xs - create URPM::Package::is_arch_compat in URPM.pm
-rw-r--r--NEWS2
-rw-r--r--URPM.pm9
-rw-r--r--URPM.xs14
3 files changed, 18 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index fd145f1..51143a8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
- choose every kernel-<flavor>-devel-<version> packages when
kernel-<flavor>-<version> is selected
+- fix regression in 2.00: we can't cache the platform, cache the result of
+ is_arch_compat instead
Version 2.01 - 14 September 2007, by Pascal "Pixel" Rigaux
diff --git a/URPM.pm b/URPM.pm
index fb5c329..bb50243 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -212,6 +212,15 @@ upgrade: ${\($pkg->flag_upgrade)}
EODUMP
}
+my %arch_cache;
+sub is_arch_compat {
+ my ($pkg) = @_;
+ my $arch = $pkg->arch;
+ exists $arch_cache{$arch} and return $arch_cache{$arch};
+
+ $arch_cache{$arch} = is_arch_compat__XS($pkg);
+}
+
package URPM::Transaction;
our @ISA = qw(); # help perl_checker
diff --git a/URPM.xs b/URPM.xs
index 216fa90..29b5591 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -111,10 +111,6 @@ void rpmError_callback() {
}
}
-#ifdef RPM_448
-static char *platform = NULL;
-#endif
-
/* needed for importing keys (from rpmio) */
int rpmioSlurp(const char * fn, const byte ** bp, ssize_t * blenp);
int b64decode (const char * s, void ** datap, size_t *lenp);
@@ -1422,8 +1418,10 @@ Pkg_arch(pkg)
}
int
-Pkg_is_arch_compat(pkg)
+Pkg_is_arch_compat__XS(pkg)
URPM::Package pkg
+ INIT:
+ char * platform;
CODE:
read_config_files(0);
if (pkg->info) {
@@ -1433,8 +1431,9 @@ Pkg_is_arch_compat(pkg)
get_fullname_parts(pkg, NULL, NULL, NULL, &arch, &eos);
*eos = 0;
#ifdef RPM_448
- if (!platform) platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
+ platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
RETVAL = rpmPlatformScore(platform, NULL, 0);
+ _free(platform);
#else
RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
#endif
@@ -1442,8 +1441,9 @@ Pkg_is_arch_compat(pkg)
} else if (pkg->h && headerIsEntry(pkg->h, RPMTAG_SOURCERPM)) {
char *arch = get_name(pkg->h, RPMTAG_ARCH);
#ifdef RPM_448
- if (!platform) platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
+ platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
RETVAL = rpmPlatformScore(platform, NULL, 0);
+ _free(platform);
#else
RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
#endif