|
Panu Matilainen |
13dcfb |
diff --git a/lib/depends.c b/lib/depends.c
|
|
Panu Matilainen |
13dcfb |
index 58aff31..810e909 100644
|
|
Panu Matilainen |
13dcfb |
--- a/lib/depends.c
|
|
Panu Matilainen |
13dcfb |
+++ b/lib/depends.c
|
|
Panu Matilainen |
13dcfb |
@@ -118,7 +118,7 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
|
|
Panu Matilainen |
13dcfb |
struct rpmtd_s td;
|
|
Panu Matilainen |
13dcfb |
const char * arch = NULL;
|
|
Panu Matilainen |
13dcfb |
const char * os = NULL;
|
|
Panu Matilainen |
13dcfb |
- rpmds oldChk, newChk;
|
|
Panu Matilainen |
13dcfb |
+ rpmds oldChk = NULL, newChk = NULL, sameChk = NULL;
|
|
Panu Matilainen |
13dcfb |
rpmds obsoletes;
|
|
Panu Matilainen |
13dcfb |
rpmalKey pkgKey; /* addedPackages key */
|
|
Panu Matilainen |
13dcfb |
int xx;
|
|
Panu Matilainen |
13dcfb |
@@ -151,10 +151,13 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
|
|
Panu Matilainen |
13dcfb |
}
|
|
Panu Matilainen |
13dcfb |
|
|
Panu Matilainen |
13dcfb |
oldChk = rpmdsThis(h, RPMTAG_REQUIRENAME, (RPMSENSE_LESS));
|
|
Panu Matilainen |
13dcfb |
- newChk = rpmdsThis(h, RPMTAG_REQUIRENAME, (RPMSENSE_EQUAL|RPMSENSE_GREATER));
|
|
Panu Matilainen |
13dcfb |
+ newChk = rpmdsThis(h, RPMTAG_REQUIRENAME, (RPMSENSE_GREATER));
|
|
Panu Matilainen |
13dcfb |
+ sameChk = rpmdsThis(h, RPMTAG_REQUIRENAME, (RPMSENSE_EQUAL));
|
|
Panu Matilainen |
13dcfb |
/* XXX can't use rpmtsiNext() filter or oc will have wrong value. */
|
|
Panu Matilainen |
13dcfb |
for (pi = rpmtsiInit(ts), oc = 0; (p = rpmtsiNext(pi, 0)) != NULL; oc++) {
|
|
Panu Matilainen |
13dcfb |
rpmds this;
|
|
Panu Matilainen |
13dcfb |
+ const char *pkgNEVR, *addNEVR;
|
|
Panu Matilainen |
13dcfb |
+ int skip = 0;
|
|
Panu Matilainen |
13dcfb |
|
|
Panu Matilainen |
13dcfb |
/* XXX Only added packages need be checked for dupes. */
|
|
Panu Matilainen |
13dcfb |
if (rpmteType(p) == TR_REMOVED)
|
|
Panu Matilainen |
13dcfb |
@@ -181,13 +184,20 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
|
|
Panu Matilainen |
13dcfb |
continue; /* XXX can't happen */
|
|
Panu Matilainen |
13dcfb |
|
|
Panu Matilainen |
13dcfb |
/*
|
|
Panu Matilainen |
13dcfb |
+ * Always skip identical NEVR.
|
|
Panu Matilainen |
13dcfb |
* On upgrade, if newer NEVR was previously added,
|
|
Panu Matilainen |
13dcfb |
* then skip adding older.
|
|
Panu Matilainen |
13dcfb |
*/
|
|
Panu Matilainen |
13dcfb |
- rc = rpmdsCompare(newChk, this);
|
|
Panu Matilainen |
13dcfb |
- if (upgrade && rc != 0) {
|
|
Panu Matilainen |
13dcfb |
- const char * pkgNEVR = rpmdsDNEVR(this);
|
|
Panu Matilainen |
13dcfb |
- const char * addNEVR = rpmdsDNEVR(oldChk);
|
|
Panu Matilainen |
13dcfb |
+ if (rpmdsCompare(sameChk, this)) {
|
|
Panu Matilainen |
13dcfb |
+ skip = 1;
|
|
Panu Matilainen |
13dcfb |
+ addNEVR = rpmdsDNEVR(sameChk);
|
|
Panu Matilainen |
13dcfb |
+ } else if (upgrade && rpmdsCompare(newChk, this)) {
|
|
Panu Matilainen |
13dcfb |
+ skip = 1;
|
|
Panu Matilainen |
13dcfb |
+ addNEVR = rpmdsDNEVR(newChk);
|
|
Panu Matilainen |
13dcfb |
+ }
|
|
Panu Matilainen |
13dcfb |
+
|
|
Panu Matilainen |
13dcfb |
+ if (skip) {
|
|
Panu Matilainen |
13dcfb |
+ pkgNEVR = rpmdsDNEVR(this);
|
|
Panu Matilainen |
13dcfb |
if (rpmIsVerbose())
|
|
Panu Matilainen |
13dcfb |
rpmlog(RPMLOG_WARNING,
|
|
Panu Matilainen |
13dcfb |
_("package %s was already added, skipping %s\n"),
|
|
Panu Matilainen |
13dcfb |
@@ -203,8 +213,8 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
|
|
Panu Matilainen |
13dcfb |
*/
|
|
Panu Matilainen |
13dcfb |
rc = rpmdsCompare(oldChk, this);
|
|
Panu Matilainen |
13dcfb |
if (upgrade && rc != 0) {
|
|
Panu Matilainen |
13dcfb |
- const char * pkgNEVR = rpmdsDNEVR(this);
|
|
Panu Matilainen |
13dcfb |
- const char * addNEVR = rpmdsDNEVR(newChk);
|
|
Panu Matilainen |
13dcfb |
+ pkgNEVR = rpmdsDNEVR(this);
|
|
Panu Matilainen |
13dcfb |
+ addNEVR = rpmdsDNEVR(newChk);
|
|
Panu Matilainen |
13dcfb |
if (rpmIsVerbose())
|
|
Panu Matilainen |
13dcfb |
rpmlog(RPMLOG_WARNING,
|
|
Panu Matilainen |
13dcfb |
_("package %s was already added, replacing with %s\n"),
|
|
Panu Matilainen |
13dcfb |
@@ -216,8 +226,6 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
|
|
Panu Matilainen |
13dcfb |
}
|
|
Panu Matilainen |
13dcfb |
}
|
|
Panu Matilainen |
13dcfb |
pi = rpmtsiFree(pi);
|
|
Panu Matilainen |
13dcfb |
- oldChk = rpmdsFree(oldChk);
|
|
Panu Matilainen |
13dcfb |
- newChk = rpmdsFree(newChk);
|
|
Panu Matilainen |
13dcfb |
|
|
Panu Matilainen |
13dcfb |
/* If newer NEVR was already added, exit now. */
|
|
Panu Matilainen |
13dcfb |
if (ec)
|
|
Panu Matilainen |
13dcfb |
@@ -353,6 +361,9 @@ addheader:
|
|
Panu Matilainen |
13dcfb |
ec = 0;
|
|
Panu Matilainen |
13dcfb |
|
|
Panu Matilainen |
13dcfb |
exit:
|
|
Panu Matilainen |
13dcfb |
+ oldChk = rpmdsFree(oldChk);
|
|
Panu Matilainen |
13dcfb |
+ newChk = rpmdsFree(newChk);
|
|
Panu Matilainen |
13dcfb |
+ sameChk = rpmdsFree(sameChk);
|
|
Panu Matilainen |
13dcfb |
pi = rpmtsiFree(pi);
|
|
Panu Matilainen |
13dcfb |
return ec;
|
|
Panu Matilainen |
13dcfb |
}
|