From 3d1a4c165264b3d9876fb84cca2ce6335c264b97 Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Wed, 4 Jul 2007 15:53:30 +0000 Subject: - add Pkg_is_platform_compat() and Urpm_platformscore() coming with rpm 4.4.8 --- URPM.xs | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'URPM.xs') diff --git a/URPM.xs b/URPM.xs index c7f22e4..31047f6 100644 --- a/URPM.xs +++ b/URPM.xs @@ -1352,7 +1352,7 @@ Pkg_is_arch_compat(pkg) RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch); #endif *eos = '@'; - free(platform); + _free(platform); } else if (pkg->h && headerIsEntry(pkg->h, RPMTAG_SOURCERPM)) { char *arch = get_name(pkg->h, RPMTAG_ARCH); #ifdef RPM_448 @@ -1367,6 +1367,40 @@ Pkg_is_arch_compat(pkg) OUTPUT: RETVAL +int +Pkg_is_platform_compat(pkg) + URPM::Package pkg + INIT: + char * platform = NULL; + CODE: +#ifdef RPM_448 + read_config_files(0); + if (pkg->h && headerIsEntry(pkg->h, RPMTAG_PLATFORM)) { + int_32 count, type; + (void) headerGetEntry(pkg->h, RPMTAG_PLATFORM, &type, (void **) &platform, &count); + RETVAL = rpmPlatformScore(platform, NULL, 0); + platform = headerFreeData(platform, type); + } else if (pkg->info) { + char *arch; + char *eos; + + get_fullname_parts(pkg, NULL, NULL, NULL, &arch, &eos); + *eos = 0; + platform = rpmExpand(arch, "-%{_real_vendor}-", eos, "%{?_gnu}", NULL); + RETVAL = rpmPlatformScore(platform, NULL, 0); + *eos = '@'; + _free(platform); + } else { +#else + croak("is_platform_compat() is availlable only since rpm 4.4.8"); + { /* to match last } and avoid another #ifdef for it */ +#endif + RETVAL = 0; + } + + OUTPUT: + RETVAL + void Pkg_summary(pkg) URPM::Package pkg @@ -3636,6 +3670,19 @@ Urpm_import_pubkey(...) OUTPUT: RETVAL +int +Urpm_platformscore(platform) + const char * platform + CODE: +#ifdef RPM_448 + RETVAL=rpmPlatformScore(platform, NULL, 0); +#else + croak("platformscore() is availlable only since rpm 4.4.8"); + RETVAL=0 +#endif + OUTPUT: + RETVAL + void Urpm_stream2header(fp) FILE *fp -- cgit v1.2.1