From 8f48788d83b7c797218dbd8ad4c061c23a01ee83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Sun, 5 Dec 2010 10:35:59 +0000 Subject: always return an array with six items for $package->fullname --- NEWS | 3 +++ URPM.pm | 5 +++-- URPM.xs | 14 +++----------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index ae4be1a..cdbc20b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,7 @@ Version 4.3 - +- URPM::Package::fullname will now always return six items for array in stead + of four to make room for disttag & distepoch, arch will still be returned as + last item (ie. array[5] in stead of array[3]) - URPM::Package::files_md5sum() has been renamed to URPM::Package::files_digest() - fix NEVRA parsing of 'gpg-pubkey' diff --git a/URPM.pm b/URPM.pm index 2dcf582..eadeb02 100644 --- a/URPM.pm +++ b/URPM.pm @@ -572,8 +572,9 @@ List of files in this rpm. =item $package->fullname() -Returns a 4 element list: name, version, release and architecture in an array -context. Returns a string NAME-VERSION-RELEASE.ARCH in scalar context. +Returns a 6 element list: name, version, release, disttag, distepoch and architecture +in an array context. Returns a string NAME-VERSION-RELEASE[-DISTTAGDISTEPOCH].ARCH +in scalar context. =item $package->get_tag($tagid) diff --git a/URPM.xs b/URPM.xs index adfa3ac..692d339 100644 --- a/URPM.xs +++ b/URPM.xs @@ -1781,25 +1781,17 @@ Pkg_fullname(pkg) PPCODE: if (gimme == G_ARRAY) { char *name, *version, *release, *disttag, *distepoch, *arch, *eos; - int items = 4; + int items = 6; if(get_fullname_parts(pkg, &name, NULL, &version, &release, &disttag, &distepoch, &arch, &eos)) croak("invalid fullname"); - /* XXX: This might result in the number of items and the order which returned - * being unexpected in the case of disttag/disttag being present. - */ - if(disttag != NULL) items++; - if(distepoch != NULL) items++; - EXTEND(SP, items); PUSHs(sv_2mortal(newSVpv(name, 0))); PUSHs(sv_2mortal(newSVpv(version, 0))); PUSHs(sv_2mortal(newSVpv(release, 0))); - if(disttag != NULL) - PUSHs(sv_2mortal(newSVpv(disttag, 0))); - if(distepoch != NULL) - PUSHs(sv_2mortal(newSVpv(distepoch, 0))); + PUSHs(sv_2mortal(newSVpv(disttag, 0))); + PUSHs(sv_2mortal(newSVpv(distepoch, 0))); PUSHs(sv_2mortal(newSVpv(arch, 0))); restore_chars(); } else if (gimme == G_SCALAR) { -- cgit v1.2.1