aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2008-12-08 17:35:22 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2008-12-08 17:35:22 +0000
commit7d2f34ae6226e5f37bc9f51bd8396cb4541948db (patch)
tree143cfd8f0bd1f25ac3d2580bf86dd03ccbfd7291
parente932863af3bad36ff555d2bff478366ef43073fd (diff)
downloadperl-URPM-7d2f34ae6226e5f37bc9f51bd8396cb4541948db.tar
perl-URPM-7d2f34ae6226e5f37bc9f51bd8396cb4541948db.tar.gz
perl-URPM-7d2f34ae6226e5f37bc9f51bd8396cb4541948db.tar.bz2
perl-URPM-7d2f34ae6226e5f37bc9f51bd8396cb4541948db.tar.xz
perl-URPM-7d2f34ae6226e5f37bc9f51bd8396cb4541948db.zip
fix rpmRelocation usage with rpm 5.2
-rw-r--r--URPM.xs15
1 files changed, 13 insertions, 2 deletions
diff --git a/URPM.xs b/URPM.xs
index e750570..990d226 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3050,7 +3050,10 @@ 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);
-#if RPM_VERSION_CODE >= RPM_VERSION(4,4,6)
+#if RPM_VERSION_CODE >= RPM_VERSION(5,2,0)
+ int relno = 0;
+ relocations = malloc(sizeof(rpmRelocation));
+#elif RPM_VERSION_CODE >= RPM_VERSION(4,4,6)
relocations = calloc(j + 1, sizeof(*relocations));
#else
relocations = calloc(j + 1, sizeof(rpmRelocation));
@@ -3058,7 +3061,11 @@ Trans_add(trans, pkg, ...)
while (--j >= 0) {
SV **e = av_fetch(excludepath, j, 0);
if (e != NULL && *e != NULL) {
- relocations[j].oldPath = SvPV_nolen(*e);
+#if RPM_VERSION_CODE >= RPM_VERSION(5,2,0)
+ rpmfiAddRelocation(&relocations, &relno, SvPV_nolen(*e), NULL);
+#else
+ relocations[j].oldPath = SvPV_nolen(*e);
+#endif
}
}
}
@@ -3067,7 +3074,11 @@ 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 */
+#if RPM_VERSION_CODE >= RPM_VERSION(5,2,0)
+ rpmfiFreeRelocations(relocations);
+#else
free(relocations);
+#endif
} else RETVAL = 0;
OUTPUT:
RETVAL