- linear search on added package provides is dumb.

- discarding entire signature header when using --addsign is dumb.
- typedef the fuile name/python object "key" throughout as fnpyKey.
- start ripping rpmDependencyConflict out of the API.

CVS patchset: 5160
CVS date: 2001/11/08 00:12:49
This commit is contained in:
jbj 2001-11-08 00:12:49 +00:00
parent e680cce3e8
commit ae2e9b1bad
18 changed files with 427 additions and 196 deletions

View File

@ -254,7 +254,7 @@ static int removePackage(rpmTransactionSet ts, int dboffset,
return 0;
}
char * hGetNVR(Header h, const char ** np )
char * hGetNVR(Header h, const char ** np)
{
const char * n, * v, * r;
char * NVR, * t;
@ -272,7 +272,7 @@ char * hGetNVR(Header h, const char ** np )
}
int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
const void * key, int upgrade, rpmRelocation * relocs)
fnpyKey key, int upgrade, rpmRelocation * relocs)
{
int scareMem = _DS_SCAREMEM;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
@ -353,7 +353,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
ts->order = xrealloc(ts->order, ts->orderAlloced * sizeof(*ts->order));
}
/* XXX cast assumes that available keys are indices, not pointers */
pkgKey = alAddPackage(ts->addedPackages, (alKey)apx, h);
pkgKey = alAddPackage(ts->addedPackages, (alKey)apx, key, h);
if (pkgKey == RPMAL_NOMATCH) {
ec = 1;
goto exit;
@ -504,13 +504,10 @@ exit:
return ec;
}
void rpmtransAvailablePackage(rpmTransactionSet ts, Header h,
/*@unused@*/ const void * key)
void rpmtransAvailablePackage(rpmTransactionSet ts, Header h, fnpyKey key)
{
alKey pkgKey;
/* XXX FIXME: return code RPMAL_NOMATCH is error */
pkgKey = alAddPackage(ts->availablePackages, RPMAL_NOMATCH, h);
(void) alAddPackage(ts->availablePackages, RPMAL_NOMATCH, key, h);
}
int rpmtransRemovePackage(rpmTransactionSet ts, int dboffset)
@ -553,7 +550,7 @@ rpmTransactionSet rpmtransFree(rpmTransactionSet ts)
}
/*@-type@*/ /* FIX: cast? */
if (p->fd != NULL)
p->fd = fdFree(p->fd, "alAddPackage (alFree)");
p->fd = fdFree(p->fd, "alAddPackage (rpmtransFree)");
/*@=type@*/
}
pi = teFreeIterator(pi);
@ -679,7 +676,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts, rpmDepSet key)
}
/* Search added packages for the dependency. */
if (alSatisfiesDepend(ts->addedPackages, key) != RPMAL_NOMATCH)
if (alSatisfiesDepend(ts->addedPackages, key, NULL) != NULL)
goto exit;
/* XXX only the installer does not have the database open here. */
@ -815,18 +812,16 @@ static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
case 0: /* requirements are satisfied. */
/*@switchbreak@*/ break;
case 1: /* requirements are not satisfied. */
{ const alKey * suggestedPkgs;
suggestedPkgs = NULL;
{ fnpyKey * suggestedKeys = NULL;
/*@-branchstate@*/
if (ts->availablePackages != NULL) {
suggestedPkgs =
alAllSatisfiesDepend(ts->availablePackages, requires);
suggestedKeys = alAllSatisfiesDepend(ts->availablePackages,
requires, NULL);
}
/*@=branchstate@*/
dsProblem(psp, h, requires, suggestedPkgs);
dsProblem(psp, h, requires, suggestedKeys);
}
/*@switchbreak@*/ break;
@ -1149,6 +1144,7 @@ static inline int addRelation(rpmTransactionSet ts,
teIterator qi; transactionElement q;
tsortInfo tsi;
const char * Name;
fnpyKey key;
alKey pkgKey;
int i = 0;
@ -1159,7 +1155,8 @@ static inline int addRelation(rpmTransactionSet ts,
if (!strncmp(Name, "rpmlib(", sizeof("rpmlib(")-1))
return 0;
pkgKey = alSatisfiesDepend(ts->addedPackages, requires);
pkgKey = RPMAL_NOMATCH;
key = alSatisfiesDepend(ts->addedPackages, requires, &pkgKey);
if (_te_debug)
fprintf(stderr, "addRelation: pkgKey %ld\n", (long)pkgKey);
@ -1176,14 +1173,16 @@ fprintf(stderr, "addRelation: pkgKey %ld\n", (long)pkgKey);
break;
}
qi = teFreeIterator(qi);
if (q == NULL)
return 0;
#if defined(DEPENDENCY_WHITEOUT)
/* Avoid certain dependency relations. */
if (q == NULL || ignoreDep(p, q))
if (ignoreDep(p, q))
return 0;
#endif
i = (q ? q - ts->order : -1);
i = q - ts->order;
/*@-nullpass -nullderef@*/
if (_te_debug)

View File

@ -89,7 +89,7 @@ struct transactionElement_s {
int_32 filesCount; /* (TR_ADDED) No. files in package. */
/*@kept@*//*@null@*/
const void * key;
fnpyKey key;
/*!< (TR_ADDED) Retrieval key (CLI uses file name, e.g.). */
/*@owned@*/ /*@null@*/
rpmRelocation * relocs;

View File

@ -10,7 +10,7 @@
#include "misc.h"
#include "debug.h"
/*@access alKey@*/
/*@access fnpyKey@*/
/*@access rpmProblem@*/
/*@access rpmProblemSet@*/
/*@access rpmDependencyConflict@*/
@ -43,7 +43,7 @@ void rpmProblemSetFree(rpmProblemSet tsprobs)
}
void rpmProblemSetAppend(rpmProblemSet tsprobs, rpmProblemType type,
const char * pkgNEVR, const void * key,
const char * pkgNEVR, fnpyKey key,
const char * dn, const char * bn,
const char * altNEVR, unsigned long ulong1)
{
@ -157,6 +157,7 @@ static int sameProblem(const rpmDependencyConflict ap,
/*@*/
{
#ifdef DYING
if (ap->sense != bp->sense)
return 1;
@ -173,6 +174,12 @@ static int sameProblem(const rpmDependencyConflict ap,
return 1;
if (ap->needsFlags && bp->needsFlags && ap->needsFlags != bp->needsFlags)
return 1;
#else
if (ap->byNEVR && bp->byNEVR && strcmp(ap->byNEVR, bp->byNEVR))
return 1;
if (ap->needsNEVR && bp->needsNEVR && strcmp(ap->needsNEVR, bp->needsNEVR))
return 1;
#endif
return 0;
}
@ -181,10 +188,12 @@ static int sameProblem(const rpmDependencyConflict ap,
rpmDependencyConflict rpmdepFreeConflicts(rpmDependencyConflict conflicts,
int numConflicts)
{
rpmDependencyConflict c;
int i;
if (conflicts)
for (i = 0; i < numConflicts; i++) {
#ifdef DYING
conflicts[i].byHeader = headerFree(conflicts[i].byHeader, "problem");
conflicts[i].byName = _free(conflicts[i].byName);
conflicts[i].byVersion = _free(conflicts[i].byVersion);
@ -194,6 +203,14 @@ rpmDependencyConflict rpmdepFreeConflicts(rpmDependencyConflict conflicts,
/*@-evalorder@*/
conflicts[i].suggestedPkgs = _free(conflicts[i].suggestedPkgs);
/*@=evalorder@*/
#else
c = conflicts + i;
c->byNEVR = _free(c->byNEVR);
c->needsNEVR = _free(c->needsNEVR);
/*@-evalorder@*/
c->suggestedKeys = _free(c->suggestedKeys);
/*@=evalorder@*/
#endif
}
return (conflicts = _free(conflicts));
@ -203,6 +220,7 @@ rpmDependencyConflict rpmdepFreeConflicts(rpmDependencyConflict conflicts,
void printDepProblems(FILE * fp,
const rpmDependencyConflict conflicts, int numConflicts)
{
rpmDependencyConflict c;
int i;
for (i = 0; i < numConflicts; i++) {
@ -216,6 +234,7 @@ void printDepProblems(FILE * fp,
if (j < i)
continue;
#ifdef DYING
fprintf(fp, "\t%s", conflicts[i].needsName);
if (conflicts[i].needsFlags)
printDepFlags(fp, conflicts[i].needsVersion,
@ -227,6 +246,13 @@ void printDepProblems(FILE * fp,
else
fprintf(fp, _(" conflicts with %s-%s-%s\n"), conflicts[i].byName,
conflicts[i].byVersion, conflicts[i].byRelease);
#else
c = conflicts + i;
fprintf(fp, "\t%s %s %s\n", c->needsNEVR+2,
((c->needsNEVR[0] == 'C' && c->needsNEVR[1] == ' ')
? _("conflicts with") : _("is needed by")),
c->byNEVR);
#endif
}
}

View File

@ -549,7 +549,7 @@ Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
return h;
}
const void * rpmfiGetKey(TFI_t fi)
fnpyKey rpmfiGetKey(TFI_t fi)
{
/*@-compdef -retexpose -usereleased@*/
return fi->key;

View File

@ -51,7 +51,7 @@ struct transactionFileInfo_s {
uint_32 multiLib; /* MULTILIB */
/*@null@*/
const void * key; /*!< Package notify key. */
fnpyKey key; /*!< Package notify key. */
/*@null@*/ /*@dependent@*/
rpmRelocation * relocs; /*!< Package file relocations. */
/*@null@*/

View File

@ -31,9 +31,12 @@ typedef /*@abstract@*/ struct availableIndex_s * availableIndex;
/*@access alKey@*/
/*@access alNum@*/
/*@access fnpyKey@*/
/*@access rpmFNSet@*/
#ifdef DYING
/*@access rpmDepSet@*/
#endif
/** \ingroup rpmdep
* Info about a single package to be installed.
@ -61,6 +64,8 @@ struct availablePackage_s {
uint_32 multiLib; /* MULTILIB */
#endif
fnpyKey key; /*!< Associated file name/python object */
};
/** \ingroup rpmdep
@ -206,7 +211,7 @@ rpmDepSet alGetProvides(const availableList al, alKey pkgKey)
{
availablePackage alp = alGetPkg(al, pkgKey);
/*@-retexpose@*/
return (alp != NULL ? alp->provides : 0);
return (alp != NULL ? alp->provides : NULL);
/*@=retexpose@*/
}
@ -214,7 +219,7 @@ rpmDepSet alGetRequires(const availableList al, alKey pkgKey)
{
availablePackage alp = alGetPkg(al, pkgKey);
/*@-retexpose@*/
return (alp != NULL ? alp->requires : 0);
return (alp != NULL ? alp->requires : NULL);
/*@=retexpose@*/
}
@ -452,7 +457,7 @@ fprintf(stderr, "*** del %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
/*@=nullstate@*/
}
alKey alAddPackage(availableList al, alKey pkgKey, Header h)
alKey alAddPackage(availableList al, alKey pkgKey, fnpyKey key, Header h)
/*@modifies al, h @*/
{
int scareMem = 1;
@ -487,6 +492,9 @@ alKey alAddPackage(availableList al, alKey pkgKey, Header h)
#ifdef DYING
alp->multiLib = 0; /* MULTILIB */
#endif
/*@-assignexpose -temptrans @*/
alp->key = key;
/*@=assignexpose =temptrans @*/
xx = headerNVR(alp->h, &alp->name, &alp->version, &alp->release);
@ -641,8 +649,10 @@ static int indexcmp(const void * one, const void * two)
void alAddProvides(availableList al, alKey pkgKey, rpmDepSet provides)
{
availableIndexEntry aie;
availableIndex ai = &al->index;
int i = alKey2Num(al, pkgKey);
int ix;
if (provides == NULL || i < 0 || i >= al->size)
return;
@ -666,43 +676,53 @@ void alAddProvides(availableList al, alKey pkgKey, rpmDepSet provides)
if ((Name = dsiGetN(provides)) == NULL)
continue; /* XXX can't happen */
aie = ai->index + ai->k;
ai->k++;
/*@-assignexpose@*/
/*@-temptrans@*/
ai->index[ai->k].pkgKey = pkgKey;
aie->pkgKey = pkgKey;
/*@=temptrans@*/
ai->index[ai->k].entry = Name;
aie->entry = Name;
/*@=assignexpose@*/
ai->index[ai->k].entryLen = strlen(Name);
assert(provides->i < 0x10000);
ai->index[ai->k].entryIx = provides->i;
ai->index[ai->k].type = IET_PROVIDES;
ai->k++;
aie->entryLen = strlen(Name);
ix = dsiGetIx(provides);
/* XXX make sure that element index fits in unsigned short */
assert(ix < 0x10000);
aie->entryIx = ix;
aie->type = IET_PROVIDES;
}
}
void alMakeIndex(availableList al)
{
availableIndex ai = &al->index;
availablePackage alp;
int i;
if (ai->size || al->list == NULL) return;
for (i = 0; i < al->size; i++)
if (al->list[i].provides != NULL)
ai->size += al->list[i].provides->Count;
for (i = 0; i < al->size; i++) {
alp = al->list + i;
if (alp->provides != NULL)
ai->size += dsiGetCount(alp->provides);
}
if (ai->size) {
ai->index = xcalloc(ai->size, sizeof(*ai->index));
ai->k = 0;
for (i = 0; i < al->size; i++)
alAddProvides(al, (alKey)i, al->list[i].provides);
for (i = 0; i < al->size; i++) {
alp = al->list + i;
alAddProvides(al, (alKey)i, alp->provides);
}
qsort(ai->index, ai->size, sizeof(*ai->index), indexcmp);
}
}
alKey * alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds)
fnpyKey *
alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
{
int found = 0;
const char * dirName;
@ -713,9 +733,11 @@ alKey * alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds)
fileIndexEntry fieNeedle =
memset(alloca(sizeof(*fieNeedle)), 0, sizeof(*fieNeedle));
fileIndexEntry fie;
alKey * ret = NULL;
availablePackage alp;
fnpyKey * ret = NULL;
const char * fileName;
if (keyp) *keyp = RPMAL_NOMATCH;
if ((fileName = dsiGetN(ds)) == NULL || *fileName != '/')
return NULL;
@ -770,9 +792,12 @@ alKey * alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds)
dsiNotify(ds, _("(added files)"), 0);
alp = al->list + fie->pkgNum;
ret = xrealloc(ret, (found+2) * sizeof(*ret));
if (ret) /* can't happen */
ret[found++] = alNum2Key(al, fie->pkgNum);
ret[found++] = alp->key;
if (keyp)
*keyp = alNum2Key(al, fie->pkgNum);
}
/*@=branchstate@*/
@ -792,38 +817,39 @@ exit:
* @param ds dependency
* @return available package pointer
*/
/*@unused@*/ static /*@dependent@*/ /*@null@*/ alKey
alFileSatisfiesDepend(const availableList al, const rpmDepSet ds)
/*@unused@*/ static /*@dependent@*/ /*@null@*/ fnpyKey
alFileSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
/*@*/
{
alKey ret = NULL;
alKey * tmp = alAllFileSatisfiesDepend(al, ds);
fnpyKey * tmp = alAllFileSatisfiesDepend(al, ds, keyp);
if (tmp) {
ret = tmp[0];
tmp = _free(tmp);
fnpyKey ret = tmp[0];
free(tmp);
return ret;
}
return ret;
return NULL;
}
#endif /* DYING */
alKey *
alAllSatisfiesDepend(const availableList al, const rpmDepSet ds)
fnpyKey *
alAllSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
{
availableIndex ai = &al->index;
availableIndexEntry needle =
memset(alloca(sizeof(*needle)), 0, sizeof(*needle));
availableIndexEntry match;
alKey * ret = NULL;
fnpyKey * ret = NULL;
const char * KName;
availablePackage alp;
int rc, found;
if (keyp) *keyp = RPMAL_NOMATCH;
if ((KName = dsiGetN(ds)) == NULL)
return ret;
if (*KName == '/') {
ret = alAllFileSatisfiesDepend(al, ds);
ret = alAllFileSatisfiesDepend(al, ds, keyp);
/* XXX Provides: /path was broken with added packages (#52183). */
if (ret != NULL && *ret != NULL)
return ret;
@ -857,10 +883,8 @@ alAllSatisfiesDepend(const availableList al, const rpmDepSet ds)
if (alp->provides != NULL) /* XXX can't happen */
switch (match->type) {
case IET_PROVIDES:
alp->provides->i = match->entryIx;
/* XXX single step on dsiNext to regenerate DNEVR string */
alp->provides->i--;
(void) dsiSetIx(alp->provides, match->entryIx - 1);
if (dsiNext(alp->provides) >= 0)
rc = dsCompare(alp->provides, ds);
@ -874,7 +898,9 @@ alAllSatisfiesDepend(const availableList al, const rpmDepSet ds)
if (rc) {
ret = xrealloc(ret, (found + 2) * sizeof(*ret));
if (ret) /* can't happen */
ret[found++] = ((alKey)(alp - al->list));
ret[found++] = alp->key;
if (keyp)
*keyp = ((alKey)(alp - al->list));
}
/*@=branchstate@*/
}
@ -885,14 +911,15 @@ alAllSatisfiesDepend(const availableList al, const rpmDepSet ds)
return ret;
}
alKey alSatisfiesDepend(const availableList al, const rpmDepSet ds)
fnpyKey
alSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
{
alKey * tmp = alAllSatisfiesDepend(al, ds);
fnpyKey * tmp = alAllSatisfiesDepend(al, ds, keyp);
if (tmp) {
alKey ret = tmp[0];
tmp = _free(tmp);
fnpyKey ret = tmp[0];
free(tmp);
return ret;
}
return RPMAL_NOMATCH;
return NULL;
}

View File

@ -126,10 +126,12 @@ void alDelPackage(availableList al, /*@null@*/ alKey pkgKey)
* Add package to available list.
* @param al available list
* @param pkgKey package key, RPMAL_NOMATCH to force an append
* @param key associated file name/python object
* @param h package header
* @return available package index
*/
alKey alAddPackage(availableList al, /*@null@*/ alKey pkgKey, Header h)
alKey alAddPackage(availableList al, /*@null@*/ alKey pkgKey,
fnpyKey key, Header h)
/*@modifies al, h @*/;
/**
@ -155,36 +157,42 @@ void alMakeIndex(availableList al)
* Check added package file lists for package(s) that provide a file.
* @param al available list
* @param ds dependency set
* @return available package pointer
* @retval keyp added package key pointer (or NULL)
* @return associated package key(s), NULL if none
*/
/*@-exportlocal@*/
/*@only@*/ /*@null@*/
alKey * alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds)
fnpyKey * alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds,
/*@null@*/ alKey * keyp)
/*@globals fileSystem @*/
/*@modifies al, fileSystem @*/;
/*@modifies al, *keyp, fileSystem @*/;
/*@=exportlocal@*/
/**
* Check added package file lists for package(s) that have a provide.
* @param al available list
* @param ds dependency set
* @return available package keys
* @retval keyp added package key pointer (or NULL)
* @return associated package key(s), NULL if none
*/
/*@only@*/ /*@null@*/
alKey * alAllSatisfiesDepend(const availableList al, const rpmDepSet ds)
fnpyKey * alAllSatisfiesDepend(const availableList al, const rpmDepSet ds,
/*@null@*/ alKey * keyp)
/*@globals fileSystem @*/
/*@modifies al, fileSystem @*/;
/*@modifies al, *keyp, fileSystem @*/;
/**
* Check added package file lists for first package that has a provide.
* @todo Eliminate.
* @param al available list
* @param ds dependency set
* @return available package index, -1 on not found
* @retval keyp added package key pointer (or NULL)
* @return associated package key, NULL if none
*/
alKey alSatisfiesDepend(const availableList al, const rpmDepSet ds)
fnpyKey alSatisfiesDepend(const availableList al, const rpmDepSet ds,
/*@null@*/ alKey * keyp)
/*@globals fileSystem @*/
/*@modifies al, fileSystem @*/;
/*@modifies al, *keyp, fileSystem @*/;
#ifdef __cplusplus
}

View File

@ -408,7 +408,7 @@ extern int packagesTotal;
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
/*@null@*/ const void * pkgKey,
/*@null@*/ fnpyKey key,
/*@null@*/ void * data)
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;

View File

@ -18,6 +18,26 @@
/*@unchecked@*/
static int _fns_debug = 0;
/*@-shadow@*/ /* XXX copy from depends.c for now. */
static char * hGetNVR(Header h, /*@out@*/ const char ** np)
/*@modifies *np @*/
{
const char * n, * v, * r;
char * NVR, * t;
(void) headerNVR(h, &n, &v, &r);
NVR = t = xcalloc(1, strlen(n) + strlen(v) + strlen(r) + sizeof("--"));
t = stpcpy(t, n);
t = stpcpy(t, "-");
t = stpcpy(t, v);
t = stpcpy(t, "-");
t = stpcpy(t, r);
if (np)
*np = n;
return NVR;
}
/*@=shadow@*/
rpmFNSet fnsFree(rpmFNSet fns)
{
HFD_t hfd = headerFreeData;
@ -55,6 +75,9 @@ rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
(scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry);
rpmFNSet fns = NULL;
const char * Type;
const char ** N;
rpmTagType Nt;
int_32 Count;
rpmTag tagBN, tagDI, tagF, tagDN;
if (tagN == RPMTAG_BASENAMES) {
@ -66,15 +89,21 @@ rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
} 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)) {
/*@-branchstate@*/
if (hge(h, tagBN, &Nt, (void **) &N, &Count)
&& N != NULL && Count > 0)
{
int xx;
fns = xcalloc(1, sizeof(*fns));
fns->h = (scareMem ? headerLink(h, "fnsNew") : NULL);
fns->i = -1;
fns->Type = Type;
fns->tagN = tagN;
fns->BN = N;
fns->BNt = Nt;
fns->Count = Count;
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)
@ -84,17 +113,19 @@ rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
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;
}
/*@-branchstate@*/
exit:
/*@-nullret@*/ /* FIX: fns->{DI,Flags} may be NULL. */
/*@i@*/ return fns;
/*@=nullret@*/
}
/*@access rpmDepSet @*/
@ -226,7 +257,7 @@ fprintf(stderr, "*** ds %p ++\t%s[%d]\n", ds, ds->Type, ds->Count);
exit:
/*@-nullret@*/ /* FIX: ds->Flags may be NULL. */
return ds;
/*@i@*/ return ds;
/*@=nullret@*/
}
@ -270,6 +301,27 @@ char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
return tbuf;
}
int dsiGetCount(rpmDepSet ds)
{
return (ds != NULL ? ds->Count : 0);
}
int dsiGetIx(rpmDepSet ds)
{
return (ds != NULL ? ds->i : -1);
}
int dsiSetIx(rpmDepSet ds, int ix)
{
int i = -1;
if (ds != NULL) {
i = ds->i;
ds->i = ix;
}
return i;
}
const char * dsiGetDNEVR(rpmDepSet ds)
{
const char * DNEVR = NULL;
@ -485,28 +537,30 @@ exit:
}
void dsProblem(problemsSet psp, Header h, const rpmDepSet ds,
const alKey * suggestedPkgs)
const fnpyKey * suggestedKeys)
{
rpmDependencyConflict dcp;
const char * Name = dsiGetN(ds);
const char * DNEVR = dsiGetDNEVR(ds);
const char * EVR = dsiGetEVR(ds);
#ifdef DYING
int_32 Flags = dsiGetFlags(ds);
const char * name, * version, * release;
int xx;
xx = headerNVR(h, &name, &version, &release);
#else
char * byNEVR = hGetNVR(h, NULL);
#endif
/*@-branchstate@*/
if (Name == NULL) Name = "???";
if (EVR == NULL) EVR = "???";
if (DNEVR == NULL) DNEVR = "?????";
if (Name == NULL) Name = "?N?";
if (EVR == NULL) EVR = "?EVR?";
if (DNEVR == NULL) DNEVR = "? ?N? ?OP? ?EVR?";
/*@=branchstate@*/
rpmMessage(RPMMESS_DEBUG, _("package %s-%s-%s has unsatisfied %s: %s\n"),
name, version, release,
ds->Type,
DNEVR+2);
rpmMessage(RPMMESS_DEBUG, _("package %s has unsatisfied %s: %s\n"),
byNEVR, ds->Type, DNEVR+2);
if (psp->num == psp->alloced) {
psp->alloced += 5;
@ -517,6 +571,7 @@ void dsProblem(problemsSet psp, Header h, const rpmDepSet ds,
dcp = psp->problems + psp->num;
psp->num++;
#ifdef DYING
dcp->byHeader = headerLink(h, "dsProblem");
dcp->byName = xstrdup(name);
dcp->byVersion = xstrdup(version);
@ -524,15 +579,18 @@ void dsProblem(problemsSet psp, Header h, const rpmDepSet ds,
dcp->needsName = xstrdup(Name);
dcp->needsVersion = xstrdup(EVR);
dcp->needsFlags = Flags;
if (ds->tagN == RPMTAG_REQUIRENAME)
dcp->sense = RPMDEP_SENSE_REQUIRES;
else if (ds->tagN == RPMTAG_CONFLICTNAME)
dcp->sense = RPMDEP_SENSE_CONFLICTS;
else
dcp->sense = 0;
#else
dcp->byNEVR = byNEVR;
dcp->needsNEVR = xstrdup(DNEVR);
#endif
dcp->suggestedPkgs = suggestedPkgs;
dcp->suggestedKeys = suggestedKeys;
}
int rangeMatchesDepFlags (Header h, const rpmDepSet req)

View File

@ -36,14 +36,14 @@ struct rpmFNSet_s {
/*@refcounted@*/ /*@null@*/
Header h; /*!< Header for file name set (or NULL) */
/*@only@*/ /*@null@*/
const char ** BN; /*!< File base name. */
/*@only@*/ /*@null@*/
/*@only@*/
const char ** BN; /*!< File base name(s). */
/*@only@*/
const int_32 * DI; /*!< File directory index. */
/*@only@*/ /*@null@*/
/*@only@*/
const uint_32 * Flags; /*!< File flags. */
/*@only@*/ /*@null@*/
const char ** DN; /*!< Directory name. */
/*@only@*/
const char ** DN; /*!< Directory name(s). */
int_32 DCount; /*!< No. of directories. */
rpmTagType BNt, DIt, Ft, DNt; /*!< Tag data types. */
int_32 Count; /*!< No. of files. */
@ -126,6 +126,31 @@ rpmDepSet dsNew(Header h, rpmTag tagN, int scareMem)
char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
/*@*/;
/**
* Return dependency set count.
* @param ds dependency set
* @return current count
*/
int dsiGetCount(/*@null@*/ rpmDepSet ds)
/*@*/;
/**
* Return dependency set index.
* @param ds dependency set
* @return current index
*/
int dsiGetIx(/*@null@*/ rpmDepSet ds)
/*@*/;
/**
* Set dependency set index.
* @param ds dependency set
* @param ix new index
* @return current index
*/
int dsiSetIx(/*@null@*/ rpmDepSet ds, int ix)
/*@modifies ds @*/;
/**
* Return current formatted dependency string.
* @param ds dependency set
@ -203,7 +228,7 @@ int dsCompare(const rpmDepSet A, const rpmDepSet B)
* Report a Requires: or Conflicts: dependency problem.
*/
void dsProblem(problemsSet psp, Header h, const rpmDepSet ds,
/*@only@*/ /*@null@*/ const alKey * suggestedPkgs)
/*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys)
/*@modifies psp, h @*/;
/**

View File

@ -74,7 +74,7 @@ void * rpmShowProgress(/*@null@*/ const void * arg,
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
/*@null@*/ const void * pkgKey,
/*@null@*/ fnpyKey key,
/*@null@*/ void * data)
/*@globals hashesPrinted, progressCurrent, progressTotal,
fileSystem @*/
@ -87,7 +87,9 @@ void * rpmShowProgress(/*@null@*/ const void * arg,
char * s;
int flags = (int) ((long)data);
void * rc = NULL;
const char * filename = pkgKey;
/*@-assignexpose -abstract @*/
const char * filename = (const char *)key;
/*@=assignexpose =abstract @*/
static FD_t fd = NULL;
switch (what) {
@ -420,9 +422,11 @@ restart:
}
/*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */
rc = rpmtransAddPackage(ts, eiu->h, NULL, fileName,
/*@-abstract@*/
rc = rpmtransAddPackage(ts, eiu->h, NULL, (fnpyKey)fileName,
(interfaceFlags & INSTALL_UPGRADE) != 0,
relocations);
/*@=abstract@*/
/*@=nullstate@*/
/* XXX reference held by transaction set */

View File

@ -1009,6 +1009,7 @@ void printDepFlags(FILE *fp, const char *version, int flags)
/**
*/
struct rpmDependencyConflict_s {
#ifdef DYING
const char * byName; /*!< package name */
const char * byVersion; /*!< package version */
const char * byRelease; /*!< package release */
@ -1020,12 +1021,19 @@ struct rpmDependencyConflict_s {
const char * needsName; /*!< dependency name */
const char * needsVersion; /*!< dependency epoch:version-release */
int needsFlags; /*!< dependency flags */
#else
char * byNEVR; /*!< package name-version-release */
char * needsNEVR; /*!< dependency [R|C] name ?? epoch:version-release */
#endif
/*@owned@*/ /*@null@*/
const alKey * suggestedPkgs; /* terminated by NULL */
const fnpyKey * suggestedKeys; /*!< Added package keys, NULL terminated. */
#ifdef DYING
enum {
RPMDEP_SENSE_REQUIRES, /*!< requirement not satisfied. */
RPMDEP_SENSE_CONFLICTS /*!< conflict was found. */
} sense;
#endif
};
/**
@ -1087,7 +1095,7 @@ void rpmProblemSetPrint(FILE *fp, rpmProblemSet tsprobs)
*/
void rpmProblemSetAppend(rpmProblemSet tsprobs, rpmProblemType type,
/*@only@*/ /*@null@*/ const char * pkgNEVR,
/*@exposed@*/ /*@null@*/ const void * key,
/*@exposed@*/ /*@null@*/ fnpyKey key,
const char * dn, const char * bn,
/*@only@*/ /*@null@*/ const char * altNEVR,
unsigned long ulong1)
@ -1421,7 +1429,7 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmTransactionSet ts, int rpmtag,
* @return 0 on success, 1 on I/O error, 2 needs capabilities
*/
int rpmtransAddPackage(rpmTransactionSet ts, Header h, /*@null@*/ FD_t fd,
/*@null@*/ /*@owned@*/ const void * key, int upgrade,
/*@null@*/ /*@owned@*/ const fnpyKey key, int upgrade,
/*@null@*/ rpmRelocation * relocs)
/*@globals fileSystem, internalState @*/
/*@modifies fd, h, ts, fileSystem, internalState @*/;
@ -1435,7 +1443,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, /*@null@*/ FD_t fd,
*/
/*@unused@*/
void rpmtransAvailablePackage(rpmTransactionSet ts, Header h,
/*@null@*/ /*@owned@*/ const void * key)
/*@null@*/ /*@owned@*/ fnpyKey key)
/*@modifies h, ts @*/;
/** \ingroup rpmtrans
@ -1483,7 +1491,7 @@ void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd)
*/
/*@unused@*/
int rpmtransGetKeys(const rpmTransactionSet ts,
/*@null@*/ /*@out@*/ const void *** ep,
/*@null@*/ /*@out@*/ fnpyKey ** ep,
/*@null@*/ /*@out@*/ int * nep)
/*@modifies ep, nep @*/;

View File

@ -58,6 +58,7 @@ extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
/*@access PSM_t@*/
/*@access alKey@*/
/*@access fnpyKey@*/
/*@access TFI_t@*/
/*@access teIterator@*/
@ -110,13 +111,13 @@ void rpmtransSetScriptFd(rpmTransactionSet ts, FD_t fd)
/*@=type@*/
}
int rpmtransGetKeys(const rpmTransactionSet ts, const void *** ep, int * nep)
int rpmtransGetKeys(const rpmTransactionSet ts, fnpyKey ** ep, int * nep)
{
int rc = 0;
if (nep) *nep = ts->orderCount;
if (ep) {
const void ** e;
fnpyKey * e;
int oc;
*ep = e = xmalloc(ts->orderCount * sizeof(*e));
@ -1041,7 +1042,7 @@ int keep_header = 1; /* XXX rpmProblemSetAppend prevents dumping headers. */
#endif
{
const char * n, * v, * r;
const void * key;
fnpyKey key;
rpmdbMatchIterator mi;
Header h;

View File

@ -13,10 +13,11 @@
#include "misc.h" /* XXX for uidToUname() and gnameToGid() */
#include "debug.h"
/*@access rpmTransactionSet*/
/*@access TFI_t*/
/*@access PSM_t*/
/*@access FD_t*/ /* XXX compared with NULL */
/*@access rpmDependencyConflict @*/
/*@access rpmTransactionSet @*/
/*@access TFI_t @*/
/*@access PSM_t @*/
/*@access FD_t @*/ /* XXX compared with NULL */
#define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
@ -501,26 +502,37 @@ static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmTransactionSet ts,
/*@-branchstate@*/
if (numConflicts) {
rpmDependencyConflict c;
#ifdef DYING
const char *n, *v, *r;
#endif
char * t, * te;
int nb = 512;
#ifdef DYING
(void) headerNVR(h, &n, &v, &r);
#endif
/*@-type@*/ /* FIX: rpmDependencyConflict usage */
for (i = 0; i < numConflicts; i++) {
nb += strlen(conflicts[i].needsName) + sizeof(", ") - 1;
c = conflicts + i;
nb += strlen(c->needsNEVR+2) + sizeof(", ") - 1;
#ifdef DYING
if (conflicts[i].needsFlags)
nb += strlen(conflicts[i].needsVersion) + 5;
#endif
}
te = t = alloca(nb);
*te = '\0';
sprintf(te, _("Unsatisfied dependencies for %s-%s-%s: "), n, v, r);
sprintf(te, _("Unsatisifed dependencies for %s:"), conflicts[0].byNEVR);
te += strlen(te);
for (i = 0; i < numConflicts; i++) {
c = conflicts + i;
if (i) te = stpcpy(te, ", ");
te = stpcpy(te, conflicts[i].needsName);
#ifdef DYING
te = stpcpy(te, c->needsName);
if (conflicts[i].needsFlags) {
int flags = conflicts[i].needsFlags;
int flags = c->needsFlags;
*te++ = ' ';
if (flags & RPMSENSE_LESS) *te++ = '<';
if (flags & RPMSENSE_GREATER) *te++ = '>';
@ -528,6 +540,9 @@ static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmTransactionSet ts,
*te++ = ' ';
te = stpcpy(te, conflicts[i].needsVersion);
}
#else
te = stpcpy(te, c->needsNEVR+2);
#endif
}
conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
/*@=type@*/

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-11-06 17:01-0500\n"
"POT-Creation-Date: 2001-11-07 18:58-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"
@ -1430,73 +1430,73 @@ msgstr ""
msgid "older package %s already added, replacing with %s\n"
msgstr ""
#: lib/depends.c:634
#: lib/depends.c:631
msgid "(cached)"
msgstr ""
#: lib/depends.c:659
#: lib/depends.c:656
msgid "(rpmrc provides)"
msgstr ""
#: lib/depends.c:675
#: lib/depends.c:672
msgid "(rpmlib provides)"
msgstr ""
#: lib/depends.c:696
#: lib/depends.c:693
msgid "(db files)"
msgstr ""
#: lib/depends.c:708
#: lib/depends.c:705
msgid "(db provides)"
msgstr ""
#: lib/depends.c:721
#: lib/depends.c:718
msgid "(db package)"
msgstr ""
#: lib/depends.c:760
#: lib/depends.c:757
#, c-format
msgid "%9s: (%s, %s) added to Depends cache.\n"
msgstr ""
#: lib/depends.c:762 lib/rpmds.c:326 lib/rpmds.c:481
#: lib/depends.c:759 lib/rpmds.c:378 lib/rpmds.c:533
msgid "NO "
msgstr ""
#: lib/depends.c:762 lib/rpmds.c:326 lib/rpmds.c:481
#: lib/depends.c:759 lib/rpmds.c:378 lib/rpmds.c:533
msgid "YES"
msgstr ""
#: lib/depends.c:1103
#: lib/depends.c:1098
#, c-format
msgid "removing %s \"%s\" from tsort relations.\n"
msgstr ""
#. Record all relations.
#: lib/depends.c:1345
#: lib/depends.c:1344
msgid "========== recording tsort relations\n"
msgstr ""
#. T4. Scan for zeroes.
#: lib/depends.c:1419
#: lib/depends.c:1418
msgid ""
"========== tsorting packages (order, #predecessors, #succesors, depth)\n"
msgstr ""
#: lib/depends.c:1494
#: lib/depends.c:1493
msgid "========== successors only (presentation order)\n"
msgstr ""
#: lib/depends.c:1555
#: lib/depends.c:1554
msgid "LOOP:\n"
msgstr ""
#: lib/depends.c:1590
#: lib/depends.c:1589
msgid "========== continuing tsort ...\n"
msgstr ""
#. Return no. of packages that could not be ordered.
#: lib/depends.c:1595
#: lib/depends.c:1594
#, c-format
msgid "rpmdepOrder failed, %d elements remain\n"
msgstr ""
@ -2105,67 +2105,75 @@ msgstr ""
msgid "generate signature"
msgstr ""
#: lib/problems.c:225
#: lib/problems.c:244
#, c-format
msgid " is needed by %s-%s-%s\n"
msgstr ""
#: lib/problems.c:228
#: lib/problems.c:247
#, c-format
msgid " conflicts with %s-%s-%s\n"
msgstr ""
#: lib/problems.c:268
#: lib/problems.c:253
msgid "conflicts with"
msgstr ""
#: lib/problems.c:253
msgid "is needed by"
msgstr ""
#: lib/problems.c:294
#, c-format
msgid "package %s is for a different architecture"
msgstr ""
#: lib/problems.c:273
#: lib/problems.c:299
#, c-format
msgid "package %s is for a different operating system"
msgstr ""
#: lib/problems.c:278
#: lib/problems.c:304
#, c-format
msgid "package %s is already installed"
msgstr ""
#: lib/problems.c:283
#: lib/problems.c:309
#, c-format
msgid "path %s in package %s is not relocateable"
msgstr ""
#: lib/problems.c:288
#: lib/problems.c:314
#, c-format
msgid "file %s conflicts between attempted installs of %s and %s"
msgstr ""
#: lib/problems.c:293
#: lib/problems.c:319
#, c-format
msgid "file %s from install of %s conflicts with file from package %s"
msgstr ""
#: lib/problems.c:298
#: lib/problems.c:324
#, c-format
msgid "package %s (which is newer than %s) is already installed"
msgstr ""
#: lib/problems.c:303
#: lib/problems.c:329
#, c-format
msgid "installing package %s needs %ld%cb on the %s filesystem"
msgstr ""
#: lib/problems.c:313
#: lib/problems.c:339
#, c-format
msgid "installing package %s needs %ld inodes on the %s filesystem"
msgstr ""
#: lib/problems.c:318
#: lib/problems.c:344
#, c-format
msgid "package %s pre-transaction syscall(s): %s failed: %s"
msgstr ""
#: lib/problems.c:325
#: lib/problems.c:351
#, c-format
msgid "unknown error %d encountered while manipulating package %s"
msgstr ""
@ -2319,8 +2327,8 @@ msgstr ""
msgid "can't query %s: %s\n"
msgstr ""
#: lib/query.c:600 lib/query.c:638 lib/rpminstall.c:326 lib/rpminstall.c:466
#: lib/rpminstall.c:837
#: lib/query.c:600 lib/query.c:638 lib/rpminstall.c:328 lib/rpminstall.c:470
#: lib/rpminstall.c:841
#, c-format
msgid "open of %s failed: %s\n"
msgstr ""
@ -2334,7 +2342,7 @@ msgstr ""
msgid "old format source packages cannot be queried\n"
msgstr ""
#: lib/query.c:648 lib/rpminstall.c:479
#: lib/query.c:648 lib/rpminstall.c:483
#, c-format
msgid "%s: read manifest failed: %s\n"
msgstr ""
@ -2393,16 +2401,16 @@ msgstr ""
msgid "record %u could not be read\n"
msgstr ""
#: lib/query.c:854 lib/rpminstall.c:625
#: lib/query.c:854 lib/rpminstall.c:629
#, c-format
msgid "package %s is not installed\n"
msgstr ""
#: lib/rpmal.c:771
#: lib/rpmal.c:793
msgid "(added files)"
msgstr ""
#: lib/rpmal.c:868
#: lib/rpmal.c:892
msgid "(added provide)"
msgstr ""
@ -2470,102 +2478,102 @@ msgid "OK"
msgstr ""
#. XXX legacy epoch-less requires/conflicts compatibility
#: lib/rpmds.c:451
#: lib/rpmds.c:503
#, c-format
msgid ""
"the \"B\" dependency needs an epoch (assuming same as \"A\")\n"
"\tA %s\tB %s\n"
msgstr ""
#: lib/rpmds.c:480
#: lib/rpmds.c:532
#, c-format
msgid " %s A %s\tB %s\n"
msgstr ""
#. @=branchstate@
#: lib/rpmds.c:506
#: lib/rpmds.c:562
#, c-format
msgid "package %s-%s-%s has unsatisfied %s: %s\n"
msgstr ""
#: lib/rpminstall.c:153
msgid "Preparing..."
msgid "package %s has unsatisfied %s: %s\n"
msgstr ""
#: lib/rpminstall.c:155
msgid "Preparing..."
msgstr ""
#: lib/rpminstall.c:157
msgid "Preparing packages for installation..."
msgstr ""
#: lib/rpminstall.c:274
#: lib/rpminstall.c:276
#, c-format
msgid "Retrieving %s\n"
msgstr ""
#. XXX undefined %{name}/%{version}/%{release} here
#. XXX %{_tmpdir} does not exist
#: lib/rpminstall.c:286
#: lib/rpminstall.c:288
#, c-format
msgid " ... as %s\n"
msgstr ""
#: lib/rpminstall.c:290
#: lib/rpminstall.c:292
#, c-format
msgid "skipping %s - transfer failed - %s\n"
msgstr ""
#: lib/rpminstall.c:388
#: lib/rpminstall.c:390
#, c-format
msgid "package %s is not relocateable\n"
msgstr ""
#: lib/rpminstall.c:440
#: lib/rpminstall.c:444
#, c-format
msgid "error reading from file %s\n"
msgstr ""
#: lib/rpminstall.c:446
#: lib/rpminstall.c:450
#, c-format
msgid "file %s requires a newer version of RPM\n"
msgstr ""
#: lib/rpminstall.c:458 lib/rpminstall.c:693
#: lib/rpminstall.c:462 lib/rpminstall.c:697
#, c-format
msgid "%s cannot be installed\n"
msgstr ""
#: lib/rpminstall.c:494
#: lib/rpminstall.c:498
#, c-format
msgid "found %d source and %d binary packages\n"
msgstr ""
#: lib/rpminstall.c:512
#: lib/rpminstall.c:516
msgid "failed dependencies:\n"
msgstr ""
#: lib/rpminstall.c:535
#: lib/rpminstall.c:539
msgid "installing binary packages\n"
msgstr ""
#: lib/rpminstall.c:558
#: lib/rpminstall.c:562
#, c-format
msgid "cannot open file %s: %s\n"
msgstr ""
#: lib/rpminstall.c:628
#: lib/rpminstall.c:632
#, c-format
msgid "\"%s\" specifies multiple packages\n"
msgstr ""
#: lib/rpminstall.c:652
#: lib/rpminstall.c:656
msgid "removing these packages would break dependencies:\n"
msgstr ""
#: lib/rpminstall.c:679
#: lib/rpminstall.c:683
#, c-format
msgid "cannot open %s: %s\n"
msgstr ""
#: lib/rpminstall.c:685
#: lib/rpminstall.c:689
#, c-format
msgid "Installing %s\n"
msgstr ""
@ -2812,36 +2820,36 @@ msgstr ""
msgid "Signature: UNKNOWN (%d)\n"
msgstr ""
#: lib/transaction.c:247
#: lib/transaction.c:248
#, c-format
msgid "%s skipped due to missingok flag\n"
msgstr ""
#. @innercontinue@
#: lib/transaction.c:886
#: lib/transaction.c:887
#, c-format
msgid "excluding directory %s\n"
msgstr ""
#: lib/verify.c:242
#: lib/verify.c:243
msgid "package lacks both user name and id lists (this should never happen)\n"
msgstr ""
#: lib/verify.c:263
#: lib/verify.c:264
msgid "package lacks both group name and id lists (this should never happen)\n"
msgstr ""
#: lib/verify.c:420
#: lib/verify.c:421
#, c-format
msgid "missing %s"
msgstr ""
#: lib/verify.c:517
#: lib/verify.c:527
#, c-format
msgid "Unsatisfied dependencies for %s-%s-%s: "
msgid "Unsatisifed dependencies for %s:"
msgstr ""
#: lib/verify.c:562
#: lib/verify.c:577
#, c-format
msgid "%s-%s-%s: immutable header region digest check failed\n"
msgstr ""

View File

@ -30,6 +30,12 @@ extern int _rpmio_debug;
return 0;
}
/* XXX These names/constants have been removed from the rpmlib API. */
enum {
RPMDEP_SENSE_REQUIRES, /*!< requirement not satisfied. */
RPMDEP_SENSE_CONFLICTS /*!< conflict was found. */
};
#ifdef __LCLINT__
#undef PyObject_HEAD
#define PyObject_HEAD int _PyObjectHead
@ -1217,8 +1223,8 @@ static PyTypeObject rpmdbType = {
* requirement or conflict.
* The needsFlags is a bitfield that describes the versioned
* nature of a requirement or conflict. The constants
* rpm.RPMDEP_SENSE_LESS, rpm.RPMDEP_SENSE_GREATER, and
* rpm.RPMDEP_SENSE_EQUAL can be logical ANDed with the needsFlags
* rpm.RPMSENSE_LESS, rpm.RPMSENSE_GREATER, and
* rpm.RPMSENSE_EQUAL can be logical ANDed with the needsFlags
* to get versioned dependency information.
* suggestedPackage is a tuple if the dependency check was aware
* of a package that solves this dependency problem when the
@ -1350,7 +1356,7 @@ static PyObject * rpmtransRemove(rpmtransObject * s, PyObject * args) {
/** \ingroup python
*/
static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) {
rpmDependencyConflict conflicts;
rpmDependencyConflict conflicts, c;
int numConflicts;
PyObject * list, * cf;
int i;
@ -1361,8 +1367,9 @@ static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) {
if (numConflicts) {
list = PyList_New(0);
/* XXX TODO: rpmlib-4.0.3 can return multiple suggested packages. */
/* XXX TODO: rpm >= 4.0.3 can return multiple suggested keys. */
for (i = 0; i < numConflicts; i++) {
#ifdef DYING
cf = Py_BuildValue("((sss)(ss)iOi)", conflicts[i].byName,
conflicts[i].byVersion, conflicts[i].byRelease,
@ -1373,6 +1380,46 @@ static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) {
conflicts[i].suggestedPkgs ?
conflicts[i].suggestedPkgs[0] : Py_None,
conflicts[i].sense);
#else
char * byName, * byVersion, * byRelease;
char * needsName, * needsOP, * needsVersion;
int needsFlags, sense;
fnpyKey key;
c = conflicts + i;
byName = c->byNEVR;
if ((byRelease = strrchr(byName, '-')) != NULL)
*byRelease++ = '\0';
if ((byVersion = strrchr(byName, '-')) != NULL)
*byVersion++ = '\0';
key = c->suggestedKeys[0];
needsName = c->needsNEVR;
if (needsName[1] == ' ') {
sense = (needsName[0] == 'C')
? RPMDEP_SENSE_CONFLICTS : RPMDEP_SENSE_REQUIRES;
needsName += 2;
} else
sense = RPMDEP_SENSE_REQUIRES;
if ((needsVersion = strrchr(needsName, ' ')) != NULL)
*needsVersion++ = '\0';
needsFlags = 0;
if ((needsOP = strrchr(needsName, ' ')) != NULL) {
for (*needsOP++ = '\0'; *needsOP != '\0'; needsOP++) {
if (*needsOP == '<') needsFlags |= RPMSENSE_LESS;
else if (*needsOP == '>') needsFlags |= RPMSENSE_GREATER;
else if (*needsOP == '=') needsFlags |= RPMSENSE_EQUAL;
}
}
cf = Py_BuildValue("((sss)(ss)iOi)", byName, byVersion, byRelease,
needsName, needsVersion, needsFlags,
(key != NULL ? key : Py_None),
sense);
#endif
PyList_Append(list, (PyObject *) cf);
Py_DECREF(cf);
}
@ -2461,7 +2508,6 @@ void initrpm(void) {
int i;
const struct headerSprintfExtension_s * extensions = rpmHeaderFormats;
struct headerSprintfExtension_s * ext;
m = Py_InitModule("rpm", rpmModuleMethods);
hdrType.ob_type = &PyType_Type;

View File

@ -563,3 +563,5 @@ fi
- fix: big-endian's with sizeof(time_t) != sizeof(int_32) mtime broken.
- fix: add Korean message catalogs (#54473).
- add RPHNPLATFORM and PLATFORM tags.
- linear search on added package provides is dumb.
- discarding entire signature header when using --addsign is dumb.

View File

@ -31,6 +31,10 @@
#define rpmIsDebug() \
(rpmlogSetMask(0) >= RPMLOG_MASK( RPMMESS_DEBUG ))
/*@-redef@*/ /* LCL: ??? */
typedef /*@abstract@*/ const void * fnpyKey;
/*@=redef@*/
/**
*/
typedef enum rpmCallbackType_e {
@ -61,7 +65,7 @@ typedef void * (*rpmCallbackFunction)
const rpmCallbackType what,
const unsigned long amount,
const unsigned long total,
/*@null@*/ const void * pkgKey,
/*@null@*/ fnpyKey key,
/*@null@*/ rpmCallbackData data)
/*@globals internalState@*/
/*@modifies internalState@*/;