rpms/rpm/devel rpm-4.6.0-rc1-skip-equal-nevr.patch, NONE, 1.1 rpm.spec, 1.300, 1.301

Panu Matilainen pmatilai at fedoraproject.org
Wed Oct 22 07:06:19 UTC 2008


Author: pmatilai

Update of /cvs/pkgs/rpms/rpm/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv19982

Modified Files:
	rpm.spec 
Added Files:
	rpm-4.6.0-rc1-skip-equal-nevr.patch 
Log Message:
- never add identical NEVRA to transaction more than once (#467822)


rpm-4.6.0-rc1-skip-equal-nevr.patch:

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


Index: rpm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rpm/devel/rpm.spec,v
retrieving revision 1.300
retrieving revision 1.301
diff -u -r1.300 -r1.301
--- rpm.spec	18 Oct 2008 23:03:04 -0000	1.300
+++ rpm.spec	22 Oct 2008 07:05:48 -0000	1.301
@@ -18,7 +18,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: 0.%{snapver}.2
+Release: 0.%{snapver}.3
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@@ -34,6 +34,7 @@
 
 # Patches already in upstream
 Patch200: rpm-4.6.0-rc1-permit-tab.patch
+Patch201: rpm-4.6.0-rc1-skip-equal-nevr.patch
 
 # These are not yet upstream
 Patch300: rpm-4.5.90-posttrans.patch
@@ -166,6 +167,7 @@
 %patch100 -p1 -b .pkgconfig-deps
 
 %patch200 -p1 -b .permit-tab
+%patch201 -p1 -b .skip-equal-nevr
 
 # needs a bit of upstream love first...
 #%patch300 -p1 -b .posttrans
@@ -357,6 +359,9 @@
 %doc doc/librpm/html/*
 
 %changelog
+* Wed Oct 22 2008 Panu Matilainen <pmatilai at redhat.com>
+- never add identical NEVRA to transaction more than once (#467822)
+
 * Sun Oct 19 2008 Panu Matilainen <pmatilai at redhat.com>
 - permit tab as macro argument separator (#467567)
 




More information about the scm-commits mailing list