Start removing alGetHeader.
CVS patchset: 5168 CVS date: 2001/11/10 19:24:19
This commit is contained in:
parent
431499aeca
commit
a086ad7dd1
318
lib/depends.c
318
lib/depends.c
|
@ -2,7 +2,7 @@
|
|||
* \file lib/depends.c
|
||||
*/
|
||||
|
||||
#define _DS_SCAREMEM 0
|
||||
#define _DS_SCAREMEM 1
|
||||
|
||||
#include "system.h"
|
||||
|
||||
|
@ -125,6 +125,127 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmTransactionSet ts, int rpmtag,
|
|||
/*@=mods =onlytrans =type@*/
|
||||
}
|
||||
|
||||
char * hGetNEVR(Header h, const char ** 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;
|
||||
}
|
||||
|
||||
static void delTE(transactionElement p)
|
||||
/*@modifies p @*/
|
||||
{
|
||||
rpmRelocation * r;
|
||||
|
||||
if (p->relocs) {
|
||||
for (r = p->relocs; (r->oldPath || r->newPath); r++) {
|
||||
r->oldPath = _free(r->oldPath);
|
||||
r->newPath = _free(r->newPath);
|
||||
}
|
||||
p->relocs = _free(p->relocs);
|
||||
}
|
||||
|
||||
p->provides = dsFree(p->provides);
|
||||
p->requires = dsFree(p->requires);
|
||||
p->conflicts = dsFree(p->conflicts);
|
||||
p->obsoletes = dsFree(p->obsoletes);
|
||||
p->fns = fnsFree(p->fns);
|
||||
|
||||
/*@-type@*/ /* FIX: cast? */
|
||||
if (p->fd != NULL)
|
||||
p->fd = fdFree(p->fd, "alAddPackage (rpmtransFree)");
|
||||
/*@=type@*/
|
||||
|
||||
p->os = _free(p->os);
|
||||
p->arch = _free(p->arch);
|
||||
p->epoch = _free(p->epoch);
|
||||
p->NEVR = _free(p->NEVR);
|
||||
p->name = _free(p->name);
|
||||
memset(p, 0, sizeof(*p)); /* XXX trash and burn */
|
||||
/*@-nullstate@*/ /* FIX: p->{NEVR,name} annotations */
|
||||
return;
|
||||
/*@=nullstate@*/
|
||||
}
|
||||
|
||||
static void addTE(transactionElement p, Header h,
|
||||
/*@null@*/ FD_t fd,
|
||||
/*@null@*/ fnpyKey key,
|
||||
/*@null@*/ rpmRelocation * relocs)
|
||||
/*@modifies p, h @*/
|
||||
{
|
||||
int scareMem = _DS_SCAREMEM;
|
||||
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
|
||||
const char * arch, * os;
|
||||
int_32 * ep;
|
||||
int xx;
|
||||
|
||||
p->NEVR = hGetNEVR(h, NULL);
|
||||
p->name = xstrdup(p->NEVR);
|
||||
if ((p->release = strrchr(p->name, '-')) != NULL)
|
||||
*p->release++ = '\0';
|
||||
if ((p->version = strrchr(p->name, '-')) != NULL)
|
||||
*p->version++ = '\0';
|
||||
|
||||
arch = NULL;
|
||||
xx = hge(h, RPMTAG_ARCH, NULL, (void **)&arch, NULL);
|
||||
p->arch = (arch != NULL ? xstrdup(arch) : NULL);
|
||||
os = NULL;
|
||||
xx = hge(h, RPMTAG_OS, NULL, (void **)&os, NULL);
|
||||
p->os = (os != NULL ? xstrdup(os) : NULL);
|
||||
|
||||
ep = NULL;
|
||||
xx = hge(h, RPMTAG_EPOCH, NULL, (void **)&ep, NULL);
|
||||
/*@-branchstate@*/
|
||||
if (ep) {
|
||||
p->epoch = xmalloc(20);
|
||||
sprintf(p->epoch, "%d", *ep);
|
||||
} else
|
||||
p->epoch = NULL;
|
||||
/*@=branchstate@*/
|
||||
|
||||
p->provides = dsNew(h, RPMTAG_PROVIDENAME, scareMem);
|
||||
p->fns = fnsNew(h, RPMTAG_BASENAMES, scareMem);
|
||||
p->requires = dsNew(h, RPMTAG_REQUIRENAME, scareMem);
|
||||
p->conflicts = dsNew(h, RPMTAG_CONFLICTNAME, scareMem);
|
||||
p->obsoletes = dsNew(h, RPMTAG_OBSOLETENAME, scareMem);
|
||||
|
||||
/*@-assignexpose -ownedtrans @*/
|
||||
p->key = key;
|
||||
/*@=assignexpose =ownedtrans @*/
|
||||
|
||||
/*@-type@*/ /* FIX: cast? */
|
||||
p->fd = (fd != NULL ? fdLink(fd, "rpmtransAddPackage") : NULL);
|
||||
/*@=type@*/
|
||||
|
||||
if (relocs != NULL) {
|
||||
rpmRelocation * r;
|
||||
int i;
|
||||
|
||||
for (i = 0, r = relocs; r->oldPath || r->newPath; i++, r++)
|
||||
{};
|
||||
p->relocs = xmalloc((i + 1) * sizeof(*p->relocs));
|
||||
|
||||
for (i = 0, r = relocs; r->oldPath || r->newPath; i++, r++) {
|
||||
p->relocs[i].oldPath = r->oldPath ? xstrdup(r->oldPath) : NULL;
|
||||
p->relocs[i].newPath = r->newPath ? xstrdup(r->newPath) : NULL;
|
||||
}
|
||||
p->relocs[i].oldPath = NULL;
|
||||
p->relocs[i].newPath = NULL;
|
||||
} else {
|
||||
p->relocs = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
rpmTransactionSet rpmtransCreateSet(rpmdb db, const char * rootDir)
|
||||
{
|
||||
rpmTransactionSet ts;
|
||||
|
@ -215,7 +336,6 @@ static int removePackage(rpmTransactionSet ts, Header h, int dboffset,
|
|||
alKey depends)
|
||||
/*@modifies ts, h @*/
|
||||
{
|
||||
int scareMem = _DS_SCAREMEM;
|
||||
transactionElement p;
|
||||
|
||||
/* Filter out duplicate erasures. */
|
||||
|
@ -248,18 +368,7 @@ static int removePackage(rpmTransactionSet ts, Header h, int dboffset,
|
|||
|
||||
memset(p, 0, sizeof(*p));
|
||||
|
||||
p->NEVR = hGetNEVR(h, NULL);
|
||||
p->name = xstrdup(p->NEVR);
|
||||
if ((p->release = strrchr(p->name, '-')) != NULL)
|
||||
*p->release++ = '\0';
|
||||
if ((p->version = strrchr(p->name, '-')) != NULL)
|
||||
*p->version++ = '\0';
|
||||
|
||||
p->provides = dsNew(h, RPMTAG_PROVIDENAME, scareMem);
|
||||
p->fns = fnsNew(h, RPMTAG_BASENAMES, scareMem);
|
||||
p->requires = dsNew(h, RPMTAG_REQUIRENAME, scareMem);
|
||||
p->conflicts = dsNew(h, RPMTAG_CONFLICTNAME, scareMem);
|
||||
p->obsoletes = dsNew(h, RPMTAG_CONFLICTNAME, scareMem);
|
||||
addTE(p, h, NULL, NULL, NULL);
|
||||
|
||||
p->type = TR_REMOVED;
|
||||
p->u.removed.dboffset = dboffset;
|
||||
|
@ -270,66 +379,34 @@ static int removePackage(rpmTransactionSet ts, Header h, int dboffset,
|
|||
return 0;
|
||||
}
|
||||
|
||||
char * hGetNEVR(Header h, const char ** 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;
|
||||
}
|
||||
|
||||
int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
|
||||
fnpyKey key, int upgrade, rpmRelocation * relocs)
|
||||
{
|
||||
int scareMem = _DS_SCAREMEM;
|
||||
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
|
||||
const char * name = NULL;
|
||||
char * addNEVR = hGetNEVR(h, &name);
|
||||
char * pkgNEVR = NULL;
|
||||
int isSource;
|
||||
int duplicate = 0;
|
||||
transactionElement p;
|
||||
rpmDepSet provides;
|
||||
rpmDepSet requires;
|
||||
rpmDepSet conflicts;
|
||||
teIterator pi; transactionElement p;
|
||||
rpmDepSet obsoletes;
|
||||
rpmFNSet fns;
|
||||
alKey pkgKey; /* addedPackages key */
|
||||
int apx; /* addedPackages index */
|
||||
int xx;
|
||||
int ec = 0;
|
||||
int rc;
|
||||
int i;
|
||||
int oc;
|
||||
|
||||
/*
|
||||
* Check for previously added versions with the same name.
|
||||
*/
|
||||
i = ts->orderCount;
|
||||
apx = 0;
|
||||
if ((p = ts->order) != NULL)
|
||||
for (i = 0; i < ts->orderCount; i++, p++) {
|
||||
pi = teInitIterator(ts);
|
||||
/* XXX Only added packages need be checked for dupes. */
|
||||
while ((p = teNext(pi, TR_ADDED)) != NULL) {
|
||||
const char * pname;
|
||||
Header ph;
|
||||
|
||||
/* XXX Only added packages are checked for dupes (for now). */
|
||||
switch (p->type) {
|
||||
case TR_ADDED:
|
||||
/*@switchbreak@*/ break;
|
||||
case TR_REMOVED:
|
||||
default:
|
||||
continue;
|
||||
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||
}
|
||||
|
||||
apx++;
|
||||
|
||||
ph = alGetHeader(ts->addedPackages, p->u.addedKey, 0);
|
||||
|
@ -367,45 +444,34 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
|
|||
}
|
||||
break;
|
||||
}
|
||||
pi = teFreeIterator(pi);
|
||||
oc = (p == NULL ? ts->orderCount : (p - ts->order));
|
||||
|
||||
isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE);
|
||||
|
||||
/*@-branchstate@*/
|
||||
if (duplicate) {
|
||||
p = ts->order + i;
|
||||
provides = rpmdsLink(p->provides, "xfer");
|
||||
p->provides = rpmdsUnlink(p->provides, "xfer");
|
||||
fns = rpmfnsLink(p->fns, "xfer");
|
||||
p->fns = rpmfnsUnlink(p->fns, "xfer");
|
||||
} else {
|
||||
provides = dsNew(h, RPMTAG_PROVIDENAME, scareMem);
|
||||
fns = fnsNew(h, RPMTAG_BASENAMES, scareMem);
|
||||
}
|
||||
/*@=branchstate@*/
|
||||
if (p != NULL && duplicate && oc < ts->orderCount)
|
||||
delTE(p);
|
||||
|
||||
requires = dsNew(h, RPMTAG_REQUIRENAME, scareMem);
|
||||
conflicts = dsNew(h, RPMTAG_CONFLICTNAME, scareMem);
|
||||
obsoletes = dsNew(h, RPMTAG_CONFLICTNAME, scareMem);
|
||||
|
||||
/* XXX cast assumes that available keys are indices, not pointers */
|
||||
pkgKey = alAddPackage(ts->addedPackages, (alKey)apx, key, h, provides, fns);
|
||||
if (pkgKey == RPMAL_NOMATCH) {
|
||||
ec = 1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* XXX Note: i == ts->orderCount here almost always. */
|
||||
if (i == ts->orderAlloced) {
|
||||
if (oc == ts->orderAlloced) {
|
||||
ts->orderAlloced += ts->delta;
|
||||
ts->order = xrealloc(ts->order, ts->orderAlloced * sizeof(*ts->order));
|
||||
}
|
||||
|
||||
p = ts->order + i;
|
||||
p = ts->order + oc;
|
||||
memset(p, 0, sizeof(*p));
|
||||
|
||||
p->u.addedKey = pkgKey;
|
||||
addTE(p, h, fd, key, relocs);
|
||||
|
||||
p->type = TR_ADDED;
|
||||
/* XXX cast assumes that available keys are indices, not pointers */
|
||||
pkgKey = alAddPackage(ts->addedPackages, (alKey)apx, p->key, h,
|
||||
p->provides, p->fns);
|
||||
if (pkgKey == RPMAL_NOMATCH) {
|
||||
ec = 1;
|
||||
goto exit;
|
||||
}
|
||||
p->u.addedKey = pkgKey;
|
||||
|
||||
p->multiLib = 0;
|
||||
|
||||
#ifdef NOYET
|
||||
|
@ -431,58 +497,6 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
|
|||
}
|
||||
#endif
|
||||
|
||||
p->NEVR = xstrdup(addNEVR);
|
||||
p->name = xstrdup(addNEVR);
|
||||
if ((p->release = strrchr(p->name, '-')) != NULL)
|
||||
*p->release++ = '\0';
|
||||
if ((p->version = strrchr(p->name, '-')) != NULL)
|
||||
*p->version++ = '\0';
|
||||
|
||||
p->provides = rpmdsUnlink(p->provides, "xfer");
|
||||
p->provides = rpmdsLink(provides, "xfer");
|
||||
provides = rpmdsUnlink(provides, "xfer");
|
||||
|
||||
p->requires = rpmdsUnlink(p->requires, "xfer");
|
||||
p->requires = rpmdsLink(requires, "xfer");
|
||||
requires = rpmdsUnlink(requires, "xfer");
|
||||
|
||||
p->conflicts = rpmdsUnlink(p->conflicts, "xfer");
|
||||
p->conflicts = rpmdsLink(conflicts, "xfer");
|
||||
conflicts = rpmdsUnlink(conflicts, "xfer");
|
||||
|
||||
p->obsoletes = rpmdsUnlink(p->obsoletes, "xfer");
|
||||
p->obsoletes = rpmdsLink(obsoletes, "xfer");
|
||||
obsoletes = rpmdsUnlink(obsoletes, "xfer");
|
||||
|
||||
p->fns = rpmfnsUnlink(p->fns, "xfer");
|
||||
p->fns = rpmfnsLink(fns, "xfer");
|
||||
fns = rpmfnsUnlink(fns, "xfer");
|
||||
|
||||
/*@-assignexpose -ownedtrans @*/
|
||||
p->key = key;
|
||||
/*@=assignexpose =ownedtrans @*/
|
||||
|
||||
/*@-type@*/ /* FIX: cast? */
|
||||
p->fd = (fd != NULL ? fdLink(fd, "rpmtransAddPackage") : NULL);
|
||||
/*@=type@*/
|
||||
|
||||
if (relocs) {
|
||||
rpmRelocation * r;
|
||||
|
||||
for (i = 0, r = relocs; r->oldPath || r->newPath; i++, r++)
|
||||
{};
|
||||
p->relocs = xmalloc((i + 1) * sizeof(*p->relocs));
|
||||
|
||||
for (i = 0, r = relocs; r->oldPath || r->newPath; i++, r++) {
|
||||
p->relocs[i].oldPath = r->oldPath ? xstrdup(r->oldPath) : NULL;
|
||||
p->relocs[i].newPath = r->newPath ? xstrdup(r->newPath) : NULL;
|
||||
}
|
||||
p->relocs[i].oldPath = NULL;
|
||||
p->relocs[i].newPath = NULL;
|
||||
} else {
|
||||
p->relocs = NULL;
|
||||
}
|
||||
|
||||
if (!duplicate) {
|
||||
assert(apx == ts->numAddedPackages);
|
||||
ts->numAddedPackages++;
|
||||
|
@ -528,7 +542,7 @@ assert(apx == ts->numAddedPackages);
|
|||
mi = rpmdbFreeIterator(mi);
|
||||
}
|
||||
|
||||
obsoletes = dsiInit(rpmdsLink(p->obsoletes, "obsoletes"));
|
||||
obsoletes = dsiInit(rpmdsLink(p->obsoletes, "Obsoletes"));
|
||||
if (obsoletes != NULL)
|
||||
while (dsiNext(obsoletes) >= 0) {
|
||||
const char * Name;
|
||||
|
@ -569,6 +583,7 @@ assert(apx == ts->numAddedPackages);
|
|||
exit:
|
||||
pkgNEVR = _free(pkgNEVR);
|
||||
addNEVR = _free(addNEVR);
|
||||
pi = teFreeIterator(pi);
|
||||
return ec;
|
||||
}
|
||||
|
||||
|
@ -615,7 +630,9 @@ rpmTransactionSet rpmtransFree(rpmTransactionSet ts)
|
|||
|
||||
pi = teInitIterator(ts);
|
||||
while ((p = teNextIterator(pi)) != NULL) {
|
||||
#ifdef DYING
|
||||
rpmRelocation * r;
|
||||
|
||||
if (p->relocs) {
|
||||
for (r = p->relocs; (r->oldPath || r->newPath); r++) {
|
||||
r->oldPath = _free(r->oldPath);
|
||||
|
@ -635,8 +652,14 @@ rpmTransactionSet rpmtransFree(rpmTransactionSet ts)
|
|||
p->fd = fdFree(p->fd, "alAddPackage (rpmtransFree)");
|
||||
/*@=type@*/
|
||||
|
||||
p->os = _free(p->os);
|
||||
p->arch = _free(p->arch);
|
||||
p->epoch = _free(p->epoch);
|
||||
p->NEVR = _free(p->NEVR);
|
||||
p->name = _free(p->name);
|
||||
#else
|
||||
delTE(p);
|
||||
#endif
|
||||
}
|
||||
pi = teFreeIterator(pi);
|
||||
|
||||
|
@ -1369,7 +1392,7 @@ static void addQ(transactionElement p,
|
|||
|
||||
int rpmdepOrder(rpmTransactionSet ts)
|
||||
{
|
||||
int numAddedPackages = alGetSize(ts->addedPackages);
|
||||
int numAddedPackages = ts->numAddedPackages;
|
||||
int chainsaw = ts->transFlags & RPMTRANS_FLAG_CHAINSAW;
|
||||
teIterator pi; transactionElement p;
|
||||
teIterator qi; transactionElement q;
|
||||
|
@ -1388,8 +1411,6 @@ int rpmdepOrder(rpmTransactionSet ts)
|
|||
int qlen;
|
||||
int i, j;
|
||||
|
||||
assert(ts->numAddedPackages == alGetSize(ts->addedPackages));
|
||||
|
||||
alMakeIndex(ts->addedPackages);
|
||||
|
||||
/*@-modfilesystem -nullpass@*/
|
||||
|
@ -1402,21 +1423,7 @@ fprintf(stderr, "*** rpmdepOrder(%p) order %p[%d]\n", ts, ts->order, ts->orderCo
|
|||
pi = teInitIterator(ts);
|
||||
/* XXX Only added packages are ordered (for now). */
|
||||
while ((p = teNext(pi, TR_ADDED)) != NULL) {
|
||||
|
||||
p->tsi = xcalloc(1, sizeof(*p->tsi));
|
||||
|
||||
#ifdef DYING
|
||||
/* Retrieve info from addedPackages. */
|
||||
p->NEVR = alGetNVR(ts->addedPackages, p->u.addedKey);
|
||||
p->name = alGetNVR(ts->addedPackages, p->u.addedKey);
|
||||
if ((p->release = strrchr(p->name, '-')) != NULL)
|
||||
*p->release++ = '\0';
|
||||
if ((p->version = strrchr(p->name, '-')) != NULL)
|
||||
*p->version++ = '\0';
|
||||
/*@-modfilesystem@*/
|
||||
prtTSI(p->NEVR, p->tsi);
|
||||
/*@=modfilesystem@*/
|
||||
#endif
|
||||
}
|
||||
pi = teFreeIterator(pi);
|
||||
|
||||
|
@ -1694,10 +1701,6 @@ prtTSI(" p", p->tsi);
|
|||
tsi = _free(tsi);
|
||||
}
|
||||
p->tsi = _free(p->tsi);
|
||||
#ifdef DYING
|
||||
p->NEVR = _free(p->NEVR);
|
||||
p->name = _free(p->name);
|
||||
#endif
|
||||
|
||||
/* Prepare added package ordering permutation. */
|
||||
orderList[j].pkgKey = p->u.addedKey;
|
||||
|
@ -1833,16 +1836,6 @@ int rpmdepCheck(rpmTransactionSet ts,
|
|||
rpmDepSet provides;
|
||||
uint_32 multiLib;
|
||||
|
||||
/* XXX Only added packages are checked (for now). */
|
||||
switch (p->type) {
|
||||
case TR_ADDED:
|
||||
/*@switchbreak@*/ break;
|
||||
case TR_REMOVED:
|
||||
default:
|
||||
continue;
|
||||
/*@notreached@*/ /*@switchbreak@*/ break;
|
||||
}
|
||||
|
||||
h = alGetHeader(ts->addedPackages, p->u.addedKey, 0);
|
||||
if (h == NULL) /* XXX can't happen */
|
||||
break;
|
||||
|
@ -1873,7 +1866,6 @@ int rpmdepCheck(rpmTransactionSet ts,
|
|||
if (rc)
|
||||
goto exit;
|
||||
|
||||
|
||||
rc = 0;
|
||||
provides = p->provides;
|
||||
provides = dsiInit(provides);
|
||||
|
|
|
@ -66,25 +66,31 @@ struct tsortInfo_s {
|
|||
* A single package instance to be installed/removed atomically.
|
||||
*/
|
||||
struct transactionElement_s {
|
||||
/*@only@*/ /*@null@*/
|
||||
char * NEVR;
|
||||
/*@owned@*/ /*@null@*/
|
||||
char * name;
|
||||
/*@dependent@*/ /*@null@*/
|
||||
char * version;
|
||||
/*@dependent@*/ /*@null@*/
|
||||
char * release;
|
||||
|
||||
int npreds; /*!< No. of predecessors. */
|
||||
int depth; /*!< Max. depth in dependency tree. */
|
||||
/*@owned@*/
|
||||
tsortInfo tsi; /*!< Ordering info. */
|
||||
|
||||
enum rpmTransactionType {
|
||||
TR_ADDED, /*!< Package will be installed. */
|
||||
TR_REMOVED /*!< Package will be removed. */
|
||||
} type; /*!< Package disposition (installed/removed). */
|
||||
|
||||
/*@only@*/
|
||||
const char * NEVR; /*!< Package name-version-release. */
|
||||
/*@owned@*/
|
||||
const char * name; /*!< Name: */
|
||||
/*@only@*/ /*@null@*/
|
||||
char * epoch;
|
||||
/*@dependent@*/ /*@null@*/
|
||||
char * version; /*!< Version: */
|
||||
/*@dependent@*/ /*@null@*/
|
||||
char * release; /*!< Release: */
|
||||
/*@only@*/ /*@null@*/
|
||||
const char * arch; /*!< Architecture hint. */
|
||||
/*@only@*/ /*@null@*/
|
||||
const char * os; /*!< Operating system hint. */
|
||||
|
||||
int npreds; /*!< No. of predecessors. */
|
||||
int depth; /*!< Max. depth in dependency tree. */
|
||||
/*@owned@*/
|
||||
tsortInfo tsi; /*!< Dependency ordering chains. */
|
||||
|
||||
/*@refcounted@*/ /*@null@*/
|
||||
rpmDepSet provides; /*!< Provides: dependencies. */
|
||||
/*@refcounted@*/ /*@null@*/
|
||||
|
@ -94,19 +100,16 @@ struct transactionElement_s {
|
|||
/*@refcounted@*/ /*@null@*/
|
||||
rpmDepSet obsoletes; /*!< Obsoletes: dependencies. */
|
||||
/*@refcounted@*/ /*@null@*/
|
||||
rpmFNSet fns; /*!< File info set. */
|
||||
rpmFNSet fns; /*!< File information. */
|
||||
|
||||
uint_32 multiLib; /* (TR_ADDED) MULTILIB */
|
||||
int_32 filesCount; /* (TR_ADDED) No. files in package. */
|
||||
uint_32 multiLib; /*!< (TR_ADDED) MULTILIB */
|
||||
|
||||
/*@kept@*//*@null@*/
|
||||
fnpyKey key;
|
||||
/*!< (TR_ADDED) Retrieval key (CLI uses file name, e.g.). */
|
||||
fnpyKey key; /*!< (TR_ADDED) Retrieval key. */
|
||||
/*@owned@*/ /*@null@*/
|
||||
rpmRelocation * relocs;
|
||||
/*!< (TR_ADDED) Payload file relocations. */
|
||||
/*@refcounted@*/ /*@null@*/
|
||||
FD_t fd; /*!< (TR_ADDED) Payload file descriptor (usually NULL). */
|
||||
rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */
|
||||
/*@refcounted@*/ /*@null@*/
|
||||
FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
|
||||
|
||||
/*@-fielduse@*/ /* LCL: confused by union? */
|
||||
union {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
/*@access rpmProblemSet@*/
|
||||
|
||||
/*@unchecked@*/
|
||||
static int _ps_debug = 1;
|
||||
static int _ps_debug = 0;
|
||||
|
||||
rpmProblemSet XrpmpsUnlink(rpmProblemSet ps, const char * msg,
|
||||
const char * fn, unsigned ln)
|
||||
|
|
49
lib/rpmal.c
49
lib/rpmal.c
|
@ -143,9 +143,15 @@ static void alFreeIndex(availableList al)
|
|||
}
|
||||
}
|
||||
|
||||
int alGetSize(const availableList al)
|
||||
/**
|
||||
* Return number of packages in list.
|
||||
* @param al available list
|
||||
* @return no. of packages in list
|
||||
*/
|
||||
static int alGetSize(/*@null@*/ const availableList al)
|
||||
/*@*/
|
||||
{
|
||||
return al->size;
|
||||
return (al != NULL ? al->size : 0);
|
||||
}
|
||||
|
||||
static inline alNum alKey2Num(/*@unused@*/ /*@null@*/ const availableList al,
|
||||
|
@ -166,12 +172,21 @@ static inline alKey alNum2Key(/*@unused@*/ /*@null@*/ const availableList al,
|
|||
/*@=nullret =temptrans =retalias @*/
|
||||
}
|
||||
|
||||
availablePackage alGetPkg(const availableList al, alKey pkgKey)
|
||||
/**
|
||||
* Return available package.
|
||||
* @param al available list
|
||||
* @param pkgKey available package key
|
||||
* @return available package pointer
|
||||
*/
|
||||
/*@dependent@*/ /*@null@*/
|
||||
static availablePackage alGetPkg(/*@null@*/ const availableList al,
|
||||
/*@null@*/ alKey pkgKey)
|
||||
/*@*/
|
||||
{
|
||||
availablePackage alp = NULL;
|
||||
alNum pkgNum = alKey2Num(al, pkgKey);
|
||||
|
||||
if (al != NULL && pkgNum >= 0 && pkgNum < al->size) {
|
||||
if (al != NULL && pkgNum >= 0 && pkgNum < alGetSize(al)) {
|
||||
if (al->list != NULL)
|
||||
alp = al->list + pkgNum;
|
||||
}
|
||||
|
@ -197,28 +212,6 @@ Header alGetHeader(availableList al, alKey pkgKey, int unlink)
|
|||
return h;
|
||||
}
|
||||
|
||||
#ifdef DYING
|
||||
char * alGetNVR(const availableList al, alKey pkgKey)
|
||||
{
|
||||
availablePackage alp = alGetPkg(al, pkgKey);
|
||||
char * pkgNVR = NULL;
|
||||
|
||||
if (alp != NULL) {
|
||||
char * t;
|
||||
t = xcalloc(1, strlen(alp->name) +
|
||||
strlen(alp->version) +
|
||||
strlen(alp->release) + sizeof("--"));
|
||||
pkgNVR = t;
|
||||
t = stpcpy(t, alp->name);
|
||||
t = stpcpy(t, "-");
|
||||
t = stpcpy(t, alp->version);
|
||||
t = stpcpy(t, "-");
|
||||
t = stpcpy(t, alp->release);
|
||||
}
|
||||
return pkgNVR;
|
||||
}
|
||||
#endif
|
||||
|
||||
availableList alCreate(int delta)
|
||||
{
|
||||
availableList al = xcalloc(1, sizeof(*al));
|
||||
|
@ -435,8 +428,8 @@ fprintf(stderr, "*** add %p[%d] %s-%s-%s\n", al->list, pkgNum, alp->name, alp->v
|
|||
/*@=modfilesys@*/
|
||||
|
||||
/*@-assignexpose -temptrans@*/
|
||||
alp->provides = rpmdsLink(provides, "alAddPackage");
|
||||
alp->fns = rpmfnsLink(fns, "alAddPackage");
|
||||
alp->provides = rpmdsLink(provides, "Provides (alAddPackage)");
|
||||
alp->fns = rpmfnsLink(fns, "Files (alAddPackage)");
|
||||
/*@=assignexpose =temptrans@*/
|
||||
|
||||
if (alp->fns && alp->fns->fc > 0) {
|
||||
|
|
32
lib/rpmal.h
32
lib/rpmal.h
|
@ -11,14 +11,6 @@
|
|||
*/
|
||||
typedef /*@abstract@*/ struct availablePackage_s * availablePackage;
|
||||
|
||||
/**
|
||||
* Return number of packages in list.
|
||||
* @param al available list
|
||||
* @return no. of packages in list
|
||||
*/
|
||||
int alGetSize(const availableList al)
|
||||
/*@*/;
|
||||
|
||||
/**
|
||||
* Return available package header.
|
||||
* @param al available list
|
||||
|
@ -30,30 +22,6 @@ Header alGetHeader(/*@null@*/ availableList al, /*@null@*/ alKey pkgKey,
|
|||
int unlink)
|
||||
/*@modifies al @*/;
|
||||
|
||||
/**
|
||||
* Return available package.
|
||||
* @param al available list
|
||||
* @param pkgKey available package key
|
||||
* @return available package pointer
|
||||
*/
|
||||
/*@-exportlocal@*/
|
||||
/*@dependent@*/ /*@null@*/
|
||||
availablePackage alGetPkg(/*@null@*/ availableList al, /*@null@*/ alKey pkgKey)
|
||||
/*@*/;
|
||||
/*@=exportlocal@*/
|
||||
|
||||
#ifdef DYING
|
||||
/**
|
||||
* Return (malloc'd) available package name-version-release string.
|
||||
* @param al available list
|
||||
* @param pkgKey available package key
|
||||
* @return name-version-release string
|
||||
*/
|
||||
/*@only@*/ /*@null@*/
|
||||
char * alGetNVR(/*@null@*/const availableList al, /*@null@*/ alKey pkgKey)
|
||||
/*@*/;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initialize available packckages, items, and directory list.
|
||||
* @param delta no. of entries to add on each realloc
|
||||
|
|
47
lib/rpmds.c
47
lib/rpmds.c
|
@ -13,7 +13,7 @@
|
|||
/*@access rpmFNSet @*/
|
||||
|
||||
/*@unchecked@*/
|
||||
static int _fns_debug = 1;
|
||||
static int _fns_debug = 0;
|
||||
|
||||
/*@-shadow@*/ /* XXX copy from depends.c for now. */
|
||||
static char * hGetNEVR(Header h, /*@out@*/ const char ** np)
|
||||
|
@ -39,8 +39,8 @@ rpmFNSet XrpmfnsUnlink(rpmFNSet fns, const char * msg, const char * fn, unsigned
|
|||
{
|
||||
if (fns == NULL) return NULL;
|
||||
/*@-modfilesystem@*/
|
||||
if (_fns_debug)
|
||||
fprintf(stderr, "--> fns %p -- %d %s at %s:%u\n", fns, fns->nrefs, msg, fn, ln);
|
||||
if (_fns_debug && msg != NULL)
|
||||
fprintf(stderr, "--> fi %p -- %d %s at %s:%u\n", fns, fns->nrefs, msg, fn, ln);
|
||||
/*@=modfilesystem@*/
|
||||
fns->nrefs--;
|
||||
return NULL;
|
||||
|
@ -51,8 +51,8 @@ rpmFNSet XrpmfnsLink(rpmFNSet fns, const char * msg, const char * fn, unsigned l
|
|||
if (fns == NULL) return NULL;
|
||||
fns->nrefs++;
|
||||
/*@-modfilesystem@*/
|
||||
if (_fns_debug)
|
||||
fprintf(stderr, "--> fns %p ++ %d %s at %s:%u\n", fns, fns->nrefs, msg, fn, ln);
|
||||
if (_fns_debug && msg != NULL)
|
||||
fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fns, fns->nrefs, msg, fn, ln);
|
||||
/*@=modfilesystem@*/
|
||||
/*@-refcounttrans@*/ return fns; /*@=refcounttrans@*/
|
||||
}
|
||||
|
@ -64,11 +64,11 @@ rpmFNSet fnsFree(rpmFNSet fns)
|
|||
if (fns == NULL) return NULL;
|
||||
|
||||
if (fns->nrefs > 1)
|
||||
return rpmfnsUnlink(fns, "dereference");
|
||||
return rpmfnsUnlink(fns, fns->Type);
|
||||
|
||||
/*@-modfilesystem@*/
|
||||
if (_fns_debug < 0)
|
||||
fprintf(stderr, "*** fns %p -- %s[%d]\n", fns, fns->Type, fns->fc);
|
||||
fprintf(stderr, "*** fi %p\t%s[%d]\n", fns, fns->Type, fns->fc);
|
||||
/*@=modfilesystem@*/
|
||||
|
||||
/*@-branchstate@*/
|
||||
|
@ -102,8 +102,8 @@ fprintf(stderr, "*** fns %p -- %s[%d]\n", fns, fns->Type, fns->fc);
|
|||
}
|
||||
/*@=branchstate@*/
|
||||
|
||||
(void) rpmfnsUnlink(fns, "destroy");
|
||||
/*@-refcounttrans -usereleased@*/
|
||||
(void) rpmfnsUnlink(fns, fns->Type);
|
||||
memset(fns, 0, sizeof(*fns)); /* XXX trash and burn */
|
||||
fns = _free(fns);
|
||||
/*@=refcounttrans =usereleased@*/
|
||||
|
@ -180,26 +180,26 @@ rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
|
|||
|
||||
/*@-modfilesystem@*/
|
||||
if (_fns_debug < 0)
|
||||
fprintf(stderr, "*** fns %p ++ %s[%d]\n", fns, fns->Type, fns->fc);
|
||||
fprintf(stderr, "*** fi %p\t%s[%d]\n", fns, fns->Type, fns->fc);
|
||||
/*@=modfilesystem@*/
|
||||
|
||||
}
|
||||
/*@=branchstate@*/
|
||||
|
||||
exit:
|
||||
return rpmfnsLink(fns, "create");
|
||||
return rpmfnsLink(fns, (fns ? fns->Type : NULL));
|
||||
}
|
||||
|
||||
/*@access rpmDepSet @*/
|
||||
|
||||
/*@unchecked@*/
|
||||
static int _ds_debug = 1;
|
||||
static int _ds_debug = 0;
|
||||
|
||||
rpmDepSet XrpmdsUnlink(rpmDepSet ds, const char * msg, const char * fn, unsigned ln)
|
||||
{
|
||||
if (ds == NULL) return NULL;
|
||||
/*@-modfilesystem@*/
|
||||
if (_ds_debug)
|
||||
if (_ds_debug && msg != NULL)
|
||||
fprintf(stderr, "--> ds %p -- %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
|
||||
/*@=modfilesystem@*/
|
||||
ds->nrefs--;
|
||||
|
@ -211,7 +211,7 @@ rpmDepSet XrpmdsLink(rpmDepSet ds, const char * msg, const char * fn, unsigned l
|
|||
if (ds == NULL) return NULL;
|
||||
ds->nrefs++;
|
||||
/*@-modfilesystem@*/
|
||||
if (_ds_debug)
|
||||
if (_ds_debug && msg != NULL)
|
||||
fprintf(stderr, "--> ds %p ++ %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
|
||||
/*@=modfilesystem@*/
|
||||
/*@-refcounttrans@*/ return ds; /*@=refcounttrans@*/
|
||||
|
@ -226,11 +226,11 @@ rpmDepSet dsFree(rpmDepSet ds)
|
|||
return NULL;
|
||||
|
||||
if (ds->nrefs > 1)
|
||||
return rpmdsUnlink(ds, "dereference");
|
||||
return rpmdsUnlink(ds, ds->Type);
|
||||
|
||||
/*@-modfilesystem@*/
|
||||
if (_ds_debug < 0)
|
||||
fprintf(stderr, "*** ds %p --\t%s[%d]\n", ds, ds->Type, ds->Count);
|
||||
fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
|
||||
/*@=modfilesystem@*/
|
||||
|
||||
|
||||
|
@ -269,7 +269,7 @@ fprintf(stderr, "*** ds %p --\t%s[%d]\n", ds, ds->Type, ds->Count);
|
|||
|
||||
ds->DNEVR = _free(ds->DNEVR);
|
||||
|
||||
(void) rpmdsUnlink(ds, "destroy");
|
||||
(void) rpmdsUnlink(ds, ds->Type);
|
||||
/*@-refcounttrans -usereleased@*/
|
||||
memset(ds, 0, sizeof(*ds)); /* XXX trash and burn */
|
||||
ds = _free(ds);
|
||||
|
@ -339,7 +339,7 @@ rpmDepSet dsNew(Header h, rpmTag tagN, int scareMem)
|
|||
|
||||
/*@-modfilesystem@*/
|
||||
if (_ds_debug < 0)
|
||||
fprintf(stderr, "*** ds %p ++\t%s[%d]\n", ds, ds->Type, ds->Count);
|
||||
fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
|
||||
/*@=modfilesystem@*/
|
||||
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ fprintf(stderr, "*** ds %p ++\t%s[%d]\n", ds, ds->Type, ds->Count);
|
|||
|
||||
exit:
|
||||
/*@-nullstate@*/ /* FIX: ds->Flags may be NULL */
|
||||
return rpmdsLink(ds, "create");
|
||||
return rpmdsLink(ds, (ds ? ds->Type : NULL));
|
||||
/*@=nullstate@*/
|
||||
}
|
||||
|
||||
|
@ -487,12 +487,13 @@ int dsiNext(/*@null@*/ rpmDepSet ds)
|
|||
|
||||
} else
|
||||
ds->i = -1;
|
||||
}
|
||||
|
||||
/*@-modfilesystem -nullderef -nullpass @*/
|
||||
if (_ds_debug < 0&& i != -1)
|
||||
fprintf(stderr, "*** ds %p\t%s[%d]: %s\n", ds, (ds && ds->Type ? ds->Type : "?Type?"), i, (ds->DNEVR ? ds->DNEVR : "?DNEVR?"));
|
||||
/*@=modfilesystem =nullderef =nullpass @*/
|
||||
/*@-modfilesystem @*/
|
||||
if (_ds_debug < 0 && i != -1)
|
||||
fprintf(stderr, "*** ds %p\t%s[%d]: %s\n", ds, (ds->Type ? ds->Type : "?Type?"), i, (ds->DNEVR ? ds->DNEVR : "?DNEVR?"));
|
||||
/*@=modfilesystem @*/
|
||||
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
|
16
lib/rpmds.h
16
lib/rpmds.h
|
@ -98,14 +98,14 @@ extern "C" {
|
|||
*/
|
||||
/*@unused@*/ /*@null@*/
|
||||
rpmFNSet rpmfnsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmFNSet fns,
|
||||
const char * msg)
|
||||
/*@null@*/ const char * msg)
|
||||
/*@modifies fns @*/;
|
||||
|
||||
/** @todo Remove debugging entry from the ABI. */
|
||||
/*@-exportlocal@*/
|
||||
/*@null@*/
|
||||
rpmFNSet XrpmfnsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmFNSet fns,
|
||||
const char * msg, const char * fn, unsigned ln)
|
||||
/*@null@*/ const char * msg, const char * fn, unsigned ln)
|
||||
/*@modifies fns @*/;
|
||||
/*@=exportlocal@*/
|
||||
#define rpmfnsUnlink(_fns, _msg) XrpmfnsUnlink(_fns, _msg, __FILE__, __LINE__)
|
||||
|
@ -116,11 +116,11 @@ rpmFNSet XrpmfnsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmFNSet fns,
|
|||
* @return new file info set reference
|
||||
*/
|
||||
/*@unused@*/
|
||||
rpmFNSet rpmfnsLink (/*@null@*/ rpmFNSet fns, const char * msg)
|
||||
rpmFNSet rpmfnsLink (/*@null@*/ rpmFNSet fns, /*@null@*/ const char * msg)
|
||||
/*@modifies fns @*/;
|
||||
|
||||
/** @todo Remove debugging entry from the ABI. */
|
||||
rpmFNSet XrpmfnsLink (/*@null@*/ rpmFNSet fns, const char * msg,
|
||||
rpmFNSet XrpmfnsLink (/*@null@*/ rpmFNSet fns, /*@null@*/ const char * msg,
|
||||
const char * fn, unsigned ln)
|
||||
/*@modifies fns @*/;
|
||||
#define rpmfnsLink(_fns, _msg) XrpmfnsLink(_fns, _msg, __FILE__, __LINE__)
|
||||
|
@ -152,14 +152,14 @@ rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
|
|||
*/
|
||||
/*@unused@*/ /*@null@*/
|
||||
rpmDepSet rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
|
||||
const char * msg)
|
||||
/*@null@*/ const char * msg)
|
||||
/*@modifies ds @*/;
|
||||
|
||||
/** @todo Remove debugging entry from the ABI. */
|
||||
/*@-exportlocal@*/
|
||||
/*@null@*/
|
||||
rpmDepSet XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
|
||||
const char * msg, const char * fn, unsigned ln)
|
||||
/*@null@*/ const char * msg, const char * fn, unsigned ln)
|
||||
/*@modifies ds @*/;
|
||||
/*@=exportlocal@*/
|
||||
#define rpmdsUnlink(_ds, _msg) XrpmdsUnlink(_ds, _msg, __FILE__, __LINE__)
|
||||
|
@ -170,11 +170,11 @@ rpmDepSet XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
|
|||
* @return new dependency set reference
|
||||
*/
|
||||
/*@unused@*/
|
||||
rpmDepSet rpmdsLink (/*@null@*/ rpmDepSet ds, const char * msg)
|
||||
rpmDepSet rpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg)
|
||||
/*@modifies ds @*/;
|
||||
|
||||
/** @todo Remove debugging entry from the ABI. */
|
||||
rpmDepSet XrpmdsLink (/*@null@*/ rpmDepSet ds, const char * msg,
|
||||
rpmDepSet XrpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg,
|
||||
const char * fn, unsigned ln)
|
||||
/*@modifies ds @*/;
|
||||
#define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
|
||||
|
|
|
@ -1091,7 +1091,7 @@ void rpmProblemSetPrint(FILE *fp, rpmProblemSet ps)
|
|||
void rpmProblemSetAppend(/*@null@*/ rpmProblemSet ps, rpmProblemType type,
|
||||
/*@null@*/ const char * pkgNEVR,
|
||||
/*@exposed@*/ /*@null@*/ fnpyKey key,
|
||||
const char * dn, const char * bn,
|
||||
/*@null@*/ const char * dn, /*@null@*/ const char * bn,
|
||||
/*@null@*/ const char * altNEVR,
|
||||
unsigned long ulong1)
|
||||
/*@modifies ps @*/;
|
||||
|
|
|
@ -61,6 +61,7 @@ extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
|
|||
/*@access alKey @*/
|
||||
/*@access fnpyKey @*/
|
||||
|
||||
/*@access rpmDepSet @*/
|
||||
/*@access rpmFNSet @*/
|
||||
/*@access TFI_t @*/
|
||||
|
||||
|
@ -71,12 +72,12 @@ extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
|
|||
/**
|
||||
*/
|
||||
struct diskspaceInfo {
|
||||
dev_t dev; /*!< file system device number. */
|
||||
signed long bneeded; /*!< no. of blocks needed. */
|
||||
signed long ineeded; /*!< no. of inodes needed. */
|
||||
int bsize; /*!< file system block size. */
|
||||
signed long bavail; /*!< no. of blocks available. */
|
||||
signed long iavail; /*!< no. of inodes available. */
|
||||
dev_t dev; /*!< File system device number. */
|
||||
signed long bneeded; /*!< No. of blocks needed. */
|
||||
signed long ineeded; /*!< No. of inodes needed. */
|
||||
int bsize; /*!< File system block size. */
|
||||
signed long bavail; /*!< No. of blocks available. */
|
||||
signed long iavail; /*!< No. of inodes available. */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -143,67 +144,20 @@ int rpmtransGetKeys(const rpmTransactionSet ts, fnpyKey ** ep, int * nep)
|
|||
|
||||
/**
|
||||
*/
|
||||
static int archOkay(Header h, /*@out@*/ const char ** pkgArchPtr)
|
||||
/*@modifies *pkgArchPtr @*/
|
||||
static int archOkay(/*@null@*/ const char * pkgArch)
|
||||
/*@*/
|
||||
{
|
||||
const char * pkgArch;
|
||||
int type, count;
|
||||
int rc = 1; /* assume AOK */
|
||||
|
||||
if (pkgArchPtr != NULL) *pkgArchPtr = pkgArch = NULL;
|
||||
|
||||
/* make sure we're trying to install this on the proper architecture */
|
||||
(void) headerGetEntry(h, RPMTAG_ARCH, &type, (void **) &pkgArch, &count);
|
||||
|
||||
#ifdef DYING
|
||||
if (type == RPM_INT8_TYPE) {
|
||||
int_8 * pkgArchNum;
|
||||
int archNum;
|
||||
|
||||
/* old arch handling */
|
||||
rpmGetArchInfo(NULL, &archNum);
|
||||
pkgArchNum = pkgArch;
|
||||
if (archNum != *pkgArchNum)
|
||||
rc = 0;
|
||||
} else
|
||||
#endif
|
||||
|
||||
if (!rpmMachineScore(RPM_MACHTABLE_INSTARCH, pkgArch)) {
|
||||
rc = 0;
|
||||
if (pkgArchPtr != NULL) *pkgArchPtr = pkgArch;
|
||||
}
|
||||
|
||||
return rc;
|
||||
if (pkgArch == NULL) return 0;
|
||||
return (rpmMachineScore(RPM_MACHTABLE_INSTARCH, pkgArch) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static int osOkay(Header h, /*@out@*/ const char ** pkgOsPtr)
|
||||
/*@modifies *pkgOsPtr @*/
|
||||
static int osOkay(/*@null@*/ const char * pkgOs)
|
||||
/*@*/
|
||||
{
|
||||
const char * pkgOs;
|
||||
int type, count;
|
||||
int rc = 1; /* assume AOK */
|
||||
|
||||
if (pkgOsPtr != NULL) *pkgOsPtr = pkgOs = NULL;
|
||||
|
||||
/* make sure we're trying to install this on the proper os */
|
||||
(void) headerGetEntry(h, RPMTAG_OS, &type, (void **) &pkgOs, &count);
|
||||
|
||||
#ifdef DYING
|
||||
if (type == RPM_INT8_TYPE) {
|
||||
/* v1 packages and v2 packages both used improper OS numbers, so just
|
||||
deal with it hope things work */
|
||||
return 1;
|
||||
} else
|
||||
#endif
|
||||
|
||||
if (!rpmMachineScore(RPM_MACHTABLE_INSTOS, pkgOs)) {
|
||||
rc = 0;
|
||||
if (pkgOsPtr != NULL) *pkgOsPtr = pkgOs;
|
||||
}
|
||||
|
||||
return rc;
|
||||
if (pkgOs == NULL) return 0;
|
||||
return (rpmMachineScore(RPM_MACHTABLE_INSTOS, pkgOs) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -706,7 +660,13 @@ static void handleOverlappedFiles(const rpmTransactionSet ts, TFI_t fi)
|
|||
}
|
||||
|
||||
/**
|
||||
* Ensure that current package is newer than installed package.
|
||||
* @param ts transaction set
|
||||
* @param p current transaction element
|
||||
* @param h installed header
|
||||
* @return 0 if not newer, 1 if okay
|
||||
*/
|
||||
#ifdef DYING
|
||||
static int ensureOlder(rpmTransactionSet ts,
|
||||
const Header h, /*@null@*/ const Header old,
|
||||
/*@dependent@*/ /*@null@*/ const void * key)
|
||||
|
@ -736,6 +696,64 @@ static int ensureOlder(rpmTransactionSet ts,
|
|||
|
||||
return rc;
|
||||
}
|
||||
#else
|
||||
static int ensureOlder(rpmTransactionSet ts, transactionElement p, Header h)
|
||||
/*@modifies ts @*/
|
||||
{
|
||||
rpmDepSet req = memset(alloca(sizeof(*req)), 0, sizeof(*req));
|
||||
const char * reqEVR;
|
||||
int_32 reqFlags = (RPMSENSE_LESS | RPMSENSE_EQUAL);
|
||||
char * t;
|
||||
int rc;
|
||||
|
||||
if (p == NULL || h == NULL)
|
||||
return 1;
|
||||
|
||||
t = alloca(strlen(p->NEVR) + (p->epoch != NULL ? strlen(p->epoch) : 0) + 1);
|
||||
*t = '\0';
|
||||
reqEVR = t;
|
||||
if (p->epoch != NULL) t = stpcpy( stpcpy(t, p->epoch), ":");
|
||||
if (p->version != NULL) t = stpcpy(t, p->version);
|
||||
*t++ = '-';
|
||||
if (p->release != NULL) t = stpcpy(t, p->release);
|
||||
|
||||
/*@-compmempass@*/
|
||||
req->i = -1;
|
||||
req->Type = "Requires";
|
||||
req->tagN = RPMTAG_REQUIRENAME;
|
||||
req->DNEVR = NULL;
|
||||
/*@-immediatetrans@*/
|
||||
/*@-assignexpose@*/
|
||||
req->N = (const char **) &p->name;
|
||||
/*@=assignexpose@*/
|
||||
req->EVR = &reqEVR;
|
||||
req->Flags = &reqFlags;
|
||||
/*@=immediatetrans@*/
|
||||
req->Count = 1;
|
||||
(void) dsiNext(dsiInit(req));
|
||||
|
||||
rc = headerMatchesDepFlags(h, req);
|
||||
|
||||
req->DNEVR = _free(req->DNEVR);
|
||||
/*@=compmempass@*/
|
||||
|
||||
/*@-branchstate@*/ /* FIX: p->key ??? */
|
||||
if (rc == 0) {
|
||||
const char * altNEVR = hGetNEVR(h, NULL);
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_OLDPACKAGE,
|
||||
p->NEVR, p->key,
|
||||
NULL, NULL,
|
||||
altNEVR,
|
||||
0);
|
||||
altNEVR = _free(altNEVR);
|
||||
rc = 1;
|
||||
} else
|
||||
rc = 0;
|
||||
/*@=branchstate@*/
|
||||
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -1055,46 +1073,29 @@ int keep_header = 1; /* XXX rpmProblemSetAppend prevents dumping headers. */
|
|||
/* The ordering doesn't matter here */
|
||||
tei = teInitIterator(ts);
|
||||
while ((p = teNext(tei, TR_ADDED)) != NULL) {
|
||||
const char * n, * v, * r;
|
||||
fnpyKey key;
|
||||
rpmdbMatchIterator mi;
|
||||
const char * str1;
|
||||
Header h;
|
||||
|
||||
pkgKey = p->u.addedKey;
|
||||
|
||||
h = alGetHeader(ts->addedPackages, pkgKey, 0);
|
||||
if (h == NULL) /* XXX can't happen */
|
||||
continue;
|
||||
|
||||
(void) headerNVR(h, &n, &v, &r);
|
||||
key = p->key;
|
||||
|
||||
str1 = NULL;
|
||||
if (!archOkay(h, &str1) && !(ts->ignoreSet & RPMPROB_FILTER_IGNOREARCH)) {
|
||||
const char * pkgNEVR = hGetNEVR(h, NULL);
|
||||
/*@-branchstate@*/ /* FIX: p->key ??? */
|
||||
if (!archOkay(p->arch) && !(ts->ignoreSet & RPMPROB_FILTER_IGNOREARCH))
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_BADARCH,
|
||||
pkgNEVR, key,
|
||||
str1, NULL,
|
||||
p->NEVR, p->key,
|
||||
p->arch, NULL,
|
||||
NULL, 0);
|
||||
pkgNEVR = _free(pkgNEVR);
|
||||
}
|
||||
|
||||
str1 = NULL;
|
||||
if (!osOkay(h, &str1) && !(ts->ignoreSet & RPMPROB_FILTER_IGNOREOS)) {
|
||||
const char * pkgNEVR = hGetNEVR(h, NULL);
|
||||
if (!osOkay(p->os) && !(ts->ignoreSet & RPMPROB_FILTER_IGNOREOS))
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_BADOS,
|
||||
pkgNEVR, key,
|
||||
str1, NULL,
|
||||
p->NEVR, p->key,
|
||||
p->os, NULL,
|
||||
NULL, 0);
|
||||
pkgNEVR = _free(pkgNEVR);
|
||||
}
|
||||
/*@=branchstate@*/
|
||||
|
||||
if (!(ts->ignoreSet & RPMPROB_FILTER_OLDPACKAGE)) {
|
||||
Header oldH;
|
||||
mi = rpmtsInitIterator(ts, RPMTAG_NAME, n, 0);
|
||||
while ((oldH = rpmdbNextIterator(mi)) != NULL)
|
||||
xx = ensureOlder(ts, h, oldH, key);
|
||||
Header h;
|
||||
mi = rpmtsInitIterator(ts, RPMTAG_NAME, p->name, 0);
|
||||
while ((h = rpmdbNextIterator(mi)) != NULL)
|
||||
xx = ensureOlder(ts, p, h);
|
||||
mi = rpmdbFreeIterator(mi);
|
||||
}
|
||||
|
||||
|
@ -1104,17 +1105,17 @@ int keep_header = 1; /* XXX rpmProblemSetAppend prevents dumping headers. */
|
|||
&& !alGetMultiLib(ts->addedPackages, i)
|
||||
#endif
|
||||
) {
|
||||
mi = rpmtsInitIterator(ts, RPMTAG_NAME, n, 0);
|
||||
xx = rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_DEFAULT, v);
|
||||
xx = rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_DEFAULT, r);
|
||||
mi = rpmtsInitIterator(ts, RPMTAG_NAME, p->name, 0);
|
||||
xx = rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_DEFAULT,
|
||||
p->version);
|
||||
xx = rpmdbSetIteratorRE(mi, RPMTAG_RELEASE, RPMMIRE_DEFAULT,
|
||||
p->release);
|
||||
|
||||
while (rpmdbNextIterator(mi) != NULL) {
|
||||
const char * pkgNEVR = hGetNEVR(h, NULL);
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_PKG_INSTALLED,
|
||||
pkgNEVR, key,
|
||||
p->NEVR, p->key,
|
||||
NULL, NULL,
|
||||
NULL, 0);
|
||||
pkgNEVR = _free(pkgNEVR);
|
||||
/*@innerbreak@*/ break;
|
||||
}
|
||||
mi = rpmdbFreeIterator(mi);
|
||||
|
@ -1124,8 +1125,6 @@ int keep_header = 1; /* XXX rpmProblemSetAppend prevents dumping headers. */
|
|||
if (p->fns != NULL)
|
||||
totalFileCount += p->fns->fc;
|
||||
|
||||
h = headerFree(h, "alGetHeader (rpmtsRun sanity)");
|
||||
|
||||
}
|
||||
tei = teFreeIterator(tei);
|
||||
|
||||
|
@ -1148,7 +1147,7 @@ int keep_header = 1; /* XXX rpmProblemSetAppend prevents dumping headers. */
|
|||
/* ===============================================
|
||||
* Initialize transaction element file info for package:
|
||||
*/
|
||||
ts->flEntries = alGetSize(ts->addedPackages) + ts->numRemovedPackages;
|
||||
ts->flEntries = ts->numAddedPackages + ts->numRemovedPackages;
|
||||
ts->flList = xcalloc(ts->flEntries, sizeof(*ts->flList));
|
||||
|
||||
/*
|
||||
|
|
|
@ -515,7 +515,7 @@ static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmTransactionSet ts,
|
|||
te = t = alloca(nb);
|
||||
*te = '\0';
|
||||
pkgNEVR = (conflicts->pkgNEVR ? conflicts->pkgNEVR : "?pkgNEVR?");
|
||||
sprintf(te, _("Unsatisifed dependencies for %s:"), pkgNEVR);
|
||||
sprintf(te, _("Unsatisifed dependencies for %s: "), pkgNEVR);
|
||||
te += strlen(te);
|
||||
for (i = 0; i < numConflicts; i++) {
|
||||
c = conflicts + i;
|
||||
|
|
56
po/rpm.pot
56
po/rpm.pot
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2001-11-09 20:32-0500\n"
|
||||
"POT-Creation-Date: 2001-11-10 14:13-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"
|
||||
|
@ -1415,88 +1415,88 @@ msgstr ""
|
|||
msgid "cannot open Packages database in %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:354
|
||||
#: lib/depends.c:431
|
||||
#, c-format
|
||||
msgid "newer package %s already added, skipping %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:359
|
||||
#: lib/depends.c:436
|
||||
#, c-format
|
||||
msgid "package %s already added, ignoring\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:364
|
||||
#: lib/depends.c:441
|
||||
#, c-format
|
||||
msgid "older package %s already added, replacing with %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:716
|
||||
#: lib/depends.c:739
|
||||
msgid "(cached)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:741
|
||||
#: lib/depends.c:764
|
||||
msgid "(rpmrc provides)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:757
|
||||
#: lib/depends.c:780
|
||||
msgid "(rpmlib provides)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:778
|
||||
#: lib/depends.c:801
|
||||
msgid "(db files)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:790
|
||||
#: lib/depends.c:813
|
||||
msgid "(db provides)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:803
|
||||
#: lib/depends.c:826
|
||||
msgid "(db package)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:842
|
||||
#: lib/depends.c:865
|
||||
#, c-format
|
||||
msgid "%9s: (%s, %s) added to Depends cache.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:844 lib/rpmds.c:468 lib/rpmds.c:625
|
||||
#: lib/depends.c:867 lib/rpmds.c:468 lib/rpmds.c:626
|
||||
msgid "NO "
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:844 lib/rpmds.c:468 lib/rpmds.c:625
|
||||
#: lib/depends.c:867 lib/rpmds.c:468 lib/rpmds.c:626
|
||||
msgid "YES"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1178
|
||||
#: lib/depends.c:1201
|
||||
#, c-format
|
||||
msgid "removing %s \"%s\" from tsort relations.\n"
|
||||
msgstr ""
|
||||
|
||||
#. Record all relations.
|
||||
#: lib/depends.c:1424
|
||||
#: lib/depends.c:1431
|
||||
msgid "========== recording tsort relations\n"
|
||||
msgstr ""
|
||||
|
||||
#. T4. Scan for zeroes.
|
||||
#: lib/depends.c:1497
|
||||
#: lib/depends.c:1504
|
||||
msgid ""
|
||||
"========== tsorting packages (order, #predecessors, #succesors, depth)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1572
|
||||
#: lib/depends.c:1579
|
||||
msgid "========== successors only (presentation order)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1633
|
||||
#: lib/depends.c:1640
|
||||
msgid "LOOP:\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1668
|
||||
#: lib/depends.c:1675
|
||||
msgid "========== continuing tsort ...\n"
|
||||
msgstr ""
|
||||
|
||||
#. Return no. of packages that could not be ordered.
|
||||
#: lib/depends.c:1673
|
||||
#: lib/depends.c:1680
|
||||
#, c-format
|
||||
msgid "rpmdepOrder failed, %d elements remain\n"
|
||||
msgstr ""
|
||||
|
@ -2411,11 +2411,11 @@ msgstr ""
|
|||
msgid "package %s is not installed\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmal.c:695
|
||||
#: lib/rpmal.c:688
|
||||
msgid "(added files)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmal.c:794
|
||||
#: lib/rpmal.c:787
|
||||
msgid "(added provide)"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2483,20 +2483,20 @@ msgid "OK"
|
|||
msgstr ""
|
||||
|
||||
#. XXX legacy epoch-less requires/conflicts compatibility
|
||||
#: lib/rpmds.c:595
|
||||
#: lib/rpmds.c:596
|
||||
#, c-format
|
||||
msgid ""
|
||||
"the \"B\" dependency needs an epoch (assuming same as \"A\")\n"
|
||||
"\tA %s\tB %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/rpmds.c:624
|
||||
#: lib/rpmds.c:625
|
||||
#, c-format
|
||||
msgid " %s A %s\tB %s\n"
|
||||
msgstr ""
|
||||
|
||||
#. @=branchstate@
|
||||
#: lib/rpmds.c:649
|
||||
#: lib/rpmds.c:650
|
||||
#, c-format
|
||||
msgid "package %s has unsatisfied %s: %s\n"
|
||||
msgstr ""
|
||||
|
@ -2825,13 +2825,13 @@ msgstr ""
|
|||
msgid "Signature: UNKNOWN (%d)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/transaction.c:252
|
||||
#: lib/transaction.c:206
|
||||
#, c-format
|
||||
msgid "%s skipped due to missingok flag\n"
|
||||
msgstr ""
|
||||
|
||||
#. @innercontinue@
|
||||
#: lib/transaction.c:905
|
||||
#: lib/transaction.c:923
|
||||
#, c-format
|
||||
msgid "excluding directory %s\n"
|
||||
msgstr ""
|
||||
|
@ -2851,7 +2851,7 @@ msgstr ""
|
|||
|
||||
#: lib/verify.c:518
|
||||
#, c-format
|
||||
msgid "Unsatisifed dependencies for %s:"
|
||||
msgid "Unsatisifed dependencies for %s: "
|
||||
msgstr ""
|
||||
|
||||
#: lib/verify.c:556
|
||||
|
|
Loading…
Reference in New Issue