From f11451e2ba4c2fa65905c66fb285c50c2e2eecba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Fri, 6 May 2011 23:41:33 +0000 Subject: fix segfault when trying to get EVR of a src.rpm from synthesis, as @provides@ are omitted for these --- NEWS | 5 +++++ URPM.pm | 2 +- URPM.xs | 16 +++++++++++++++- 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); -- cgit v1.2.1