aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-09-21 11:30:58 +0000
committerThierry Vignaud <tv@mageia.org>2012-09-21 11:30:58 +0000
commitcf697b9faf3ed57ef592d761b008afb32101ec3e (patch)
treec825b110f9dc8a0177602d003eaade2abd624225 /URPM.xs
parent04fb01d300c331b51928090dddc2780d0cd9500d (diff)
downloadperl-URPM-cf697b9faf3ed57ef592d761b008afb32101ec3e.tar
perl-URPM-cf697b9faf3ed57ef592d761b008afb32101ec3e.tar.gz
perl-URPM-cf697b9faf3ed57ef592d761b008afb32101ec3e.tar.bz2
perl-URPM-cf697b9faf3ed57ef592d761b008afb32101ec3e.tar.xz
perl-URPM-cf697b9faf3ed57ef592d761b008afb32101ec3e.zip
add EVR method for rpmdrake
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs30
1 files changed, 30 insertions, 0 deletions
diff --git a/URPM.xs b/URPM.xs
index fccb009..997580d 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1437,6 +1437,36 @@ Pkg_release(pkg)
}
void
+Pkg_EVR(pkg)
+ URPM::Package pkg
+ PPCODE:
+ if (pkg->info) {
+ char *s, *eos;
+ char *version, *arch;
+ int epoch;
+
+ if ((s = strchr(pkg->info, '@')) != NULL) {
+ if ((eos = strchr(s+1, '@')) != NULL)
+ *eos = 0; /* mark end of string to enable searching backwards */
+ epoch = atoi(s+1);
+ if (eos != NULL) *eos = '@';
+ } else
+ epoch = 0;
+ get_fullname_parts(pkg, NULL, &version, NULL, &arch, &eos);
+ if (epoch == 0)
+ mXPUSHs(newSVpv(version, arch-version-1));
+ else {
+ char *res;
+ arch--;
+ *arch = '\0';
+ asprintf(&res, "%d:%s", epoch, version);
+ mXPUSHs(newSVpv(res, 0));
+ *arch = '.'; /* restore info string modified */
+ }
+ } else if (pkg->h)
+ mXPUSHs(newSVpv(get_name(pkg->h, RPMTAG_EVR), 0));
+
+void
Pkg_arch(pkg)
URPM::Package pkg
PPCODE: