aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2010-12-03 19:25:55 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2010-12-03 19:25:55 +0000
commit3250ba1805605ea2fdd15ff577f7995f46ccec6d (patch)
treebd7d52194acd72f3d1a6ee3ca8291ec2de4bf8d0
parentb7caea4e86d8135b2289a46a83c862b7ad0964e6 (diff)
downloadperl-URPM-3250ba1805605ea2fdd15ff577f7995f46ccec6d.tar
perl-URPM-3250ba1805605ea2fdd15ff577f7995f46ccec6d.tar.gz
perl-URPM-3250ba1805605ea2fdd15ff577f7995f46ccec6d.tar.bz2
perl-URPM-3250ba1805605ea2fdd15ff577f7995f46ccec6d.tar.xz
perl-URPM-3250ba1805605ea2fdd15ff577f7995f46ccec6d.zip
fix parsing of NEVRA for 'gpg-pubkey'
-rw-r--r--NEWS4
-rw-r--r--URPM.xs14
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, ']');