aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2011-04-16 07:49:31 +0000
committerThierry Vignaud <tv@mageia.org>2011-04-16 07:49:31 +0000
commitf4c504acf2520f4765bcc5c2294065c72989b777 (patch)
tree376b8b320c0ca20ac9d0e9e042ab920b604039d8
parente574fa64644a04ba211ac21a4baa9e9aa3ccc546 (diff)
downloadperl-URPM-f4c504acf2520f4765bcc5c2294065c72989b777.tar
perl-URPM-f4c504acf2520f4765bcc5c2294065c72989b777.tar.gz
perl-URPM-f4c504acf2520f4765bcc5c2294065c72989b777.tar.bz2
perl-URPM-f4c504acf2520f4765bcc5c2294065c72989b777.tar.xz
perl-URPM-f4c504acf2520f4765bcc5c2294065c72989b777.zip
clean rpm5 support out
-rwxr-xr-xMakefile.PL8
-rw-r--r--URPM.xs102
2 files changed, 2 insertions, 108 deletions
diff --git a/Makefile.PL b/Makefile.PL
index 3274db1..9b5b3d0 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -50,16 +50,12 @@ ChangeLog:
}
my @rpmflags;
-my $ldflags = `pkg-config --libs rpm`;
+my $ldflags = `pkg-config --libs rpm -lrpmbuild`;
if ($hversion ge hexversion("4.9.0") && $hversion lt hexversion("5.0")) {
# rpm.org version 4.9.0
push @rpmflags, "-DRPM490";
}
-if ($hversion ge hexversion("4.4.90") && $hversion lt hexversion("5.0")) {
- # rpm.org version
- push @rpmflags, "-DRPM_ORG";
- $ldflags .= ' -lrpmbuild';
-}
+
my $ccflags = join(' ', '-Wall -Wextra -fno-strict-aliasing', @rpmflags);
print "Found RPM version $version (compiling with flags: $ccflags)\n";
diff --git a/URPM.xs b/URPM.xs
index 71ae08b..e515cc7 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -28,15 +28,11 @@
#undef Stat
#undef Fstat
-#ifdef RPM_ORG
static inline void *_free(const void * p) {
if (p != NULL) free((void *)p);
return NULL;
}
typedef struct rpmSpec_s * Spec;
-#else
-#include <rpm/rpm46compat.h>
-#endif
#include <rpm/rpmio.h>
#include <rpm/rpmdb.h>
@@ -554,9 +550,7 @@ return_list_tag(URPM__Package pkg, int32_t tag_name) {
switch (rpmtdType(&td)) {
case RPM_NULL_TYPE:
break;
-#ifdef RPM_ORG
case RPM_CHAR_TYPE:
-#endif
case RPM_INT8_TYPE:
case RPM_INT16_TYPE:
case RPM_INT32_TYPE:
@@ -1181,10 +1175,6 @@ static void drop_tags(Header *h) {
headerDel(*h, RPMTAG_FILESIZES); /* ? */
headerDel(*h, RPMTAG_FILERDEVS); /* it seems unused. always empty */
headerDel(*h, RPMTAG_FILEVERIFYFLAGS); /* only used for -V */
-#ifndef RPM_ORG
- headerDel(*h, RPMTAG_FILEDIGESTALGOS); /* only used for -V */
- headerDel(*h, RPMTAG_FILEDIGESTS); /* only used for -V */ /* alias: RPMTAG_FILEMD5S */
-#endif
/* keep RPMTAG_FILEFLAGS for %config (rpmnew) to work */
/* keep RPMTAG_FILELANGS for %lang (_install_langs) to work */
/* keep RPMTAG_FILELINKTOS for checking conflicts between symlinks */
@@ -1235,18 +1225,10 @@ update_header(char *filename, URPM__Package pkg, __attribute__((unused)) int kee
rpmtsSetVSFlags(ts, _RPMVSF_NOSIGNATURES | vsflags);
if (fd != NULL && rpmReadPackageFile(ts, fd, filename, &header) == 0 && header) {
char *basename;
-#ifndef RPM_ORG
- struct stat sb;
-#else
int32_t size;
-#endif
basename = strrchr(filename, '/');
-#ifndef RPM_ORG
- Fstat(fd, &sb);
-#else
size = fdSize(fd);
-#endif
Fclose(fd);
/* this is only kept for compatibility with older distros
@@ -1519,9 +1501,6 @@ int
Pkg_is_arch_compat__XS(pkg)
URPM::Package pkg
INIT:
-#ifndef RPM_ORG
- char * platform;
-#endif
CODE:
read_config_files(0);
if (pkg->info) {
@@ -1530,23 +1509,11 @@ Pkg_is_arch_compat__XS(pkg)
get_fullname_parts(pkg, NULL, NULL, NULL, &arch, &eos);
*eos = 0;
-#ifndef RPM_ORG
- platform = rpmExpand(arch, "-%{_target_vendor}-%{_target_os}%{?_gnu}", NULL);
- RETVAL = rpmPlatformScore(platform, NULL, 0);
- _free(platform);
-#else
RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
-#endif
*eos = '@';
} else if (pkg->h && headerIsEntry(pkg->h, RPMTAG_SOURCERPM)) {
char *arch = get_name(pkg->h, RPMTAG_ARCH);
-#ifndef RPM_ORG
- platform = rpmExpand(arch, "-%{_target_vendor}-%{_target_os}%{?_gnu}", NULL);
- RETVAL = rpmPlatformScore(platform, NULL, 0);
- _free(platform);
-#else
RETVAL = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
-#endif
} else {
RETVAL = 0;
}
@@ -1557,33 +1524,9 @@ int
Pkg_is_platform_compat(pkg)
URPM::Package pkg
INIT:
-#ifndef RPM_ORG
- char * platform = NULL;
- struct rpmtd_s val;
-#endif
CODE:
-#ifndef RPM_ORG
- read_config_files(0);
- if (pkg->h && headerIsEntry(pkg->h, RPMTAG_PLATFORM)) {
- (void) headerGet(pkg->h, RPMTAG_PLATFORM, &val, HEADERGET_DEFAULT);
- platform = (char *) rpmtdGetString(&val);
- RETVAL = rpmPlatformScore(platform, NULL, 0);
- platform = headerFreeData(platform, val.type);
- } else if (pkg->info) {
- char *arch;
- char *eos;
-
- get_fullname_parts(pkg, NULL, NULL, NULL, &arch, &eos);
- *eos = 0;
- platform = rpmExpand(arch, "-%{_target_vendor}-", eos, "%{?_gnu}", NULL);
- RETVAL = rpmPlatformScore(platform, NULL, 0);
- *eos = '@';
- _free(platform);
- } else {
-#else
croak("is_platform_compat() is available only since rpm 4.4.8");
{ /* to match last } and avoid another #ifdef for it */
-#endif
RETVAL = 0;
}
@@ -3033,11 +2976,7 @@ Trans_add(trans, pkg, ...)
CODE:
if ((pkg->flag & FLAG_ID) <= FLAG_ID_MAX && pkg->h != NULL) {
int update = 0;
-#ifndef RPM_ORG
- rpmRelocation relocations = NULL;
-#else
rpmRelocation *relocations = NULL;
-#endif
/* compability mode with older interface of add */
if (items == 3) {
update = SvIV(ST(2));
@@ -3053,20 +2992,11 @@ Trans_add(trans, pkg, ...)
if (SvROK(ST(i+1)) && SvTYPE(SvRV(ST(i+1))) == SVt_PVAV) {
AV *excludepath = (AV*)SvRV(ST(i+1));
I32 j = 1 + av_len(excludepath);
-#ifndef RPM_ORG
- int relno = 0;
- relocations = malloc(sizeof(rpmRelocation));
-#else
relocations = calloc(j + 1, sizeof(rpmRelocation));
-#endif
while (--j >= 0) {
SV **e = av_fetch(excludepath, j, 0);
if (e != NULL && *e != NULL) {
-#ifndef RPM_ORG
- rpmfiAddRelocation(&relocations, &relno, SvPV_nolen(*e), NULL);
-#else
relocations[j].oldPath = SvPV_nolen(*e);
-#endif
}
}
}
@@ -3075,11 +3005,7 @@ Trans_add(trans, pkg, ...)
}
RETVAL = rpmtsAddInstallElement(trans->ts, pkg->h, (fnpyKey)(1+(long)(pkg->flag & FLAG_ID)), update, relocations) == 0;
/* free allocated memory, check rpm is copying it just above, at least in 4.0.4 */
-#ifndef RPM_ORG
- rpmfiFreeRelocations(relocations);
-#else
free(relocations);
-#endif
} else RETVAL = 0;
OUTPUT:
RETVAL
@@ -3853,18 +3779,9 @@ int
Urpm_archscore(arch)
const char * arch
PREINIT:
-#ifndef RPM_ORG
- char * platform = NULL;
-#endif
CODE:
read_config_files(0);
-#ifndef RPM_ORG
- platform = rpmExpand(arch, "-%{_target_vendor}-%{_target_os}%{?_gnu}", NULL);
- RETVAL=rpmPlatformScore(platform, NULL, 0);
- _free(platform);
-#else
RETVAL=rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch);
-#endif
OUTPUT:
RETVAL
@@ -3872,18 +3789,9 @@ int
Urpm_osscore(os)
const char * os
PREINIT:
-#ifndef RPM_ORG
- char * platform = NULL;
-#endif
CODE:
read_config_files(0);
-#ifndef RPM_ORG
- platform = rpmExpand("%{_target_cpu}-%{_target_vendor}-", os, "%{?_gnu}", NULL);
- RETVAL=rpmPlatformScore(platform, NULL, 0);
- _free(platform);
-#else
RETVAL=rpmMachineScore(RPM_MACHTABLE_INSTOS, os);
-#endif
OUTPUT:
RETVAL
@@ -3892,13 +3800,9 @@ Urpm_platformscore(platform)
const char * platform
CODE:
read_config_files(0);
-#ifndef RPM_ORG
- RETVAL=rpmPlatformScore(platform, NULL, 0);
-#else
unused_variable(platform);
croak("platformscore() is available only since rpm 4.4.8");
RETVAL=0;
-#endif
OUTPUT:
RETVAL
@@ -3951,13 +3855,7 @@ Urpm_spec2srcheader(specfile)
// (See http://www.rpm.org/wiki/Releases/4.9.0)
spec = rpmtsSetSpec(ts, NULL);
header = spec->sourceHeader;
-#endif
-#ifdef RPM_ORG
-#ifndef RPM490
if (! header)
-#endif
-#endif
-#ifndef RPM490
initSourceHeader(spec);
#endif
pkg = (URPM__Package)malloc(sizeof(struct s_Package));