summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/depends.c199
-rw-r--r--lib/depends.h2
-rw-r--r--lib/hdrinline.h7
-rw-r--r--lib/header.c19
-rw-r--r--lib/header.h9
-rw-r--r--lib/rpmds.c200
-rw-r--r--lib/rpmds.h30
-rw-r--r--lib/rpmlibprov.c29
-rw-r--r--lib/transaction.c25
-rw-r--r--po/rpm.pot94
10 files changed, 311 insertions, 303 deletions
diff --git a/lib/depends.c b/lib/depends.c
index 17c6b3caf..1525e39b4 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -155,6 +155,7 @@ static void delTE(transactionElement p)
p->relocs = _free(p->relocs);
}
+ p->this = dsFree(p->this);
p->provides = dsFree(p->provides);
p->requires = dsFree(p->requires);
p->conflicts = dsFree(p->conflicts);
@@ -163,14 +164,14 @@ static void delTE(transactionElement p)
/*@-type@*/ /* FIX: cast? */
if (p->fd != NULL)
- p->fd = fdFree(p->fd, "alAddPackage (rpmtransFree)");
+ p->fd = fdFree(p->fd, "alAddPackage (delTE)");
/*@=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);
+ p->NEVR = _free(p->NEVR);
memset(p, 0, sizeof(*p)); /* XXX trash and burn */
/*@-nullstate@*/ /* FIX: p->{NEVR,name} annotations */
return;
@@ -185,8 +186,8 @@ static void addTE(transactionElement p, Header h,
{
int scareMem = _DS_SCAREMEM;
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
- const char * arch, * os;
int_32 * ep;
+ const char * arch, * os;
int xx;
p->NEVR = hGetNEVR(h, NULL);
@@ -213,6 +214,7 @@ static void addTE(transactionElement p, Header h,
p->epoch = NULL;
/*@=branchstate@*/
+ p->this = dsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
p->provides = dsNew(h, RPMTAG_PROVIDENAME, scareMem);
p->fns = fnsNew(h, RPMTAG_BASENAMES, scareMem);
p->requires = dsNew(h, RPMTAG_REQUIRENAME, scareMem);
@@ -224,7 +226,7 @@ static void addTE(transactionElement p, Header h,
/*@=assignexpose =ownedtrans @*/
/*@-type@*/ /* FIX: cast? */
- p->fd = (fd != NULL ? fdLink(fd, "rpmtransAddPackage") : NULL);
+ p->fd = (fd != NULL ? fdLink(fd, "addTE") : NULL);
/*@=type@*/
if (relocs != NULL) {
@@ -383,15 +385,12 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
fnpyKey key, int upgrade, rpmRelocation * relocs)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
- const char * name = NULL;
- char * addNEVR = hGetNEVR(h, &name);
- char * pkgNEVR = NULL;
int isSource;
int duplicate = 0;
teIterator pi; transactionElement p;
+ rpmDepSet add;
rpmDepSet obsoletes;
alKey pkgKey; /* addedPackages key */
- int apx; /* addedPackages index */
int xx;
int ec = 0;
int rc;
@@ -399,53 +398,29 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
/*
* Check for previously added versions with the same name.
+ * FIXME: only catches previously added, older packages.
*/
- apx = 0;
+ add = dsThis(h, RPMTAG_REQUIRENAME, (RPMSENSE_EQUAL|RPMSENSE_LESS));
+ pkgKey = RPMAL_NOMATCH;
pi = teInitIterator(ts);
/* XXX Only added packages need be checked for dupes. */
while ((p = teNext(pi, TR_ADDED)) != NULL) {
- const char * pname;
- Header ph;
-
- apx++;
-
- ph = alGetHeader(ts->addedPackages, p->u.addedKey, 0);
- if (ph == NULL)
- break;
-
- pkgNEVR = _free(pkgNEVR);
- pname = NULL;
- pkgNEVR = hGetNEVR(ph, &pname);
-
- if (strcmp(pname, name)) {
- pkgNEVR = _free(pkgNEVR);
- ph = headerFree(ph, "alGetHeader nomatch");
- continue;
- }
-
- rc = rpmVersionCompare(ph, h);
- ph = headerFree(ph, "alGetHeader match");
-
- if (rc > 0) {
+ rc = dsCompare(add, p->this);
+ if (rc != 0) {
+ const char * pkgNEVR = dsiGetDNEVR(p->this);
+ const char * addNEVR = dsiGetDNEVR(add);
rpmMessage(RPMMESS_WARNING,
- _("newer package %s already added, skipping %s\n"),
- pkgNEVR, addNEVR);
- goto exit;
- } else if (rc == 0) {
- rpmMessage(RPMMESS_WARNING,
- _("package %s already added, ignoring\n"),
- pkgNEVR);
- goto exit;
- } else {
- rpmMessage(RPMMESS_WARNING,
- _("older package %s already added, replacing with %s\n"),
- pkgNEVR, addNEVR);
+ _("package %s was already added, replacing with %s\n"),
+ (pkgNEVR ? pkgNEVR + 2 : "?pkgNEVR?"),
+ (addNEVR ? addNEVR + 2 : "?addNEVR?"));
duplicate = 1;
+ pkgKey = p->u.addedKey;
+ break;
}
- break;
}
pi = teFreeIterator(pi);
- oc = (p == NULL ? ts->orderCount : (p - ts->order));
+ add = dsFree(add);
+ oc = (p ? (p - ts->order) : ts->orderCount);
isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE);
@@ -463,8 +438,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
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,
+ pkgKey = alAddPackage(ts->addedPackages, pkgKey, p->key, h,
p->provides, p->fns);
if (pkgKey == RPMAL_NOMATCH) {
ec = 1;
@@ -498,7 +472,6 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
#endif
if (!duplicate) {
-assert(apx == ts->numAddedPackages);
ts->numAddedPackages++;
ts->orderCount++;
}
@@ -581,8 +554,6 @@ assert(apx == ts->numAddedPackages);
ec = 0;
exit:
- pkgNEVR = _free(pkgNEVR);
- addNEVR = _free(addNEVR);
pi = teFreeIterator(pi);
return ec;
}
@@ -630,36 +601,7 @@ 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);
- 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);
-#else
delTE(p);
-#endif
}
pi = teFreeIterator(pi);
@@ -874,29 +816,26 @@ exit:
/**
* Check header requires/conflicts against against installed+added packages.
* @param ts transaction set
- * @param h header to check
- * @param keyName dependency name
+ * @param pkgNEVR package name-version-release
+ * @param requires Requires: dependencies (or NULL)
+ * @param conflicts Conflicts: dependencies (or NULL)
+ * @param keyName dependency name to filter (or NULL)
* @param multiLib skip multilib colored dependencies?
* @return 0 no problems found
*/
-static int checkPackageDeps(rpmTransactionSet ts,
- Header h, const char * keyName, uint_32 multiLib)
+static int checkPackageDeps(rpmTransactionSet ts, const char * pkgNEVR,
+ /*@null@*/ rpmDepSet requires, /*@null@*/ rpmDepSet conflicts,
+ /*@null@*/ const char * keyName, uint_32 multiLib)
/*@globals fileSystem @*/
- /*@modifies ts, h, fileSystem */
+ /*@modifies ts, requires, conflicts, fileSystem */
{
rpmProblemSet ps = ts->probs;
- const char * name, * version, * release;
- int scareMem = _DS_SCAREMEM;
- rpmDepSet requires;
- rpmDepSet conflicts;
const char * Name;
int_32 Flags;
- int rc, xx;
+ int rc;
int ourrc = 0;
- xx = headerNVR(h, &name, &version, &release);
-
- requires = dsiInit(dsNew(h, RPMTAG_REQUIRENAME, scareMem));
+ requires = dsiInit(requires);
if (requires != NULL)
while (!ourrc && dsiNext(requires) >= 0) {
@@ -929,7 +868,7 @@ static int checkPackageDeps(rpmTransactionSet ts,
}
/*@=branchstate@*/
- dsProblem(ps, h, requires, suggestedKeys);
+ dsProblem(ps, pkgNEVR, requires, suggestedKeys);
}
/*@switchbreak@*/ break;
@@ -939,9 +878,8 @@ static int checkPackageDeps(rpmTransactionSet ts,
/*@switchbreak@*/ break;
}
}
- requires = dsFree(requires);
- conflicts = dsiInit(dsNew(h, RPMTAG_CONFLICTNAME, scareMem));
+ conflicts = dsiInit(conflicts);
if (conflicts != NULL)
while (!ourrc && dsiNext(conflicts) >= 0) {
@@ -965,7 +903,7 @@ static int checkPackageDeps(rpmTransactionSet ts,
switch (rc) {
case 0: /* conflicts exist. */
/*@-mayaliasunique@*/ /* LCL: NULL may alias h ??? */
- dsProblem(ps, h, conflicts, NULL);
+ dsProblem(ps, pkgNEVR, conflicts, NULL);
/*@=mayaliasunique@*/
/*@switchbreak@*/ break;
case 1: /* conflicts don't exist. */
@@ -976,7 +914,6 @@ static int checkPackageDeps(rpmTransactionSet ts,
/*@switchbreak@*/ break;
}
}
- conflicts = dsFree(conflicts);
return ourrc;
}
@@ -995,20 +932,33 @@ static int checkPackageSet(rpmTransactionSet ts,
/*@globals fileSystem @*/
/*@modifies ts, mi, fileSystem @*/
{
+ int scareMem = 1;
Header h;
- int rc = 0;
+ int ec = 0;
(void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
- if (checkPackageDeps(ts, h, key, 0)) {
- rc = 1;
+ const char * pkgNEVR;
+ rpmDepSet requires, conflicts;
+ int rc;
+
+ pkgNEVR = hGetNEVR(h, NULL);
+ requires = dsNew(h, RPMTAG_REQUIRENAME, scareMem);
+ conflicts = dsNew(h, RPMTAG_CONFLICTNAME, scareMem);
+ rc = checkPackageDeps(ts, pkgNEVR, requires, conflicts, key, 0);
+ conflicts = dsFree(conflicts);
+ requires = dsFree(requires);
+ pkgNEVR = _free(pkgNEVR);
+
+ if (rc) {
+ ec = 1;
break;
}
}
mi = rpmdbFreeIterator(mi);
- return rc;
+ return ec;
}
/**
@@ -1392,6 +1342,9 @@ static void addQ(transactionElement p,
int rpmdepOrder(rpmTransactionSet ts)
{
+ rpmDepSet requires;
+ int_32 Flags;
+
int numAddedPackages = ts->numAddedPackages;
int chainsaw = ts->transFlags & RPMTRANS_FLAG_CHAINSAW;
teIterator pi; transactionElement p;
@@ -1432,8 +1385,6 @@ 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) {
- rpmDepSet requires;
- int_32 Flags;
requires = p->requires;
if (requires == NULL)
@@ -1629,7 +1580,6 @@ prtTSI(" p", p->tsi);
/* T13. Print predecessor chain from start of loop. */
while ((p = q) != NULL && (q = p->tsi->tsi_chain) != NULL) {
- rpmDepSet requires;
const char * dp;
char buf[4096];
@@ -1804,7 +1754,6 @@ int rpmdepCheck(rpmTransactionSet ts,
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
rpmdbMatchIterator mi = NULL;
- Header h = NULL;
teIterator pi = NULL; transactionElement p;
int closeatexit = 0;
int j, xx;
@@ -1832,37 +1781,19 @@ int rpmdepCheck(rpmTransactionSet ts,
pi = teInitIterator(ts);
/* XXX Only added packages are checked (for now). */
while ((p = teNext(pi, TR_ADDED)) != NULL) {
- char * pkgNVR = NULL, * n, * v, * r;
rpmDepSet provides;
uint_32 multiLib;
- h = alGetHeader(ts->addedPackages, p->u.addedKey, 0);
- if (h == NULL) /* XXX can't happen */
- break;
-
- pkgNVR = _free(pkgNVR);
- pkgNVR = hGetNEVR(h, NULL);
multiLib = p->multiLib;
- rpmMessage(RPMMESS_DEBUG, "========== +++ %s\n" , pkgNVR);
- rc = checkPackageDeps(ts, h, NULL, multiLib);
- h = headerFree(h, "alGetHeader");
-
- if (rc) {
- pkgNVR = _free(pkgNVR);
+ rpmMessage(RPMMESS_DEBUG, "========== +++ %s\n" , p->NEVR);
+ rc = checkPackageDeps(ts, p->NEVR, p->requires, p->conflicts,
+ NULL, multiLib);
+ if (rc)
goto exit;
- }
/* Adding: check name against conflicts matches. */
-
- if ((r = strrchr(pkgNVR, '-')) != NULL)
- *r++ = '\0';
- if ((v = strrchr(pkgNVR, '-')) != NULL)
- *v++ = '\0';
- n = pkgNVR;
-
- rc = checkDependentConflicts(ts, n);
- pkgNVR = _free(pkgNVR);
+ rc = checkDependentConflicts(ts, p->name);
if (rc)
goto exit;
@@ -1894,17 +1825,17 @@ int rpmdepCheck(rpmTransactionSet ts,
/*@-branchstate@*/
if (ts->numRemovedPackages > 0) {
rpmDepSet provides;
+ Header h;
mi = rpmtsInitIterator(ts, RPMDBI_PACKAGES, NULL, 0);
xx = rpmdbAppendIterator(mi,
ts->removedPackages, ts->numRemovedPackages);
while ((h = rpmdbNextIterator(mi)) != NULL) {
- { const char * name, * version, * release;
-
- xx = headerNVR(h, &name, &version, &release);
- rpmMessage(RPMMESS_DEBUG, "========== --- %s-%s-%s\n" ,
- name, version, release);
+ { const char * name = NULL;
+ const char * pkgNEVR = hGetNEVR(h, &name);
+ rpmMessage(RPMMESS_DEBUG, "========== --- %s\n" , pkgNEVR);
+ pkgNEVR = _free(pkgNEVR);
/* Erasing: check name against requiredby matches. */
rc = checkDependentPackages(ts, name);
diff --git a/lib/depends.h b/lib/depends.h
index 968798de4..aa12b168e 100644
--- a/lib/depends.h
+++ b/lib/depends.h
@@ -92,6 +92,8 @@ struct transactionElement_s {
tsortInfo tsi; /*!< Dependency ordering chains. */
/*@refcounted@*/ /*@null@*/
+ rpmDepSet this; /*!< This package's provided NEVR. */
+/*@refcounted@*/ /*@null@*/
rpmDepSet provides; /*!< Provides: dependencies. */
/*@refcounted@*/ /*@null@*/
rpmDepSet requires; /*!< Requires: dependencies. */
diff --git a/lib/hdrinline.h b/lib/hdrinline.h
index 5300b9c1f..dd852a027 100644
--- a/lib/hdrinline.h
+++ b/lib/hdrinline.h
@@ -46,7 +46,7 @@ Header headerNew(void)
*/
/*@unused@*/ static inline
/*@null@*/ Header XheaderFree( /*@killref@*/ /*@null@*/ Header h,
- const char * msg, const char * fn, unsigned ln)
+ /*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies h @*/
{
/*@-abstract@*/
@@ -62,7 +62,8 @@ Header headerNew(void)
* @return new theader reference
*/
/*@unused@*/ static inline
-Header XheaderLink(Header h, const char * msg, const char * fn, unsigned ln)
+Header XheaderLink(Header h, /*@null@*/ const char * msg,
+ const char * fn, unsigned ln)
/*@modifies h @*/
{
return (h2hv(h)->Xhdrlink) (h, msg, fn, ln);
@@ -76,7 +77,7 @@ Header XheaderLink(Header h, const char * msg, const char * fn, unsigned ln)
*/
/*@unused@*/ static inline
Header XheaderUnlink(/*@killref@*/ /*@null@*/ Header h,
- const char * msg, const char * fn, unsigned ln)
+ /*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies h @*/
{
/*@-abstract@*/
diff --git a/lib/header.c b/lib/header.c
index 01556bd56..1d1c2198e 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -34,7 +34,7 @@
#define PARSER_IN_EXPR 2
/*@unchecked@*/
-static int _h_debug = 0;
+static int _h_debug = 1;
/** \ingroup header
*/
@@ -99,13 +99,14 @@ _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p) /*@modifies *p @*/
* @return referenced header instance
*/
HSTATIC
-Header XheaderLink(Header h, const char * msg, const char * fn, unsigned ln)
+Header XheaderLink(Header h, /*@null@*/ const char * msg,
+ const char * fn, unsigned ln)
/*@modifies h @*/
{
if (h != NULL) h->nrefs++;
/*@-modfilesystem@*/
-if (_h_debug)
-fprintf(stderr, "--> h %p ++ %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), msg, fn, ln);
+if (_h_debug > 0 && msg != NULL)
+fprintf(stderr, "--> h %p ++ %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), msg, fn, ln);
/*@=modfilesystem@*/
/*@-refcounttrans -nullret @*/
return h;
@@ -119,12 +120,12 @@ fprintf(stderr, "--> h %p ++ %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), m
*/
HSTATIC
Header XheaderUnlink(/*@killref@*/ /*@null@*/ Header h,
- const char * msg, const char * fn, unsigned ln)
+ /*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies h @*/
{
/*@-modfilesystem@*/
-if (_h_debug)
-fprintf(stderr, "--> h %p -- %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), msg, fn, ln);
+if (_h_debug > 0 && msg != NULL)
+fprintf(stderr, "--> h %p -- %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), msg, fn, ln);
/*@=modfilesystem@*/
if (h != NULL) h->nrefs--;
return NULL;
@@ -136,8 +137,8 @@ fprintf(stderr, "--> h %p -- %d %s at %s:%u\n", h, (h != NULL ? h->nrefs : 0), m
* @return NULL always
*/
HSTATIC /*@null@*/
-Header XheaderFree( /*@null@*/ /*@killref@*/ Header h,
- const char * msg, const char * fn, unsigned ln)
+Header XheaderFree(/*@killref@*/ /*@null@*/ Header h,
+ /*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies h @*/
{
(void) XheaderUnlink(h, msg, fn, ln);
diff --git a/lib/header.h b/lib/header.h
index 80e17773b..2323dd133 100644
--- a/lib/header.h
+++ b/lib/header.h
@@ -301,8 +301,8 @@ Header (*HDRnew) (void)
* @return NULL always
*/
typedef
-/*@null@*/ Header (*HDRfree) (/*@null@*/ /*@killref@*/ Header h,
- const char * msg, const char * fn, unsigned ln)
+/*@null@*/ Header (*HDRfree) (/*@killref@*/ /*@null@*/ Header h,
+ /*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies h @*/;
/** \ingroup header
@@ -311,7 +311,8 @@ typedef
* @return referenced header instance
*/
typedef
-Header (*HDRlink) (Header h, const char * msg, const char * fn, unsigned ln)
+Header (*HDRlink) (Header h, /*@null@*/ const char * msg,
+ const char * fn, unsigned ln)
/*@modifies h @*/;
/** \ingroup header
@@ -321,7 +322,7 @@ Header (*HDRlink) (Header h, const char * msg, const char * fn, unsigned ln)
*/
typedef
Header (*HDRunlink) (/*@killref@*/ /*@null@*/ Header h,
- const char * msg, const char * fn, unsigned ln)
+ /*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies h @*/;
/** \ingroup header
diff --git a/lib/rpmds.c b/lib/rpmds.c
index 4ea70da57..7551b813b 100644
--- a/lib/rpmds.c
+++ b/lib/rpmds.c
@@ -15,26 +15,6 @@
/*@unchecked@*/
static int _fns_debug = 0;
-/*@-shadow@*/ /* XXX copy from depends.c for now. */
-static char * hGetNEVR(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 XrpmfnsUnlink(rpmFNSet fns, const char * msg, const char * fn, unsigned ln)
{
if (fns == NULL) return NULL;
@@ -89,7 +69,7 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fns, fns->Type, fns->fc);
/*@-evalorder@*/
if (fns->h != NULL) {
- fns->h = headerFree(fns->h, "fnsFree");
+ fns->h = headerFree(fns->h, fns->Type);
} else {
fns->fmtimes = _free(fns->fmtimes);
fns->fmodes = _free(fns->fmodes);
@@ -137,9 +117,9 @@ rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
int xx;
fns = xcalloc(1, sizeof(*fns));
- fns->h = headerLink(h, "fnsNew");
- fns->i = -1;
fns->Type = Type;
+ fns->h = headerLink(h, fns->Type);
+ fns->i = -1;
fns->tagN = tagN;
fns->bnl = N;
fns->fc = Count;
@@ -175,7 +155,7 @@ rpmFNSet fnsNew(Header h, rpmTag tagN, int scareMem)
_fdupe(fns, fsizes);
_fdupe(fns, frdevs);
_fdupe(fns, dil);
- fns->h = headerFree(fns->h, "fnsNew");
+ fns->h = headerFree(fns->h, fns->Type);
}
/*@-modfilesystem@*/
@@ -263,7 +243,7 @@ fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
/*@-evalorder@*/
ds->Flags = (ds->h != NULL ? hfd(ds->Flags, ds->Ft) : _free(ds->Flags));
/*@=evalorder@*/
- ds->h = headerFree(ds->h, "dsFree");
+ ds->h = headerFree(ds->h, ds->Type);
}
/*@=branchstate@*/
@@ -322,9 +302,9 @@ rpmDepSet dsNew(Header h, rpmTag tagN, int scareMem)
int xx;
ds = xcalloc(1, sizeof(*ds));
- ds->h = (scareMem ? headerLink(h, "dsNew") : NULL);
- ds->i = -1;
ds->Type = Type;
+ ds->h = (scareMem ? headerLink(h, ds->Type) : NULL);
+ ds->i = -1;
ds->DNEVR = NULL;
ds->tagN = tagN;
ds->N = N;
@@ -391,6 +371,121 @@ char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
return tbuf;
}
+rpmDepSet dsThis(Header h, rpmTag tagN, int_32 Flags)
+{
+ HGE_t hge = (HGE_t) headerGetEntryMinMemory;
+ rpmDepSet ds = NULL;
+ const char * Type;
+ const char * n, * v, * r;
+ int_32 * ep;
+ const char ** N, ** EVR;
+ char * t;
+ int xx;
+
+ if (tagN == RPMTAG_PROVIDENAME) {
+ Type = "Provides";
+ } else
+ if (tagN == RPMTAG_REQUIRENAME) {
+ Type = "Requires";
+ } else
+ if (tagN == RPMTAG_CONFLICTNAME) {
+ Type = "Conflicts";
+ } else
+ if (tagN == RPMTAG_OBSOLETENAME) {
+ Type = "Obsoletes";
+ } else
+ if (tagN == RPMTAG_TRIGGERNAME) {
+ Type = "Trigger";
+ } else
+ goto exit;
+
+ xx = headerNVR(h, &n, &v, &r);
+ ep = NULL;
+ xx = hge(h, RPMTAG_EPOCH, NULL, (void **)&ep, NULL);
+
+ t = xmalloc(sizeof(*N) + strlen(n) + 1);
+ N = (const char **) t;
+ t += sizeof(*N);
+ N[0] = t;
+ t = stpcpy(t, n);
+
+ t = xmalloc(sizeof(*EVR) +
+ (ep ? 20 : 0) + strlen(v) + strlen(r) + sizeof("-"));
+ EVR = (const char **) t;
+ t += sizeof(*EVR);
+ EVR[0] = t;
+ if (ep) {
+ sprintf(t, "%d:", *ep);
+ t += strlen(t);
+ }
+ t = stpcpy( stpcpy( stpcpy( t, v), "-"), r);
+
+ ds = xcalloc(1, sizeof(*ds));
+ ds->h = NULL;
+ ds->Type = Type;
+ ds->tagN = tagN;
+ ds->Count = 1;
+ ds->N = N;
+ ds->EVR = EVR;
+ ds->Flags = xmalloc(sizeof(*ds->Flags)); ds->Flags[0] = Flags;
+ ds->i = 0;
+ { char pre[2];
+ pre[0] = ds->Type[0];
+ pre[1] = '\0';
+ /*@-nullstate@*/ /* LCL: ds->Type may be NULL ??? */
+ ds->DNEVR = dsDNEVR(pre, ds);
+ /*@=nullstate@*/
+ }
+
+exit:
+ return rpmdsLink(ds, (ds ? ds->Type : NULL));
+}
+
+rpmDepSet dsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
+{
+ rpmDepSet ds = NULL;
+ const char * Type;
+
+ if (tagN == RPMTAG_PROVIDENAME) {
+ Type = "Provides";
+ } else
+ if (tagN == RPMTAG_REQUIRENAME) {
+ Type = "Requires";
+ } else
+ if (tagN == RPMTAG_CONFLICTNAME) {
+ Type = "Conflicts";
+ } else
+ if (tagN == RPMTAG_OBSOLETENAME) {
+ Type = "Obsoletes";
+ } else
+ if (tagN == RPMTAG_TRIGGERNAME) {
+ Type = "Trigger";
+ } else
+ goto exit;
+
+ ds = xcalloc(1, sizeof(*ds));
+ ds->h = NULL;
+ ds->Type = Type;
+ ds->tagN = tagN;
+ ds->Count = 1;
+ /*@-assignexpose@*/
+ ds->N = xmalloc(sizeof(*ds->N)); ds->N[0] = N;
+ ds->EVR = xmalloc(sizeof(*ds->EVR)); ds->EVR[0] = EVR;
+ /*@=assignexpose@*/
+ ds->Flags = xmalloc(sizeof(*ds->Flags)); ds->Flags[0] = Flags;
+ ds->i = 0;
+ { char t[2];
+ t[0] = ds->Type[0];
+ t[1] = '\0';
+ /*@-nullstate@*/ /* LCL: ds->Type may be NULL ??? */
+ ds->DNEVR = dsDNEVR(t, ds);
+ /*@=nullstate@*/
+ }
+
+exit:
+ return rpmdsLink(ds, (ds ? ds->Type : NULL));
+}
+
int dsiGetCount(rpmDepSet ds)
{
return (ds != NULL ? ds->Count : 0);
@@ -629,13 +724,12 @@ exit:
return result;
}
-void dsProblem(rpmProblemSet tsprobs, Header h, const rpmDepSet ds,
+void dsProblem(rpmProblemSet tsprobs, const char * pkgNEVR, const rpmDepSet ds,
const fnpyKey * suggestedKeys)
{
const char * Name = dsiGetN(ds);
const char * DNEVR = dsiGetDNEVR(ds);
const char * EVR = dsiGetEVR(ds);
- char * pkgNEVR = hGetNEVR(h, NULL);
rpmProblemType type;
fnpyKey key;
@@ -655,7 +749,6 @@ void dsProblem(rpmProblemSet tsprobs, Header h, const rpmDepSet ds,
key = (suggestedKeys ? suggestedKeys[0] : NULL);
rpmProblemSetAppend(tsprobs, type, pkgNEVR, key,
NULL, NULL, DNEVR, 0);
- pkgNEVR = _free(pkgNEVR);
}
int rangeMatchesDepFlags (Header h, const rpmDepSet req)
@@ -705,46 +798,33 @@ exit:
int headerMatchesDepFlags(Header h, const rpmDepSet req)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
- const char *name, *version, *release;
+ const char * pkgN, * v, * r;
int_32 * epoch;
const char * pkgEVR;
- char * p;
+ char * t;
int_32 pkgFlags = RPMSENSE_EQUAL;
- rpmDepSet pkg = memset(alloca(sizeof(*pkg)), 0, sizeof(*pkg));
- int rc;
+ rpmDepSet pkg;
+ int rc = 1; /* XXX assume match as names should be the same already here */
if (!((req->Flags[req->i] & RPMSENSE_SENSEMASK) && req->EVR[req->i] && *req->EVR[req->i]))
- return 1;
+ return rc;
/* Get package information from header */
- (void) headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &pkgN, &v, &r);
- pkgEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1);
- *p = '\0';
+ pkgEVR = t = alloca(21 + strlen(v) + 1 + strlen(r) + 1);
+ *t = '\0';
if (hge(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) {
- sprintf(p, "%d:", *epoch);
- while (*p != '\0')
- p++;
+ sprintf(t, "%d:", *epoch);
+ while (*t != '\0')
+ t++;
+ }
+ (void) stpcpy( stpcpy( stpcpy(t, v) , "-") , r);
+
+ if ((pkg = dsSingle(RPMTAG_PROVIDENAME, pkgN, pkgEVR, pkgFlags)) != NULL) {
+ rc = dsCompare(pkg, req);
+ pkg = dsFree(pkg);
}
- (void) stpcpy( stpcpy( stpcpy(p, version) , "-") , release);
-
- /*@-compmempass@*/ /* FIX: move pkg immediate variables from stack */
- pkg->i = -1;
- pkg->Type = "Provides";
- pkg->tagN = RPMTAG_PROVIDENAME;
- pkg->DNEVR = NULL;
- /*@-immediatetrans@*/
- pkg->N = &name;
- pkg->EVR = &pkgEVR;
- pkg->Flags = &pkgFlags;
- /*@=immediatetrans@*/
- pkg->Count = 1;
- (void) dsiNext(dsiInit(pkg));
-
- rc = dsCompare(pkg, req);
-
- pkg->DNEVR = _free(pkg->DNEVR);
- /*@=compmempass@*/
return rc;
}
diff --git a/lib/rpmds.h b/lib/rpmds.h
index cd802b8d5..a843f9a1a 100644
--- a/lib/rpmds.h
+++ b/lib/rpmds.h
@@ -81,7 +81,7 @@ struct rpmDepSet_s {
/*@only@*/
const char ** EVR; /*!< Epoch-Version-Release. */
/*@only@*/
- const int_32 * Flags; /*!< Flags identifying context/comparison. */
+ int_32 * Flags; /*!< Flags identifying context/comparison. */
rpmTagType Nt, EVRt, Ft; /*!< Tag data types. */
int_32 Count; /*!< No. of elements */
/*@refs@*/ int nrefs; /*!< Reference count. */
@@ -209,6 +209,29 @@ char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
/*@*/;
/**
+ * Create, load and initialize a dependency for this header.
+ * @param h header
+ * @param tagN type of dependency
+ * @param Flags comparison flags
+ * @return new dependency set
+ */
+/*@null@*/
+rpmDepSet dsThis(Header h, rpmTag tagN, int_32 Flags)
+ /*@*/;
+
+/**
+ * Create, load and initialize a dependency set of size 1.
+ * @param tagN type of dependency
+ * @param N name
+ * @param EVR epoch:version-release
+ * @param Flags comparison flags
+ * @return new dependency set
+ */
+/*@null@*/
+rpmDepSet dsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
+ /*@*/;
+
+/**
* Return dependency set count.
* @param ds dependency set
* @return current count
@@ -309,9 +332,10 @@ int dsCompare(const rpmDepSet A, const rpmDepSet B)
/**
* Report a Requires: or Conflicts: dependency problem.
*/
-void dsProblem(/*@null@*/ rpmProblemSet tsprobs, Header h, const rpmDepSet ds,
+void dsProblem(/*@null@*/ rpmProblemSet tsprobs,
+ const char * pkgNEVR, const rpmDepSet ds,
/*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys)
- /*@modifies tsprobs, h @*/;
+ /*@modifies tsprobs @*/;
/**
* Compare package provides dependencies from header with a single dependency.
diff --git a/lib/rpmlibprov.c b/lib/rpmlibprov.c
index a6460872a..3ef8bf41c 100644
--- a/lib/rpmlibprov.c
+++ b/lib/rpmlibprov.c
@@ -11,13 +11,16 @@
#include "debug.h"
-/*@access rpmDepSet@*/
-
+/**
+ */
struct rpmlibProvides_s {
-/*@observer@*/ /*@null@*/ const char * featureName;
-/*@observer@*/ /*@null@*/ const char * featureEVR;
+/*@observer@*/ /*@null@*/
+ const char * featureName;
+/*@observer@*/ /*@null@*/
+ const char * featureEVR;
int featureFlags;
-/*@observer@*/ /*@null@*/ const char * featureDescription;
+/*@observer@*/ /*@null@*/
+ const char * featureDescription;
};
/*@observer@*/ /*@unchecked@*/
@@ -64,22 +67,14 @@ int rpmCheckRpmlibProvides(const rpmDepSet key)
{
const struct rpmlibProvides_s * rlp;
int rc = 0;
- rpmDepSet pro = memset(alloca(sizeof(*pro)), 0, sizeof(*pro));
- pro->Type = "Provides";
- pro->tagN = RPMTAG_PROVIDENAME;
for (rlp = rpmlibProvides; rlp->featureName != NULL; rlp++) {
if (rlp->featureEVR && rlp->featureFlags) {
- /*@-immediatetrans@*/
- pro->DNEVR = NULL;
- pro->N = (const char **) &rlp->featureName;
- pro->EVR = (const char **) &rlp->featureEVR;
- pro->Flags = &rlp->featureFlags;
- /*@=immediatetrans@*/
- pro->Count = 1;
- (void) dsiNext(dsiInit(pro));
+ rpmDepSet pro;
+ pro = dsSingle(RPMTAG_PROVIDENAME, rlp->featureName,
+ rlp->featureEVR, rlp->featureFlags);
rc = dsCompare(pro, key);
- pro->DNEVR = _free(pro->DNEVR);
+ pro = dsFree(pro);
}
if (rc)
break;
diff --git a/lib/transaction.c b/lib/transaction.c
index 0213085e3..cf26e9939 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -61,7 +61,6 @@ extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
/*@access alKey @*/
/*@access fnpyKey @*/
-/*@access rpmDepSet @*/
/*@access rpmFNSet @*/
/*@access TFI_t @*/
@@ -700,9 +699,9 @@ static int ensureOlder(rpmTransactionSet ts,
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);
+ const char * reqEVR;
+ rpmDepSet req;
char * t;
int rc;
@@ -717,25 +716,9 @@ static int ensureOlder(rpmTransactionSet ts, transactionElement p, Header h)
*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));
-
+ req = dsSingle(RPMTAG_REQUIRENAME, p->name, reqEVR, reqFlags);
rc = headerMatchesDepFlags(h, req);
-
- req->DNEVR = _free(req->DNEVR);
- /*@=compmempass@*/
+ req = dsFree(req);
/*@-branchstate@*/ /* FIX: p->key ??? */
if (rc == 0) {
diff --git a/po/rpm.pot b/po/rpm.pot
index 52a1046df..8c67124ae 100644
--- a/po/rpm.pot
+++ b/po/rpm.pot
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-11-10 14:13-0500\n"
+"POT-Creation-Date: 2001-11-10 19:10-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,94 +1415,84 @@ msgstr ""
msgid "cannot open Packages database in %s\n"
msgstr ""
-#: lib/depends.c:431
+#: lib/depends.c:413
#, c-format
-msgid "newer package %s already added, skipping %s\n"
+msgid "package %s was already added, replacing with %s\n"
msgstr ""
-#: lib/depends.c:436
-#, c-format
-msgid "package %s already added, ignoring\n"
-msgstr ""
-
-#: lib/depends.c:441
-#, c-format
-msgid "older package %s already added, replacing with %s\n"
-msgstr ""
-
-#: lib/depends.c:739
+#: lib/depends.c:681
msgid "(cached)"
msgstr ""
-#: lib/depends.c:764
+#: lib/depends.c:706
msgid "(rpmrc provides)"
msgstr ""
-#: lib/depends.c:780
+#: lib/depends.c:722
msgid "(rpmlib provides)"
msgstr ""
-#: lib/depends.c:801
+#: lib/depends.c:743
msgid "(db files)"
msgstr ""
-#: lib/depends.c:813
+#: lib/depends.c:755
msgid "(db provides)"
msgstr ""
-#: lib/depends.c:826
+#: lib/depends.c:768
msgid "(db package)"
msgstr ""
-#: lib/depends.c:865
+#: lib/depends.c:807
#, c-format
msgid "%9s: (%s, %s) added to Depends cache.\n"
msgstr ""
-#: lib/depends.c:867 lib/rpmds.c:468 lib/rpmds.c:626
+#: lib/depends.c:809 lib/rpmds.c:563 lib/rpmds.c:721
msgid "NO "
msgstr ""
-#: lib/depends.c:867 lib/rpmds.c:468 lib/rpmds.c:626
+#: lib/depends.c:809 lib/rpmds.c:563 lib/rpmds.c:721
msgid "YES"
msgstr ""
-#: lib/depends.c:1201
+#: lib/depends.c:1151
#, c-format
msgid "removing %s \"%s\" from tsort relations.\n"
msgstr ""
#. Record all relations.
-#: lib/depends.c:1431
+#: lib/depends.c:1384
msgid "========== recording tsort relations\n"
msgstr ""
#. T4. Scan for zeroes.
-#: lib/depends.c:1504
+#: lib/depends.c:1455
msgid ""
"========== tsorting packages (order, #predecessors, #succesors, depth)\n"
msgstr ""
-#: lib/depends.c:1579
+#: lib/depends.c:1530
msgid "========== successors only (presentation order)\n"
msgstr ""
-#: lib/depends.c:1640
+#: lib/depends.c:1590
msgid "LOOP:\n"
msgstr ""
-#: lib/depends.c:1675
+#: lib/depends.c:1625
msgid "========== continuing tsort ...\n"
msgstr ""
#. Return no. of packages that could not be ordered.
-#: lib/depends.c:1680
+#: lib/depends.c:1630
#, c-format
msgid "rpmdepOrder failed, %d elements remain\n"
msgstr ""
#: lib/formats.c:29 lib/formats.c:53 lib/formats.c:84 lib/formats.c:281
-#: lib/header.c:2962 lib/header.c:2983 lib/header.c:3005
+#: lib/header.c:2963 lib/header.c:2984 lib/header.c:3006
msgid "(not a number)"
msgstr ""
@@ -1593,88 +1583,88 @@ msgstr ""
#. This should not be allowed
#. @-modfilesys@
-#: lib/header.c:346
+#: lib/header.c:347
msgid "dataLength() RPM_STRING_TYPE count must be 1.\n"
msgstr ""
#. @-modfilesys@
-#: lib/header.c:383 lib/header_internal.c:161 lib/psm.c:956
+#: lib/header.c:384 lib/header_internal.c:161 lib/psm.c:956
#, c-format
msgid "Data type %d not supported\n"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2219
+#: lib/header.c:2220
#, c-format
msgid "missing { after %"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2249
+#: lib/header.c:2250
msgid "missing } after %{"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2263
+#: lib/header.c:2264
msgid "empty tag format"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2277
+#: lib/header.c:2278
msgid "empty tag name"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2294
+#: lib/header.c:2295
msgid "unknown tag"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2321
+#: lib/header.c:2322
msgid "] expected at end of array"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2339
+#: lib/header.c:2340
msgid "unexpected ]"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2343
+#: lib/header.c:2344
msgid "unexpected }"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2409
+#: lib/header.c:2410
msgid "? expected in expression"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2418
+#: lib/header.c:2419
msgid "{ expected after ? in expression"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2431 lib/header.c:2473
+#: lib/header.c:2432 lib/header.c:2474
msgid "} expected in expression"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2441
+#: lib/header.c:2442
msgid ": expected following ? subexpression"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2458
+#: lib/header.c:2459
msgid "{ expected after : in expression"
msgstr ""
#. @-observertrans -readonlytrans@
-#: lib/header.c:2483
+#: lib/header.c:2484
msgid "| expected at end of expression"
msgstr ""
-#: lib/header.c:2706
+#: lib/header.c:2707
msgid "(unknown type)"
msgstr ""
@@ -2483,20 +2473,20 @@ msgid "OK"
msgstr ""
#. XXX legacy epoch-less requires/conflicts compatibility
-#: lib/rpmds.c:596
+#: lib/rpmds.c:691
#, c-format
msgid ""
"the \"B\" dependency needs an epoch (assuming same as \"A\")\n"
"\tA %s\tB %s\n"
msgstr ""
-#: lib/rpmds.c:625
+#: lib/rpmds.c:720
#, c-format
msgid " %s A %s\tB %s\n"
msgstr ""
#. @=branchstate@
-#: lib/rpmds.c:650
+#: lib/rpmds.c:744
#, c-format
msgid "package %s has unsatisfied %s: %s\n"
msgstr ""
@@ -2825,13 +2815,13 @@ msgstr ""
msgid "Signature: UNKNOWN (%d)\n"
msgstr ""
-#: lib/transaction.c:206
+#: lib/transaction.c:205
#, c-format
msgid "%s skipped due to missingok flag\n"
msgstr ""
#. @innercontinue@
-#: lib/transaction.c:923
+#: lib/transaction.c:906
#, c-format
msgid "excluding directory %s\n"
msgstr ""