aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-11 09:58:41 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-11 09:58:41 +0000
commitb8548deceb1fc8e038b5b0385fa5ae1eedbe879b (patch)
tree1b296c5c461f4530f356c02f468950adb442795a
parent56dc88b6c4ccb09cbf552ddac4764c351ab4ead5 (diff)
downloadperl-URPM-b8548deceb1fc8e038b5b0385fa5ae1eedbe879b.tar
perl-URPM-b8548deceb1fc8e038b5b0385fa5ae1eedbe879b.tar.gz
perl-URPM-b8548deceb1fc8e038b5b0385fa5ae1eedbe879b.tar.bz2
perl-URPM-b8548deceb1fc8e038b5b0385fa5ae1eedbe879b.tar.xz
perl-URPM-b8548deceb1fc8e038b5b0385fa5ae1eedbe879b.zip
- speedup is_arch_compat (x7) by keeping the platform in a cache
-rw-r--r--NEWS1
-rw-r--r--URPM.xs12
2 files changed, 7 insertions, 6 deletions
diff --git a/NEWS b/NEWS
index 7e8d5b8..bb9d032 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+- speedup is_arch_compat (7 times faster) by keeping the platform in a cache
- do not propose packages for non installed locales
- pass the prefered choices to {callback_choices}: this allows urpmi to select
all the prefered packages according to installed locales
diff --git a/URPM.xs b/URPM.xs
index 1d3afc3..f74e581 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -111,6 +111,10 @@ 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);
@@ -1420,8 +1424,6 @@ Pkg_arch(pkg)
int
Pkg_is_arch_compat(pkg)
URPM::Package pkg
- INIT:
- char * platform;
CODE:
read_config_files(0);
if (pkg->info) {
@@ -1431,9 +1433,8 @@ Pkg_is_arch_compat(pkg)
get_fullname_parts(pkg, NULL, NULL, NULL, &arch, &eos);
*eos = 0;
#ifdef RPM_448
- platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
+ if ($platform) platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
RETVAL = rpmPlatformScore(platform, NULL, 0);
- _free(platform);
#else
RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
#endif
@@ -1441,9 +1442,8 @@ 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
- platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
+ if (!platform) platform = rpmExpand(arch, "-%{_real_vendor}-%{_target_os}%{?_gnu}", NULL);
RETVAL = rpmPlatformScore(platform, NULL, 0);
- _free(platform);
#else
RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
#endif