Start merging file info into dependency set.

CVS patchset: 5157
CVS date: 2001/11/05 14:09:22
This commit is contained in:
jbj 2001-11-05 14:09:22 +00:00
parent a5a5eed7c4
commit 0724785fb3
6 changed files with 238 additions and 80 deletions

View File

@ -819,23 +819,12 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
suggestedPkgs = NULL;
#ifdef DYING
/*@-branchstate -mods -type@*/ /* FIX: hack to disable noise */
#endif
/*@-branchstate@*/
if (ts->availablePackages != NULL) {
#ifdef DYING
const char * Type = requires->Type;
requires->Type = NULL;
#endif
suggestedPkgs =
alAllSatisfiesDepend(ts->availablePackages, requires);
#ifdef DYING
requires->Type = Type;
#endif
}
#ifdef DYING
/*@=branchstate =mods =type@*/
#endif
/*@=branchstate@*/
dsProblem(psp, h, requires, suggestedPkgs);
@ -1170,20 +1159,8 @@ static inline int addRelation(rpmTransactionSet ts,
if (!strncmp(Name, "rpmlib(", sizeof("rpmlib(")-1))
return 0;
#ifdef DYING
/*@-mods -type@*/ /* FIX: hack to disable noise */
{ const char * Type = requires->Type;
requires->Type = NULL;
#endif
pkgKey = alSatisfiesDepend(ts->addedPackages, requires);
#ifdef DYING
requires->Type = Type;
}
/*@=mods =type@*/
#endif
if (_te_debug)
fprintf(stderr, "addRelation: pkgKey %ld\n", (long)pkgKey);

View File

@ -31,6 +31,8 @@ typedef /*@abstract@*/ struct availableIndex_s * availableIndex;
/*@access alKey@*/
/*@access alNum@*/
/*@access rpmFNSet@*/
/*@access rpmDepSet@*/
/** \ingroup rpmdep
@ -45,16 +47,22 @@ struct availablePackage_s {
const char * version; /*!< Header version. */
/*@dependent@*/
const char * release; /*!< Header release. */
/*@dependent@*//*@null@*/
int_32 * epoch; /*!< Header epoch (if any). */
/*@owned@*/ /*@null@*/
rpmDepSet provides; /*!< Provides: dependencies. */
/*@owned@*/ /*@null@*/
rpmDepSet requires; /*!< Requires: dependencies. */
/*@owned@*//*@null@*/
const char ** baseNames; /*!< Header file basenames. */
#ifdef DYING
/*@dependent@*//*@null@*/
int_32 * epoch; /*!< Header epoch (if any). */
const char ** baseNames; /*!< Header file basenames. */
int filesCount; /*!< No. of files in header. */
#else
/*@owned@*//*@null@*/
rpmFNSet fns; /*!< File name set. */
#endif
#ifdef DYING
uint_32 multiLib; /* MULTILIB */
@ -185,11 +193,17 @@ int alGetMultiLib(const availableList al, alKey pkgKey)
}
#endif
#ifndef DYING
int alGetFilesCount(const availableList al, alKey pkgKey)
{
availablePackage alp = alGetPkg(al, pkgKey);
return (alp != NULL ? alp->filesCount : 0);
int_32 filesCount = 0;
if (alp != NULL)
if (alp->fns != NULL)
filesCount = alp->fns->Count;
return filesCount;
}
#endif
rpmDepSet alGetProvides(const availableList al, alKey pkgKey)
{
@ -261,21 +275,27 @@ availableList alCreate(int delta)
availableList alFree(availableList al)
{
#ifdef DYING
HFD_t hfd = headerFreeData;
availablePackage p;
#endif
availablePackage alp;
int i;
if (al == NULL)
return NULL;
if ((p = al->list) != NULL)
for (i = 0; i < al->size; i++, p++) {
if ((alp = al->list) != NULL)
for (i = 0; i < al->size; i++, alp++) {
p->provides = dsFree(p->provides);
p->requires = dsFree(p->requires);
alp->provides = dsFree(alp->provides);
alp->requires = dsFree(alp->requires);
p->baseNames = hfd(p->baseNames, -1);
p->h = headerFree(p->h, "alFree");
#ifdef DYING
alp->baseNames = hfd(alp->baseNames, -1);
#else
alp->fns = fnsFree(alp->fns);
#endif
alp->h = headerFree(alp->h, "alFree");
}
@ -330,7 +350,8 @@ if (_al_debug)
fprintf(stderr, "*** del %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->version, alp->release);
/*@=modfilesys@*/
if (alp->baseNames != NULL && alp->filesCount > 0) {
if (alp->fns != NULL)
if (alp->fns->BN != NULL && alp->fns->Count > 0) {
int origNumDirs = al->numDirs;
const char ** dirNames;
int_32 numDirs;
@ -400,7 +421,9 @@ alKey alAddPackage(availableList al, alKey pkgKey, Header h)
int scareMem = 1;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
#ifdef DYING
rpmTagType dnt, bnt;
#endif
availablePackage alp;
alNum pkgNum = alKey2Num(al, pkgKey);
int xx;
@ -463,6 +486,7 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
alp->provides = dsNew(h, RPMTAG_PROVIDENAME, scareMem);
alp->requires = dsNew(h, RPMTAG_REQUIRENAME, scareMem);
#ifdef DYING
if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **)&alp->baseNames, &alp->filesCount))
{
alp->filesCount = 0;
@ -472,30 +496,42 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
const char ** dirNames;
int_32 numDirs;
uint_32 * fileFlags = NULL;
int * dirMapping;
dirInfo dirNeedle =
memset(alloca(sizeof(*dirNeedle)), 0, sizeof(*dirNeedle));
dirInfo dirMatch;
int first, last, fileNum, dirNum;
int origNumDirs;
xx = hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, &numDirs);
xx = hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
xx = hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL);
}
if (alp->filesCount > 0)
#else
alp->fns = fnsNew(h, RPMTAG_BASENAMES, scareMem);
if (alp->fns && alp->fns->Count > 0)
#endif
{
int * dirMapping;
dirInfo dirNeedle =
memset(alloca(sizeof(*dirNeedle)), 0, sizeof(*dirNeedle));
dirInfo dirMatch;
int first, last, dirNum;
int origNumDirs;
/* XXX FIXME: We ought to relocate the directory list here */
dirMapping = alloca(sizeof(*dirMapping) * numDirs);
dirMapping = alloca(sizeof(*dirMapping) * alp->fns->DCount);
/* allocated enough space for all the directories we could possible
need to add */
al->dirs = xrealloc(al->dirs,
(al->numDirs + numDirs) * sizeof(*al->dirs));
(al->numDirs + alp->fns->DCount) * sizeof(*al->dirs));
origNumDirs = al->numDirs;
for (dirNum = 0; dirNum < numDirs; dirNum++) {
dirNeedle->dirName = (char *) dirNames[dirNum];
dirNeedle->dirNameLen = strlen(dirNames[dirNum]);
if (alp->fns->DN != NULL)
for (dirNum = 0; dirNum < alp->fns->DCount; dirNum++) {
/*@-assignexpose@*/
dirNeedle->dirName = (char *) alp->fns->DN[dirNum];
/*@=assignexpose@*/
dirNeedle->dirNameLen = strlen(alp->fns->DN[dirNum]);
dirMatch = bsearch(dirNeedle, al->dirs, origNumDirs,
sizeof(*dirNeedle), dirInfoCompare);
if (dirMatch) {
@ -503,35 +539,42 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
} else {
dirMapping[dirNum] = al->numDirs;
dirMatch = al->dirs + al->numDirs;
dirMatch->dirName = xstrdup(dirNames[dirNum]);
dirMatch->dirNameLen = strlen(dirNames[dirNum]);
dirMatch->dirName = xstrdup(alp->fns->DN[dirNum]);
dirMatch->dirNameLen = strlen(alp->fns->DN[dirNum]);
dirMatch->files = NULL;
dirMatch->numFiles = 0;
al->numDirs++;
}
}
dirNames = hfd(dirNames, dnt);
alp->fns->DN = hfd(alp->fns->DN, alp->fns->DNt);
for (first = 0; first < alp->filesCount; first = last + 1) {
for (last = first; (last + 1) < alp->filesCount; last++) {
if (dirIndexes[first] != dirIndexes[last + 1])
for (first = 0; first < alp->fns->Count; first = last + 1) {
if (alp->fns->DI == NULL) /* XXX can't happen */
continue;
for (last = first; (last + 1) < alp->fns->Count; last++) {
if (alp->fns->DI[first] != alp->fns->DI[last + 1])
/*@innerbreak@*/ break;
}
dirMatch = al->dirs + dirMapping[dirIndexes[first]];
dirMatch = al->dirs + dirMapping[alp->fns->DI[first]];
dirMatch->files = xrealloc(dirMatch->files,
(dirMatch->numFiles + last - first + 1) *
sizeof(*dirMatch->files));
if (alp->baseNames != NULL) /* XXX can't happen */
for (fileNum = first; fileNum <= last; fileNum++) {
for (alp->fns->i = first; alp->fns->i <= last; alp->fns->i++) {
if (alp->fns->BN == NULL) /* XXX can't happen */
/*@innercontinue@*/ continue;
if (alp->fns->Flags == NULL) /* XXX can't happen */
/*@innercontinue@*/ continue;
/*@-assignexpose@*/
dirMatch->files[dirMatch->numFiles].baseName =
alp->baseNames[fileNum];
alp->fns->BN[alp->fns->i];
/*@=assignexpose@*/
dirMatch->files[dirMatch->numFiles].pkgNum = pkgNum;
dirMatch->files[dirMatch->numFiles].fileFlags =
fileFlags[fileNum];
alp->fns->Flags[alp->fns->i];
dirMatch->numFiles++;
}
}
@ -542,9 +585,7 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
}
/*@-compdef@*/ /* FIX: al->list->relocs-?{oldPath,newPath} undefined */
alFreeIndex(al);
/*@=compdef@*/
assert(((alNum)(alp - al->list)) == pkgNum);
return ((alKey)(alp - al->list));

View File

@ -30,6 +30,7 @@ int alGetMultiLib(/*@null@*/ const availableList al, /*@null@*/ alKey pkgKey)
/*@*/;
#endif
#ifndef DYING
/**
* Return available package files count.
* @param al available list
@ -38,6 +39,7 @@ int alGetMultiLib(/*@null@*/ const availableList al, /*@null@*/ alKey pkgKey)
*/
int alGetFilesCount(/*@null@*/ const availableList al, /*@null@*/ alKey pkgKey)
/*@*/;
#endif
/**
* Return available package provides.

View File

@ -12,6 +12,91 @@
/*@access problemsSet @*/
/*@access alKey@*/
/*@access rpmFNSet @*/
/*@unchecked@*/
static int _fns_debug = 0;
rpmFNSet fnsFree(rpmFNSet fns)
{
HFD_t hfd = headerFreeData;
if (fns == NULL)
return NULL;
/*@-modfilesystem@*/
if (_fns_debug)
fprintf(stderr, "*** fns %p -- %s[%d]\n", fns, fns->Type, fns->Count);
/*@=modfilesystem@*/
/*@-branchstate@*/
if (fns->Count > 0) {
fns->DN = hfd(fns->DN, fns->DNt);
fns->BN = hfd(fns->BN, fns->BNt);
/*@-evalorder@*/
fns->DI =
(fns->h != NULL ? hfd(fns->DI, fns->DIt) : _free(fns->DI));
fns->Flags =
(fns->h != NULL ? hfd(fns->Flags, fns->Ft) : _free(fns->Flags));
/*@=evalorder@*/
fns->h = headerFree(fns->h, "fnsFree");
}
/*@=branchstate@*/
memset(fns, 0, sizeof(*fns)); /* XXX trash and burn */
fns = _free(fns);
return NULL;
}
rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
{
HGE_t hge =
(scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry);
rpmFNSet fns = NULL;
const char * Type;
rpmTag tagBN, tagDI, tagF, tagDN;
if (tagN == RPMTAG_BASENAMES) {
Type = "Files";
tagBN = tagN;
tagDI = RPMTAG_DIRINDEXES;
tagF = RPMTAG_FILEFLAGS;
tagDN = RPMTAG_DIRNAMES;
} else
goto exit;
fns = xcalloc(1, sizeof(*fns));
fns->i = -1;
fns->Type = Type;
fns->tagN = tagN;
fns->h = (scareMem ? headerLink(h, "fnsNew") : NULL);
if (hge(h, tagBN, &fns->BNt, (void **) &fns->BN, &fns->Count)) {
int xx;
xx = hge(h, tagDN, &fns->DNt, (void **) &fns->DN, &fns->DCount);
xx = hge(h, tagDI, &fns->DIt, (void **) &fns->DI, NULL);
if (!scareMem && fns->DI != NULL)
fns->DI = memcpy(xmalloc(fns->Count * sizeof(*fns->DI)),
fns->DI, fns->Count * sizeof(*fns->DI));
xx = hge(h, tagF, &fns->Ft, (void **) &fns->Flags, NULL);
if (!scareMem && fns->Flags != NULL)
fns->Flags = memcpy(xmalloc(fns->Count * sizeof(*fns->Flags)),
fns->Flags, fns->Count * sizeof(*fns->Flags));
} else
fns->h = headerFree(fns->h, "fnsNew");
exit:
/*@-modfilesystem@*/
if (_fns_debug)
fprintf(stderr, "*** fns %p ++ %s[%d]\n", fns, fns->Type, fns->Count);
/*@=modfilesystem@*/
return fns;
}
/*@access rpmDepSet @*/
/*@unchecked@*/
@ -22,6 +107,9 @@ rpmDepSet dsFree(rpmDepSet ds)
HFD_t hfd = headerFreeData;
rpmTag tagEVR, tagF;
if (ds == NULL)
return NULL;
/*@-modfilesystem@*/
if (_ds_debug)
fprintf(stderr, "*** ds %p -- %s[%d]\n", ds, ds->Type, ds->Count);

View File

@ -19,6 +19,36 @@ struct problemsSet_s {
int alloced; /*!< No. of problems allocated. */
} ;
/**
*/
typedef /*@abstract@*/ struct rpmFNSet_s * rpmFNSet;
/**
* A package filename set.
*/
struct rpmFNSet_s {
int i; /*!< File index. */
/*@observer@*/
const char * Type; /*!< Tag name. */
rpmTag tagN; /*!< Header tag. */
/*@refcounted@*/ /*@null@*/
Header h; /*!< Header for file name set (or NULL) */
/*@only@*/ /*@null@*/
const char ** BN; /*!< File base name. */
/*@only@*/ /*@null@*/
const int_32 * DI; /*!< File directory index. */
/*@only@*/ /*@null@*/
const uint_32 * Flags; /*!< File flags. */
/*@only@*/ /*@null@*/
const char ** DN; /*!< Directory name. */
int_32 DCount; /*!< No. of directories. */
rpmTagType BNt, DIt, Ft, DNt; /*!< Tag data types. */
int_32 Count; /*!< No. of files. */
};
/**
* A package dependency set.
*/
@ -33,6 +63,7 @@ struct rpmDepSet_s {
rpmTag tagN; /*!< Header tag. */
/*@refcounted@*/ /*@null@*/
Header h; /*!< Header for dependency set (or NULL) */
/*@only@*/
const char ** N; /*!< Name. */
/*@only@*/
@ -40,7 +71,7 @@ struct rpmDepSet_s {
/*@only@*/
const int_32 * Flags; /*!< Flags identifying context/comparison. */
rpmTagType Nt, EVRt, Ft; /*!< Tag data types. */
int Count; /*!< No. of elements */
int_32 Count; /*!< No. of elements */
};
#ifdef __cplusplus
@ -48,7 +79,26 @@ extern "C" {
#endif
/**
* Destroy a new dependency set.
* Destroy a file name set.
* @param ds file name set
* @return NULL always
*/
/*@only@*/ /*@null@*/
rpmFNSet fnsFree(/*@only@*/ /*@null@*/ rpmFNSet fns)
/*@modifies fns@*/;
/**
* Create and load a file name set.
* @param h header
* @param tagN RPMTAG_BASENAMES
* @param scareMem Use pointers to refcounted header memory?
* @return new file name set
*/
/*@only@*/ /*@null@*/
rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
/*@modifies h @*/;
/**
* Destroy a dependency set.
* @param ds dependency set
* @return NULL always
*/

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-11-04 22:42-0500\n"
"POT-Creation-Date: 2001-11-05 08:53-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -1459,44 +1459,44 @@ msgstr ""
msgid "%9s: (%s, %s) added to Depends cache.\n"
msgstr ""
#: lib/depends.c:762 lib/rpmds.c:229 lib/rpmds.c:384
#: lib/depends.c:762 lib/rpmds.c:317 lib/rpmds.c:472
msgid "NO "
msgstr ""
#: lib/depends.c:762 lib/rpmds.c:229 lib/rpmds.c:384
#: lib/depends.c:762 lib/rpmds.c:317 lib/rpmds.c:472
msgid "YES"
msgstr ""
#: lib/depends.c:1114
#: lib/depends.c:1103
#, c-format
msgid "removing %s \"%s\" from tsort relations.\n"
msgstr ""
#. Record all relations.
#: lib/depends.c:1366
#: lib/depends.c:1343
msgid "========== recording tsort relations\n"
msgstr ""
#. T4. Scan for zeroes.
#: lib/depends.c:1440
#: lib/depends.c:1417
msgid ""
"========== tsorting packages (order, #predecessors, #succesors, depth)\n"
msgstr ""
#: lib/depends.c:1515
#: lib/depends.c:1492
msgid "========== successors only (presentation order)\n"
msgstr ""
#: lib/depends.c:1576
#: lib/depends.c:1553
msgid "LOOP:\n"
msgstr ""
#: lib/depends.c:1611
#: lib/depends.c:1588
msgid "========== continuing tsort ...\n"
msgstr ""
#. Return no. of packages that could not be ordered.
#: lib/depends.c:1616
#: lib/depends.c:1593
#, c-format
msgid "rpmdepOrder failed, %d elements remain\n"
msgstr ""
@ -2398,11 +2398,11 @@ msgstr ""
msgid "package %s is not installed\n"
msgstr ""
#: lib/rpmal.c:677
#: lib/rpmal.c:718
msgid "(added files)"
msgstr ""
#: lib/rpmal.c:780
#: lib/rpmal.c:821
msgid "(added provide)"
msgstr ""
@ -2470,20 +2470,20 @@ msgid "OK"
msgstr ""
#. XXX legacy epoch-less requires/conflicts compatibility
#: lib/rpmds.c:354
#: lib/rpmds.c:442
#, c-format
msgid ""
"the \"B\" dependency needs an epoch (assuming same as \"A\")\n"
"\tA %s\tB %s\n"
msgstr ""
#: lib/rpmds.c:383
#: lib/rpmds.c:471
#, c-format
msgid " %s A %s\tB %s\n"
msgstr ""
#. @=branchstate@
#: lib/rpmds.c:409
#: lib/rpmds.c:497
#, c-format
msgid "package %s-%s-%s has unsatisfied %s: %s\n"
msgstr ""