Create rpmDepSet.

CVS patchset: 5143
CVS date: 2001/10/30 18:55:39
This commit is contained in:
jbj 2001-10-30 18:55:39 +00:00
parent 9ea554f799
commit 93ab09b3d9
4 changed files with 148 additions and 105 deletions

View File

@ -21,13 +21,16 @@
/*@access rpmdb@*/ /* XXX compared with NULL */ /*@access rpmdb@*/ /* XXX compared with NULL */
/*@access rpmdbMatchIterator@*/ /* XXX compared with NULL */ /*@access rpmdbMatchIterator@*/ /* XXX compared with NULL */
/*@access rpmTransactionSet@*/ /*@access rpmTransactionSet@*/
/*@access rpmDependencyConflict@*/
/*@access rpmDependencyConflict@*/
/*@access problemsSet@*/ /*@access problemsSet@*/
/*@access orderListIndex@*/ /*@access orderListIndex@*/
/*@access tsortInfo@*/ /*@access tsortInfo@*/
#ifdef DYING
/*@access availablePackage@*/ /*@access availablePackage@*/
#endif
/*@unchecked@*/ /*@unchecked@*/
static int _cacheDependsRC = 1; static int _cacheDependsRC = 1;
@ -242,10 +245,14 @@ static int rangeMatchesDepFlags (Header h,
HGE_t hge = (HGE_t)headerGetEntryMinMemory; HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData; HFD_t hfd = headerFreeData;
rpmTagType pnt, pvt; rpmTagType pnt, pvt;
#ifdef DYING
const char ** provides; const char ** provides;
const char ** providesEVR; const char ** providesEVR;
int_32 * provideFlags; int_32 * provideFlags;
int providesCount; int providesCount;
#else
struct rpmDepSet_s provides;
#endif
int result; int result;
int i, xx; int i, xx;
@ -258,25 +265,25 @@ static int rangeMatchesDepFlags (Header h,
* If no provides version info is available, match any requires. * If no provides version info is available, match any requires.
*/ */
if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt, if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt,
(void **) &providesEVR, &providesCount)) (void **) &provides.EVR, &provides.Count))
return 1; return 1;
xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL); xx = hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provides.Flags, NULL);
if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount)) if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides.N, &provides.Count))
{ {
providesEVR = hfd(providesEVR, pvt); provides.EVR = hfd(provides.EVR, pvt);
return 0; /* XXX should never happen */ return 0; /* XXX should never happen */
} }
result = 0; result = 0;
for (i = 0; i < providesCount; i++) { for (i = 0; i < provides.Count; i++) {
/* Filter out provides that came along for the ride. */ /* Filter out provides that came along for the ride. */
if (strcmp(provides[i], reqName)) if (strcmp(provides.N[i], reqName))
continue; continue;
result = rpmRangesOverlap(provides[i], providesEVR[i], provideFlags[i], result = rpmRangesOverlap(provides.N[i], provides.EVR[i], provides.Flags[i],
reqName, reqEVR, reqFlags); reqName, reqEVR, reqFlags);
/* If this provide matches the require, we're done. */ /* If this provide matches the require, we're done. */
@ -284,8 +291,8 @@ static int rangeMatchesDepFlags (Header h,
break; break;
} }
provides = hfd(provides, pnt); provides.N = hfd(provides.N, pnt);
providesEVR = hfd(providesEVR, pvt); provides.EVR = hfd(provides.EVR, pvt);
return result; return result;
} }
@ -994,14 +1001,22 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
rpmTagType rnt, rvt; rpmTagType rnt, rvt;
rpmTagType cnt, cvt; rpmTagType cnt, cvt;
const char * name, * version, * release; const char * name, * version, * release;
#ifdef DYING
const char ** requires; const char ** requires;
const char ** requiresEVR = NULL; const char ** requiresEVR = NULL;
int_32 * requireFlags = NULL; int_32 * requireFlags = NULL;
int requiresCount = 0; int requiresCount = 0;
#else
struct rpmDepSet_s requires;
#endif
#ifdef DYING
const char ** conflicts; const char ** conflicts;
const char ** conflictsEVR = NULL; const char ** conflictsEVR = NULL;
int_32 * conflictFlags = NULL; int_32 * conflictFlags = NULL;
int conflictsCount = 0; int conflictsCount = 0;
#else
struct rpmDepSet_s conflicts;
#endif
rpmTagType type; rpmTagType type;
int i, rc, xx; int i, rc, xx;
int ourrc = 0; int ourrc = 0;
@ -1009,32 +1024,32 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
xx = headerNVR(h, &name, &version, &release); xx = headerNVR(h, &name, &version, &release);
if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires, &requiresCount)) if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires.N, &requires.Count))
{ {
requiresCount = 0; requires.Count = 0;
rvt = RPM_STRING_ARRAY_TYPE; rvt = RPM_STRING_ARRAY_TYPE;
} else { } else {
xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **) &requireFlags, NULL); xx = hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **) &requires.Flags, NULL);
xx = hge(h, RPMTAG_REQUIREVERSION, &rvt, (void **) &requiresEVR, NULL); xx = hge(h, RPMTAG_REQUIREVERSION, &rvt, (void **) &requires.EVR, NULL);
} }
for (i = 0; i < requiresCount && !ourrc; i++) { for (i = 0; i < requires.Count && !ourrc; i++) {
const char * keyDepend; const char * keyDepend;
/* Filter out requires that came along for the ride. */ /* Filter out requires that came along for the ride. */
if (keyName && strcmp(keyName, requires[i])) if (keyName && strcmp(keyName, requires.N[i]))
continue; continue;
/* If this requirement comes from the core package only, not libraries, /* If this requirement comes from the core package only, not libraries,
then if we're installing the libraries only, don't count it in. */ then if we're installing the libraries only, don't count it in. */
if (multiLib && !isDependsMULTILIB(requireFlags[i])) if (multiLib && !isDependsMULTILIB(requires.Flags[i]))
continue; continue;
keyDepend = printDepend("R", keyDepend = printDepend("R",
requires[i], requiresEVR[i], requireFlags[i]); requires.N[i], requires.EVR[i], requires.Flags[i]);
rc = unsatisfiedDepend(ts, " Requires", keyDepend, rc = unsatisfiedDepend(ts, " Requires", keyDepend,
requires[i], requiresEVR[i], requireFlags[i], &suggestion); requires.N[i], requires.EVR[i], requires.Flags[i], &suggestion);
switch (rc) { switch (rc) {
case 0: /* requirements are satisfied. */ case 0: /* requirements are satisfied. */
@ -1054,9 +1069,9 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
pp->byName = xstrdup(name); pp->byName = xstrdup(name);
pp->byVersion = xstrdup(version); pp->byVersion = xstrdup(version);
pp->byRelease = xstrdup(release); pp->byRelease = xstrdup(release);
pp->needsName = xstrdup(requires[i]); pp->needsName = xstrdup(requires.N[i]);
pp->needsVersion = xstrdup(requiresEVR[i]); pp->needsVersion = xstrdup(requires.EVR[i]);
pp->needsFlags = requireFlags[i]; pp->needsFlags = requires.Flags[i];
pp->sense = RPMDEP_SENSE_REQUIRES; pp->sense = RPMDEP_SENSE_REQUIRES;
if (suggestion) { if (suggestion) {
@ -1083,38 +1098,38 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
keyDepend = _free(keyDepend); keyDepend = _free(keyDepend);
} }
if (requiresCount) { if (requires.Count) {
requiresEVR = hfd(requiresEVR, rvt); requires.EVR = hfd(requires.EVR, rvt);
requires = hfd(requires, rnt); requires.N = hfd(requires.N, rnt);
} }
if (!hge(h, RPMTAG_CONFLICTNAME, &cnt, (void **)&conflicts, &conflictsCount)) if (!hge(h, RPMTAG_CONFLICTNAME, &cnt, (void **)&conflicts.N, &conflicts.Count))
{ {
conflictsCount = 0; conflicts.Count = 0;
cvt = RPM_STRING_ARRAY_TYPE; cvt = RPM_STRING_ARRAY_TYPE;
} else { } else {
xx = hge(h, RPMTAG_CONFLICTFLAGS, &type, xx = hge(h, RPMTAG_CONFLICTFLAGS, &type,
(void **) &conflictFlags, &conflictsCount); (void **) &conflicts.Flags, &conflicts.Count);
xx = hge(h, RPMTAG_CONFLICTVERSION, &cvt, xx = hge(h, RPMTAG_CONFLICTVERSION, &cvt,
(void **) &conflictsEVR, &conflictsCount); (void **) &conflicts.EVR, &conflicts.Count);
} }
for (i = 0; i < conflictsCount && !ourrc; i++) { for (i = 0; i < conflicts.Count && !ourrc; i++) {
const char * keyDepend; const char * keyDepend;
/* Filter out conflicts that came along for the ride. */ /* Filter out conflicts that came along for the ride. */
if (keyName && strcmp(keyName, conflicts[i])) if (keyName && strcmp(keyName, conflicts.N[i]))
continue; continue;
/* If this requirement comes from the core package only, not libraries, /* If this requirement comes from the core package only, not libraries,
then if we're installing the libraries only, don't count it in. */ then if we're installing the libraries only, don't count it in. */
if (multiLib && !isDependsMULTILIB(conflictFlags[i])) if (multiLib && !isDependsMULTILIB(conflicts.Flags[i]))
continue; continue;
keyDepend = printDepend("C", conflicts[i], conflictsEVR[i], conflictFlags[i]); keyDepend = printDepend("C", conflicts.N[i], conflicts.EVR[i], conflicts.Flags[i]);
rc = unsatisfiedDepend(ts, "Conflicts", keyDepend, rc = unsatisfiedDepend(ts, "Conflicts", keyDepend,
conflicts[i], conflictsEVR[i], conflictFlags[i], NULL); conflicts.N[i], conflicts.EVR[i], conflicts.Flags[i], NULL);
/* 1 == unsatisfied, 0 == satsisfied */ /* 1 == unsatisfied, 0 == satsisfied */
switch (rc) { switch (rc) {
@ -1133,9 +1148,9 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
pp->byName = xstrdup(name); pp->byName = xstrdup(name);
pp->byVersion = xstrdup(version); pp->byVersion = xstrdup(version);
pp->byRelease = xstrdup(release); pp->byRelease = xstrdup(release);
pp->needsName = xstrdup(conflicts[i]); pp->needsName = xstrdup(conflicts.N[i]);
pp->needsVersion = xstrdup(conflictsEVR[i]); pp->needsVersion = xstrdup(conflicts.EVR[i]);
pp->needsFlags = conflictFlags[i]; pp->needsFlags = conflicts.Flags[i];
pp->sense = RPMDEP_SENSE_CONFLICTS; pp->sense = RPMDEP_SENSE_CONFLICTS;
pp->suggestedPackages = NULL; pp->suggestedPackages = NULL;
} }
@ -1152,9 +1167,9 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
keyDepend = _free(keyDepend); keyDepend = _free(keyDepend);
} }
if (conflictsCount) { if (conflicts.Count) {
conflictsEVR = hfd(conflictsEVR, cvt); conflicts.EVR = hfd(conflicts.EVR, cvt);
conflicts = hfd(conflicts, cnt); conflicts.N = hfd(conflicts.N, cnt);
} }
return ourrc; return ourrc;
@ -1359,19 +1374,19 @@ zapRelation(availablePackage q, availablePackage p,
if (tsi->tsi_suc != p) if (tsi->tsi_suc != p)
continue; continue;
if (p->requires == NULL) continue; /* XXX can't happen */ if (p->requires.N == NULL) continue; /* XXX can't happen */
if (p->requireFlags == NULL) continue; /* XXX can't happen */ if (p->requires.EVR == NULL) continue; /* XXX can't happen */
if (p->requiresEVR == NULL) continue; /* XXX can't happen */ if (p->requires.Flags == NULL) continue;/* XXX can't happen */
j = tsi->tsi_reqx; j = tsi->tsi_reqx;
dp = printDepend( identifyDepend(p->requireFlags[j]), dp = printDepend( identifyDepend(p->requires.Flags[j]),
p->requires[j], p->requiresEVR[j], p->requireFlags[j]); p->requires.N[j], p->requires.EVR[j], p->requires.Flags[j]);
/* /*
* Attempt to unravel a dependency loop by eliminating Requires's. * Attempt to unravel a dependency loop by eliminating Requires's.
*/ */
/*@-branchstate@*/ /*@-branchstate@*/
if (zap && !(p->requireFlags[j] & RPMSENSE_PREREQ)) { if (zap && !(p->requires.Flags[j] & RPMSENSE_PREREQ)) {
rpmMessage(RPMMESS_DEBUG, rpmMessage(RPMMESS_DEBUG,
_("removing %s-%s-%s \"%s\" from tsort relations.\n"), _("removing %s-%s-%s \"%s\" from tsort relations.\n"),
p->name, p->version, p->release, dp); p->name, p->version, p->release, dp);
@ -1408,18 +1423,18 @@ static inline int addRelation( const rpmTransactionSet ts,
tsortInfo tsi; tsortInfo tsi;
int matchNum; int matchNum;
if (!p->requires || !p->requiresEVR || !p->requireFlags) if (!p->requires.N || !p->requires.EVR || !p->requires.Flags)
return 0; return 0;
q = alSatisfiesDepend(ts->addedPackages, NULL, NULL, q = alSatisfiesDepend(ts->addedPackages, NULL, NULL,
p->requires[j], p->requiresEVR[j], p->requireFlags[j]); p->requires.N[j], p->requires.EVR[j], p->requires.Flags[j]);
/* Ordering depends only on added package relations. */ /* Ordering depends only on added package relations. */
if (q == NULL) if (q == NULL)
return 0; return 0;
/* Avoid rpmlib feature dependencies. */ /* Avoid rpmlib feature dependencies. */
if (!strncmp(p->requires[j], "rpmlib(", sizeof("rpmlib(")-1)) if (!strncmp(p->requires.N[j], "rpmlib(", sizeof("rpmlib(")-1))
return 0; return 0;
#if defined(DEPENDENCY_WHITEOUT) #if defined(DEPENDENCY_WHITEOUT)
@ -1536,7 +1551,7 @@ int rpmdepOrder(rpmTransactionSet ts)
if ((p = alGetPkg(ts->addedPackages, i)) == NULL) if ((p = alGetPkg(ts->addedPackages, i)) == NULL)
break; break;
if (p->requiresCount <= 0) if (p->requires.Count <= 0)
continue; continue;
memset(selected, 0, sizeof(*selected) * npkgs); memset(selected, 0, sizeof(*selected) * npkgs);
@ -1548,16 +1563,16 @@ int rpmdepOrder(rpmTransactionSet ts)
/* T2. Next "q <- p" relation. */ /* T2. Next "q <- p" relation. */
/* First, do pre-requisites. */ /* First, do pre-requisites. */
for (j = 0; j < p->requiresCount; j++) { for (j = 0; j < p->requires.Count; j++) {
if (p->requireFlags == NULL) /* XXX can't happen */ if (p->requires.Flags == NULL) /* XXX can't happen */
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
/* Skip if not %pre/%post requires or legacy prereq. */ /* Skip if not %pre/%post requires or legacy prereq. */
if (isErasePreReq(p->requireFlags[j]) || if (isErasePreReq(p->requires.Flags[j]) ||
!( isInstallPreReq(p->requireFlags[j]) || !( isInstallPreReq(p->requires.Flags[j]) ||
isLegacyPreReq(p->requireFlags[j]) )) isLegacyPreReq(p->requires.Flags[j]) ))
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
/* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */ /* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */
@ -1566,16 +1581,16 @@ int rpmdepOrder(rpmTransactionSet ts)
} }
/* Then do co-requisites. */ /* Then do co-requisites. */
for (j = 0; j < p->requiresCount; j++) { for (j = 0; j < p->requires.Count; j++) {
if (p->requireFlags == NULL) /* XXX can't happen */ if (p->requires.Flags == NULL) /* XXX can't happen */
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
/* Skip if %pre/%post requires or legacy prereq. */ /* Skip if %pre/%post requires or legacy prereq. */
if (isErasePreReq(p->requireFlags[j]) || if (isErasePreReq(p->requires.Flags[j]) ||
( isInstallPreReq(p->requireFlags[j]) || ( isInstallPreReq(p->requires.Flags[j]) ||
isLegacyPreReq(p->requireFlags[j]) )) isLegacyPreReq(p->requires.Flags[j]) ))
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
/* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */ /* T3. Record next "q <- p" relation (i.e. "p" requires "q"). */
@ -1889,13 +1904,13 @@ int rpmdepCheck(rpmTransactionSet ts,
if (rc) if (rc)
goto exit; goto exit;
if (p->providesCount == 0 || p->provides == NULL) if (p->provides.Count == 0 || p->provides.N == NULL)
continue; continue;
rc = 0; rc = 0;
for (j = 0; j < p->providesCount; j++) { for (j = 0; j < p->provides.Count; j++) {
/* Adding: check provides key against conflicts matches. */ /* Adding: check provides key against conflicts matches. */
if (!checkDependentConflicts(ts, ps, p->provides[j])) if (!checkDependentConflicts(ts, ps, p->provides.N[j]))
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
rc = 1; rc = 1;
/*@innerbreak@*/ break; /*@innerbreak@*/ break;
@ -1925,22 +1940,27 @@ int rpmdepCheck(rpmTransactionSet ts,
goto exit; goto exit;
} }
{ const char ** provides; {
#ifdef DYING
const char ** provides;
int providesCount; int providesCount;
#else
struct rpmDepSet_s provides;
#endif
rpmTagType pnt; rpmTagType pnt;
if (hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, if (hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides.N,
&providesCount)) &provides.Count))
{ {
rc = 0; rc = 0;
for (j = 0; j < providesCount; j++) { for (j = 0; j < provides.Count; j++) {
/* Erasing: check provides against requiredby matches. */ /* Erasing: check provides against requiredby matches. */
if (!checkDependentPackages(ts, ps, provides[j])) if (!checkDependentPackages(ts, ps, provides.N[j]))
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
rc = 1; rc = 1;
/*@innerbreak@*/ break; /*@innerbreak@*/ break;
} }
provides = hfd(provides, pnt); provides.N = hfd(provides.N, pnt);
if (rc) if (rc)
goto exit; goto exit;
} }

View File

@ -14,6 +14,8 @@ typedef /*@abstract@*/ struct problemsSet_s * problemsSet;
typedef /*@abstract@*/ struct orderListIndex_s * orderListIndex; typedef /*@abstract@*/ struct orderListIndex_s * orderListIndex;
typedef /*@abstract@*/ struct transactionElement_s * transactionElement; typedef /*@abstract@*/ struct transactionElement_s * transactionElement;
typedef /*@abstract@*/ struct rpmDepSet_s * rpmDepSet;
/*@unchecked@*/ /*@unchecked@*/
/*@-exportlocal@*/ /*@-exportlocal@*/
extern int _ts_debug; extern int _ts_debug;
@ -44,6 +46,19 @@ struct transactionElement_s {
} ; } ;
/*@=fielduse@*/ /*@=fielduse@*/
/**
* A package dependency set.
*/
struct rpmDepSet_s {
/*@owned@*/
const char ** N;
/*@owned@*/
const char ** EVR;
const int_32 * Flags;
int Count;
int Index;
};
/** \ingroup rpmdep /** \ingroup rpmdep
* The set of packages to be installed/removed atomically. * The set of packages to be installed/removed atomically.
*/ */

View File

@ -261,10 +261,10 @@ availableList alFree(availableList al)
} }
} }
p->provides = hfd(p->provides, -1); p->provides.N = hfd(p->provides.N, -1);
p->providesEVR = hfd(p->providesEVR, -1); p->provides.EVR = hfd(p->provides.EVR, -1);
p->requires = hfd(p->requires, -1); p->requires.N = hfd(p->requires.N, -1);
p->requiresEVR = hfd(p->requiresEVR, -1); p->requires.EVR = hfd(p->requires.EVR, -1);
p->baseNames = hfd(p->baseNames, -1); p->baseNames = hfd(p->baseNames, -1);
p->h = headerFree(p->h); p->h = headerFree(p->h);
@ -469,35 +469,35 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, p->name, p->versi
if (!hge(h, RPMTAG_EPOCH, NULL, (void **) &p->epoch, NULL)) if (!hge(h, RPMTAG_EPOCH, NULL, (void **) &p->epoch, NULL))
p->epoch = NULL; p->epoch = NULL;
if (!hge(h, RPMTAG_PROVIDENAME, NULL, (void **) &p->provides, if (!hge(h, RPMTAG_PROVIDENAME, NULL, (void **) &p->provides.N,
&p->providesCount)) &p->provides.Count))
{ {
p->providesCount = 0; p->provides.Count = 0;
p->provides = NULL; p->provides.N = NULL;
p->providesEVR = NULL; p->provides.EVR = NULL;
p->provideFlags = NULL; p->provides.Flags = NULL;
} else { } else {
if (!hge(h, RPMTAG_PROVIDEVERSION, if (!hge(h, RPMTAG_PROVIDEVERSION,
NULL, (void **) &p->providesEVR, NULL)) NULL, (void **) &p->provides.EVR, NULL))
p->providesEVR = NULL; p->provides.EVR = NULL;
if (!hge(h, RPMTAG_PROVIDEFLAGS, if (!hge(h, RPMTAG_PROVIDEFLAGS,
NULL, (void **) &p->provideFlags, NULL)) NULL, (void **) &p->provides.Flags, NULL))
p->provideFlags = NULL; p->provides.Flags = NULL;
} }
if (!hge(h, RPMTAG_REQUIRENAME, NULL, (void **) &p->requires, if (!hge(h, RPMTAG_REQUIRENAME, NULL, (void **) &p->requires.N,
&p->requiresCount)) { &p->requires.Count)) {
p->requiresCount = 0; p->requires.Count = 0;
p->requires = NULL; p->requires.N = NULL;
p->requiresEVR = NULL; p->requires.EVR = NULL;
p->requireFlags = NULL; p->requires.Flags = NULL;
} else { } else {
if (!hge(h, RPMTAG_REQUIREVERSION, if (!hge(h, RPMTAG_REQUIREVERSION,
NULL, (void **) &p->requiresEVR, NULL)) NULL, (void **) &p->requires.EVR, NULL))
p->requiresEVR = NULL; p->requires.EVR = NULL;
if (!hge(h, RPMTAG_REQUIREFLAGS, if (!hge(h, RPMTAG_REQUIREFLAGS,
NULL, (void **) &p->requireFlags, NULL)) NULL, (void **) &p->requires.Flags, NULL))
p->requireFlags = NULL; p->requires.Flags = NULL;
} }
if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **)&p->baseNames, &p->filesCount)) if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **)&p->baseNames, &p->filesCount))
@ -636,27 +636,27 @@ void alMakeIndex(availableList al)
if (ai->size || al->list == NULL) return; if (ai->size || al->list == NULL) return;
for (i = 0; i < al->size; i++) for (i = 0; i < al->size; i++)
ai->size += al->list[i].providesCount; ai->size += al->list[i].provides.Count;
if (ai->size) { if (ai->size) {
ai->index = xcalloc(ai->size, sizeof(*ai->index)); ai->index = xcalloc(ai->size, sizeof(*ai->index));
k = 0; k = 0;
for (i = 0; i < al->size; i++) { for (i = 0; i < al->size; i++) {
for (j = 0; j < al->list[i].providesCount; j++) { for (j = 0; j < al->list[i].provides.Count; j++) {
/* If multilib install, skip non-multilib provides. */ /* If multilib install, skip non-multilib provides. */
if (al->list[i].multiLib && if (al->list[i].multiLib &&
!isDependsMULTILIB(al->list[i].provideFlags[j])) { !isDependsMULTILIB(al->list[i].provides.Flags[j])) {
ai->size--; ai->size--;
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
} }
ai->index[k].package = al->list + i; ai->index[k].package = al->list + i;
/*@-assignexpose@*/ /*@-assignexpose@*/
ai->index[k].entry = al->list[i].provides[j]; ai->index[k].entry = al->list[i].provides.N[j];
/*@=assignexpose@*/ /*@=assignexpose@*/
ai->index[k].entryLen = strlen(al->list[i].provides[j]); ai->index[k].entryLen = strlen(al->list[i].provides.N[j]);
ai->index[k].type = IET_PROVIDES; ai->index[k].type = IET_PROVIDES;
k++; k++;
} }
@ -814,17 +814,17 @@ alAllSatisfiesDepend(const availableList al,
rc = 0; rc = 0;
switch (match->type) { switch (match->type) {
case IET_PROVIDES: case IET_PROVIDES:
for (i = 0; i < p->providesCount; i++) { for (i = 0; i < p->provides.Count; i++) {
const char * proEVR; const char * proEVR;
int proFlags; int proFlags;
/* Filter out provides that came along for the ride. */ /* Filter out provides that came along for the ride. */
if (strcmp(p->provides[i], keyName)) if (strcmp(p->provides.N[i], keyName))
/*@innercontinue@*/ continue; /*@innercontinue@*/ continue;
proEVR = (p->providesEVR ? p->providesEVR[i] : NULL); proEVR = (p->provides.EVR ? p->provides.EVR[i] : NULL);
proFlags = (p->provideFlags ? p->provideFlags[i] : 0); proFlags = (p->provides.Flags ? p->provides.Flags[i] : 0);
rc = rpmRangesOverlap(p->provides[i], proEVR, proFlags, rc = rpmRangesOverlap(p->provides.N[i], proEVR, proFlags,
keyName, keyEVR, keyFlags); keyName, keyEVR, keyFlags);
if (rc) if (rc)
/*@innerbreak@*/ break; /*@innerbreak@*/ break;

View File

@ -38,16 +38,24 @@ struct availablePackage_s {
/*@dependent@*/ const char * name; /*!< Header name. */ /*@dependent@*/ const char * name; /*!< Header name. */
/*@dependent@*/ const char * version; /*!< Header version. */ /*@dependent@*/ const char * version; /*!< Header version. */
/*@dependent@*/ const char * release; /*!< Header release. */ /*@dependent@*/ const char * release; /*!< Header release. */
#ifdef DYING
/*@owned@*/ const char ** provides; /*!< Provides: name strings. */ /*@owned@*/ const char ** provides; /*!< Provides: name strings. */
/*@owned@*/ const char ** providesEVR; /*!< Provides: [epoch:]version[-release] strings. */ /*@owned@*/ const char ** providesEVR; /*!< Provides: [epoch:]version[-release] strings. */
/*@dependent@*/ int * provideFlags; /*!< Provides: logical range qualifiers. */ /*@dependent@*/ int * provideFlags; /*!< Provides: logical range qualifiers. */
int providesCount; /*!< No. of Provide:'s in header. */
#else
struct rpmDepSet_s provides; /*!< Provides: dependencies. */
#endif
#ifdef DYING
/*@owned@*//*@null@*/ const char ** requires; /*!< Requires: name strings. */ /*@owned@*//*@null@*/ const char ** requires; /*!< Requires: name strings. */
/*@owned@*//*@null@*/ const char ** requiresEVR;/*!< Requires: [epoch:]version[-release] strings. */ /*@owned@*//*@null@*/ const char ** requiresEVR;/*!< Requires: [epoch:]version[-release] strings. */
/*@dependent@*//*@null@*/ int * requireFlags; /*!< Requires: logical range qualifiers. */ /*@dependent@*//*@null@*/ int * requireFlags; /*!< Requires: logical range qualifiers. */
int requiresCount; /*!< No. of Require:'s in header. */
#else
struct rpmDepSet_s requires; /*!< Requires: dependencies. */
#endif
/*@owned@*//*@null@*/ const char ** baseNames; /*!< Header file basenames. */ /*@owned@*//*@null@*/ const char ** baseNames; /*!< Header file basenames. */
/*@dependent@*//*@null@*/ int_32 * epoch; /*!< Header epoch (if any). */ /*@dependent@*//*@null@*/ int_32 * epoch; /*!< Header epoch (if any). */
int providesCount; /*!< No. of Provide:'s in header. */
int requiresCount; /*!< No. of Require:'s in header. */
int filesCount; /*!< No. of files in header. */ int filesCount; /*!< No. of files in header. */
int npreds; /*!< No. of predecessors. */ int npreds; /*!< No. of predecessors. */
int depth; /*!< Max. depth in dependency tree. */ int depth; /*!< Max. depth in dependency tree. */