Transactions made increasingly opaque.
CVS patchset: 5438 CVS date: 2002/05/17 21:08:39
This commit is contained in:
parent
076a6e29c5
commit
38385c8d63
|
@ -230,7 +230,7 @@ int rpmtsAddPackage(rpmTransactionSet ts, Header h,
|
|||
goto exit;
|
||||
|
||||
/* Do lazy (readonly?) open of rpm database. */
|
||||
if (ts->rpmdb == NULL) {
|
||||
if (rpmtsGetRdb(ts) == NULL) {
|
||||
if ((ec = rpmtsOpenDB(ts, ts->dbmode)) != 0)
|
||||
goto exit;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts, rpmDepSet dep)
|
|||
*/
|
||||
if (_cacheDependsRC) {
|
||||
dbiIndex dbi;
|
||||
dbi = dbiOpen(ts->rpmdb, RPMDBI_DEPENDS, 0);
|
||||
dbi = dbiOpen(rpmtsGetRdb(ts), RPMDBI_DEPENDS, 0);
|
||||
if (dbi == NULL)
|
||||
_cacheDependsRC = 0;
|
||||
else {
|
||||
|
@ -433,7 +433,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts, rpmDepSet dep)
|
|||
goto exit;
|
||||
|
||||
/* XXX only the installer does not have the database open here. */
|
||||
if (ts->rpmdb != NULL) {
|
||||
if (rpmtsGetRdb(ts) != NULL) {
|
||||
if (Name[0] == '/') {
|
||||
/* depFlags better be 0! */
|
||||
|
||||
|
@ -481,7 +481,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts, rpmDepSet dep)
|
|||
/*
|
||||
* Search for an unsatisfied dependency.
|
||||
*/
|
||||
if (!(ts->transFlags & RPMTRANS_FLAG_NOSUGGESTS) && ts->solve != NULL)
|
||||
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOSUGGESTS) && ts->solve != NULL)
|
||||
xx = (*ts->solve) (ts, dep);
|
||||
|
||||
unsatisfied:
|
||||
|
@ -494,7 +494,7 @@ exit:
|
|||
*/
|
||||
if (_cacheDependsRC) {
|
||||
dbiIndex dbi;
|
||||
dbi = dbiOpen(ts->rpmdb, RPMDBI_DEPENDS, 0);
|
||||
dbi = dbiOpen(rpmtsGetRdb(ts), RPMDBI_DEPENDS, 0);
|
||||
if (dbi == NULL) {
|
||||
_cacheDependsRC = 0;
|
||||
} else {
|
||||
|
@ -699,7 +699,7 @@ static int checkDependentConflicts(rpmTransactionSet ts, const char * dep)
|
|||
{
|
||||
int rc = 0;
|
||||
|
||||
if (ts->rpmdb != NULL) { /* XXX is this necessary? */
|
||||
if (rpmtsGetRdb(ts) != NULL) { /* XXX is this necessary? */
|
||||
rpmdbMatchIterator mi;
|
||||
mi = rpmtsInitIterator(ts, RPMTAG_CONFLICTNAME, dep, 0);
|
||||
rc = checkPackageSet(ts, dep, mi);
|
||||
|
@ -1140,7 +1140,7 @@ int rpmtsOrder(rpmTransactionSet ts)
|
|||
int_32 Flags;
|
||||
|
||||
#ifdef DYING
|
||||
int chainsaw = ts->transFlags & RPMTRANS_FLAG_CHAINSAW;
|
||||
int chainsaw = rpmtsGetFlags(ts) & RPMTRANS_FLAG_CHAINSAW;
|
||||
#else
|
||||
int chainsaw = 1;
|
||||
#endif
|
||||
|
@ -1655,7 +1655,7 @@ int rpmtsCheck(rpmTransactionSet ts)
|
|||
int rc;
|
||||
|
||||
/* Do lazy, readonly, open of rpm database. */
|
||||
if (ts->rpmdb == NULL) {
|
||||
if (rpmtsGetRdb(ts) == NULL) {
|
||||
if ((rc = rpmtsOpenDB(ts, ts->dbmode)) != 0)
|
||||
goto exit;
|
||||
closeatexit = 1;
|
||||
|
@ -1777,7 +1777,7 @@ exit:
|
|||
if (closeatexit)
|
||||
xx = rpmtsCloseDB(ts);
|
||||
else if (_cacheDependsRC)
|
||||
xx = rpmdbCloseDBI(ts->rpmdb, RPMDBI_DEPENDS);
|
||||
xx = rpmdbCloseDBI(rpmtsGetRdb(ts), RPMDBI_DEPENDS);
|
||||
/*@=branchstate@*/
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
|
||||
|
||||
/*@unchecked@*/
|
||||
int _fsm_debug = 1;
|
||||
int _fsm_debug = 0;
|
||||
|
||||
/* XXX Failure to remove is not (yet) cause for failure. */
|
||||
/*@-exportlocal -exportheadervar@*/
|
||||
|
@ -522,8 +522,8 @@ int fsmSetup(FSM_t fsm, fileStage goal,
|
|||
|
||||
memset(fsm->sufbuf, 0, sizeof(fsm->sufbuf));
|
||||
if (fsm->goal == FSM_PKGINSTALL) {
|
||||
if (ts && ts->id > 0)
|
||||
sprintf(fsm->sufbuf, ";%08x", (unsigned)ts->id);
|
||||
if (ts && rpmtsGetTid(ts) > 0)
|
||||
sprintf(fsm->sufbuf, ";%08x", (unsigned)rpmtsGetTid(ts));
|
||||
}
|
||||
|
||||
ec = fsm->rc = 0;
|
||||
|
|
|
@ -26,7 +26,9 @@ if (_ps_debug > 0 && msg != NULL)
|
|||
fprintf(stderr, "--> ps %p -- %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln);
|
||||
/*@=modfilesystem@*/
|
||||
ps->nrefs--;
|
||||
return NULL;
|
||||
/*@-refcounttrans@*/
|
||||
return ps;
|
||||
/*@=refcounttrans@*/
|
||||
}
|
||||
|
||||
rpmProblemSet XrpmpsLink(rpmProblemSet ps, const char * msg,
|
||||
|
@ -37,26 +39,23 @@ rpmProblemSet XrpmpsLink(rpmProblemSet ps, const char * msg,
|
|||
if (_ps_debug > 0 && msg != NULL)
|
||||
fprintf(stderr, "--> ps %p ++ %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln);
|
||||
/*@=modfilesystem@*/
|
||||
/*@-refcounttrans@*/ return ps; /*@=refcounttrans@*/
|
||||
/*@-refcounttrans@*/
|
||||
return ps;
|
||||
/*@=refcounttrans@*/
|
||||
}
|
||||
|
||||
rpmProblemSet rpmProblemSetCreate(void)
|
||||
{
|
||||
rpmProblemSet ps;
|
||||
|
||||
ps = xcalloc(1, sizeof(*ps));
|
||||
ps->numProblems = ps->numProblemsAlloced = 0;
|
||||
ps->probs = NULL;
|
||||
ps->nrefs = 0;
|
||||
|
||||
rpmProblemSet ps = xcalloc(1, sizeof(*ps));
|
||||
return rpmpsLink(ps, "create");
|
||||
}
|
||||
|
||||
rpmProblemSet rpmProblemSetFree(rpmProblemSet ps)
|
||||
{
|
||||
if (ps == NULL) return NULL;
|
||||
if (ps->nrefs > 1)
|
||||
return rpmpsUnlink(ps, "dereference");
|
||||
ps = rpmpsUnlink(ps, "dereference");
|
||||
if (ps->nrefs > 0)
|
||||
return NULL;
|
||||
|
||||
if (ps->probs) {
|
||||
int i;
|
||||
|
@ -68,12 +67,7 @@ rpmProblemSet rpmProblemSetFree(rpmProblemSet ps)
|
|||
}
|
||||
ps->probs = _free(ps->probs);
|
||||
}
|
||||
/*@-nullstate@*/ /* FIX: ps->probs may be NULL */
|
||||
(void) rpmpsUnlink(ps, "destroy");
|
||||
/*@=nullstate@*/
|
||||
/*@-refcounttrans -usereleased@*/
|
||||
ps = _free(ps);
|
||||
/*@=refcounttrans =usereleased@*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
45
lib/psm.c
45
lib/psm.c
|
@ -38,7 +38,6 @@
|
|||
|
||||
/*@access TFI_t@*/
|
||||
/*@access transactionElement@*/ /* XXX rpmInstallSourcePackage */
|
||||
/*@access rpmTransactionSet@*/
|
||||
|
||||
/*@access alKey@*/
|
||||
/*@access rpmDepSet@*/
|
||||
|
@ -497,9 +496,9 @@ rpmRC rpmInstallSourcePackage(rpmTransactionSet ts, FD_t fd,
|
|||
goto exit;
|
||||
}
|
||||
|
||||
/*@-assignexpose@*/
|
||||
/*@-assignexpose -type@*/
|
||||
fi->te = ts->order[0];
|
||||
/*@=assignexpose@*/
|
||||
/*@=assignexpose =type@*/
|
||||
fi->te->fd = fdLink(fd, "installSourcePackage");
|
||||
hge = fi->hge;
|
||||
hfd = fi->hfd;
|
||||
|
@ -752,7 +751,7 @@ static int runScript(PSM_t psm, Header h,
|
|||
FD_t fd;
|
||||
|
||||
/*@-branchstate@*/
|
||||
if (makeTempFile((!ts->chrootDone ? rootDir : "/"), &fn, &fd)) {
|
||||
if (makeTempFile((!rpmtsGetChrootDone(ts) ? rootDir : "/"), &fn, &fd)) {
|
||||
if (freePrefixes) free(prefixes);
|
||||
return 1;
|
||||
}
|
||||
|
@ -769,7 +768,7 @@ static int runScript(PSM_t psm, Header h,
|
|||
xx = Fclose(fd);
|
||||
|
||||
{ const char * sn = fn;
|
||||
if (!ts->chrootDone && rootDir != NULL &&
|
||||
if (!rpmtsGetChrootDone(ts) && rootDir != NULL &&
|
||||
!(rootDir[0] == '/' && rootDir[1] == '\0'))
|
||||
{
|
||||
sn += strlen(rootDir)-1;
|
||||
|
@ -868,7 +867,7 @@ static int runScript(PSM_t psm, Header h,
|
|||
rootDir = strchr(rootDir, '/');
|
||||
/*@fallthrough@*/
|
||||
case URL_IS_UNKNOWN:
|
||||
if (!ts->chrootDone && !(rootDir[0] == '/' && rootDir[1] == '\0')) {
|
||||
if (!rpmtsGetChrootDone(ts) && !(rootDir[0] == '/' && rootDir[1] == '\0')) {
|
||||
/*@-superuser -noeffect @*/
|
||||
xx = chroot(rootDir);
|
||||
/*@=superuser =noeffect @*/
|
||||
|
@ -971,11 +970,11 @@ exit:
|
|||
* @param triggersAlreadyRun
|
||||
* @return
|
||||
*/
|
||||
static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
|
||||
static int handleOneTrigger(const PSM_t psm, Header sourceH, Header triggeredH,
|
||||
int arg2, unsigned char * triggersAlreadyRun)
|
||||
/*@globals rpmGlobalMacroContext,
|
||||
fileSystem, internalState@*/
|
||||
/*@modifies psm, triggeredH, *triggersAlreadyRun, rpmGlobalMacroContext,
|
||||
/*@modifies triggeredH, *triggersAlreadyRun, rpmGlobalMacroContext,
|
||||
fileSystem, internalState @*/
|
||||
{
|
||||
int scareMem = 1;
|
||||
|
@ -1041,7 +1040,7 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
|
|||
{ int arg1;
|
||||
int index;
|
||||
|
||||
arg1 = rpmdbCountPackages(ts->rpmdb, Name);
|
||||
arg1 = rpmdbCountPackages(rpmtsGetRdb(ts), Name);
|
||||
if (arg1 < 0) {
|
||||
/* XXX W2DO? fails as "execution of script failed" */
|
||||
rc = RPMRC_FAIL;
|
||||
|
@ -1092,7 +1091,7 @@ static int runTriggers(PSM_t psm)
|
|||
int numPackage;
|
||||
rpmRC rc = RPMRC_OK;
|
||||
|
||||
numPackage = rpmdbCountPackages(ts->rpmdb, teGetN(psm->te)) + psm->countCorrection;
|
||||
numPackage = rpmdbCountPackages(rpmtsGetRdb(ts), teGetN(psm->te)) + psm->countCorrection;
|
||||
if (numPackage < 0)
|
||||
return 1;
|
||||
|
||||
|
@ -1243,7 +1242,7 @@ int psmStage(PSM_t psm, pkgStage stage)
|
|||
* versions of this package that will be installed when we are
|
||||
* finished.
|
||||
*/
|
||||
psm->npkgs_installed = rpmdbCountPackages(ts->rpmdb, teGetN(psm->te));
|
||||
psm->npkgs_installed = rpmdbCountPackages(rpmtsGetRdb(ts), teGetN(psm->te));
|
||||
if (psm->npkgs_installed < 0) {
|
||||
rc = RPMRC_FAIL;
|
||||
break;
|
||||
|
@ -1463,7 +1462,7 @@ assert(psm->mi == NULL);
|
|||
|
||||
/* Add remove transaction id to header. */
|
||||
if (psm->oh)
|
||||
{ int_32 tid = ts->id;
|
||||
{ int_32 tid = rpmtsGetTid(ts);
|
||||
xx = headerAddEntry(psm->oh, RPMTAG_REMOVETID,
|
||||
RPM_INT32_TYPE, &tid, 1);
|
||||
}
|
||||
|
@ -1792,12 +1791,14 @@ assert(psm->mi == NULL);
|
|||
case PSM_CREATE:
|
||||
break;
|
||||
case PSM_NOTIFY:
|
||||
/*@-type@*/
|
||||
if (ts && ts->notify) {
|
||||
/*@-noeffectuncon @*/ /* FIX: check rc */
|
||||
(void) ts->notify(fi->h, psm->what, psm->amount, psm->total,
|
||||
teGetKey(psm->te), ts->notifyData);
|
||||
/*@=noeffectuncon @*/
|
||||
}
|
||||
/*@=type@*/
|
||||
break;
|
||||
case PSM_DESTROY:
|
||||
break;
|
||||
|
@ -1813,7 +1814,7 @@ assert(psm->mi == NULL);
|
|||
case PSM_CHROOT_IN:
|
||||
{ const char * rootDir = rpmtsGetRootDir(ts);
|
||||
/* Change root directory if requested and not already done. */
|
||||
if (rootDir != NULL && !ts->chrootDone && !psm->chrootDone) {
|
||||
if (rootDir != NULL && !rpmtsGetChrootDone(ts) && !psm->chrootDone) {
|
||||
static int _loaded = 0;
|
||||
|
||||
/*
|
||||
|
@ -1830,21 +1831,21 @@ assert(psm->mi == NULL);
|
|||
/*@-superuser@*/
|
||||
rc = chroot(rootDir);
|
||||
/*@=superuser@*/
|
||||
psm->chrootDone = ts->chrootDone = 1;
|
||||
if (ts->rpmdb != NULL) ts->rpmdb->db_chrootDone = 1;
|
||||
psm->chrootDone = 1;
|
||||
(void) rpmtsSetChrootDone(ts, 1);
|
||||
}
|
||||
} break;
|
||||
case PSM_CHROOT_OUT:
|
||||
/* Restore root directory if changed. */
|
||||
if (psm->chrootDone) {
|
||||
const char * currDir = rpmtsGetCurrDir(ts);
|
||||
/*@-superuser@*/
|
||||
rc = chroot(".");
|
||||
/*@=superuser@*/
|
||||
psm->chrootDone = ts->chrootDone = 0;
|
||||
if (ts->rpmdb != NULL)
|
||||
ts->rpmdb->db_chrootDone = 0;
|
||||
if (ts->currDir != NULL) /* XXX can't happen */
|
||||
xx = chdir(ts->currDir);
|
||||
psm->chrootDone = 0;
|
||||
(void) rpmtsSetChrootDone(ts, 0);
|
||||
if (currDir != NULL) /* XXX can't happen */
|
||||
xx = chdir(currDir);
|
||||
}
|
||||
break;
|
||||
case PSM_SCRIPT: /* Run current package scriptlets. */
|
||||
|
@ -1895,11 +1896,11 @@ fprintf(stderr, "*** PSM_RDB_LOAD: header #%u not found\n", fi->record);
|
|||
case PSM_RPMDB_ADD:
|
||||
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST) break;
|
||||
if (fi->h != NULL) /* XXX can't happen */
|
||||
rc = rpmdbAdd(ts->rpmdb, ts->id, fi->h);
|
||||
rc = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), fi->h);
|
||||
break;
|
||||
case PSM_RPMDB_REMOVE:
|
||||
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST) break;
|
||||
rc = rpmdbRemove(ts->rpmdb, ts->id, fi->record);
|
||||
rc = rpmdbRemove(rpmtsGetRdb(ts), rpmtsGetTid(ts), fi->record);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "misc.h" /* XXX for makeTempFile() */
|
||||
#include "debug.h"
|
||||
|
||||
/*@access rpmTransactionSet @*/ /* ts->rpmdb, ts->id, ts->dig et al */
|
||||
/*@access rpmTransactionSet @*/ /* ts->dig et al */
|
||||
/*?access Header @*/ /* XXX compared with NULL */
|
||||
/*@access FD_t @*/ /* XXX stealing digests */
|
||||
/*@access pgpDig @*/
|
||||
|
@ -328,11 +328,11 @@ exit:
|
|||
* @param argv array of pubkey file names (NULL terminated)
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int rpmImportPubkey(rpmTransactionSet ts,
|
||||
static int rpmImportPubkey(const rpmTransactionSet ts,
|
||||
/*@unused@*/ QVA_t qva,
|
||||
/*@null@*/ const char ** argv)
|
||||
/*@globals RPMVERSION, fileSystem, internalState @*/
|
||||
/*@modifies ts, fileSystem, internalState @*/
|
||||
/*@modifies fileSystem, internalState @*/
|
||||
{
|
||||
const char * fn;
|
||||
int res = 0;
|
||||
|
@ -437,11 +437,11 @@ static int rpmImportPubkey(rpmTransactionSet ts,
|
|||
|
||||
/* XXX W2DO: tag value inheirited from parent? */
|
||||
xx = headerAddEntry(h, RPMTAG_BUILDHOST, RPM_STRING_TYPE, buildhost, 1);
|
||||
|
||||
xx = headerAddEntry(h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE, &ts->id, 1);
|
||||
|
||||
/* XXX W2DO: tag value inheirited from parent? */
|
||||
xx = headerAddEntry(h, RPMTAG_BUILDTIME, RPM_INT32_TYPE, &ts->id, 1);
|
||||
{ int_32 tid = rpmtsGetTid(ts);
|
||||
xx = headerAddEntry(h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE, &tid, 1);
|
||||
/* XXX W2DO: tag value inheirited from parent? */
|
||||
xx = headerAddEntry(h, RPMTAG_BUILDTIME, RPM_INT32_TYPE, &tid, 1);
|
||||
}
|
||||
|
||||
#ifdef NOTYET
|
||||
/* XXX W2DO: tag value inheirited from parent? */
|
||||
|
@ -449,7 +449,7 @@ static int rpmImportPubkey(rpmTransactionSet ts,
|
|||
#endif
|
||||
|
||||
/* Add header to database. */
|
||||
xx = rpmdbAdd(ts->rpmdb, ts->id, h);
|
||||
xx = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), h);
|
||||
|
||||
bottom:
|
||||
/* Clean up. */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
/*@access TFI_t @*/
|
||||
/*@access transactionElement @*/
|
||||
/*@access rpmTransactionSet @*/ /* XXX for ts->ignoreSet and ts->probs */
|
||||
/*@access rpmTransactionSet @*/ /* XXX for ts->ignoreSet */
|
||||
|
||||
/*@unchecked@*/
|
||||
static int _fi_debug = 0;
|
||||
|
@ -486,9 +486,11 @@ Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
|
|||
|
||||
/* XXX actions check prevents problem from being appended twice. */
|
||||
if (j == numValid && !allowBadRelocate && actions) {
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_BADRELOCATE,
|
||||
rpmProblemSet ps = rpmtsGetProblems(ts);
|
||||
rpmProblemSetAppend(ps, RPMPROB_BADRELOCATE,
|
||||
p->NEVR, p->key,
|
||||
relocations[i].oldPath, NULL, NULL, 0);
|
||||
ps = rpmProblemSetFree(ps);
|
||||
}
|
||||
del =
|
||||
strlen(relocations[i].newPath) - strlen(relocations[i].oldPath);
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
#include <rpmcli.h>
|
||||
|
||||
#include "rpmdb.h"
|
||||
#include "rpmts.h" /* XXX ts->rpmdb */
|
||||
#include "rpmts.h"
|
||||
|
||||
#include "manifest.h"
|
||||
#include "misc.h" /* XXX for rpmGlob() */
|
||||
#include "debug.h"
|
||||
|
||||
/*@access rpmTransactionSet @*/ /* XXX compared with NULL, ts->rpmdb */
|
||||
/*@access rpmTransactionSet @*/ /* XXX ts->goal, ts->dbmode */
|
||||
/*@access rpmProblemSet @*/ /* XXX compared with NULL */
|
||||
/*@access Header @*/ /* XXX compared with NULL */
|
||||
/*@access rpmdb @*/ /* XXX compared with NULL */
|
||||
|
@ -307,8 +307,9 @@ restart:
|
|||
fprintf(stdout, _("Retrieving %s\n"), fileURL);
|
||||
|
||||
{ char tfnbuf[64];
|
||||
const char * rootDir;
|
||||
rootDir = (ts->rootDir && *ts->rootDir) ? ts->rootDir : "";
|
||||
const char * rootDir = rpmtsGetRootDir(ts);
|
||||
if (!(rootDir && * rootDir))
|
||||
rootDir = "";
|
||||
strcpy(tfnbuf, "rpm-xfer.XXXXXX");
|
||||
(void) mktemp(tfnbuf);
|
||||
tfn = rpmGenPath(rootDir, "%{_tmppath}/", tfnbuf);
|
||||
|
@ -398,12 +399,10 @@ restart:
|
|||
if (eiu->rpmrc == RPMRC_OK || eiu->rpmrc == RPMRC_BADSIZE) {
|
||||
|
||||
/* Open database RDWR for binary packages. */
|
||||
/*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */
|
||||
if (rpmtsOpenDB(ts, ts->dbmode)) {
|
||||
eiu->numFailed++;
|
||||
goto exit;
|
||||
}
|
||||
/*@=nullstate@*/ /* FIX: ts->rootDir may be NULL? */
|
||||
|
||||
if (eiu->relocations) {
|
||||
const char ** paths;
|
||||
|
@ -411,7 +410,8 @@ restart:
|
|||
int c;
|
||||
|
||||
if (headerGetEntry(eiu->h, RPMTAG_PREFIXES, &pft,
|
||||
(void **) &paths, &c) && (c == 1)) {
|
||||
(void **) &paths, &c) && (c == 1))
|
||||
{
|
||||
eiu->relocations->oldPath = xstrdup(paths[0]);
|
||||
paths = headerFreeData(paths, pft);
|
||||
} else {
|
||||
|
@ -433,9 +433,7 @@ restart:
|
|||
int count;
|
||||
|
||||
xx = headerNVR(eiu->h, &name, NULL, NULL);
|
||||
/*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */
|
||||
mi = rpmtsInitIterator(ts, RPMTAG_NAME, name, 0);
|
||||
/*@=nullstate@*/ /* FIX: ts->rootDir may be NULL? */
|
||||
count = rpmdbGetIteratorCount(mi);
|
||||
while ((oldH = rpmdbNextIterator(mi)) != NULL) {
|
||||
if (rpmVersionCompare(oldH, eiu->h) < 0)
|
||||
|
@ -452,13 +450,11 @@ restart:
|
|||
/* Package is newer than those currently installed. */
|
||||
}
|
||||
|
||||
/*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */
|
||||
/*@-abstract@*/
|
||||
rc = rpmtsAddPackage(ts, eiu->h, (fnpyKey)fileName,
|
||||
(ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
|
||||
relocations);
|
||||
/*@=abstract@*/
|
||||
/*@=nullstate@*/
|
||||
|
||||
/* XXX reference held by transaction set */
|
||||
eiu->h = headerFree(eiu->h, "Install added");
|
||||
|
@ -533,12 +529,10 @@ restart:
|
|||
|
||||
if (eiu->numRPMS && !(ia->installInterfaceFlags & INSTALL_NODEPS)) {
|
||||
|
||||
/*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */
|
||||
if (rpmtsCheck(ts)) {
|
||||
eiu->numFailed = eiu->numPkgs;
|
||||
stopInstall = 1;
|
||||
}
|
||||
/*@=nullstate@*/
|
||||
|
||||
ps = rpmtsGetProblems(ts);
|
||||
if (!stopInstall && ps) {
|
||||
|
@ -569,12 +563,10 @@ restart:
|
|||
}
|
||||
|
||||
if (eiu->numRPMS && !(ia->installInterfaceFlags & INSTALL_NOORDER)) {
|
||||
/*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */
|
||||
if (rpmtsOrder(ts)) {
|
||||
eiu->numFailed = eiu->numPkgs;
|
||||
stopInstall = 1;
|
||||
}
|
||||
/*@=nullstate@*/
|
||||
}
|
||||
|
||||
if (eiu->numRPMS && !stopInstall) {
|
||||
|
@ -583,9 +575,7 @@ restart:
|
|||
|
||||
rpmMessage(RPMMESS_DEBUG, _("installing binary packages\n"));
|
||||
|
||||
/*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */
|
||||
rc = rpmtsRun(ts, NULL, probFilter);
|
||||
/*@=nullstate@*/
|
||||
ps = rpmtsGetProblems(ts);
|
||||
|
||||
if (rc < 0) {
|
||||
|
|
|
@ -741,16 +741,16 @@ void printDepProblems(FILE * fp, /*@null@*/ const rpmProblemSet ps)
|
|||
* Unreference a problem set instance.
|
||||
* @param ps problem set
|
||||
* @param msg
|
||||
* @return NULL always
|
||||
* @return problem set
|
||||
*/
|
||||
/*@unused@*/ /*@null@*/
|
||||
rpmProblemSet rpmpsUnlink (/*@killref@*/ /*@only@*/ rpmProblemSet ps,
|
||||
/*@unused@*/
|
||||
rpmProblemSet rpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmProblemSet ps,
|
||||
const char * msg)
|
||||
/*@modifies ps @*/;
|
||||
|
||||
/** @todo Remove debugging entry from the ABI. */
|
||||
/*@null@*/
|
||||
rpmProblemSet XrpmpsUnlink (/*@killref@*/ /*@only@*/ rpmProblemSet ps,
|
||||
rpmProblemSet XrpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmProblemSet ps,
|
||||
const char * msg, const char * fn, unsigned ln)
|
||||
/*@modifies ps @*/;
|
||||
#define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
|
||||
|
|
92
lib/rpmts.c
92
lib/rpmts.c
|
@ -18,6 +18,8 @@
|
|||
|
||||
#include "debug.h"
|
||||
|
||||
/*@access rpmdb @*/ /* XXX db->db_chrootDone, NULL */
|
||||
|
||||
/*@access FD_t @*/ /* XXX compared with NULL */
|
||||
/*@access rpmProblemSet @*/
|
||||
/*@access rpmTransactionSet @*/
|
||||
|
@ -67,9 +69,9 @@ int rpmtsCloseDB(rpmTransactionSet ts)
|
|||
{
|
||||
int rc = 0;
|
||||
|
||||
if (ts->rpmdb != NULL) {
|
||||
rc = rpmdbClose(ts->rpmdb);
|
||||
ts->rpmdb = NULL;
|
||||
if (ts->rdb != NULL) {
|
||||
rc = rpmdbClose(ts->rdb);
|
||||
ts->rdb = NULL;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
@ -78,7 +80,7 @@ int rpmtsOpenDB(rpmTransactionSet ts, int dbmode)
|
|||
{
|
||||
int rc = 0;
|
||||
|
||||
if (ts->rpmdb != NULL && ts->dbmode == dbmode)
|
||||
if (ts->rdb != NULL && ts->dbmode == dbmode)
|
||||
return 0;
|
||||
|
||||
(void) rpmtsCloseDB(ts);
|
||||
|
@ -86,7 +88,7 @@ int rpmtsOpenDB(rpmTransactionSet ts, int dbmode)
|
|||
/* XXX there's a potential db lock race here. */
|
||||
|
||||
ts->dbmode = dbmode;
|
||||
rc = rpmdbOpen(ts->rootDir, &ts->rpmdb, ts->dbmode, 0644);
|
||||
rc = rpmdbOpen(ts->rootDir, &ts->rdb, ts->dbmode, 0644);
|
||||
if (rc) {
|
||||
const char * dn;
|
||||
/*@-globs -mods@*/ /* FIX: rpmGlobalMacroContext for an error? shrug */
|
||||
|
@ -102,7 +104,7 @@ int rpmtsOpenDB(rpmTransactionSet ts, int dbmode)
|
|||
rpmdbMatchIterator rpmtsInitIterator(const rpmTransactionSet ts, int rpmtag,
|
||||
const void * keyp, size_t keylen)
|
||||
{
|
||||
return rpmdbInitIterator(ts->rpmdb, rpmtag, keyp, keylen);
|
||||
return rpmdbInitIterator(ts->rdb, rpmtag, keyp, keylen);
|
||||
}
|
||||
|
||||
static int rpmtsCloseSDB(rpmTransactionSet ts)
|
||||
|
@ -283,7 +285,6 @@ rpmProblemSet rpmtsGetProblems(rpmTransactionSet ts)
|
|||
if (ts->probs) {
|
||||
if (ts->probs->numProblems > 0)
|
||||
ps = rpmpsLink(ts->probs, NULL);
|
||||
ts->probs = rpmpsUnlink(ts->probs, NULL);
|
||||
}
|
||||
}
|
||||
return ps;
|
||||
|
@ -418,6 +419,24 @@ void rpmtsSetRootDir(rpmTransactionSet ts, const char * rootDir)
|
|||
}
|
||||
}
|
||||
|
||||
const char * rpmtsGetCurrDir(rpmTransactionSet ts)
|
||||
{
|
||||
const char * currDir = NULL;
|
||||
if (ts != NULL) {
|
||||
currDir = ts->currDir;
|
||||
}
|
||||
return currDir;
|
||||
}
|
||||
|
||||
void rpmtsSetCurrDir(rpmTransactionSet ts, const char * currDir)
|
||||
{
|
||||
if (ts != NULL) {
|
||||
ts->currDir = _free(ts->currDir);
|
||||
if (currDir)
|
||||
ts->currDir = xstrdup(currDir);
|
||||
}
|
||||
}
|
||||
|
||||
FD_t rpmtsGetScriptFd(rpmTransactionSet ts)
|
||||
{
|
||||
FD_t scriptFd = NULL;
|
||||
|
@ -442,6 +461,57 @@ void rpmtsSetScriptFd(rpmTransactionSet ts, FD_t scriptFd)
|
|||
}
|
||||
}
|
||||
|
||||
int rpmtsGetChrootDone(rpmTransactionSet ts)
|
||||
{
|
||||
int chrootDone = 0;
|
||||
if (ts != NULL) {
|
||||
chrootDone = ts->chrootDone;
|
||||
}
|
||||
return chrootDone;
|
||||
}
|
||||
|
||||
int rpmtsSetChrootDone(rpmTransactionSet ts, int chrootDone)
|
||||
{
|
||||
int ochrootDone = 0;
|
||||
if (ts != NULL) {
|
||||
ochrootDone = ts->chrootDone;
|
||||
if (ts->rdb != NULL)
|
||||
ts->rdb->db_chrootDone = chrootDone;
|
||||
ts->chrootDone = chrootDone;
|
||||
}
|
||||
return ochrootDone;
|
||||
}
|
||||
|
||||
int_32 rpmtsGetTid(rpmTransactionSet ts)
|
||||
{
|
||||
int_32 tid = 0;
|
||||
if (ts != NULL) {
|
||||
tid = ts->tid;
|
||||
}
|
||||
return tid;
|
||||
}
|
||||
|
||||
int_32 rpmtsSetTid(rpmTransactionSet ts, int_32 tid)
|
||||
{
|
||||
int_32 otid = 0;
|
||||
if (ts != NULL) {
|
||||
otid = ts->tid;
|
||||
ts->tid = tid;
|
||||
}
|
||||
return otid;
|
||||
}
|
||||
|
||||
rpmdb rpmtsGetRdb(rpmTransactionSet ts)
|
||||
{
|
||||
rpmdb rdb = NULL;
|
||||
if (ts != NULL) {
|
||||
rdb = ts->rdb;
|
||||
}
|
||||
/*@-compdef -refcounttrans -usereleased @*/
|
||||
return rdb;
|
||||
/*@=compdef =refcounttrans =usereleased @*/
|
||||
}
|
||||
|
||||
rpmtsFlags rpmtsGetFlags(rpmTransactionSet ts)
|
||||
{
|
||||
rpmtsFlags otransFlags = 0;
|
||||
|
@ -451,12 +521,12 @@ rpmtsFlags rpmtsGetFlags(rpmTransactionSet ts)
|
|||
return otransFlags;
|
||||
}
|
||||
|
||||
rpmtsFlags rpmtsSetFlags(rpmTransactionSet ts, rpmtsFlags ntransFlags)
|
||||
rpmtsFlags rpmtsSetFlags(rpmTransactionSet ts, rpmtsFlags transFlags)
|
||||
{
|
||||
rpmtsFlags otransFlags = 0;
|
||||
if (ts != NULL) {
|
||||
otransFlags = ts->transFlags;
|
||||
ts->transFlags = ntransFlags;
|
||||
ts->transFlags = transFlags;
|
||||
}
|
||||
return otransFlags;
|
||||
}
|
||||
|
@ -511,11 +581,11 @@ rpmTransactionSet rpmtsCreate(void)
|
|||
ts->filesystems = NULL;
|
||||
ts->di = NULL;
|
||||
|
||||
ts->rpmdb = NULL;
|
||||
ts->rdb = NULL;
|
||||
ts->dbmode = O_RDONLY;
|
||||
|
||||
ts->scriptFd = NULL;
|
||||
ts->id = (int_32) time(NULL);
|
||||
ts->tid = (int_32) time(NULL);
|
||||
ts->delta = 5;
|
||||
|
||||
ts->numRemovedPackages = 0;
|
||||
|
|
73
lib/rpmts.h
73
lib/rpmts.h
|
@ -39,7 +39,7 @@ struct rpmTransactionSet_s {
|
|||
/*@only@*/ /*@null@*/
|
||||
const void ** suggests; /*!< Possible depCheck suggestions. */
|
||||
/*@refcounted@*/ /*@null@*/
|
||||
rpmdb sdb; /*!< Available universe database handle. */
|
||||
rpmdb sdb; /*!< Solve database handle. */
|
||||
|
||||
/*@observer@*/ /*@null@*/
|
||||
rpmCallbackFunction notify; /*!< Callback function. */
|
||||
|
@ -59,7 +59,7 @@ struct rpmTransactionSet_s {
|
|||
|
||||
int dbmode; /*!< Database open mode. */
|
||||
/*@refcounted@*/ /*@null@*/
|
||||
rpmdb rpmdb; /*!< Database handle. */
|
||||
rpmdb rdb; /*!< Install database handle. */
|
||||
/*@only@*/
|
||||
hashTable ht; /*!< Fingerprint hash table. */
|
||||
|
||||
|
@ -90,7 +90,7 @@ struct rpmTransactionSet_s {
|
|||
/*@null@*/
|
||||
FD_t scriptFd; /*!< Scriptlet stdout/stderr. */
|
||||
int delta; /*!< Delta for reallocation. */
|
||||
int_32 id; /*!< Transaction id. */
|
||||
int_32 tid; /*!< Transaction id. */
|
||||
|
||||
int verify_legacy; /*!< Verify legacy signatures? */
|
||||
int nodigests; /*!< Verify digests? */
|
||||
|
@ -311,8 +311,24 @@ const char * rpmtsGetRootDir(rpmTransactionSet ts)
|
|||
* @param ts transaction set
|
||||
* @param rootDir new transaction rootDir (or NULL)
|
||||
*/
|
||||
void rpmtsSetRootDir(rpmTransactionSet ts,
|
||||
/*@null@*/ const char * rootDir)
|
||||
void rpmtsSetRootDir(rpmTransactionSet ts, /*@null@*/ const char * rootDir)
|
||||
/*@modifies ts @*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Get transaction currDir, i.e. current directory before chroot(2).
|
||||
* @param ts transaction set
|
||||
* @return transaction currDir
|
||||
*/
|
||||
/*@observer@*/ /*@null@*/
|
||||
const char * rpmtsGetCurrDir(rpmTransactionSet ts)
|
||||
/*@*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Set transaction currDir, i.e. current directory before chroot(2).
|
||||
* @param ts transaction set
|
||||
* @param currDir new transaction currDir (or NULL)
|
||||
*/
|
||||
void rpmtsSetCurrDir(rpmTransactionSet ts, /*@null@*/ const char * currDir)
|
||||
/*@modifies ts @*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
|
@ -332,6 +348,49 @@ FD_t rpmtsGetScriptFd(rpmTransactionSet ts)
|
|||
void rpmtsSetScriptFd(rpmTransactionSet ts, /*@null@*/ FD_t scriptFd)
|
||||
/*@modifies ts, scriptFd @*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Get chrootDone flag, i.e. has chroot(2) been performed?
|
||||
* @param ts transaction set
|
||||
* @return chrootDone flag
|
||||
*/
|
||||
int rpmtsGetChrootDone(rpmTransactionSet ts)
|
||||
/*@*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Set chrootDone flag, i.e. has chroot(2) been performed?
|
||||
* @param ts transaction set
|
||||
* @param chrootDone new chrootDone flag
|
||||
* @return previous chrootDone flag
|
||||
*/
|
||||
int rpmtsSetChrootDone(rpmTransactionSet ts, int chrootDone)
|
||||
/*@modifies ts @*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Get transaction id, i.e. transaction time stamp.
|
||||
* @param ts transaction set
|
||||
* @return chrootDone flag
|
||||
*/
|
||||
int_32 rpmtsGetTid(rpmTransactionSet ts)
|
||||
/*@*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Set transaction id, i.e. transaction time stamp.
|
||||
* @param ts transaction set
|
||||
* @param tid new transaction id
|
||||
* @return previous transaction id
|
||||
*/
|
||||
int_32 rpmtsSetTid(rpmTransactionSet ts, int_32 tid)
|
||||
/*@modifies ts @*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Get transaction database handle.
|
||||
* @param ts transaction set
|
||||
* @return transaction database handle
|
||||
*/
|
||||
/*@null@*/
|
||||
rpmdb rpmtsGetRdb(rpmTransactionSet ts)
|
||||
/*@*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Get transaction flags, i.e. bits to control rpmtsRun().
|
||||
* @param ts transaction set
|
||||
|
@ -343,10 +402,10 @@ rpmtsFlags rpmtsGetFlags(rpmTransactionSet ts)
|
|||
/** \ingroup rpmts
|
||||
* Set transaction flags, i.e. bits to control rpmtsRun().
|
||||
* @param ts transaction set
|
||||
* @param ntransFlags new transaction flags
|
||||
* @param transFlags new transaction flags
|
||||
* @return previous transaction flags
|
||||
*/
|
||||
rpmtsFlags rpmtsSetFlags(rpmTransactionSet ts, rpmtsFlags ntransFlags)
|
||||
rpmtsFlags rpmtsSetFlags(rpmTransactionSet ts, rpmtsFlags transFlags)
|
||||
/*@modifies ts @*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
|
|
|
@ -84,43 +84,6 @@ struct diskspaceInfo {
|
|||
probably right :-( */
|
||||
#define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
|
||||
|
||||
#ifdef DYING
|
||||
void rpmtsSetScriptFd(rpmTransactionSet ts, FD_t fd)
|
||||
{
|
||||
ts->scriptFd = (fd ? fdLink(fd, "rpmtsSetScriptFd") : NULL);
|
||||
}
|
||||
|
||||
int rpmtsGetKeys(const rpmTransactionSet ts, fnpyKey ** ep, int * nep)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if (nep) *nep = ts->orderCount;
|
||||
if (ep) {
|
||||
teIterator pi; transactionElement p;
|
||||
fnpyKey * e;
|
||||
|
||||
*ep = e = xmalloc(ts->orderCount * sizeof(*e));
|
||||
pi = teInitIterator(ts);
|
||||
while ((p = teNextIterator(pi)) != NULL) {
|
||||
switch (teGetType(p)) {
|
||||
case TR_ADDED:
|
||||
/*@-dependenttrans@*/
|
||||
*e = teGetKey(p);
|
||||
/*@=dependenttrans@*/
|
||||
/*@switchbreak@*/ break;
|
||||
case TR_REMOVED:
|
||||
default:
|
||||
*e = NULL;
|
||||
/*@switchbreak@*/ break;
|
||||
}
|
||||
e++;
|
||||
}
|
||||
pi = teFreeIterator(pi);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
*/
|
||||
static int archOkay(/*@null@*/ const char * pkgArch)
|
||||
|
@ -174,7 +137,7 @@ static fileAction decideFileFate(const rpmTransactionSet ts,
|
|||
* The file doesn't exist on the disk. Create it unless the new
|
||||
* package has marked it as missingok, or allfiles is requested.
|
||||
*/
|
||||
if (!(ts->transFlags & RPMTRANS_FLAG_ALLFILES)
|
||||
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_ALLFILES)
|
||||
&& (newFlags & RPMFILE_MISSINGOK))
|
||||
{
|
||||
rpmMessage(RPMMESS_DEBUG, _("%s skipped due to missingok flag\n"),
|
||||
|
@ -298,6 +261,7 @@ static int handleInstInstalledFiles(const rpmTransactionSet ts,
|
|||
const char * altNEVR = NULL;
|
||||
TFI_t otherFi = NULL;
|
||||
int numReplaced = 0;
|
||||
rpmProblemSet ps;
|
||||
int i;
|
||||
|
||||
{ rpmdbMatchIterator mi;
|
||||
|
@ -319,6 +283,7 @@ static int handleInstInstalledFiles(const rpmTransactionSet ts,
|
|||
|
||||
fi->replaced = xcalloc(sharedCount, sizeof(*fi->replaced));
|
||||
|
||||
ps = rpmtsGetProblems(ts);
|
||||
for (i = 0; i < sharedCount; i++, shared++) {
|
||||
int otherFileNum, fileNum;
|
||||
|
||||
|
@ -339,7 +304,7 @@ static int handleInstInstalledFiles(const rpmTransactionSet ts,
|
|||
|
||||
if (filecmp(otherFi, fi)) {
|
||||
if (reportConflicts) {
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_FILE_CONFLICT,
|
||||
rpmProblemSetAppend(ps, RPMPROB_FILE_CONFLICT,
|
||||
teGetNEVR(p), teGetKey(p),
|
||||
tfiGetDN(fi), tfiGetBN(fi),
|
||||
altNEVR,
|
||||
|
@ -361,6 +326,7 @@ static int handleInstInstalledFiles(const rpmTransactionSet ts,
|
|||
fi->replacedSizes[fileNum] = otherFi->fsizes[otherFi->i];
|
||||
|
||||
}
|
||||
ps = rpmProblemSetFree(ps);
|
||||
|
||||
altNEVR = _free(altNEVR);
|
||||
otherFi = fiFree(otherFi, 1);
|
||||
|
@ -566,9 +532,11 @@ static void handleOverlappedFiles(const rpmTransactionSet ts,
|
|||
{
|
||||
struct diskspaceInfo * ds = NULL;
|
||||
uint_32 fixupSize = 0;
|
||||
rpmProblemSet ps;
|
||||
const char * fn;
|
||||
int i, j;
|
||||
|
||||
ps = rpmtsGetProblems(ts);
|
||||
fi = tfiInit(fi, 0);
|
||||
if (fi != NULL) /* XXX lclint */
|
||||
while ((i = tfiNext(fi)) >= 0) {
|
||||
|
@ -671,7 +639,7 @@ assert(otherFi != NULL);
|
|||
if ((ts->ignoreSet & RPMPROB_FILTER_REPLACENEWFILES)
|
||||
&& filecmp(otherFi, fi))
|
||||
{
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_NEW_FILE_CONFLICT,
|
||||
rpmProblemSetAppend(ps, RPMPROB_NEW_FILE_CONFLICT,
|
||||
teGetNEVR(p), teGetKey(p),
|
||||
fn, NULL,
|
||||
teGetNEVR(otherFi->te),
|
||||
|
@ -768,6 +736,7 @@ assert(otherFi != NULL);
|
|||
ds->bneeded -= BLOCK_ROUND(fixupSize, ds->bsize);
|
||||
}
|
||||
}
|
||||
ps = rpmProblemSetFree(ps);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -805,13 +774,15 @@ static int ensureOlder(rpmTransactionSet ts,
|
|||
req = dsFree(req);
|
||||
|
||||
if (rc == 0) {
|
||||
rpmProblemSet ps = rpmtsGetProblems(ts);
|
||||
const char * altNEVR = hGetNEVR(h, NULL);
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_OLDPACKAGE,
|
||||
rpmProblemSetAppend(ps, RPMPROB_OLDPACKAGE,
|
||||
teGetNEVR(p), teGetKey(p),
|
||||
NULL, NULL,
|
||||
altNEVR,
|
||||
0);
|
||||
altNEVR = _free(altNEVR);
|
||||
ps = rpmProblemSetFree(ps);
|
||||
rc = 1;
|
||||
} else
|
||||
rc = 0;
|
||||
|
@ -826,7 +797,7 @@ static void skipFiles(const rpmTransactionSet ts, TFI_t fi)
|
|||
/*@globals rpmGlobalMacroContext @*/
|
||||
/*@modifies fi, rpmGlobalMacroContext @*/
|
||||
{
|
||||
int noDocs = (ts->transFlags & RPMTRANS_FLAG_NODOCS);
|
||||
int noDocs = (rpmtsGetFlags(ts) & RPMTRANS_FLAG_NODOCS);
|
||||
char ** netsharedPaths = NULL;
|
||||
const char ** languages;
|
||||
const char * dn, * bn;
|
||||
|
@ -1056,6 +1027,7 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
int nexti;
|
||||
alKey lastKey;
|
||||
fingerPrintCache fpc;
|
||||
rpmProblemSet ps;
|
||||
PSM_t psm = memset(alloca(sizeof(*psm)), 0, sizeof(*psm));
|
||||
teIterator pi; transactionElement p;
|
||||
teIterator qi; transactionElement q;
|
||||
|
@ -1063,23 +1035,29 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
|
||||
/* FIXME: what if the same package is included in ts twice? */
|
||||
|
||||
if (ts->transFlags & RPMTRANS_FLAG_NOSCRIPTS)
|
||||
ts->transFlags |= (_noTransScripts | _noTransTriggers);
|
||||
if (ts->transFlags & RPMTRANS_FLAG_NOTRIGGERS)
|
||||
ts->transFlags |= _noTransTriggers;
|
||||
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS)
|
||||
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) | _noTransScripts | _noTransTriggers));
|
||||
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOTRIGGERS)
|
||||
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) | _noTransTriggers));
|
||||
|
||||
/* XXX MULTILIB is broken, as packages can and do execute /sbin/ldconfig. */
|
||||
if (ts->transFlags & (RPMTRANS_FLAG_JUSTDB | RPMTRANS_FLAG_MULTILIB))
|
||||
ts->transFlags |= (_noTransScripts | _noTransTriggers);
|
||||
if (rpmtsGetFlags(ts) & (RPMTRANS_FLAG_JUSTDB | RPMTRANS_FLAG_MULTILIB))
|
||||
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) | _noTransScripts | _noTransTriggers));
|
||||
|
||||
ts->probs = rpmProblemSetFree(ts->probs);
|
||||
ts->probs = rpmProblemSetCreate();
|
||||
|
||||
ts->ignoreSet = ignoreSet;
|
||||
ts->currDir = _free(ts->currDir);
|
||||
ts->currDir = currentDirectory();
|
||||
ts->chrootDone = 0;
|
||||
if (ts->rpmdb) ts->rpmdb->db_chrootDone = 0;
|
||||
ts->id = (int_32) time(NULL);
|
||||
{ const char * currDir = currentDirectory();
|
||||
rpmtsSetCurrDir(ts, currDir);
|
||||
currDir = _free(currDir);
|
||||
}
|
||||
|
||||
(void) rpmtsSetChrootDone(ts, 0);
|
||||
|
||||
{ int_32 tid = (int_32) time(NULL);
|
||||
(void) rpmtsSetTid(ts, tid);
|
||||
}
|
||||
|
||||
memset(psm, 0, sizeof(*psm));
|
||||
psm->ts = rpmtsLink(ts, "tsRun");
|
||||
|
@ -1150,6 +1128,7 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
* For packages being removed:
|
||||
* - count files.
|
||||
*/
|
||||
ps = rpmtsGetProblems(ts);
|
||||
/* The ordering doesn't matter here */
|
||||
pi = teInitIterator(ts);
|
||||
while ((p = teNext(pi, TR_ADDED)) != NULL) {
|
||||
|
@ -1162,14 +1141,14 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
|
||||
if (!(ts->ignoreSet & RPMPROB_FILTER_IGNOREARCH))
|
||||
if (!archOkay(teGetA(p)))
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_BADARCH,
|
||||
rpmProblemSetAppend(ps, RPMPROB_BADARCH,
|
||||
teGetNEVR(p), teGetKey(p),
|
||||
teGetA(p), NULL,
|
||||
NULL, 0);
|
||||
|
||||
if (!(ts->ignoreSet & RPMPROB_FILTER_IGNOREOS))
|
||||
if (!osOkay(teGetO(p)))
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_BADOS,
|
||||
rpmProblemSetAppend(ps, RPMPROB_BADOS,
|
||||
teGetNEVR(p), teGetKey(p),
|
||||
teGetO(p), NULL,
|
||||
NULL, 0);
|
||||
|
@ -1191,7 +1170,7 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
teGetR(p));
|
||||
|
||||
while (rpmdbNextIterator(mi) != NULL) {
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_PKG_INSTALLED,
|
||||
rpmProblemSetAppend(ps, RPMPROB_PKG_INSTALLED,
|
||||
teGetNEVR(p), teGetKey(p),
|
||||
NULL, NULL,
|
||||
NULL, 0);
|
||||
|
@ -1205,6 +1184,7 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
|
||||
}
|
||||
pi = teFreeIterator(pi);
|
||||
ps = rpmProblemSetFree(ps);
|
||||
|
||||
/* The ordering doesn't matter here */
|
||||
pi = teInitIterator(ts);
|
||||
|
@ -1259,13 +1239,14 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
}
|
||||
pi = teFreeIterator(pi);
|
||||
|
||||
if (!ts->chrootDone) {
|
||||
if (!rpmtsGetChrootDone(ts)) {
|
||||
const char * rootDir = rpmtsGetRootDir(ts);
|
||||
xx = chdir("/");
|
||||
/*@-superuser -noeffect @*/
|
||||
xx = chroot(ts->rootDir);
|
||||
if (rootDir != NULL)
|
||||
xx = chroot(rootDir);
|
||||
/*@=superuser =noeffect @*/
|
||||
ts->chrootDone = 1;
|
||||
if (ts->rpmdb) ts->rpmdb->db_chrootDone = 1;
|
||||
(void) rpmtsSetChrootDone(ts, 1);
|
||||
}
|
||||
|
||||
ts->ht = htCreate(totalFileCount * 2, 0, 0, fpHashFunction, fpEqual);
|
||||
|
@ -1305,6 +1286,7 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
/* ===============================================
|
||||
* Compute file disposition for each package in transaction set.
|
||||
*/
|
||||
ps = rpmtsGetProblems(ts);
|
||||
pi = teInitIterator(ts);
|
||||
while ((p = teNextIterator(pi)) != NULL) {
|
||||
dbiIndexSet * matches;
|
||||
|
@ -1324,8 +1306,9 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
|
||||
/* Extract file info for all files in this package from the database. */
|
||||
matches = xcalloc(fc, sizeof(*matches));
|
||||
if (rpmdbFindFpList(ts->rpmdb, fi->fps, matches, fc)) {
|
||||
if (rpmdbFindFpList(rpmtsGetRdb(ts), fi->fps, matches, fc)) {
|
||||
psm->ts = rpmtsUnlink(ts, "tsRun (rpmFindFpList fail)");
|
||||
ps = rpmProblemSetFree(ps);
|
||||
return 1; /* XXX WTFO? */
|
||||
}
|
||||
|
||||
|
@ -1427,14 +1410,14 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
/*@innercontinue@*/ continue;
|
||||
|
||||
if (adj_fs_blocks(dip->bneeded) > dip->bavail) {
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_DISKSPACE,
|
||||
rpmProblemSetAppend(ps, RPMPROB_DISKSPACE,
|
||||
teGetNEVR(p), teGetKey(p),
|
||||
ts->filesystems[i], NULL, NULL,
|
||||
(adj_fs_blocks(dip->bneeded) - dip->bavail) * dip->bsize);
|
||||
}
|
||||
|
||||
if (adj_fs_blocks(dip->ineeded) > dip->iavail) {
|
||||
rpmProblemSetAppend(ts->probs, RPMPROB_DISKNODES,
|
||||
rpmProblemSetAppend(ps, RPMPROB_DISKNODES,
|
||||
teGetNEVR(p), teGetKey(p),
|
||||
ts->filesystems[i], NULL, NULL,
|
||||
(adj_fs_blocks(dip->ineeded) - dip->iavail));
|
||||
|
@ -1446,14 +1429,16 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
}
|
||||
}
|
||||
pi = teFreeIterator(pi);
|
||||
ps = rpmProblemSetFree(ps);
|
||||
|
||||
if (ts->chrootDone) {
|
||||
if (rpmtsGetChrootDone(ts)) {
|
||||
const char * currDir = rpmtsGetCurrDir(ts);
|
||||
/*@-superuser -noeffect @*/
|
||||
xx = chroot(".");
|
||||
/*@=superuser =noeffect @*/
|
||||
ts->chrootDone = 0;
|
||||
if (ts->rpmdb) ts->rpmdb->db_chrootDone = 0;
|
||||
xx = chdir(ts->currDir);
|
||||
(void) rpmtsSetChrootDone(ts, 0);
|
||||
if (currDir != NULL)
|
||||
xx = chdir(currDir);
|
||||
}
|
||||
|
||||
/*@-noeffectuncon @*/ /* FIX: check rc */
|
||||
|
@ -1474,14 +1459,13 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
}
|
||||
pi = teFreeIterator(pi);
|
||||
|
||||
fpCacheFree(fpc);
|
||||
htFree(ts->ht);
|
||||
ts->ht = NULL;
|
||||
fpc = fpCacheFree(fpc);
|
||||
ts->ht = htFree(ts->ht);
|
||||
|
||||
/* ===============================================
|
||||
* If unfiltered problems exist, free memory and return.
|
||||
*/
|
||||
if ((ts->transFlags & RPMTRANS_FLAG_BUILD_PROBS)
|
||||
if ((rpmtsGetFlags(ts) & RPMTRANS_FLAG_BUILD_PROBS)
|
||||
|| (ts->probs->numProblems &&
|
||||
(okProbs != NULL || rpmProblemSetTrim(ts->probs, okProbs)))
|
||||
)
|
||||
|
@ -1494,7 +1478,7 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
/* ===============================================
|
||||
* Save removed files before erasing.
|
||||
*/
|
||||
if (ts->transFlags & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE)) {
|
||||
if (rpmtsGetFlags(ts) & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE)) {
|
||||
pi = teInitIterator(ts);
|
||||
while ((p = teNextIterator(pi)) != NULL) {
|
||||
fi = teiGetFi(pi);
|
||||
|
@ -1502,7 +1486,7 @@ int rpmtsRun(rpmTransactionSet ts,
|
|||
case TR_ADDED:
|
||||
/*@switchbreak@*/ break;
|
||||
case TR_REMOVED:
|
||||
if (!(ts->transFlags & RPMTRANS_FLAG_REPACKAGE))
|
||||
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_REPACKAGE))
|
||||
/*@switchbreak@*/ break;
|
||||
psm->te = p;
|
||||
psm->fi = rpmfiLink(fi, "tsRepackage");
|
||||
|
@ -1589,9 +1573,9 @@ fi->actions = actions;
|
|||
|
||||
}
|
||||
if (teGetMultiLib(p))
|
||||
ts->transFlags |= RPMTRANS_FLAG_MULTILIB;
|
||||
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) | RPMTRANS_FLAG_MULTILIB));
|
||||
else
|
||||
ts->transFlags &= ~RPMTRANS_FLAG_MULTILIB;
|
||||
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) & ~RPMTRANS_FLAG_MULTILIB));
|
||||
|
||||
if (psmStage(psm, PSM_PKGINSTALL)) {
|
||||
ourrc++;
|
||||
|
@ -1624,7 +1608,7 @@ fi->actions = actions;
|
|||
}
|
||||
/*@switchbreak@*/ break;
|
||||
}
|
||||
xx = rpmdbSync(ts->rpmdb);
|
||||
xx = rpmdbSync(rpmtsGetRdb(ts));
|
||||
(void) rpmfiUnlink(psm->fi, "tsInstall");
|
||||
psm->fi = NULL;
|
||||
psm->te = NULL;
|
||||
|
|
|
@ -487,7 +487,7 @@ static PyObject * py_rpmtsGetAttr(rpmtsObject * o, char * name) {
|
|||
static void py_rpmtsDealloc(PyObject * o) {
|
||||
rpmtsObject * trans = (void *) o;
|
||||
|
||||
trans->ts->rpmdb = NULL; /* XXX HACK: avoid rpmdb close/free */
|
||||
trans->ts->rdb = NULL; /* XXX HACK: avoid rpmdb close/free */
|
||||
rpmtsFree(trans->ts);
|
||||
if (trans->dbo) {
|
||||
Py_DECREF(trans->dbo);
|
||||
|
@ -569,7 +569,7 @@ static PyObject * py_rpmtsCreate(PyObject * self, PyObject * args) {
|
|||
o->ts = rpmtsCreate();
|
||||
(void) rpmtsSetRootDir(o->ts, rootDir);
|
||||
/* XXX this will be fun to fix */
|
||||
o->ts->rpmdb = (db ? dbFromDb(db) : NULL);
|
||||
o->ts->rdb = (db ? dbFromDb(db) : NULL);
|
||||
o->keyList = PyList_New(0);
|
||||
|
||||
return (void *) o;
|
||||
|
|
|
@ -20,10 +20,11 @@ fingerPrintCache fpCacheCreate(int sizeHint)
|
|||
return fpc;
|
||||
}
|
||||
|
||||
void fpCacheFree(fingerPrintCache cache)
|
||||
fingerPrintCache fpCacheFree(fingerPrintCache cache)
|
||||
{
|
||||
htFree(cache->ht);
|
||||
cache->ht = htFree(cache->ht);
|
||||
free(cache);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,7 +138,6 @@ static fingerPrint doLookup(fingerPrintCache cache,
|
|||
strcpy(dn, (*buf != '\0' ? buf : "/"));
|
||||
newEntry->ino = sb.st_ino;
|
||||
newEntry->dev = sb.st_dev;
|
||||
newEntry->isFake = 0;
|
||||
newEntry->dirName = dn;
|
||||
fp.entry = newEntry;
|
||||
|
||||
|
@ -158,7 +158,7 @@ static fingerPrint doLookup(fingerPrintCache cache,
|
|||
fp.baseName = baseName;
|
||||
if (!scareMemory && fp.subDir != NULL)
|
||||
fp.subDir = xstrdup(fp.subDir);
|
||||
/*@-compdef@*/ /* FIX: fp.entry.{dirName,dev,ino,isFake} undef @*/
|
||||
/*@-compdef@*/ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
|
||||
return fp;
|
||||
/*@=compdef@*/
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ static fingerPrint doLookup(fingerPrintCache cache,
|
|||
|
||||
/*@notreached@*/
|
||||
|
||||
/*@-compdef@*/ /* FIX: fp.entry.{dirName,dev,ino,isFake} undef @*/
|
||||
/*@-compdef@*/ /* FIX: fp.entry.{dirName,dev,ino} undef @*/
|
||||
/*@-nullret@*/ return fp; /*@=nullret@*/ /* LCL: can't happen. */
|
||||
/*@=compdef@*/
|
||||
}
|
||||
|
@ -244,7 +244,17 @@ void fpLookupList(fingerPrintCache cache, const char ** dirNames,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef UNUSED
|
||||
/**
|
||||
* Return finger prints of all file names in header.
|
||||
* @warning: scareMemory is assumed!
|
||||
* @param cache pointer to fingerprint cache
|
||||
* @param h package header
|
||||
* @retval fpList pointer to array of finger prints
|
||||
*/
|
||||
static
|
||||
void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
|
||||
/*@modifies h, cache, *fpList @*/;
|
||||
{
|
||||
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
|
||||
HFD_t hfd = headerFreeData;
|
||||
|
@ -263,3 +273,4 @@ void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
|
|||
dirNames = hfd(dirNames, dnt);
|
||||
baseNames = hfd(baseNames, bnt);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,6 @@ struct fprintCacheEntry_s {
|
|||
const char * dirName; /*!< path to existing directory */
|
||||
dev_t dev; /*!< stat(2) device number */
|
||||
ino_t ino; /*!< stat(2) inode number */
|
||||
int isFake; /*!< (currently unused) */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -50,10 +49,6 @@ struct fingerPrint_s {
|
|||
/*@dependent@*/ const char * baseName; /*!< file base name */
|
||||
};
|
||||
|
||||
/* only if !scarceMemory */
|
||||
/** */
|
||||
#define fpFree(a) free((void *)(a).baseName)
|
||||
|
||||
/** */
|
||||
#define FP_ENTRY_EQUAL(a, b) (((a)->dev == (b)->dev) && ((a)->ino == (b)->ino))
|
||||
|
||||
|
@ -96,8 +91,10 @@ int rpmdbFindFpList(/*@null@*/ rpmdb db, fingerPrint * fpList,
|
|||
/**
|
||||
* Destroy finger print cache.
|
||||
* @param cache pointer to fingerprint cache
|
||||
* @return NULL always
|
||||
*/
|
||||
void fpCacheFree(/*@only@*/ fingerPrintCache cache)
|
||||
/*@null@*/
|
||||
fingerPrintCache fpCacheFree(/*@only@*/ fingerPrintCache cache)
|
||||
/*@modifies cache @*/;
|
||||
|
||||
/**
|
||||
|
@ -146,17 +143,6 @@ void fpLookupList(fingerPrintCache cache, const char ** dirNames,
|
|||
int fileCount, fingerPrint * fpList)
|
||||
/*@modifies cache, *fpList @*/;
|
||||
|
||||
/**
|
||||
* Return finger prints of all file names in header.
|
||||
* @warning: scareMemory is assumed!
|
||||
* @param cache pointer to fingerprint cache
|
||||
* @param h package header
|
||||
* @retval fpList pointer to array of finger prints
|
||||
*/
|
||||
/*@unused@*/
|
||||
void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
|
||||
/*@modifies h, cache, *fpList @*/;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1003,7 +1003,7 @@ if (rc == 0)
|
|||
|
||||
if (rc) {
|
||||
allMatches = dbiFreeIndexSet(allMatches);
|
||||
fpCacheFree(fpc);
|
||||
fpc = fpCacheFree(fpc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ if (rc == 0)
|
|||
rec = _free(rec);
|
||||
allMatches = dbiFreeIndexSet(allMatches);
|
||||
|
||||
fpCacheFree(fpc);
|
||||
fpc = fpCacheFree(fpc);
|
||||
|
||||
if ((*matches)->count == 0) {
|
||||
*matches = dbiFreeIndexSet(*matches);
|
||||
|
@ -2976,7 +2976,7 @@ if (key->size == 0) key->size++; /* XXX "/" fixup. */
|
|||
|
||||
mi = rpmdbFreeIterator(mi);
|
||||
|
||||
fpCacheFree(fpc);
|
||||
fpc = fpCacheFree(fpc);
|
||||
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ void htAddEntry(hashTable ht, const void * key, const void * data)
|
|||
b->data[b->dataCount++] = data;
|
||||
}
|
||||
|
||||
void htFree(hashTable ht)
|
||||
hashTable htFree(hashTable ht)
|
||||
{
|
||||
hashBucket b, n;
|
||||
int i;
|
||||
|
@ -157,6 +157,7 @@ void htFree(hashTable ht)
|
|||
|
||||
ht->buckets = _free(ht->buckets);
|
||||
ht = _free(ht);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int htHasEntry(hashTable ht, const void * key)
|
||||
|
|
|
@ -59,8 +59,10 @@ hashTable htCreate(int numBuckets, int keySize, int freeData,
|
|||
/**
|
||||
* Destroy hash table.
|
||||
* @param ht pointer to hash table
|
||||
* @return NULL always
|
||||
*/
|
||||
void htFree( /*@only@*/ hashTable ht)
|
||||
/*@null@*/
|
||||
hashTable htFree( /*@only@*/ hashTable ht)
|
||||
/*@modifies ht @*/;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue