Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1
rpm
findfplistexclude.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File findfplistexclude.diff of Package rpm
Allow an "exclude" parameter for rpmdbFindFp, specifying a header that is to be excluded in the match. Used to speed up package erase operations. Also fixes the skipDir problem that made rpm incorrectly delete files even if another package still references them. rh#140055 Index: lib/transaction.c =================================================================== --- lib/transaction.c.orig +++ lib/transaction.c @@ -1758,7 +1758,7 @@ rpmMessage(RPMMESS_DEBUG, _("computing f (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_FINGERPRINT), 0); /* Extract file info for all files in this package from the database. */ matches = xcalloc(fc, sizeof(*matches)); - if (rpmdbFindFpList(rpmtsGetRdb(ts), fi->fps, matches, fc)) { + if (rpmdbFindFpListExclude(rpmtsGetRdb(ts), fi->fps, matches, fc, rpmteType(p) == TR_REMOVED ? fi->record : 0)) { ps = rpmpsFree(ps); rpmtsFreeLock(lock); return 1; /* XXX WTFO? */ Index: rpmdb/fprint.h =================================================================== --- rpmdb/fprint.h.orig +++ rpmdb/fprint.h @@ -79,6 +79,12 @@ int rpmdbFindFpList(/*@null@*/ rpmdb db, /*@modifies db, *matchList, rpmGlobalMacroContext, fileSystem, internalState @*/; +int rpmdbFindFpListExclude(/*@null@*/ rpmdb db, fingerPrint * fpList, + /*@out@*/ dbiIndexSet * matchList, int numItems, unsigned int exclude) + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies db, *matchList, rpmGlobalMacroContext, + fileSystem, internalState @*/; + /* Be carefull with the memory... assert(*fullName == '/' || !scareMemory) */ /** Index: rpmdb/rpmdb.c =================================================================== --- rpmdb/rpmdb.c.orig +++ rpmdb/rpmdb.c @@ -2390,7 +2390,7 @@ static void rpmdbSortIterator(/*@null@*/ } /*@-bounds@*/ /* LCL: segfault */ -static int rpmdbGrowIterator(/*@null@*/ rpmdbMatchIterator mi, int fpNum) +static int rpmdbGrowIterator(/*@null@*/ rpmdbMatchIterator mi, int fpNum, unsigned int exclude) /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/ { @@ -2401,7 +2401,7 @@ static int rpmdbGrowIterator(/*@null@*/ dbiIndexSet set; int rc; int xx; - int i; + int i, j; if (mi == NULL) return 1; @@ -2437,6 +2437,25 @@ static int rpmdbGrowIterator(/*@null@*/ set = NULL; (void) dbt2set(dbi, data, &set); + + /* prune the set against exclude */ + for (i = j = 0; i < set->count; i++) { + if (exclude && set->recs[i].hdrNum == exclude) + continue; + if (i != j) + set->recs[j] = set->recs[i]; + j++; + } + if (j == 0) { +#ifdef SQLITE_HACK + xx = dbiCclose(dbi, dbcursor, 0); + dbcursor = NULL; +#endif + set = dbiFreeIndexSet(set); + return DB_NOTFOUND; + } + set->count = j; + for (i = 0; i < set->count; i++) set->recs[i].fpNum = fpNum; @@ -3412,6 +3431,12 @@ static int skipDir(const char * dn) int rpmdbFindFpList(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList, int numItems) { + return rpmdbFindFpListExclude(db, fpList, matchList, numItems, 0); +} + +int rpmdbFindFpListExclude(rpmdb db, fingerPrint * fpList, dbiIndexSet * matchList, + int numItems, unsigned int exclude) +{ DBT * key; DBT * data; HGE_t hge = (HGE_t)headerGetEntryMinMemory; @@ -3443,10 +3468,13 @@ key->data = (void *) fpList[i].baseName; key->size = strlen((char *)key->data); if (key->size == 0) key->size++; /* XXX "/" fixup. */ - if (skipDir(fpList[i].entry->dirName)) + /* HACK HACK HACK: don't skip dirs while removing + * packages as we will loose files on conflicts. + * exclude is not zero when removing */ + if (!exclude && skipDir(fpList[i].entry->dirName)) continue; - xx = rpmdbGrowIterator(mi, i); + xx = rpmdbGrowIterator(mi, i, exclude); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor