aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--NEWS5
-rw-r--r--URPM.pm2
-rw-r--r--URPM.xs16
3 files changed, 21 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index c33cfb1..d9885bd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Version 4.29 - 7 May 2011, by Per Øyvind Karlsen
+
+- fix segfault when trying to get EVR of a src.rpm from synthesis, as
+ @provides@ are omitted for these
+
Version 4.28 - 5 May 2011, by Per Øyvind Karlsen
- revert attempt at refactorizing Trans_run() which turned out to give code
diff --git a/URPM.pm b/URPM.pm
index 2cb1d8f..30aaf2f 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -11,7 +11,7 @@ use URPM::Resolve;
use URPM::Signature;
our @ISA = qw(DynaLoader);
-our $VERSION = '4.28';
+our $VERSION = '4.29';
URPM->bootstrap($VERSION);
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);