- return multiple suggested packages (Pawel Kolodziej <pawelk@pld.org.pl>).

- fix: return suggested packages when using Depends cache.

CVS patchset: 4823
CVS date: 2001/05/31 22:31:14
This commit is contained in:
jbj 2001-05-31 22:31:14 +00:00
parent f8b347a38a
commit f5ebe3fb42
26 changed files with 560 additions and 321 deletions

View File

@ -10,6 +10,16 @@
# XXX ignore doxygen markings
-unrecogcomments
#+mustmod # segfault in psm.c:597
#+proto-param-match
#-cpp-names
#-declundef # db3 is noisy
#-deepbreak # 485 cases
#-export-local
#-export-header
#-export-header-var
# don't-bother-me-yet parameters
-branchstate # painful
-mustfree # alloca is painful

View File

@ -71,6 +71,9 @@
- fix: popt exec doesn't add '--', --target et al no longer need '='.
- fix: popt consume-next-arg "!#:+" w/o side effect (#41956).
- fix: for busted db1, attempt chain reconnection to following record.
- return multiple suggested packages
(Pawel Kolodziej <pawelk@pld.org.pl>).
- fix: return suggested packages when using Depends cache.
4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere.

View File

@ -22,7 +22,7 @@ static int checkSpec(Header h)
rpmdb db = NULL;
int mode = O_RDONLY;
rpmTransactionSet ts;
struct rpmDependencyConflict * conflicts;
rpmDependencyConflict conflicts;
int numConflicts;
int rc;
@ -30,7 +30,7 @@ static int checkSpec(Header h)
return 0;
if (rpmdbOpen(rootdir, &db, mode, 0644)) {
const char *dn;
const char * dn;
dn = rpmGetPath( (rootdir ? rootdir : ""), "%{_dbpath}", NULL);
rpmError(RPMERR_OPEN, _("cannot open rpm database in %s\n"), dn);
dn = _free(dn);
@ -44,7 +44,7 @@ static int checkSpec(Header h)
if (rc == 0 && conflicts) {
rpmMessage(RPMMESS_ERROR, _("failed build dependencies:\n"));
printDepProblems(stderr, conflicts, numConflicts);
rpmdepFreeConflicts(conflicts, numConflicts);
conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
rc = 1;
}

6
db3/configure vendored
View File

@ -9,7 +9,7 @@ ln -sf ../dist $db_dist/../db/dist
ln -sf ../dist $db_dist
CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure \
`echo $* | sed -e "s% --cache-file=.*$% --enable-shared --enable-static --enable-debug --enable-rpc --with-uniquename=rpmdb --srcdir=$db_dist%"`
`echo $* | sed -e "s% --cache-file=.*$% --enable-shared --enable-static --enable-debug --enable-rpc --with-uniquename=_rpmdb --srcdir=$db_dist%"`
# XXX hack to get db-3.3.4 to configure properly
rm -f $db_dist/../db/dist $db_dist/dist
@ -26,9 +26,9 @@ db3_install: all install_setip \\' > Makefile
mv db.h db.h.orig
cat db.h.orig | sed \
-e '/^struct __db;/i \
-e '/^struct __db;/i\
/*@-incondefs@*/' \
-e '/^struct __key_range;/a \
-e '/^struct __key_range;/a\
/*@=incondefs@*/' > db.h
# Generate manifest for rpmdb.

View File

@ -10,6 +10,16 @@
# XXX ignore doxygen markings
-unrecogcomments
#+mustmod # segfault in psm.c:597
+proto-param-match
#-cpp-names
#-declundef # db3 is noisy
#-deepbreak # 485 cases
#-export-local
#-export-header
#-export-header-var
# don't-bother-me-yet parameters
-branchstate # ~140 painful
-mustfree # ~588 alloca is painful

View File

@ -20,6 +20,8 @@ int _depends_debug = 0;
/*@access rpmdb@*/ /* XXX compared with NULL */
/*@access rpmdbMatchIterator@*/ /* XXX compared with NULL */
/*@access rpmTransactionSet@*/
/*@access rpmDependencyConflict@*/
/*@access availableList@*/
int headerNVR(Header h, const char **np, const char **vp, const char **rp)
{
@ -50,8 +52,9 @@ int headerNVR(Header h, const char **np, const char **vp, const char **rp)
* @param keyFlags dependency logical range qualifiers
* @return formatted dependency (malloc'ed)
*/
static /*@only@*/ char *printDepend(const char * depend, const char * key,
const char * keyEVR, int keyFlags) /*@*/
static /*@only@*/ char * printDepend(const char * depend, const char * key,
const char * keyEVR, int keyFlags)
/*@*/
{
char *tbuf, *t;
size_t nb;
@ -118,8 +121,8 @@ struct orderListIndex {
* Destroy available item index.
* @param al available list
*/
static void alFreeIndex(struct availableList * al)
/*@modifies al->index @*/
static void alFreeIndex(availableList al)
/*@modifies al @*/
{
if (al->index.size) {
al->index.index = _free(al->index.index);
@ -131,8 +134,8 @@ static void alFreeIndex(struct availableList * al)
* Initialize available packckages, items, and directories list.
* @param al available list
*/
static void alCreate(struct availableList * al)
/*@modifies *al @*/
static void alCreate(availableList al)
/*@modifies al @*/
{
al->alloced = al->delta;
al->size = 0;
@ -149,7 +152,8 @@ static void alCreate(struct availableList * al)
* Free available packages, items, and directories members.
* @param al available list
*/
static void alFree(struct availableList * al)
static void alFree(availableList al)
/*@modifies al @*/
{
HFD_t hfd = headerFreeData;
struct availablePackage * p;
@ -226,9 +230,11 @@ static int dirInfoCompare(const void * one, const void * two) /*@*/
* @param relocs package file relocations
* @return available package pointer
*/
static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList * al,
static /*@exposed@*/ struct availablePackage *
alAddPackage(availableList al,
Header h, /*@null@*/ /*@dependent@*/ const void * key,
/*@null@*/ FD_t fd, /*@null@*/ rpmRelocation * relocs)
/*@modifies al, h @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@ -410,7 +416,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
* @param two 2nd available index entry
* @return result of comparison
*/
static int indexcmp(const void * one, const void * two)
static int indexcmp(const void * one, const void * two) /*@*/
{
const struct availableIndexEntry * a = one;
const struct availableIndexEntry * b = two;
@ -426,8 +432,8 @@ static int indexcmp(const void * one, const void * two)
* Generate index for available list.
* @param al available list
*/
static void alMakeIndex(struct availableList * al)
/*@modifies al->index @*/
static void alMakeIndex(availableList al)
/*@modifies al @*/
{
struct availableIndex * ai = &al->index;
int i, j, k;
@ -470,10 +476,11 @@ static void alMakeIndex(struct availableList * al)
* @retval *vp pointer to version
* @retval *rp pointer to release
*/
static void parseEVR(char *evr,
/*@exposed@*/ /*@out@*/ const char **ep,
/*@exposed@*/ /*@out@*/ const char **vp,
/*@exposed@*/ /*@out@*/const char **rp) /*@modifies evr,*ep,*vp,*rp @*/
static void parseEVR(char * evr,
/*@exposed@*/ /*@out@*/ const char ** ep,
/*@exposed@*/ /*@out@*/ const char ** vp,
/*@exposed@*/ /*@out@*/ const char ** rp)
/*@modifies *ep, *vp, *rp @*/
{
const char *epoch;
const char *version; /* assume only version is present */
@ -509,8 +516,8 @@ const char *rpmNAME = PACKAGE;
const char *rpmEVR = VERSION;
int rpmFLAGS = RPMSENSE_EQUAL;
int rpmRangesOverlap(const char *AName, const char *AEVR, int AFlags,
const char *BName, const char *BEVR, int BFlags)
int rpmRangesOverlap(const char * AName, const char * AEVR, int AFlags,
const char * BName, const char * BEVR, int BFlags)
{
const char *aDepend = printDepend(NULL, AName, AEVR, AFlags);
const char *bDepend = printDepend(NULL, BName, BEVR, BFlags);
@ -587,7 +594,9 @@ exit:
typedef int (*dbrecMatch_t) (Header h, const char *reqName, const char * reqEVR, int reqFlags);
static int rangeMatchesDepFlags (Header h, const char *reqName, const char * reqEVR, int reqFlags)
static int rangeMatchesDepFlags (Header h,
const char * reqName, const char * reqEVR, int reqFlags)
/*@*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@ -641,7 +650,7 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req
}
int headerMatchesDepFlags(Header h,
const char * reqName, const char * reqEVR, int reqFlags)
const char * reqName, const char * reqEVR, int reqFlags)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
const char *name, *version, *release;
@ -722,7 +731,7 @@ rpmTransactionSet rpmtransCreateSet(rpmdb rpmdb, const char * rootDir)
* @param b 2nd instance address
* @return result of comparison
*/
static int intcmp(const void * a, const void *b)
static int intcmp(const void * a, const void * b) /*@*/
{
const int * aptr = a;
const int * bptr = b;
@ -903,11 +912,12 @@ void rpmtransFree(rpmTransactionSet ts)
ts = _free(ts);
}
void rpmdepFreeConflicts(struct rpmDependencyConflict * conflicts,
int numConflicts)
rpmDependencyConflict rpmdepFreeConflicts(rpmDependencyConflict conflicts,
int numConflicts)
{
int i;
if (conflicts)
for (i = 0; i < numConflicts; i++) {
conflicts[i].byHeader = headerFree(conflicts[i].byHeader);
conflicts[i].byName = _free(conflicts[i].byName);
@ -915,37 +925,40 @@ void rpmdepFreeConflicts(struct rpmDependencyConflict * conflicts,
conflicts[i].byRelease = _free(conflicts[i].byRelease);
conflicts[i].needsName = _free(conflicts[i].needsName);
conflicts[i].needsVersion = _free(conflicts[i].needsVersion);
conflicts[i].suggestedPackages = _free(conflicts[i].suggestedPackages);
}
conflicts = _free(conflicts);
return (conflicts = _free(conflicts));
}
/**
* Check added package file lists for a file.
* Check added package file lists for package(s) that provide a file.
* @param al available list
* @param keyType type of dependency
* @param fileName file name to search for
* @return available package pointer
*/
/*@dependent@*/ /*@null@*/ static struct availablePackage *
alFileSatisfiesDepend(struct availableList * al,
const char * keyType, const char * fileName)
static /*@only@*/ /*@null@*/ struct availablePackage **
alAllFileSatisfiesDepend(const availableList al,
const char * keyType, const char * fileName)
/*@*/
{
int i;
int i, found;
const char * dirName;
const char * baseName;
struct dirInfo_s dirNeedle;
dirInfo dirMatch;
struct availablePackage ** ret;
/* Solaris 2.6 bsearch sucks down on this. */
if (al->numDirs == 0 || al->dirs == NULL || al->list == NULL)
return NULL;
{ char * chptr = xstrdup(fileName);
dirName = chptr;
if ((chptr = strrchr(chptr, '/')) != NULL) {
chptr++; /* leave the trailing '/' */
*chptr = '\0';
{ char * t;
dirName = t = xstrdup(fileName);
if ((t = strrchr(t, '/')) != NULL) {
t++; /* leave the trailing '/' */
*t = '\0';
}
}
@ -953,36 +966,83 @@ alFileSatisfiesDepend(struct availableList * al,
dirNeedle.dirNameLen = strlen(dirName);
dirMatch = bsearch(&dirNeedle, al->dirs, al->numDirs,
sizeof(dirNeedle), dirInfoCompare);
dirName = _free(dirName);
if (dirMatch == NULL) return NULL;
if (dirMatch == NULL) {
dirName = _free(dirName);
return NULL;
}
/* rewind to the first match */
while (dirMatch > al->dirs && dirInfoCompare(dirMatch-1, &dirNeedle) == 0)
dirMatch--;
baseName = strrchr(fileName, '/') + 1;
/* XXX FIXME: these file lists should be sorted and bsearched */
for (i = 0; i < dirMatch->numFiles; i++) {
if (dirMatch->files[i].baseName == NULL ||
strcmp(dirMatch->files[i].baseName, baseName))
continue;
for (found = 0, ret = NULL;
dirMatch <= al->dirs + al->numDirs &&
dirInfoCompare(dirMatch, &dirNeedle) == 0;
dirMatch++)
{
/* XXX FIXME: these file lists should be sorted and bsearched */
for (i = 0; i < dirMatch->numFiles; i++) {
if (dirMatch->files[i].baseName == NULL ||
strcmp(dirMatch->files[i].baseName, baseName))
continue;
/*
* If a file dependency would be satisfied by a file
* we are not going to install, skip it.
*/
if (al->list[dirMatch->files[i].pkgNum].multiLib &&
!isFileMULTILIB(dirMatch->files[i].fileFlags))
continue;
/*
* If a file dependency would be satisfied by a file
* we are not going to install, skip it.
*/
if (al->list[dirMatch->files[i].pkgNum].multiLib &&
!isFileMULTILIB(dirMatch->files[i].fileFlags))
continue;
if (keyType)
rpmMessage(RPMMESS_DEBUG, _("%s: %-45s YES (added files)\n"),
keyType, fileName);
return al->list + dirMatch->files[i].pkgNum;
if (keyType)
rpmMessage(RPMMESS_DEBUG, _("%s: %-45s YES (added files)\n"),
keyType, fileName);
ret = xrealloc(ret, (found+2) * sizeof(*ret));
if (ret) /* can't happen */
ret[found++] = al->list + dirMatch->files[i].pkgNum;
break;
}
}
return NULL;
dirName = _free(dirName);
/*@-mods@*/ /* FIX: al->list might be modified. */
if (ret)
ret[found] = NULL;
/*@=mods@*/
return ret;
}
#ifdef DYING
/**
* Check added package file lists for a provide.
* Check added package file lists for first package that provides a file.
* @param al available list
* @param keyType type of dependency
* @param fileName file name to search for
* @return available package pointer
*/
/*@unused@*/ static /*@dependent@*/ /*@null@*/ struct availablePackage *
alFileSatisfiesDepend(const availableList al,
const char * keyType, const char * fileName)
/*@*/
{
struct availablePackage * ret;
struct availablePackage ** tmp =
alAllFileSatisfiesDepend(al, keyType, fileName);
if (tmp) {
ret = tmp[0];
tmp = _free(tmp);
return ret;
}
return NULL;
}
#endif /* DYING */
/**
* Check added package file lists for package(s) that have a provide.
* @param al available list
* @param keyType type of dependency
* @param keyDepend dependency string representation
@ -991,17 +1051,18 @@ alFileSatisfiesDepend(struct availableList * al,
* @param keyFlags dependency logical range qualifiers
* @return available package pointer
*/
/*@dependent@*/ /*@null@*/ static struct availablePackage * alSatisfiesDepend(
struct availableList * al,
const char * keyType, const char * keyDepend,
const char * keyName, const char * keyEVR, int keyFlags)
static /*@only@*/ /*@null@*/ struct availablePackage **
alAllSatisfiesDepend(const availableList al,
const char * keyType, const char * keyDepend,
const char * keyName, const char * keyEVR, int keyFlags)
/*@*/
{
struct availableIndexEntry needle, * match;
struct availablePackage * p;
int i, rc;
struct availablePackage * p, ** ret = NULL;
int i, rc, found;
if (*keyName == '/')
return alFileSatisfiesDepend(al, keyType, keyName);
return alAllFileSatisfiesDepend(al, keyType, keyName);
if (!al->index.size || al->index.index == NULL) return NULL;
@ -1012,51 +1073,99 @@ alFileSatisfiesDepend(struct availableList * al,
if (match == NULL) return NULL;
p = match->package;
rc = 0;
switch (match->type) {
case IET_PROVIDES:
for (i = 0; i < p->providesCount; i++) {
const char *proEVR;
int proFlags;
/* rewind to the first match */
while (match > al->index.index && indexcmp(match-1,&needle) == 0)
match--;
/* Filter out provides that came along for the ride. */
if (strcmp(p->provides[i], keyName))
continue;
for (ret = NULL, found = 0;
match <= al->index.index + al->index.size &&
indexcmp(match,&needle) == 0;
match++)
{
proEVR = (p->providesEVR ? p->providesEVR[i] : NULL);
proFlags = (p->provideFlags ? p->provideFlags[i] : 0);
rc = rpmRangesOverlap(p->provides[i], proEVR, proFlags,
keyName, keyEVR, keyFlags);
if (rc) break;
p = match->package;
rc = 0;
switch (match->type) {
case IET_PROVIDES:
for (i = 0; i < p->providesCount; i++) {
const char * proEVR;
int proFlags;
/* Filter out provides that came along for the ride. */
if (strcmp(p->provides[i], keyName))
continue;
proEVR = (p->providesEVR ? p->providesEVR[i] : NULL);
proFlags = (p->provideFlags ? p->provideFlags[i] : 0);
rc = rpmRangesOverlap(p->provides[i], proEVR, proFlags,
keyName, keyEVR, keyFlags);
if (rc) break;
}
if (keyType && keyDepend && rc)
rpmMessage(RPMMESS_DEBUG, _("%s: %-45s YES (added provide)\n"),
keyType, keyDepend+2);
break;
}
if (rc) {
ret = xrealloc(ret, (found + 2) * sizeof(*ret));
if (ret) /* can't happen */
ret[found++] = p;
}
if (keyType && keyDepend && rc)
rpmMessage(RPMMESS_DEBUG, _("%s: %-45s YES (added provide)\n"),
keyType, keyDepend+2);
break;
}
if (rc)
return p;
if (ret)
ret[found] = NULL;
return NULL;
return ret;
}
/**
* Check key for an unsatisfied dependency.
* Check added package file lists for first package that has a provide.
* @todo Eliminate.
* @param al available list
* @param keyType type of dependency
* @param keyDepend dependency string representation
* @param keyName dependency name string
* @param keyEVR dependency [epoch:]version[-release] string
* @param keyFlags dependency logical range qualifiers
* @retval suggestion possible package to resolve dependency
* @return available package pointer
*/
static inline /*@only@*/ /*@null@*/ struct availablePackage *
alSatisfiesDepend(const availableList al,
const char * keyType, const char * keyDepend,
const char * keyName, const char * keyEVR, int keyFlags)
/*@*/
{
struct availablePackage * ret;
struct availablePackage ** tmp =
alAllSatisfiesDepend(al, keyType, keyDepend, keyName, keyEVR, keyFlags);
if (tmp) {
ret = tmp[0];
tmp = _free(tmp);
return ret;
}
return NULL;
}
/**
* Check key for an unsatisfied dependency.
* @todo Eliminate rpmrc provides.
* @param al available list
* @param keyType type of dependency
* @param keyDepend dependency string representation
* @param keyName dependency name string
* @param keyEVR dependency [epoch:]version[-release] string
* @param keyFlags dependency logical range qualifiers
* @retval suggestion possible package(s) to resolve dependency
* @return 0 if satisfied, 1 if not satisfied, 2 if error
*/
static int unsatisfiedDepend(rpmTransactionSet ts,
const char * keyType, const char * keyDepend,
const char * keyName, const char * keyEVR, int keyFlags,
/*@out@*/ struct availablePackage ** suggestion)
const char * keyType, const char * keyDepend,
const char * keyName, const char * keyEVR, int keyFlags,
/*@null@*/ /*@out@*/ struct availablePackage *** suggestion)
/*@modifies *suggestion @*/
{
static int _cacheDependsRC = 1;
rpmdbMatchIterator mi;
@ -1086,6 +1195,11 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
rpmMessage(RPMMESS_DEBUG, _("%s: %-45s %-s (cached)\n"),
keyType, keyDepend, (rc ? _("NO ") : _("YES")));
xx = dbiCclose(dbi, NULL, 0);
if (suggestion && rc == 1)
*suggestion = alAllSatisfiesDepend(&ts->availablePackages,
NULL, NULL, keyName, keyEVR, keyFlags);
return rc;
}
xx = dbiCclose(dbi, dbcursor, 0);
@ -1131,7 +1245,9 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
goto unsatisfied;
}
if (alSatisfiesDepend(&ts->addedPackages, keyType, keyDepend, keyName, keyEVR, keyFlags)) {
if (alSatisfiesDepend(&ts->addedPackages, keyType, keyDepend,
keyName, keyEVR, keyFlags))
{
goto exit;
}
@ -1167,7 +1283,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
}
mi = rpmdbFreeIterator(mi);
#ifndef DYING
#ifdef DYING
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, keyName, 0);
(void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
@ -1185,10 +1301,8 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
}
if (suggestion)
/*@-dependenttrans@*/
*suggestion = alSatisfiesDepend(&ts->availablePackages, NULL, NULL,
*suggestion = alAllSatisfiesDepend(&ts->availablePackages, NULL, NULL,
keyName, keyEVR, keyFlags);
/*@=dependenttrans@*/
unsatisfied:
rpmMessage(RPMMESS_DEBUG, _("%s: %-45s NO\n"), keyType, keyDepend+2);
@ -1220,8 +1334,18 @@ exit:
return rc;
}
static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
/**
* Check header requires/conflicts against against installed+added packages.
* @param ts transaction set
* @param psp dependency problems
* @param h header to check
* @param keyName dependency name
* @param multiLib skip multilib colored dependencies?
* @return 0 no problems found
*/
static int checkPackageDeps(rpmTransactionSet ts, problemsSet psp,
Header h, const char * keyName, uint_32 multiLib)
/*@modifies h, psp */
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@ -1239,7 +1363,7 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
int type;
int i, rc;
int ourrc = 0;
struct availablePackage * suggestion;
struct availablePackage ** suggestion;
(void) headerNVR(h, &name, &version, &release);
@ -1290,10 +1414,25 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
psp->problems[psp->num].needsFlags = requireFlags[i];
psp->problems[psp->num].sense = RPMDEP_SENSE_REQUIRES;
if (suggestion)
psp->problems[psp->num].suggestedPackage = suggestion->key;
else
psp->problems[psp->num].suggestedPackage = NULL;
if (suggestion) {
int j;
for (j = 0; suggestion[j]; j++)
;
psp->problems[psp->num].suggestedPackages =
xmalloc( (j + 1) * sizeof(void *) );
for (j = 0; suggestion[j]; j++)
psp->problems[psp->num].suggestedPackages[j]
= suggestion[j]->key;
psp->problems[psp->num].suggestedPackages[j] = NULL;
#ifdef DYING
psp->problems[psp->num].suggestedPackage = suggestion[0]->key;
#endif
} else {
psp->problems[psp->num].suggestedPackages = NULL;
#ifdef DYING
psp->problems[psp->num].suggestedPackage = NULL;
#endif
}
psp->num++;
break;
@ -1357,7 +1496,10 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
psp->problems[psp->num].needsVersion = xstrdup(conflictsEVR[i]);
psp->problems[psp->num].needsFlags = conflictFlags[i];
psp->problems[psp->num].sense = RPMDEP_SENSE_CONFLICTS;
psp->problems[psp->num].suggestedPackages = NULL;
#ifdef DYING
psp->problems[psp->num].suggestedPackage = NULL;
#endif
psp->num++;
break;
@ -1380,11 +1522,18 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
}
/**
* Check dependency against installed packages.
* Adding: check name/provides key against each conflict match,
* Erasing: check name/provides/filename key against each requiredby match.
* @param ts transaction set
* @param psp dependency problems
* @param key dependency name
* @param mi rpm database iterator
* @return 0 no problems found
*/
static int checkPackageSet(rpmTransactionSet ts, struct problemsSet * psp,
const char * key, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi)
static int checkPackageSet(rpmTransactionSet ts, problemsSet psp,
const char * key, /*@only@*/ /*@null@*/ rpmdbMatchIterator mi)
/*@modifies mi, psp @*/
{
Header h;
int rc = 0;
@ -1404,9 +1553,14 @@ static int checkPackageSet(rpmTransactionSet ts, struct problemsSet * psp,
/**
* Erasing: check name/provides/filename key against requiredby matches.
* @param ts transaction set
* @param psp dependency problems
* @param key requires name
* @return 0 no problems found
*/
static int checkDependentPackages(rpmTransactionSet ts,
struct problemsSet * psp, const char * key)
problemsSet psp, const char * key)
/*@modifies psp @*/
{
rpmdbMatchIterator mi;
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_REQUIRENAME, key, 0);
@ -1415,9 +1569,14 @@ static int checkDependentPackages(rpmTransactionSet ts,
/**
* Adding: check name/provides key against conflicts matches.
* @param ts transaction set
* @param psp dependency problems
* @param key conflicts name
* @return 0 no problems found
*/
static int checkDependentConflicts(rpmTransactionSet ts,
struct problemsSet * psp, const char * key)
problemsSet psp, const char * key)
/*@modifies psp @*/
{
int rc = 0;
@ -1463,7 +1622,9 @@ static struct badDeps_s {
{ NULL, NULL }
};
static int ignoreDep(struct availablePackage * p, struct availablePackage * q)
static int ignoreDep(const struct availablePackage * p,
const struct availablePackage * q)
/*@*/
{
struct badDeps_s *bdp;
@ -1481,6 +1642,7 @@ static int ignoreDep(struct availablePackage * p, struct availablePackage * q)
* @param q predecessor
*/
static void markLoop(struct tsortInfo * tsi, struct availablePackage * q)
/*@modifies *tsi @*/
{
struct availablePackage * p;
@ -1494,7 +1656,8 @@ static void markLoop(struct tsortInfo * tsi, struct availablePackage * q)
}
}
static inline /*@observer@*/ const char * const identifyDepend(int_32 f) {
static inline /*@observer@*/ const char * const identifyDepend(int_32 f)
{
if (isLegacyPreReq(f))
return "PreReq:";
f = _notpre(f);
@ -1526,7 +1689,8 @@ static inline /*@observer@*/ const char * const identifyDepend(int_32 f) {
*/
static /*@owned@*/ /*@null@*/ const char *
zapRelation(struct availablePackage * q, struct availablePackage * p,
int zap, int * nzaps)
int zap, /*@in@*/ /*@out@*/ int * nzaps)
/*@modifies q, p, *nzaps @*/
{
struct tsortInfo * tsi_prev;
struct tsortInfo * tsi;
@ -1552,21 +1716,14 @@ zapRelation(struct availablePackage * q, struct availablePackage * p,
p->requires[j], p->requiresEVR[j], p->requireFlags[j]);
/*
* XXX Attempt to unravel a dependency loop by eliminating PreReq's.
* This hack "works" for the (relatively) more important autogenerated
* Requires: lib*.so.*
* but may cause package %pre/%post scriptlets with, for example,
* PreReq: /bin/sh
* to fail.
* Attempt to unravel a dependency loop by eliminating Requires's.
*/
if (zap && !(p->requireFlags[j] & RPMSENSE_PREREQ)) {
rpmMessage(RPMMESS_WARNING,
_("removing %s-%s-%s \"%s\" from tsort relations.\n"),
p->name, p->version, p->release, dp);
p->tsi.tsi_count--;
/*@-nullderef@*/
tsi_prev->tsi_next = tsi->tsi_next;
/*@=nullderef@*/
if (tsi_prev) tsi_prev->tsi_next = tsi->tsi_next;
tsi->tsi_next = NULL;
tsi->tsi_suc = NULL;
tsi = _free(tsi);
@ -1591,12 +1748,15 @@ zapRelation(struct availablePackage * q, struct availablePackage * p,
*/
static inline int addRelation( const rpmTransactionSet ts,
struct availablePackage * p, unsigned char * selected, int j)
/*@modifies p->tsi.tsi_u.count, p->depth, *selected @*/
{
struct availablePackage * q;
struct tsortInfo * tsi;
int matchNum;
/*@-nullderef@*/
if (!p->requires || !p->requiresEVR || !p->requireFlags)
return 0;
q = alSatisfiesDepend(&ts->addedPackages, NULL, NULL,
p->requires[j], p->requiresEVR[j], p->requireFlags[j]);
@ -1607,7 +1767,6 @@ static inline int addRelation( const rpmTransactionSet ts,
/* Avoid rpmlib feature dependencies. */
if (!strncmp(p->requires[j], "rpmlib(", sizeof("rpmlib(")-1))
return 0;
/*@=nullderef@*/
#if defined(DEPENDENCY_WHITEOUT)
/* Avoid certain dependency relations. */
@ -1642,7 +1801,7 @@ static inline int addRelation( const rpmTransactionSet ts,
* @param b 2nd ordered list entry
* @return result of comparison
*/
static int orderListIndexCmp(const void * one, const void * two)
static int orderListIndexCmp(const void * one, const void * two) /*@*/
{
int a = ((const struct orderListIndex *)one)->alIndex;
int b = ((const struct orderListIndex *)two)->alIndex;
@ -1655,9 +1814,10 @@ static int orderListIndexCmp(const void * one, const void * two)
* @retval qp address of first element
* @retval rp address of last element
*/
static void addQ(/*@kept@*/ struct availablePackage * p,
/*@in@*/ /*@out@*/ struct availablePackage ** qp,
/*@in@*/ /*@out@*/ struct availablePackage ** rp)
static void addQ(struct availablePackage * p,
/*@in@*/ /*@out@*/ struct availablePackage ** qp,
/*@in@*/ /*@out@*/ struct availablePackage ** rp)
/*@modifies p->tsi, *qp, *rp @*/
{
struct availablePackage *q, *qprev;
@ -1782,9 +1942,7 @@ rescan:
if (p->tsi.tsi_count != 0)
continue;
p->tsi.tsi_suc = NULL;
/*@-ownedtrans@*/
addQ(p, &q, &r);
/*@=ownedtrans@*/
qlen++;
}
@ -1809,7 +1967,7 @@ rescan:
if (p && (--p->tsi.tsi_count) <= 0) {
/* XXX FIXME: add control bit. */
p->tsi.tsi_suc = NULL;
/*@-nullstate@*/
/*@-nullstate@*/ /* FIX: q->tsi.tsi_u.suc may be NULL */
addQ(p, &q->tsi.tsi_suc, &r);
/*@=nullstate@*/
qlen++;
@ -1961,7 +2119,7 @@ rescan:
}
int rpmdepCheck(rpmTransactionSet ts,
struct rpmDependencyConflict ** conflicts, int * numConflicts)
rpmDependencyConflict * conflicts, int * numConflicts)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@ -1971,11 +2129,11 @@ int rpmdepCheck(rpmTransactionSet ts,
int rc;
rpmdbMatchIterator mi = NULL;
Header h = NULL;
struct problemsSet ps;
problemsSet ps = alloca(sizeof(*ps));
ps.alloced = 5;
ps.num = 0;
ps.problems = xcalloc(ps.alloced, sizeof(struct rpmDependencyConflict));
ps->alloced = 5;
ps->num = 0;
ps->problems = xcalloc(ps->alloced, sizeof(*ps->problems));
*conflicts = NULL;
*numConflicts = 0;
@ -1993,12 +2151,12 @@ int rpmdepCheck(rpmTransactionSet ts,
rpmMessage(RPMMESS_DEBUG, ("========== +++ %s-%s-%s\n"),
p->name, p->version, p->release);
rc = checkPackageDeps(ts, &ps, p->h, NULL, p->multiLib);
rc = checkPackageDeps(ts, ps, p->h, NULL, p->multiLib);
if (rc)
goto exit;
/* Adding: check name against conflicts matches. */
rc = checkDependentConflicts(ts, &ps, p->name);
rc = checkDependentConflicts(ts, ps, p->name);
if (rc)
goto exit;
@ -2008,7 +2166,7 @@ int rpmdepCheck(rpmTransactionSet ts,
rc = 0;
for (j = 0; j < p->providesCount; j++) {
/* Adding: check provides key against conflicts matches. */
if (!checkDependentConflicts(ts, &ps, p->provides[j]))
if (!checkDependentConflicts(ts, ps, p->provides[j]))
continue;
rc = 1;
break;
@ -2032,7 +2190,7 @@ int rpmdepCheck(rpmTransactionSet ts,
name, version, release);
/* Erasing: check name against requiredby matches. */
rc = checkDependentPackages(ts, &ps, name);
rc = checkDependentPackages(ts, ps, name);
if (rc)
goto exit;
}
@ -2047,7 +2205,7 @@ int rpmdepCheck(rpmTransactionSet ts,
rc = 0;
for (j = 0; j < providesCount; j++) {
/* Erasing: check provides against requiredby matches. */
if (!checkDependentPackages(ts, &ps, provides[j]))
if (!checkDependentPackages(ts, ps, provides[j]))
continue;
rc = 1;
break;
@ -2081,7 +2239,7 @@ int rpmdepCheck(rpmTransactionSet ts,
*fileName = '\0';
(void) stpcpy( stpcpy(fileName, dirNames[dirIndexes[j]]) , baseNames[j]);
/* Erasing: check filename against requiredby matches. */
if (!checkDependentPackages(ts, &ps, fileName))
if (!checkDependentPackages(ts, ps, fileName))
continue;
rc = 1;
break;
@ -2099,15 +2257,15 @@ int rpmdepCheck(rpmTransactionSet ts,
mi = rpmdbFreeIterator(mi);
}
if (ps.num) {
*conflicts = ps.problems;
ps.problems = NULL;
*numConflicts = ps.num;
if (ps->num) {
*conflicts = ps->problems;
ps->problems = NULL;
*numConflicts = ps->num;
}
rc = 0;
exit:
mi = rpmdbFreeIterator(mi);
ps.problems = _free(ps.problems);
ps->problems = _free(ps->problems);
return rc;
}

View File

@ -14,12 +14,12 @@
struct tsortInfo {
union {
int count;
/*@kept@*//*@null@*/ struct availablePackage * suc;
/*@kept@*/ /*@null@*/ struct availablePackage * suc;
} tsi_u;
#define tsi_count tsi_u.count
#define tsi_suc tsi_u.suc
/*@owned@*//*@null@*/ struct tsortInfo * tsi_next;
/*@kept@*//*@null@*/ struct availablePackage * tsi_pkg;
/*@owned@*/ /*@null@*/ struct tsortInfo * tsi_next;
/*@kept@*/ /*@null@*/ struct availablePackage * tsi_pkg;
int tsi_reqx;
int tsi_qcnt;
} ;
@ -94,7 +94,7 @@ typedef struct dirInfo_s {
/** \ingroup rpmdep
* Set of available packages, items, and directories.
*/
struct availableList {
typedef /*@abstract@*/ struct availableList_s {
/*@owned@*/ /*@null@*/ struct availablePackage * list; /*!< Set of packages. */
struct availableIndex index; /*!< Set of available items. */
int delta; /*!< Delta for pkg list reallocation. */
@ -102,7 +102,7 @@ struct availableList {
int alloced; /*!< No. of pkgs allocated for list. */
int numDirs; /*!< No. of directories. */
/*@owned@*/ /*@null@*/ dirInfo dirs; /*!< Set of directories. */
} ;
} * availableList;
/** \ingroup rpmdep
* A single package instance to be installed/removed atomically.
@ -126,8 +126,9 @@ struct transactionElement {
*/
struct rpmTransactionSet_s {
rpmtransFlags transFlags; /*!< Bit(s) to control operation. */
rpmCallbackFunction notify; /*!< Callback function. */
/*@observer@*/ rpmCallbackData notifyData;/*!< Callback private data. */
/*@null@*/ rpmCallbackFunction notify; /*!< Callback function. */
/*@observer@*/ /*@null@*/ rpmCallbackData notifyData;
/*!< Callback private data. */
/*@dependent@*/ rpmProblemSet probs; /*!< Current problems in transaction. */
rpmprobFilterFlags ignoreSet; /*!< Bits to filter current problems. */
int filesystemCount; /*!< No. of mounted filesystems. */
@ -137,8 +138,9 @@ struct rpmTransactionSet_s {
/*@only@*/ int * removedPackages; /*!< Set of packages being removed. */
int numRemovedPackages; /*!< No. removed rpmdb instances. */
int allocedRemovedPackages; /*!< Size of removed packages array. */
struct availableList addedPackages; /*!< Set of packages being installed. */
struct availableList availablePackages;
struct availableList_s addedPackages;
/*!< Set of packages being installed. */
struct availableList_s availablePackages;
/*!< Universe of possible packages. */
/*@only@*/ struct transactionElement * order;
/*!< Packages sorted by dependencies. */
@ -157,11 +159,11 @@ struct rpmTransactionSet_s {
/** \ingroup rpmdep
* Problems encountered while checking dependencies.
*/
struct problemsSet {
struct rpmDependencyConflict * problems; /*!< Problems encountered. */
typedef /*@abstract@*/ struct problemsSet_s {
rpmDependencyConflict problems; /*!< Problems encountered. */
int num; /*!< No. of problems found. */
int alloced; /*!< No. of problems allocated. */
} ;
} * problemsSet;
#ifdef __cplusplus
extern "C" {
@ -178,7 +180,8 @@ extern "C" {
* @return 1 if dependency overlaps, 0 otherwise
*/
int headerMatchesDepFlags(Header h,
const char *reqName, const char * reqEVR, int reqFlags);
const char * reqName, const char * reqEVR, int reqFlags)
/*@*/;
#ifdef __cplusplus
}

View File

@ -175,10 +175,11 @@ static int fsnamesTag( /*@unused@*/ Header h, /*@out@*/ int_32 * type,
* @retval freedata address of data-was-malloc'ed indicator
* @return 0 on success
*/
static int instprefixTag(Header h, /*@out@*/ int_32 * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies h, *type, *data, *count, *freeData @*/
static int instprefixTag(Header h, /*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ const void ** data,
/*@null@*/ /*@out@*/ int_32 * count,
/*@null@*/ /*@out@*/ int * freeData)
/*@modifies *type, *data, *count, *freeData @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@ -186,12 +187,12 @@ static int instprefixTag(Header h, /*@out@*/ int_32 * type,
char ** array;
if (hge(h, RPMTAG_INSTALLPREFIX, type, (void **)data, count)) {
*freeData = 0;
if (freeData) *freeData = 0;
return 0;
} else if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &array, count)) {
*data = xstrdup(array[0]);
*freeData = 1;
*type = RPM_STRING_TYPE;
if (data) *data = xstrdup(array[0]);
if (freeData) *freeData = 1;
if (type) *type = RPM_STRING_TYPE;
array = hfd(array, ipt);
return 0;
}
@ -417,7 +418,7 @@ static char * _macro_i18ndomains = "%{?_i18ndomains:%{_i18ndomains}}";
static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies h, *type, *data, *count, *freeData @*/
/*@modifies *type, *data, *count, *freeData @*/
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
char * dstring = rpmExpand(_macro_i18ndomains, NULL);
@ -501,7 +502,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
static int summaryTag(Header h, /*@out@*/ int_32 * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies h, *type, *data, *count, *freeData @*/
/*@modifies *type, *data, *count, *freeData @*/
{
return i18nTag(h, RPMTAG_SUMMARY, type, data, count, freeData);
}
@ -517,7 +518,7 @@ static int summaryTag(Header h, /*@out@*/ int_32 * type,
static int descriptionTag(Header h, /*@out@*/ int_32 * type,
/*@out@*/ const void ** data, /*@out@*/ int_32 * count,
/*@out@*/ int * freeData)
/*@modifies h, *type, *data, *count, *freeData @*/
/*@modifies *type, *data, *count, *freeData @*/
{
return i18nTag(h, RPMTAG_DESCRIPTION, type, data, count, freeData);
}

View File

@ -428,10 +428,10 @@ HeaderIterator headerInitIterator(Header h)
return hi;
}
void headerFreeIterator(HeaderIterator iter)
void headerFreeIterator(HeaderIterator hi)
{
iter->h = headerFree(iter->h);
iter = _free(iter);
hi->h = headerFree(hi->h);
hi = _free(hi);
}
int headerNextIterator(HeaderIterator hi,
@ -2398,7 +2398,7 @@ static int getExtension(Header h, headerTagTagFunction fn,
static char * formatValue(struct sprintfTag * tag, Header h,
const struct headerSprintfExtension * extensions,
struct extensionCache * extCache, int element)
/*@modifies h, extCache->avail @*/
/*@modifies extCache->avail @*/
{
int len;
char buf[20];
@ -2680,7 +2680,7 @@ static void freeExtensionCache(const struct headerSprintfExtension * extensions,
cache = _free(cache);
}
char * headerSprintf(Header h, const char * origFmt,
char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions,
errmsg_t * errmsg)
@ -2694,8 +2694,8 @@ char * headerSprintf(Header h, const char * origFmt,
int i;
struct extensionCache * extCache;
/*fmtString = escapeString(origFmt);*/
fmtString = xstrdup(origFmt);
/*fmtString = escapeString(fmt);*/
fmtString = xstrdup(fmt);
if (parseFormat(fmtString, tags, extensions, &format, &numTokens,
NULL, PARSER_BEGIN, errmsg)) {

View File

@ -205,24 +205,24 @@ unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
/** \ingroup header
* Convert header to in-memory representation.
* @param p on-disk header (with offsets)
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
/*@-exportlocal@*/
/*@null@*/ Header headerLoad(/*@kept@*/ void * p) /*@*/;
/*@null@*/ Header headerLoad(/*@kept@*/ void * uh) /*@*/;
/*@=exportlocal@*/
/** \ingroup header
* Make a copy and convert header to in-memory representation.
* @param p on-disk header (with offsets)
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
/*@null@*/ Header headerCopyLoad(void * p) /*@*/;
/*@null@*/ Header headerCopyLoad(void * uh) /*@*/;
/** \ingroup header
* Convert header to on-disk representation.
* @param h header (with pointers)
* @return on-disk header (with offsets)
* @return on-disk header blob (i.e. with offsets)
*/
/*@only@*/ /*@null@*/ void * headerUnload(Header h)
/*@modifies h @*/;
@ -286,13 +286,13 @@ typedef const char * errmsg_t;
* @param h header
* @param fmt format to use
* @param tags array of tag name/value pairs
* @param extentions chained table of formatting extensions.
* @param extensions chained table of formatting extensions.
* @retval errmsg error message (if any)
* @return formatted output string (malloc'ed)
*/
/*@only@*/ char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extentions,
const struct headerSprintfExtension * extensions,
/*@null@*/ /*@out@*/ errmsg_t * errmsg)
/*@modifies *errmsg @*/;
@ -466,27 +466,28 @@ int headerRemoveEntry(Header h, int_32 tag)
* @return header tag iterator
*/
HeaderIterator headerInitIterator(Header h)
/*@modifies h*/;
/*@modifies h */;
/** \ingroup header
* Return next tag from header.
* @param iter header tag iterator
* @param hi header tag iterator
* @retval tag address of tag
* @retval type address of tag value data type
* @retval p address of pointer to tag value(s)
* @retval c address of number of values
* @return 1 on success, 0 on failure
*/
int headerNextIterator(HeaderIterator iter,
/*@out@*/ int_32 * tag, /*@out@*/ int_32 * type,
/*@out@*/ const void ** p, /*@out@*/ int_32 * c)
/*@modifies iter, *tag, *type, *p, *c @*/;
int headerNextIterator(HeaderIterator hi,
/*@null@*/ /*@out@*/ int_32 * tag, /*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ const void ** p, /*@null@*/ /*@out@*/ int_32 * c)
/*@modifies hi, *tag, *type, *p, *c @*/;
/** \ingroup header
* Destroy header tag iterator.
* @param iter header tag iterator
* @param hi header tag iterator
*/
void headerFreeIterator( /*@only@*/ HeaderIterator iter);
void headerFreeIterator(/*@only@*/ HeaderIterator hi)
/*@modifies hi @*/;
/** \ingroup header
* Duplicate a header.

View File

@ -34,27 +34,27 @@ extern "C" {
/**
* Initialize MD5 hash.
* Set bit count to 0 and buffer to mysterious initialization constants.
* @param context MD5 private data
* @param ctx MD5 private data
* @param brokenEndian calculate broken MD5 sum?
*/
void rpmMD5Init( /*@out@*/ struct MD5Context *context, int brokenEndian);
void rpmMD5Init( /*@out@*/ struct MD5Context * ctx, int brokenEndian);
/**
* Update context to reflect the concatenation of another buffer full
* Update context to reflect the concatenation of another buffer full.
* of bytes.
* @param context MD5 private data
* @param ctx MD5 private data
* @param data next data buffer
* @param len no. bytes of data
*/
void rpmMD5Update(struct MD5Context *context, unsigned char const *buf,
void rpmMD5Update(struct MD5Context * ctx, unsigned char const *buf,
unsigned len);
/**
* Return MD5 digest, and reset context.
* @retval MD5 digest
* @param context MD5 private data
* @param ctx MD5 private data
*/
/*@-fixedformalarray@*/
void rpmMD5Final(unsigned char digest[16], struct MD5Context *context);
void rpmMD5Final(unsigned char digest[16], struct MD5Context * ctx);
/*@=fixedformalarray@*/
/**

View File

@ -42,18 +42,20 @@ void freeSplitString( /*@only@*/ char ** list);
/**
*/
int rpmfileexists(const char * filespec) /*@*/;
int rpmfileexists(const char * urlfn) /*@*/;
/**
*/
int rpmvercmp(const char * one, const char * two);
int rpmvercmp(const char * a, const char * b);
/* these are like the normal functions, but they malloc() the space which
is needed */
/*
* These are like the libc functions, but they malloc() the space which
* is needed.
*/
/**
*/
int dosetenv(const char *name, const char *value, int overwrite);
int dosetenv(const char * name, const char * value, int overwrite);
/**
*/

View File

@ -89,8 +89,10 @@ Header headerRegenSigHeader(const Header h)
* @param hdrPtr address of header (or NULL)
* @return rpmRC return code
*/
static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
/*@out@*/ Header * sigs, /*@out@*/ Header *hdrPtr)
static rpmRC readPackageHeaders(FD_t fd,
/*@null@*/ /*@out@*/ struct rpmlead * leadPtr,
/*@null@*/ /*@out@*/ Header * sigs,
/*@null@*/ /*@out@*/ Header * hdrPtr)
/*@modifies fd, *leadPtr, *sigs, *hdrPtr @*/
{
Header hdrBlock;
@ -200,7 +202,9 @@ rpmRC rpmReadPackageInfo(FD_t fd, Header * sigp, Header * hdrp)
rpmRC rc = readPackageHeaders(fd, NULL, sigp, hdrp);
if (rc == RPMRC_FAIL)
return rc;
if (hdrp && *hdrp && sigp && *sigp)
if (hdrp == NULL || sigp == NULL)
return rc;
if (*hdrp && *sigp)
headerMergeLegacySigs(*hdrp, *sigp);
return rc;
}

View File

@ -12,6 +12,7 @@
/*@access rpmProblemSet@*/
/*@access rpmProblem@*/
/*@access rpmDependencyConflict@*/
/* XXX FIXME: merge into problems */
/* XXX used in verify.c rpmlibprov.c */
@ -31,8 +32,9 @@ void printDepFlags(FILE * fp, const char * version, int flags)
fprintf(fp, " %s", version);
}
static int sameProblem(struct rpmDependencyConflict * ap,
struct rpmDependencyConflict * bp)
static int sameProblem(const rpmDependencyConflict ap,
const rpmDependencyConflict bp)
/*@*/
{
if (ap->sense != bp->sense)
@ -56,8 +58,8 @@ static int sameProblem(struct rpmDependencyConflict * ap,
}
/* XXX FIXME: merge into problems */
void printDepProblems(FILE * fp, struct rpmDependencyConflict * conflicts,
int numConflicts)
void printDepProblems(FILE * fp,
const rpmDependencyConflict conflicts, int numConflicts)
{
int i;
@ -105,7 +107,7 @@ static inline int snprintf(char * buf, int nb, const char * fmt, ...)
}
#endif
const char * rpmProblemString(rpmProblem prob)
const char * rpmProblemString(const rpmProblem prob)
{
/*@observer@*/ const char * pkgNEVR = (prob->pkgNEVR ? prob->pkgNEVR : "");
/*@observer@*/ const char * altNEVR = (prob->altNEVR ? prob->altNEVR : "");
@ -184,7 +186,7 @@ const char * rpmProblemString(rpmProblem prob)
void rpmProblemPrint(FILE *fp, rpmProblem prob)
{
const char *msg = rpmProblemString(prob);
const char * msg = rpmProblemString(prob);
fprintf(fp, "%s\n", msg);
msg = _free(msg);
}

View File

@ -722,7 +722,7 @@ rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
if (rc) rc = RPMRC_FAIL;
exit:
if (rc == RPMRC_OK && specFile && specFilePtr)
if (specFilePtr && specFile && rc == RPMRC_OK)
*specFilePtr = specFile;
else
specFile = _free(specFile);

View File

@ -479,7 +479,7 @@ restart:
if (numFailed) goto exit;
if (numRPMS && !(interfaceFlags & INSTALL_NODEPS)) {
struct rpmDependencyConflict * conflicts;
rpmDependencyConflict conflicts;
int numConflicts;
if (rpmdepCheck(ts, &conflicts, &numConflicts)) {
@ -490,7 +490,7 @@ restart:
if (!stopInstall && conflicts) {
rpmMessage(RPMMESS_ERROR, _("failed dependencies:\n"));
printDepProblems(stderr, conflicts, numConflicts);
rpmdepFreeConflicts(conflicts, numConflicts);
conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
numFailed = numPkgs;
stopInstall = 1;
}
@ -567,7 +567,7 @@ int rpmErase(const char * rootdir, const char ** argv,
const char ** arg;
int numFailed = 0;
rpmTransactionSet ts;
struct rpmDependencyConflict * conflicts;
rpmDependencyConflict conflicts;
int numConflicts;
int stopUninstall = 0;
int numPackages = 0;
@ -625,7 +625,7 @@ int rpmErase(const char * rootdir, const char ** argv,
rpmMessage(RPMMESS_ERROR, _("removing these packages would break "
"dependencies:\n"));
printDepProblems(stderr, conflicts, numConflicts);
rpmdepFreeConflicts(conflicts, numConflicts);
conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
numFailed += numPackages;
stopUninstall = 1;
}

View File

@ -43,28 +43,30 @@ extern "C" {
/**
* Return package signatures and header from file handle.
* @deprecated Signature tags are appended to header in rpm-4.0.2.
* @todo Eliminate.
* @param fd file handle
* @retval signatures address of signatures pointer (or NULL)
* @retval hdr address of header pointer (or NULL)
* @retval sigp address of signature header (or NULL)
* @retval hdrp address of header (or NULL)
* @return rpmRC return code
*/
rpmRC rpmReadPackageInfo(FD_t fd, /*@out@*/ Header * signatures,
/*@out@*/ Header * hdr)
/*@modifies fd, *signatures, *hdr @*/;
rpmRC rpmReadPackageInfo(FD_t fd, /*@null@*/ /*@out@*/ Header * sigp,
/*@null@*/ /*@out@*/ Header * hdrp)
/*@modifies fd, *sigp, *hdrp @*/;
/**
* Return package header and lead info from file handle.
* @param fd file handle
* @retval hdr address of header (or NULL)
* @retval isSource
* @retval major
* @retval minor
* @retval hdrp address of header (or NULL)
* @retval isSource address to return lead source flag (or NULL)
* @retval major address to return lead major (or NULL)
* @retval minor address to return lead minor (or NULL)
* @return rpmRC return code
*/
rpmRC rpmReadPackageHeader(FD_t fd, /*@out@*/ Header * hdr,
/*@out@*/ int * isSource, /*@out@*/ int * major,
/*@out@*/ int * minor)
/*@modifies fd, *hdr, *isSource, *major, *minor @*/;
rpmRC rpmReadPackageHeader(FD_t fd, /*@null@*/ /*@out@*/ Header * hdrp,
/*@null@*/ /*@out@*/ int * isSource, /*@null@*/ /*@out@*/ int * major,
/*@null@*/ /*@out@*/ int * minor)
/*@modifies fd, *hdrp, *isSource, *major, *minor @*/;
/** \ingroup header
* Return name, version, release strings from header.
@ -484,10 +486,10 @@ int rpmReadConfigFiles(/*@null@*/ const char * file,
/** \ingroup rpmrc
* Read rpmrc (and macro) configuration file(s).
* @param file colon separated files to read (NULL uses default)
* @param rcfiles colon separated files to read (NULL uses default)
* @return 0 on succes
*/
int rpmReadRC(/*@null@*/ const char * file);
int rpmReadRC(/*@null@*/ const char * rcfiles);
/** \ingroup rpmrc
* Return current arch name and/or number.
@ -526,10 +528,10 @@ int rpmMachineScore(int type, const char * name);
/** \ingroup rpmrc
* Display current rpmrc (and macro) configuration.
* @param f output file handle
* @param fp output file handle
* @return 0 always
*/
int rpmShowRC(FILE *f);
int rpmShowRC(FILE * fp);
/** \ingroup rpmrc
* @deprecated Use addMacro to set _target_* macros.
@ -845,26 +847,32 @@ void printDepFlags(FILE *fp, const char *version, int flags)
/**
*/
struct rpmDependencyConflict {
typedef /*@abstract@*/ struct rpmDependencyConflict_s {
const char * byName;
const char * byVersion;
const char * byRelease;
Header byHeader;
/* these needs fields are misnamed -- they are used for the package
which isn't needed as well */
/*
* These needs fields are misnamed -- they are used for the package
* which isn't needed as well.
*/
const char * needsName;
const char * needsVersion;
int needsFlags;
/*@observer@*/ /*@null@*/ const void * suggestedPackage; /* NULL if none */
/*@owned@*/ /*@null@*/ const void ** suggestedPackages; /* terminated by NULL */
enum {
RPMDEP_SENSE_REQUIRES, /*!< requirement not satisfied. */
RPMDEP_SENSE_CONFLICTS /*!< conflict was found. */
} sense;
} ;
} * rpmDependencyConflict;
/**
* Print results of rpmdepCheck() dependency check.
* @param fp output file
* @param conflicts dependency problems
* @param numConflicts no. of dependency problems
*/
void printDepProblems(FILE *fp, struct rpmDependencyConflict *conflicts,
void printDepProblems(FILE * fp, const rpmDependencyConflict conflicts,
int numConflicts)
/*@modifies *fp @*/;
@ -874,8 +882,7 @@ void printDepProblems(FILE *fp, struct rpmDependencyConflict *conflicts,
* @param prob rpm problem
* @return formatted string
*/
/*@only@*/ extern const char * rpmProblemString(rpmProblem prob)
/*@modifies prob @*/;
/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob) /*@*/;
/**
* Output formatted string representation of problem to file handle.
@ -929,19 +936,20 @@ typedef struct rpmRelocation_s {
/**
* Install source package.
* @param root path to top of install tree
* @param rootDir path to top of install tree (or NULL)
* @param fd file handle
* @retval specFile address of spec file name
* @retval specFilePtr address of spec file name (or NULL)
* @param notify progress callback
* @param notifyData progress callback private data
* @retval cooke address of cookie pointer
* @retval cooke address of cookie pointer (or NULL)
* @return rpmRC return code
*/
rpmRC rpmInstallSourcePackage(/*@null@*/ const char * root, FD_t fd,
/*@out@*/ const char ** specFile,
rpmCallbackFunction notify, rpmCallbackData notifyData,
/*@out@*/ char ** cookie)
/*@modifies fd, *specFile, *cookie @*/;
rpmRC rpmInstallSourcePackage(/*@null@*/ const char * rootDir, FD_t fd,
/*@null@*/ /*@out@*/ const char ** specFilePtr,
/*@null@*/ rpmCallbackFunction notify,
/*@null@*/ rpmCallbackData notifyData,
/*@null@*/ /*@out@*/ char ** cookie)
/*@modifies fd, *specFilePtr, *cookie @*/;
/**
* Compare headers to determine which header is "newer".
@ -1024,7 +1032,8 @@ typedef /*@abstract@*/ struct rpmTransactionSet_s * rpmTransactionSet;
*/
/*@only@*/ rpmTransactionSet rpmtransCreateSet(
/*@null@*/ /*@kept@*/ rpmdb rpmdb,
/*@null@*/ const char * rootdir);
/*@null@*/ const char * rootDir)
/*@*/;
/** \ingroup rpmtrans
* Add package to be installed to unordered transaction set.
@ -1038,13 +1047,14 @@ typedef /*@abstract@*/ struct rpmTransactionSet_s * rpmTransactionSet;
* @param h package header
* @param fd package file handle
* @param key package private data
* @param update is package being upgraded?
* @param upgrade is package being upgraded?
* @param relocs package file relocations
* @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 update,
/*@null@*/ rpmRelocation * relocs);
/*@null@*/ /*@owned@*/ const void * key, int upgrade,
/*@null@*/ rpmRelocation * relocs)
/*@modifies fd, h, ts @*/;
/** \ingroup rpmtrans
* Add package to universe of possible packages to install in transaction set.
@ -1053,20 +1063,23 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, /*@null@*/ FD_t fd,
* @param key package private data
*/
void rpmtransAvailablePackage(rpmTransactionSet ts, Header h,
/*@null@*/ /*@owned@*/ const void * key);
/*@null@*/ /*@owned@*/ const void * key)
/*@modifies h, ts @*/;
/** \ingroup rpmtrans
* Add package to be removed to unordered transaction set.
* @param ts transaction set
* @param dboffset rpm database instance
*/
void rpmtransRemovePackage(rpmTransactionSet ts, int dboffset);
void rpmtransRemovePackage(rpmTransactionSet ts, int dboffset)
/*@modifies ts @*/;
/** \ingroup rpmtrans
* Destroy transaction set.
* @param ts transaction set
*/
void rpmtransFree( /*@only@*/ rpmTransactionSet ts);
void rpmtransFree( /*@only@*/ rpmTransactionSet ts)
/*@modifies ts @*/;
/** \ingroup rpmtrans
* Save file handle to be used as stderr when running package scripts.
@ -1091,13 +1104,14 @@ int rpmtransGetKeys(const rpmTransactionSet ts,
/** \ingroup rpmtrans
* Check that all dependencies can be resolved.
* @param ts transaction set
* @retval conflicts
* @retval numConflicts
* @retval conflicts dependency problems
* @retval numConflicts no. of dependency problems
* @return 0 on success
*/
int rpmdepCheck(rpmTransactionSet ts,
/*@exposed@*/ /*@out@*/ struct rpmDependencyConflict ** conflicts,
/*@exposed@*/ /*@out@*/ int * numConflicts);
/*@exposed@*/ /*@out@*/ rpmDependencyConflict * conflicts,
/*@exposed@*/ /*@out@*/ int * numConflicts)
/*@modifies ts, *conflicts, *numConflicts @*/;
/** \ingroup rpmtrans
* Determine package order in a transaction set according to dependencies.
@ -1118,15 +1132,18 @@ int rpmdepCheck(rpmTransactionSet ts,
* @param ts transaction set
* @return 0 if packages are successfully ordered, 1 otherwise
*/
int rpmdepOrder(rpmTransactionSet ts) /*@modifies ts @*/;
int rpmdepOrder(rpmTransactionSet ts)
/*@modifies ts @*/;
/** \ingroup rpmtrans
* Destroy dependency conflicts storage.
* @param conflicts dependency conflicts
* @param numConflicts no. of dependency conflicts
* @param conflicts dependency problems
* @param numConflicts no. of dependency problems
* @retrun NULL always
*/
void rpmdepFreeConflicts( /*@only@*/ struct rpmDependencyConflict * conflicts,
int numConflicts);
/*@null@*/ rpmDependencyConflict rpmdepFreeConflicts(
/*@only@*/ /*@null@*/ rpmDependencyConflict conflicts, int numConflicts)
/*@modifies conflicts @*/;
/** \ingroup rpmtrans
* Bit(s) to control rpmRunTransaction() operation.
@ -1200,8 +1217,9 @@ int rpmGetRpmlibProvides(/*@out@*/ const char *** provNames,
* @param BFlags 2nd dependency logical range qualifiers
* @return 1 if dependencies overlap, 0 otherwise
*/
int rpmRangesOverlap(const char *AName, const char *AEVR, int AFlags,
const char *BName, const char *BEVR, int BFlags) /*@*/;
int rpmRangesOverlap(const char * AName, const char * AEVR, int AFlags,
const char * BName, const char * BEVR, int BFlags)
/*@*/;
/** \ingroup rpmtrans
* Check dependency against internal rpmlib feature provides.
@ -1252,7 +1270,8 @@ int rpmRunTransactions(rpmTransactionSet ts,
rpmProblemSet okProbs,
/*@out@*/ rpmProblemSet * newProbs,
rpmtransFlags transFlags,
rpmprobFilterFlags ignoreSet);
rpmprobFilterFlags ignoreSet)
/*@modifies ts, *newProbs @*/;
/*@}*/
@ -1261,8 +1280,7 @@ int rpmRunTransactions(rpmTransactionSet ts,
* @param tag tag value
* @return name of tag
*/
/*@observer@*/ extern const char *const tagName(int tag)
/*@*/;
/*@observer@*/ extern const char *const tagName(int tag) /*@*/;
/**
* Return value of tag from name.
@ -1301,28 +1319,30 @@ struct rpmlead {
/**
* Release storage used by file system usage cache.
*/
void freeFilesystems(void);
void freeFilesystems(void) /*@modifies internalState@*/;
/**
* Return (cached) file system mount points.
* @retval addess of file system names (or NULL)
* @retval num address of number of file systems
* @retval listptr addess of file system names (or NULL)
* @retval num address of number of file systems (or NULL)
* @return 0 on success, 1 on error
*/
int rpmGetFilesystemList( /*@out@*/ const char *** listptr, /*@out@*/ int * num)
/*@modifies *listptr, *num @*/;
int rpmGetFilesystemList( /*@null@*/ /*@out@*/ const char *** listptr,
/*@null@*/ /*@out@*/ int * num)
/*@modifies *listptr, *num @*/;
/**
* Determine per-file system usage for a list of files.
* @param filelist array of absolute file names
* @param fileList array of absolute file names
* @param fssizes array of file sizes
* @param numFiles number of files in list
* @retval usagesPtr address of per-file system usage array.
* @retval usagesPtr address of per-file system usage array (or NULL)
* @param flags (unused)
* @return 0 on success, 1 on error
*/
int rpmGetFilesystemUsage(const char ** filelist, int_32 * fssizes,
int numFiles, /*@out@*/ uint_32 ** usagesPtr, int flags);
int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes,
int numFiles, /*@null@*/ /*@out@*/ uint_32 ** usagesPtr, int flags)
/*@modifies *usagesPtr @*/;
/* ==================================================================== */
/** \name RPMBT */
@ -1494,29 +1514,30 @@ extern struct poptOption rpmQueryPoptTable[];
* Display list of tags that can be used in --queryformat.
* @param f file handle to use for display
*/
void rpmDisplayQueryTags(FILE * f);
void rpmDisplayQueryTags(FILE * f) /*@modifies f@*/;
/** \ingroup rpmcli
* Common query/verify source interface, called once for each CLI arg.
* @param qva parsed query/verify options
* @param source type of source to query/verify
* @param arg name of source to query/verify
* @param db rpm database
* @param rpmdb rpm database
* @param showPackage query/verify specific display routine
* @return showPackage() result, 1 if rpmdbInitIterator() is NULL
*/
int rpmQueryVerify(QVA_t qva, rpmQVSources source, const char * arg,
rpmdb db, QVF_t showPackage);
rpmdb rpmdb, QVF_t showPackage)
/*@modifies fileSystem@*/;
/** \ingroup rpmcli
* Display results of package query.
* @todo Devise a meaningful return code.
* @param qva parsed query/verify options
* @param db rpm database (unused for queries)
* @param rpmdb rpm database (unused for queries)
* @param h header to use for query
* @return 0 always
*/
int showQueryPackage(QVA_t qva, rpmdb db, Header h);
int showQueryPackage(QVA_t qva, rpmdb rpmdb, Header h);
/** \ingroup rpmcli
* Display package information.
@ -1525,7 +1546,8 @@ int showQueryPackage(QVA_t qva, rpmdb db, Header h);
* @param arg name of source to query
* @return rpmQueryVerify() result, or 1 on rpmdbOpen() failure
*/
int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg);
int rpmQuery(QVA_t qva, rpmQVSources source, const char * arg)
/*@modifies fileSystem@*/;
/** \ingroup rpmcli
*/
@ -1534,11 +1556,12 @@ extern struct poptOption rpmVerifyPoptTable[];
/** \ingroup rpmcli
* Display results of package verify.
* @param qva parsed query/verify options
* @param db rpm database
* @param rpmdb rpm database
* @param h header to use for verify
* @return result of last non-zero verify return
*/
int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb db, Header h);
int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb rpmdb, Header h)
/*@modifies fileSystem@*/;
/** \ingroup rpmcli
* Verify package install.
@ -1547,7 +1570,8 @@ int showVerifyPackage(QVA_t qva, /*@only@*/ rpmdb db, Header h);
* @param arg name of source to verify
* @return rpmQueryVerify() result, or 1 on rpmdbOpen() failure
*/
int rpmVerify(QVA_t qva, rpmQVSources source, const char *arg);
int rpmVerify(QVA_t qva, rpmQVSources source, const char *arg)
/*@modifies fileSystem@*/;
/*@}*/
/* ==================================================================== */
@ -1572,29 +1596,33 @@ typedef enum rpmInstallInterfaceFlags_e {
/** \ingroup rpmcli
* Install/upgrade/freshen binary rpm package.
* @param rootdir path to top of install tree
* @param argv array of package file names (NULL terminated)
* @param fileArgv array of package file names (NULL terminated)
* @param transFlags bits to control rpmRunTransactions()
* @param interfaceFlags bits to control rpmInstall()
* @param probFilter bits to filter problem types
* @param relocations package file relocations
* @return 0 on success
*/
int rpmInstall(/*@null@*/ const char * rootdir, /*@null@*/ const char ** argv,
int rpmInstall(/*@null@*/ const char * rootdir,
/*@null@*/ const char ** fileArgv,
rpmtransFlags transFlags,
rpmInstallInterfaceFlags interfaceFlags,
rpmprobFilterFlags probFilter,
/*@null@*/ rpmRelocation * relocations);
/*@null@*/ rpmRelocation * relocations)
/*@modifies fileSystem, *relocations @*/;
/** \ingroup rpmcli
* Install source rpm package.
* @param prefix path to top of install tree
* @param rootdir path to top of install tree
* @param arg source rpm file name
* @retval specFile address of (installed) spec file name
* @retval cookie
* @return 0 on success
*/
int rpmInstallSource(const char * prefix, const char * arg,
/*@out@*/ const char ** specFile, /*@out@*/ char ** cookie);
int rpmInstallSource(const char * rootdir, const char * arg,
/*@null@*/ /*@out@*/ const char ** specFile,
/*@null@*/ /*@out@*/ char ** cookie)
/*@modifies fileSystem, *specFile, *cookie @*/;
/** \ingroup rpmcli
* Bit(s) to control rpmErase() operation.

View File

@ -1389,7 +1389,7 @@ void rpmGetOsInfo(const char ** name, int * num) {
getMachineInfo(OS, name, num);
}
void rpmRebuildTargetVars(const char ** buildtarget, const char ** canontarget)
void rpmRebuildTargetVars(const char ** target, const char ** canontarget)
{
char *ca = NULL, *co = NULL, *ct = NULL;
@ -1401,10 +1401,10 @@ void rpmRebuildTargetVars(const char ** buildtarget, const char ** canontarget)
rpmSetTables(RPM_MACHTABLE_INSTARCH, RPM_MACHTABLE_INSTOS);
rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
if (buildtarget && *buildtarget) {
if (target && *target) {
char *c;
/* Set arch and os from specified build target */
ca = xstrdup(*buildtarget);
ca = xstrdup(*target);
if ((c = strchr(ca, '-')) != NULL) {
*c++ = '\0';

View File

@ -413,7 +413,7 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
return 0;
}
int rpmAddSignature(Header header, const char * file, int_32 sigTag,
int rpmAddSignature(Header h, const char * file, int_32 sigTag,
const char *passPhrase)
{
struct stat st;
@ -427,25 +427,25 @@ int rpmAddSignature(Header header, const char * file, int_32 sigTag,
(void) stat(file, &st);
size = st.st_size;
ret = 0;
(void) headerAddEntry(header, RPMSIGTAG_SIZE, RPM_INT32_TYPE, &size, 1);
(void) headerAddEntry(h, RPMSIGTAG_SIZE, RPM_INT32_TYPE, &size, 1);
break;
case RPMSIGTAG_MD5:
ret = mdbinfile(file, buf);
if (ret == 0)
(void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, buf, 16);
(void) headerAddEntry(h, sigTag, RPM_BIN_TYPE, buf, 16);
break;
case RPMSIGTAG_PGP5: /* XXX legacy */
case RPMSIGTAG_PGP:
rpmMessage(RPMMESS_VERBOSE, _("Generating signature using PGP.\n"));
ret = makePGPSignature(file, &sig, &size, passPhrase);
if (ret == 0)
(void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
(void) headerAddEntry(h, sigTag, RPM_BIN_TYPE, sig, size);
break;
case RPMSIGTAG_GPG:
rpmMessage(RPMMESS_VERBOSE, _("Generating signature using GPG.\n"));
ret = makeGPGSignature(file, &sig, &size, passPhrase);
if (ret == 0)
(void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
(void) headerAddEntry(h, sigTag, RPM_BIN_TYPE, sig, size);
break;
}

View File

@ -46,12 +46,13 @@ Header rpmNewSignature(void) /*@*/;
* Read (and verify header+archive size) signature header.
* If an old-style signature is found, we emulate a new style one.
* @param fd file handle
* @retval header address of (signature) header
* @param sig_type type of signature header to read (from lead).
* @retval headerp address of (signature) header (or NULL)
* @param sig_type type of signature header to read (from lead)
* @return rpmRC return code
*/
rpmRC rpmReadSignature(FD_t fd, /*@out@*/ Header *header, sigType sig_type)
/*@modifies fd, *header @*/;
rpmRC rpmReadSignature(FD_t fd, /*@null@*/ /*@out@*/ Header *headerp,
sigType sig_type)
/*@modifies fd, *headerp @*/;
/** \ingroup signature
* Write signature header.

View File

@ -72,7 +72,7 @@ struct poptOption rpmVerifyPoptTable[] = {
};
/* ======================================================================== */
int rpmVerifyFile(const char * prefix, Header h, int filenum,
int rpmVerifyFile(const char * root, Header h, int filenum,
int * result, int omitMask)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
@ -126,8 +126,8 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
(void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
filespec = alloca(strlen(dirNames[dirIndexes[filenum]]) +
strlen(baseNames[filenum]) + strlen(prefix) + 5);
sprintf(filespec, "%s/%s%s", prefix, dirNames[dirIndexes[filenum]],
strlen(baseNames[filenum]) + strlen(root) + 5);
sprintf(filespec, "%s/%s%s", root, dirNames[dirIndexes[filenum]],
baseNames[filenum]);
baseNames = hfd(baseNames, bnt);
dirNames = hfd(dirNames, dnt);
@ -326,6 +326,11 @@ int rpmVerifyScript(const char * rootDir, Header h, /*@null@*/ FD_t scriptFd)
}
/* ======================================================================== */
/**
* Check file info from header against what's actually installed.
* @param h header
* @return 0 no problems, 1 problems found
*/
static int verifyHeader(QVA_t qva, Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
@ -338,7 +343,7 @@ static int verifyHeader(QVA_t qva, Header h)
rpmVerifyAttrs verifyResult = 0;
rpmVerifyAttrs omitMask = !(qva->qva_flags & VERIFY_MD5)
? RPMVERIFY_MD5 : RPMVERIFY_NONE;
int ec = 0;
int ec = 0; /* assume no problems */
int i;
te = t = buf;
@ -407,16 +412,22 @@ static int verifyHeader(QVA_t qva, Header h)
}
exit:
if (fileNames) free(fileNames);
fileNames = _free(fileNames);
return ec;
}
/**
* Check installed package dependencies for problems.
* @param rpmdb rpm database
* @param h header
* @return 0 no problems, 1 problems found
*/
static int verifyDependencies(rpmdb rpmdb, Header h)
{
rpmTransactionSet rpmdep;
struct rpmDependencyConflict * conflicts;
rpmDependencyConflict conflicts;
int numConflicts;
int rc = 0;
int rc = 0; /* assume no problems */
int i;
rpmdep = rpmtransCreateSet(rpmdb, NULL);
@ -454,7 +465,7 @@ static int verifyDependencies(rpmdb rpmdb, Header h)
te = stpcpy(te, conflicts[i].needsVersion);
}
}
rpmdepFreeConflicts(conflicts, numConflicts);
conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
if (te > t) {
*te++ = '\n';
*te = '\0';

View File

@ -5,6 +5,7 @@
#include <alloca.h>
#include <errno.h>
#include <fcntl.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
@ -16,6 +17,7 @@
#include "rpmlib.h"
#include "misc.h"
#include "rpmmacro.h"
#include "rpmio_internal.h"
#include "upgrade.h"
extern int _rpmio_debug;
@ -325,7 +327,7 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
}
/* RPMVERIFY_USER and RPM_VERIFY_GROUP are handled wrong here, but rpmlib.a
doesn't do these correctly either. At least this is consisten */
doesn't do these correctly either. At least this is consistent. */
if (verifyResult & RPMVERIFY_USER) {
if (!s->uids) {
headerGetEntry(s->h, RPMTAG_FILEUIDS, &type, (void **) &s->uids,
@ -2232,7 +2234,6 @@ static int closeCallback(FILE * f) {
return 0;
}
#if 0
/** \ingroup python
*/
static PyObject * doFopen(PyObject * self, PyObject * args) {
@ -2282,7 +2283,6 @@ static PyObject * doFopen(PyObject * self, PyObject * args) {
return PyFile_FromFile (node->f, path, mode, closeCallback);
}
#endif
/** \ingroup python
*/

View File

@ -148,7 +148,7 @@ for dbi in \
Basenames Conflictname Dirnames Group Installtid Name Providename \
Provideversion Removetid Requirename Requireversion Triggername
do
touch $RPM_BUILD_ROOT/var/lib/rpm/dbi
touch $RPM_BUILD_ROOT/var/lib/rpm/$dbi
done
%endif

View File

@ -48,7 +48,7 @@ falloc.lo: falloc.c $(top_srcdir)/system.h $(top_srcdir)/rpmio/rpmio.h falloc.h
touch $@
clean-local:
rm -f $(DB3LOBJS)
rm -f $(DB3LOBJS) *.o .created
.PHONY: sources
sources:

View File

@ -656,7 +656,12 @@ static int db3stat(dbiIndex dbi, unsigned int flags)
#endif
flags = 0;
dbi->dbi_stats = _free(dbi->dbi_stats);
/* XXX 3.3.4 change. */
#if DB_VERSION_MAJOR == 3 && DB_VERSION_MINOR == 3
rc = db->stat(db, &dbi->dbi_stats, flags);
#else
rc = db->stat(db, &dbi->dbi_stats, NULL, flags);
#endif
rc = cvtdberr(dbi, "db->stat", rc, _debug);
return rc;
}

View File

@ -207,7 +207,7 @@ restart:
if (conflicts) {
rpmMessage(RPMMESS_ERROR, _("failed dependencies:\n"));
printDepProblems(stderr, conflicts, numConflicts);
rpmdepFreeConflicts(conflicts, numConflicts);
conflicts = rpmdepFreeConflicts(conflicts, numConflicts);
rc = -1;
goto exit;
}