diff options
author | Olivier Thauvin <nanardon@mandriva.org> | 2007-07-04 15:53:30 +0000 |
---|---|---|
committer | Olivier Thauvin <nanardon@mandriva.org> | 2007-07-04 15:53:30 +0000 |
commit | 3d1a4c165264b3d9876fb84cca2ce6335c264b97 (patch) | |
tree | 4eb0b2b6087e1ee2eaf84c1a989064f9428d9005 /URPM.xs | |
parent | ca1219cb28ad7ef95073a654bb1b103c9e1b69b2 (diff) | |
download | perl-URPM-3d1a4c165264b3d9876fb84cca2ce6335c264b97.tar perl-URPM-3d1a4c165264b3d9876fb84cca2ce6335c264b97.tar.gz perl-URPM-3d1a4c165264b3d9876fb84cca2ce6335c264b97.tar.bz2 perl-URPM-3d1a4c165264b3d9876fb84cca2ce6335c264b97.tar.xz perl-URPM-3d1a4c165264b3d9876fb84cca2ce6335c264b97.zip |
- add Pkg_is_platform_compat() and Urpm_platformscore() coming with rpm 4.4.8
Diffstat (limited to 'URPM.xs')
-rw-r--r-- | URPM.xs | 49 |
1 files changed, 48 insertions, 1 deletions
@@ -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 |