From 55ef8cfed5bd6331182e9425be234fb3d5ba026f Mon Sep 17 00:00:00 2001 From: Alexey Tourbin Date: Wed, 30 Sep 2009 16:11:11 +0400 Subject: [PATCH 1/3] removed support for availablePackages/suggestedPackages --- lib/depends.c | 47 ++++------------------------------------------ lib/depends.h | 2 -- lib/rpmlib.h | 12 ------------ python/rpmmodule.c | 29 ++++++---------------------- 4 files changed, 10 insertions(+), 80 deletions(-) diff --git a/lib/depends.c b/lib/depends.c index c775313..63b0f5d 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -619,8 +619,6 @@ rpmTransactionSet rpmtransCreateSet(rpmdb rpmdb, const char * rootDir) ts->addedPackages.delta = ts->delta; alCreate(&ts->addedPackages); - ts->availablePackages.delta = ts->delta; - alCreate(&ts->availablePackages); ts->orderAlloced = ts->delta; ts->orderCount = 0; @@ -799,12 +797,6 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd, return 0; } -void rpmtransAvailablePackage(rpmTransactionSet ts, Header h, const void * key) -{ - struct availablePackage * al; - al = alAddPackage(&ts->availablePackages, h, key, NULL, NULL); -} - int rpmtransRemovePackage(rpmTransactionSet ts, int dboffset) { return removePackage(ts, dboffset, -1); @@ -814,7 +806,6 @@ rpmTransactionSet rpmtransFree(rpmTransactionSet ts) { if (ts) { alFree(&ts->addedPackages); - alFree(&ts->availablePackages); ts->di = _free(ts->di); ts->removedPackages = _free(ts->removedPackages); ts->order = _free(ts->order); @@ -842,7 +833,6 @@ rpmDependencyConflict rpmdepFreeConflicts(rpmDependencyConflict conflicts, conflicts[i].byRelease = _free(conflicts[i].byRelease); conflicts[i].needsName = _free(conflicts[i].needsName); conflicts[i].needsVersion = _free(conflicts[i].needsVersion); - conflicts[i].suggestedPackages = _free(conflicts[i].suggestedPackages); } return (conflicts = _free(conflicts)); @@ -1072,21 +1062,17 @@ alSatisfiesDepend(const availableList al, * @param keyName dependency name string * @param keyEVR dependency [epoch:]version[-release] string * @param keyFlags dependency logical range qualifiers - * @retval suggestion possible package(s) to resolve dependency * @return 0 if satisfied, 1 if not satisfied, 2 if error */ static int unsatisfiedDepend(rpmTransactionSet ts, const char * keyType, const char * keyDepend, - const char * keyName, const char * keyEVR, int keyFlags, - /*@null@*/ /*@out@*/ struct availablePackage *** suggestion) - /*@modifies ts, *suggestion @*/ + const char * keyName, const char * keyEVR, int keyFlags) + /*@modifies ts @*/ { rpmdbMatchIterator mi; Header h; int rc = 0; /* assume dependency is satisfied */ - if (suggestion) *suggestion = NULL; - /* * Check if dbiOpen/dbiPut failed (e.g. permissions), we can't cache. */ @@ -1111,10 +1097,6 @@ static int unsatisfiedDepend(rpmTransactionSet ts, keyType, keyDepend, (rc ? _("NO ") : _("YES"))); xx = dbiCclose(dbi, NULL, 0); - if (suggestion && rc == 1) - *suggestion = alAllSatisfiesDepend(&ts->availablePackages, - NULL, NULL, keyName, keyEVR, keyFlags); - return rc; } xx = dbiCclose(dbi, dbcursor, 0); @@ -1214,10 +1196,6 @@ static int unsatisfiedDepend(rpmTransactionSet ts, } - if (suggestion) - *suggestion = alAllSatisfiesDepend(&ts->availablePackages, NULL, NULL, - keyName, keyEVR, keyFlags); - unsatisfied: rpmMessage(RPMMESS_DEBUG, _("%s: %-45s NO\n"), keyType, keyDepend+2); rc = 1; /* dependency is unsatisfied */ @@ -1276,7 +1254,6 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, rpmTagType type; int i, rc; int ourrc = 0; - struct availablePackage ** suggestion; (void) headerNVR(h, &name, &version, &release); @@ -1300,7 +1277,7 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, requires[i], requiresEVR[i], requireFlags[i]); rc = unsatisfiedDepend(ts, " Requires", keyDepend, - requires[i], requiresEVR[i], requireFlags[i], &suggestion); + requires[i], requiresEVR[i], requireFlags[i]); switch (rc) { case 0: /* requirements are satisfied. */ @@ -1324,19 +1301,6 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, pp->needsVersion = xstrdup(requiresEVR[i]); pp->needsFlags = requireFlags[i]; pp->sense = RPMDEP_SENSE_REQUIRES; - - if (suggestion) { - int j; - for (j = 0; suggestion[j]; j++) - {}; - pp->suggestedPackages = - xmalloc( (j + 1) * sizeof(*pp->suggestedPackages) ); - for (j = 0; suggestion[j]; j++) - pp->suggestedPackages[j] = suggestion[j]->key; - pp->suggestedPackages[j] = NULL; - } else { - pp->suggestedPackages = NULL; - } } psp->num++; @@ -1375,7 +1339,7 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, keyDepend = printDepend("C", conflicts[i], conflictsEVR[i], conflictFlags[i]); rc = unsatisfiedDepend(ts, "Conflicts", keyDepend, - conflicts[i], conflictsEVR[i], conflictFlags[i], NULL); + conflicts[i], conflictsEVR[i], conflictFlags[i]); /* 1 == unsatisfied, 0 == satsisfied */ switch (rc) { @@ -1398,7 +1362,6 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp, pp->needsVersion = xstrdup(conflictsEVR[i]); pp->needsFlags = conflictFlags[i]; pp->sense = RPMDEP_SENSE_CONFLICTS; - pp->suggestedPackages = NULL; } psp->num++; @@ -1812,7 +1775,6 @@ int rpmdepOrder(rpmTransactionSet ts) int i, j; alMakeIndex(&ts->addedPackages); - alMakeIndex(&ts->availablePackages); /* T1. Initialize. */ loopcheck = npkgs; @@ -2149,7 +2111,6 @@ int rpmdepCheck(rpmTransactionSet ts, *numConflicts = 0; alMakeIndex(&ts->addedPackages); - alMakeIndex(&ts->availablePackages); /* * Look at all of the added packages and make sure their dependencies diff --git a/lib/depends.h b/lib/depends.h index 117e3d3..f5c78b2 100644 --- a/lib/depends.h +++ b/lib/depends.h @@ -151,8 +151,6 @@ struct rpmTransactionSet_s { int allocedRemovedPackages; /*!< Size of removed packages array. */ struct availableList_s addedPackages; /*!< Set of packages being installed. */ - struct availableList_s availablePackages; - /*!< Universe of possible packages. */ /*@only@*/ transactionElement order; /*!< Packages sorted by dependencies. */ int orderCount; /*!< No. of transaction elements. */ diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 6579187..43e64f7 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -1035,7 +1035,6 @@ typedef /*@abstract@*/ struct rpmDependencyConflict_s { const char * needsName; /*!< dependency name */ const char * needsVersion; /*!< dependency epoch:version-release */ int needsFlags; /*!< dependency flags */ -/*@owned@*/ /*@null@*/ const void ** suggestedPackages; /* terminated by NULL */ enum { RPMDEP_SENSE_REQUIRES, /*!< requirement not satisfied. */ RPMDEP_SENSE_CONFLICTS /*!< conflict was found. */ @@ -1300,17 +1299,6 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, /*@null@*/ FD_t fd, /*@null@*/ rpmRelocation * relocs) /*@modifies fd, h, ts @*/; -/** \ingroup rpmtrans - * Add package to universe of possible packages to install in transaction set. - * @param ts transaction set - * @param h header - * @param key package private data - */ -/*@unused@*/ -void rpmtransAvailablePackage(rpmTransactionSet ts, Header h, - /*@null@*/ /*@owned@*/ const void * key) - /*@modifies h, ts @*/; - /** \ingroup rpmtrans * Add package to be removed to unordered transaction set. * @param ts transaction set diff --git a/python/rpmmodule.c b/python/rpmmodule.c index 77c5614..3170397 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -217,21 +217,17 @@ static PyObject * rpmtransAdd(rpmtransObject * s, PyObject * args) { return NULL; } - if (how && strcmp(how, "a") && strcmp(how, "u") && strcmp(how, "i")) { - PyErr_SetString(PyExc_TypeError, "how argument must be \"u\", \"a\", or \"i\""); + if (how && strcmp(how, "u") && strcmp(how, "i")) { + PyErr_SetString(PyExc_TypeError, "how argument must be \"u\" or \"i\""); return NULL; } else if (how && !strcmp(how, "u")) isUpgrade = 1; - if (how && !strcmp(how, "a")) - rpmtransAvailablePackage(s->ts, hdrGetHeader(h), key); - else - rpmtransAddPackage(s->ts, hdrGetHeader(h), NULL, key, isUpgrade, NULL); + rpmtransAddPackage(s->ts, hdrGetHeader(h), NULL, key, isUpgrade, NULL); /* This should increment the usage count for me */ - if (key) { + if (key) PyList_Append(s->keyList, key); - } Py_INCREF(Py_None); return Py_None; @@ -273,7 +269,7 @@ static PyObject * rpmtransRemove(rpmtransObject * s, PyObject * args) { static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) { rpmDependencyConflict conflicts; int numConflicts; - PyObject * list, * cf, * suggestions; + PyObject * list, * cf; int i, j; int allSuggestions = 0; @@ -283,20 +279,7 @@ static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) { if (numConflicts) { list = PyList_New(0); - /* XXX TODO: rpmlib-4.0.3 can return multiple suggested packages. */ for (i = 0; i < numConflicts; i++) { - if (!conflicts[i].suggestedPackages) - suggestions = Py_None; - else if (!allSuggestions) - suggestions = conflicts[i].suggestedPackages[0]; - else { - suggestions = PyList_New(0); - - for (j = 0; conflicts[i].suggestedPackages[j]; j++) - PyList_Append(suggestions, - conflicts[i].suggestedPackages[j]); - } - cf = Py_BuildValue("((sss)(ss)iOi)", conflicts[i].byName, conflicts[i].byVersion, conflicts[i].byRelease, @@ -304,7 +287,7 @@ static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) { conflicts[i].needsVersion, conflicts[i].needsFlags, - suggestions, + /* suggestions */ Py_None, conflicts[i].sense); PyList_Append(list, (PyObject *) cf); Py_DECREF(cf); From afe7a56661361306ca7e99270fd95b5e59259b75 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Tue, 22 Sep 2009 09:26:39 +0300 Subject: [PATCH 2/3] Remove ancient, unused code to filter duplicates on rpmdb rebuild - enabling this as-is would be murderous to multilib systems - getting duplicates in the db would be a bug elsewhere --- rpmdb/rpmdb.c | 36 +++--------------------------------- rpmdb/rpmdb.h | 1 - 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 2f98357..0696ad6 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -48,7 +48,6 @@ static int _debug = 0; /*@unchecked@*/ static int _rebuildinprogress = 0; /*@unchecked@*/ -static int _db_filter_dups = 0; #define _DBI_FLAGS 0 #define _DBI_PERMS 0644 @@ -883,17 +882,15 @@ static /*@only@*/ /*@null@*/ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root, /*@kept@*/ /*@null@*/ const char * home, int mode, int perms, int flags) - /*@globals _db_filter_dups, rpmGlobalMacroContext @*/ - /*@modifies _db_filter_dups, rpmGlobalMacroContext @*/ + /*@globals rpmGlobalMacroContext @*/ + /*@modifies rpmGlobalMacroContext @*/ { rpmdb db = xcalloc(sizeof(*db), 1); const char * epfx = _DB_ERRPFX; static int _initialized = 0; - if (!_initialized) { - _db_filter_dups = rpmExpandNumeric("%{?_filterdbdups}"); + if (!_initialized) _initialized = 1; - } /*@-assignexpose@*/ *db = dbTemplate; /* structure assignment */ @@ -922,7 +919,6 @@ rpmdb newRpmdb(/*@kept@*/ /*@null@*/ const char * root, db->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL); /*@=nullpass@*/ db->db_remove_env = 0; - db->db_filter_dups = _db_filter_dups; db->db_ndbi = dbiTagsMax; db->_dbi = xcalloc(db->db_ndbi, sizeof(*db->_dbi)); /*@-globstate@*/ return db; /*@=globstate@*/ @@ -3356,32 +3352,6 @@ int rpmdbRebuild(const char * prefix) continue; } - /* Filter duplicate entries ? (bug in pre rpm-3.0.4) */ - if (_db_filter_dups || newdb->db_filter_dups) { - const char * name, * version, * release; - int skip = 0; - - (void) headerNVR(h, &name, &version, &release); - - /*@-shadow@*/ - { rpmdbMatchIterator mi; - mi = rpmdbInitIterator(newdb, RPMTAG_NAME, name, 0); - (void) rpmdbSetIteratorRE(mi, RPMTAG_VERSION, - RPMMIRE_DEFAULT, version); - (void) rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, - RPMMIRE_DEFAULT, release); - while (rpmdbNextIterator(mi)) { - skip = 1; - /*@innerbreak@*/ break; - } - mi = rpmdbFreeIterator(mi); - } - /*@=shadow@*/ - - if (skip) - continue; - } - /* Deleted entries are eliminated in legacy headers by copy. */ { Header nh = (headerIsEntry(h, RPMTAG_HEADERIMAGE) ? headerCopy(h) : NULL); diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h index ad60d51..d8a61b4 100644 --- a/rpmdb/rpmdb.h +++ b/rpmdb/rpmdb.h @@ -311,7 +311,6 @@ struct rpmdb_s { int db_api; /*!< Berkeley API type */ /*@owned@*/ const char * db_errpfx; int db_remove_env; - int db_filter_dups; int db_chrootDone; /*!< If chroot(2) done, ignore db_root. */ void (*db_errcall) (const char *db_errpfx, char *buffer) /*@*/; From ff017795b120396260c0f473968117e039e211dd Mon Sep 17 00:00:00 2001 From: Alexey Tourbin Date: Thu, 1 Oct 2009 04:42:15 +0400 Subject: [PATCH 3/3] 4.0.4-alt77.M40.27 - Removed support for availablePackages/suggestedPackages. - Removed rebuilddb db_filter_dups code (Panu Matilainen). --- rpm-4_0.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rpm-4_0.spec b/rpm-4_0.spec index b29c5d4..706f1e9 100644 --- a/rpm-4_0.spec +++ b/rpm-4_0.spec @@ -4,7 +4,7 @@ Name: %rpm_name Version: %rpm_version -Release: alt77.M40.26 +Release: alt77.M40.27 %define ifdef() %if %{expand:%%{?%{1}:1}%%{!?%{1}:0}} %define get_dep() %(rpm -q --qf '%%{NAME} >= %%|SERIAL?{%%{SERIAL}:}|%%{VERSION}-%%{RELEASE}' %1 2>/dev/null || echo '%1 >= unknown') @@ -475,6 +475,10 @@ fi %_bindir/rpm2cpio.static %changelog +* Thu Oct 01 2009 Alexey Tourbin 4.0.4-alt77.M40.27 +- Removed support for availablePackages/suggestedPackages. +- Removed rebuilddb db_filter_dups code (Panu Matilainen). + * Tue Sep 29 2009 Alexey Tourbin 4.0.4-alt77.M40.26 - rpmio, rpmbuild: Added support for .xz/.lzma compressed sources and patches. - Removed old scripts in /usr/lib/rpm.