From 3250ba1805605ea2fdd15ff577f7995f46ccec6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Fri, 3 Dec 2010 19:25:55 +0000 Subject: fix parsing of NEVRA for 'gpg-pubkey' --- NEWS | 4 ++++ URPM.xs | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index c56dd10..8a518a1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Version 4.3 - + +- fix NEVRA parsing of 'gpg-pubkey' + Version 4.2 - 3 Dec 2010, by Per Øyvind Karlsen - fix URPM::Package::files() diff --git a/URPM.xs b/URPM.xs index 965cecf..0e47578 100644 --- a/URPM.xs +++ b/URPM.xs @@ -249,12 +249,17 @@ get_evr(URPM__Package pkg) { return evr; } -/* This function might modify strings that needs to be reverted after use +/* This function might modify strings that needs to be restored after use * with restore_chars() */ static int get_fullname_parts(URPM__Package pkg, char **name, int *epoch, char **version, char **release, char **disttag, char **distepoch, char **arch, char **eos) { char *_version = NULL, *_release = NULL, *_disttag = NULL, *_distepoch = NULL, *_arch = NULL, *_eos = NULL, *tmp = NULL; + /* XXX: Could've probably be written in a more generic way, only thing we + * really want to do is to check for arch field, which will be missing in + * the case of gpg-pubkey at least.. + */ + int pubkey; if(pkg->info) { if ((_eos = strchr(pkg->info, '@')) != NULL) { @@ -262,9 +267,10 @@ get_fullname_parts(URPM__Package pkg, char **name, int *epoch, char **version, c if(name != NULL || version != NULL || release != NULL || disttag != NULL || distepoch != NULL || arch != NULL) { backup_char(_eos); if (eos != NULL) *eos = _eos+1; - if ((_arch = strrchr(pkg->info, '.')) != NULL) { - backup_char(_arch); - if (arch != NULL) *arch = _arch + 1; + if ((pubkey = !strncmp(pkg->info, "gpg-pubkey", 10)) || (_arch = strrchr(pkg->info, '.')) != NULL) { + if(!pubkey) + backup_char(_arch); + if (arch != NULL) *arch = pubkey ? "" : _arch + 1; if (distepoch != NULL || disttag != NULL || release != NULL || version != NULL || name != NULL) { if((_distepoch = strchr(strrchr(pkg->provides, '-'), ':')) != NULL) { tmp = strrchr(_distepoch+1, ']'); -- cgit v1.2.1