aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-06-21 13:04:00 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-06-21 13:04:00 +0000
commitab628b201339681b172bc65835bdbf2b96888b2b (patch)
tree2496a819fdfc2fa0bf72641dee4421084827b3ad
parent36114e372da41922cf8b6b03a590c98633c6a8ec (diff)
downloadperl-URPM-ab628b201339681b172bc65835bdbf2b96888b2b.tar
perl-URPM-ab628b201339681b172bc65835bdbf2b96888b2b.tar.gz
perl-URPM-ab628b201339681b172bc65835bdbf2b96888b2b.tar.bz2
perl-URPM-ab628b201339681b172bc65835bdbf2b96888b2b.tar.xz
perl-URPM-ab628b201339681b172bc65835bdbf2b96888b2b.zip
ignore distepoch in Pkg_compare()
-rw-r--r--URPM.xs8
1 files changed, 7 insertions, 1 deletions
diff --git a/URPM.xs b/URPM.xs
index 2d338e0..e4ba8dc 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -2148,7 +2148,7 @@ Pkg_compare(pkg, evr)
_epoch = get_int(pkg->h, RPMTAG_EPOCH);
} else croak("undefined package");
if (!compare) {
- char *epoch, *version, *release;
+ char *epoch, *version, *release, *distepoch;
/* extract epoch and version from evr */
version = evr;
@@ -2170,6 +2170,10 @@ Pkg_compare(pkg, evr)
/* continue extracting release if any */
if ((release = strrchr(version, '-')) != NULL) {
*release++ = 0;
+ /* XXX: compare distepoch rather than just ignoring? */
+ if ((distepoch = strrchr(release, ':')) != NULL)
+ *distepoch++ = 0;
+
compare = rpmvercmp(_version, version);
if (!compare) {
/* need to compare with release here */
@@ -2178,6 +2182,8 @@ Pkg_compare(pkg, evr)
compare = rpmvercmp(_release, release);
}
release[-1] = '-'; /* restore in memory modification */
+ if (distepoch != NULL)
+ distepoch[-1] = ':';
} else {
compare = rpmvercmp(_version, version);
}