aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-05-06 23:41:33 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-05-06 23:41:33 +0000
commitf11451e2ba4c2fa65905c66fb285c50c2e2eecba (patch)
treed7402f8d7e8cf262d187ba47a9094ff447a531b7 /URPM.xs
parent21f9e8412b6adbf77c86211eda46854eef149d31 (diff)
downloadperl-URPM-f11451e2ba4c2fa65905c66fb285c50c2e2eecba.tar
perl-URPM-f11451e2ba4c2fa65905c66fb285c50c2e2eecba.tar.gz
perl-URPM-f11451e2ba4c2fa65905c66fb285c50c2e2eecba.tar.bz2
perl-URPM-f11451e2ba4c2fa65905c66fb285c50c2e2eecba.tar.xz
perl-URPM-f11451e2ba4c2fa65905c66fb285c50c2e2eecba.zip
fix segfault when trying to get EVR of a src.rpm from synthesis, as @provides@ are omitted for these
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs16
1 files changed, 15 insertions, 1 deletions
diff --git a/URPM.xs b/URPM.xs
index a292f02..3f1c2bb 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -944,7 +944,21 @@ pack_list(Header header, rpmTag tag_name, rpmTag tag_flags, rpmTag tag_version,
static const char *
get_evr(URPM__Package pkg) {
const char *evr = NULL;
- if(pkg->provides && !pkg->h) {
+ if(pkg->info && !pkg->h) {
+ if (!pkg->provides) {
+ /* for src.rpms there's no @provides@ field added to the synthesis, so
+ * we'll create one by request here for EVR. */
+ char *name = NULL;
+ int epoch = 0;
+ char *version = NULL;
+ char *release = NULL;
+ char *distepoch = NULL;
+ get_fullname_parts(pkg, &name, &epoch, &version, &release, NULL, NULL, NULL, NULL);
+ int sz = asprintf(&pkg->provides, "%s[== %d:%s-%s]", name, epoch, version, release);
+ restore_chars();
+ if (sz < 0)
+ return "";
+ }
char *name = NULL;
char *tmp = NULL, *tmp2 = NULL, *tmp3 = NULL;
get_fullname_parts(pkg, &name, NULL, NULL, NULL, NULL, NULL, NULL, NULL);