From f4d12868e2a45b20fe9b3f763ce35a30623f3633 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 24 Apr 2008 14:56:27 +0300 Subject: [PATCH] Add rpmteEVR() function - seems like a useful thing to have - use in ensureOlder() --- lib/rpmte.c | 5 +++++ lib/rpmte.h | 7 +++++++ lib/transaction.c | 5 +---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/rpmte.c b/lib/rpmte.c index 9d005a5..86e8d78 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -434,6 +434,11 @@ int rpmteDBOffset(rpmte te) return (te != NULL ? te->u.removed.dboffset : 0); } +const char * rpmteEVR(rpmte te) +{ + return (te != NULL ? te->NEVR + strlen(te->name) + 1 : NULL); +} + const char * rpmteNEVR(rpmte te) { return (te != NULL ? te->NEVR : NULL); diff --git a/lib/rpmte.h b/lib/rpmte.h index b1f74cf..d735281 100644 --- a/lib/rpmte.h +++ b/lib/rpmte.h @@ -313,6 +313,13 @@ rpmalKey rpmteDependsOnKey(rpmte te); int rpmteDBOffset(rpmte te); /** \ingroup rpmte + * Retrieve [epoch:]version-release string from transaction element. + * @param te transaction element + * @return name-version-release string + */ +const char * rpmteEVR(rpmte te); + +/** \ingroup rpmte * Retrieve name-version-release string from transaction element. * @param te transaction element * @return name-version-release string diff --git a/lib/transaction.c b/lib/transaction.c index eb4eb7c..57ed438 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -593,16 +593,13 @@ static int ensureOlder(rpmts ts, const rpmte p, const Header h) { rpmsenseFlags reqFlags = (RPMSENSE_LESS | RPMSENSE_EQUAL); - const char * reqEVR; rpmds req; int rc; if (p == NULL || h == NULL) return 1; - reqEVR = rpmteNEVR(p) + strlen(rpmteN(p)) + 1; - - req = rpmdsSingle(RPMTAG_REQUIRENAME, rpmteN(p), reqEVR, reqFlags); + req = rpmdsSingle(RPMTAG_REQUIRENAME, rpmteN(p), rpmteEVR(p), reqFlags); rc = rpmdsNVRMatchesDep(h, req, _rpmds_nopromote); req = rpmdsFree(req); -- 2.7.4