- fix: synthesize unpacking progress callbacks for packages w/o files.

CVS patchset: 5440
CVS date: 2002/05/19 23:37:24
This commit is contained in:
jbj 2002-05-19 23:37:24 +00:00
parent 2126e4ad09
commit 386882db7a
48 changed files with 4510 additions and 4502 deletions

View File

@ -114,6 +114,7 @@
- plug install mode leaks.
- opaque (well mostly) rpmTransactionSet using methods.
- Grand Renaming of rpm data types.
- fix: synthesize unpacking progress callbacks for packages w/o files.
4.0.3 -> 4.0.4:
- solaris: translate i86pc to i386 (#57182).

View File

@ -15,8 +15,13 @@
#include <rpmbuild.h>
#include "cpio.h"
#define _RPMFI_INTERNAL
#include "rpmfi.h"
#define _RPMTE_INTERNAL
#include "rpmte.h"
#include "buildio.h"
#include "myftw.h"

View File

@ -14,6 +14,7 @@
#include "fsm.h"
#include "psm.h"
#define _RPMFI_INTERNAL /* XXX fi->fsm */
#include "rpmfi.h"
#include "rpmts.h"

View File

@ -14,7 +14,11 @@
#include "rpmal.h"
#include "rpmds.h"
#include "rpmfi.h"
#define _RPMTE_INTERNAL
#include "rpmte.h"
#define _RPMTS_INTERNAL
#include "rpmts.h"
#include "debug.h"
@ -482,7 +486,7 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep)
/*
* Search for an unsatisfied dependency.
*/
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOSUGGESTS) && ts->solve != NULL)
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOSUGGESTS) && ts->solve != NULL)
xx = (*ts->solve) (ts, dep);
unsatisfied:
@ -1142,7 +1146,7 @@ int rpmtsOrder(rpmts ts)
int_32 Flags;
#ifdef DYING
int chainsaw = rpmtsGetFlags(ts) & RPMTRANS_FLAG_CHAINSAW;
int chainsaw = rpmtsFlags(ts) & RPMTRANS_FLAG_CHAINSAW;
#else
int chainsaw = 1;
#endif

View File

@ -15,6 +15,7 @@
#include "psm.h" /* XXX fiTypeString */
#include "rpmerr.h"
#define _RPMFI_INTERNAL
#include "rpmfi.h"
#include "rpmte.h"
#include "rpmts.h"
@ -126,7 +127,7 @@ mapInitIterator(rpmts ts, rpmfi fi)
iter = xcalloc(1, sizeof(*iter));
iter->ts = rpmtsLink(ts, "mapIterator");
iter->fi = rpmfiLink(fi, "mapIterator");
iter->reverse = (fi->te->type == TR_REMOVED && fi->action != FA_COPYOUT);
iter->reverse = (rpmteType(fi->te) == TR_REMOVED && fi->action != FA_COPYOUT);
iter->i = (iter->reverse ? (fi->fc - 1) : 0);
iter->isave = iter->i;
return iter;
@ -503,14 +504,9 @@ int fsmSetup(FSM_t fsm, fileStage goal,
fsm->iter = mapInitIterator(ts, fi);
if (fsm->goal == FSM_PKGINSTALL) {
if (ts && ts->notify) {
/*@-type@*/ /* FIX: cast? */
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_START, 0, fi->archiveSize,
rpmfiKey(fi), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
void * ptr;
ptr = rpmtsNotify(ts, fi->te,
RPMCALLBACK_INST_START, 0, fi->archiveSize);
}
/*@-assignexpose@*/
@ -595,22 +591,22 @@ int fsmMapPath(FSM_t fsm)
break;
case FA_COPYIN:
case FA_CREATE:
assert(fi->te->type == TR_ADDED);
assert(rpmteType(fi->te) == TR_ADDED);
break;
case FA_SKIPNSTATE:
if (fi->fstates && fi->te->type == TR_ADDED)
if (fi->fstates && rpmteType(fi->te) == TR_ADDED)
fi->fstates[i] = RPMFILE_STATE_NOTINSTALLED;
break;
case FA_SKIPNETSHARED:
if (fi->fstates && fi->te->type == TR_ADDED)
if (fi->fstates && rpmteType(fi->te) == TR_ADDED)
fi->fstates[i] = RPMFILE_STATE_NETSHARED;
break;
case FA_BACKUP:
if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
switch (fi->te->type) {
switch (rpmteType(fi->te)) {
case TR_ADDED:
fsm->osuffix = SUFFIX_RPMORIG;
/*@innerbreak@*/ break;
@ -621,18 +617,18 @@ assert(fi->te->type == TR_ADDED);
break;
case FA_ALTNAME:
assert(fi->te->type == TR_ADDED);
assert(rpmteType(fi->te) == TR_ADDED);
if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
fsm->nsuffix = SUFFIX_RPMNEW;
break;
case FA_SAVE:
assert(fi->te->type == TR_ADDED);
assert(rpmteType(fi->te) == TR_ADDED);
if (!(fsm->fflags & RPMFILE_GHOST)) /* XXX Don't if %ghost file. */
fsm->osuffix = SUFFIX_RPMSAVE;
break;
case FA_ERASE:
assert(fi->te->type == TR_REMOVED);
assert(rpmteType(fi->te) == TR_REMOVED);
/*
* XXX TODO: %ghost probably shouldn't be removed, but that changes
* legacy rpm behavior.
@ -689,7 +685,7 @@ int fsmMapAttrs(FSM_t fsm)
{ rpmts ts = fsmGetTs(fsm);
if (ts != NULL && !(ts->transFlags & RPMTRANS_FLAG_NOMD5)) {
if (ts != NULL && !(rpmtsFlags(ts) & RPMTRANS_FLAG_NOMD5)) {
fsm->fmd5sum = (fi->fmd5s ? fi->fmd5s[i] : NULL);
fsm->md5sum = (fi->md5s ? (fi->md5s + (16 * i)) : NULL);
} else {
@ -896,15 +892,9 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
{ const rpmts ts = fsmGetTs(fsm);
rpmfi fi = fsmGetFi(fsm);
if (ts && ts->notify && fi) {
size_t size = (fdGetCpioPos(fsm->cfd) - pos);
/*@-type@*/ /* FIX: cast? */
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS, size, size,
rpmfiKey(fi), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
size_t size = (fdGetCpioPos(fsm->cfd) - pos);
void * ptr;
ptr = rpmtsNotify(ts, fi->te, RPMCALLBACK_INST_PROGRESS, size, size);
}
rc = 0;
@ -1435,7 +1425,7 @@ int fsmStage(FSM_t fsm, fileStage stage)
case FSM_CREATE:
{ rpmts ts = fsmGetTs(fsm);
#define _tsmask (RPMTRANS_FLAG_PKGCOMMIT | RPMTRANS_FLAG_COMMIT)
fsm->commit = ((ts && (ts->transFlags & _tsmask) &&
fsm->commit = ((ts && (rpmtsFlags(ts) & _tsmask) &&
fsm->goal != FSM_PKGCOMMIT) ? 0 : 1);
#undef _tsmask
}
@ -1696,15 +1686,9 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) {
rpmts ts = fsmGetTs(fsm);
rpmfi fi = fsmGetFi(fsm);
if (ts && ts->notify && fi) {
/*@-type@*/ /* FIX: cast? */
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS,
fdGetCpioPos(fsm->cfd), fi->archiveSize,
rpmfiKey(fi), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
void * ptr;
ptr = rpmtsNotify(ts, fi->te, RPMCALLBACK_INST_PROGRESS,
fdGetCpioPos(fsm->cfd), fi->archiveSize);
}
break;
case FSM_UNDO:

View File

@ -10,6 +10,8 @@
#include <rpmlib.h>
#include "rpmps.h"
#define _RPMTS_INTERNAL
#include "rpmts.h"
#include "misc.h" /* XXX stripTrailingChar() */

116
lib/psm.c
View File

@ -17,8 +17,14 @@
#include <rpmurl.h>
#include "rpmal.h"
#define _RPMDS_INTERNAL /* XXX trigger->i */
#include "rpmds.h"
#define _RPMFI_INTERNAL
#include "rpmfi.h"
#define _RPMTE_INTERNAL
#include "rpmte.h"
#include "rpmts.h"
@ -498,9 +504,12 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
goto exit;
}
/*@-assignexpose -type@*/
fi->te = ts->order[0];
/*@=assignexpose =type@*/
/*@-onlytrans@*/ /* FIX: te reference */
fi->te = rpmtsElement(ts, 0);
/*@=onlytrans@*/
/*@-nullpass@*/ /* FIX fi->h may be null */
fi->te->h = headerLink(fi->h, "fi->te->h");
/*@=nullpass@*/
fi->te->fd = fdLink(fd, "installSourcePackage");
hge = fi->hge;
hfd = fi->hfd;
@ -561,14 +570,14 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
}
}
_sourcedir = rpmGenPath(rpmtsGetRootDir(ts), "%{_sourcedir}", "");
_sourcedir = rpmGenPath(rpmtsRootDir(ts), "%{_sourcedir}", "");
rc = chkdir(_sourcedir, "sourcedir");
if (rc) {
rc = RPMRC_FAIL;
goto exit;
}
_specdir = rpmGenPath(rpmtsGetRootDir(ts), "%{_specdir}", "");
_specdir = rpmGenPath(rpmtsRootDir(ts), "%{_specdir}", "");
rc = chkdir(_specdir, "specdir");
if (rc) {
rc = RPMRC_FAIL;
@ -627,6 +636,7 @@ exit:
/*@-branchstate@*/
if (fi) {
fi->te->h = headerFree(fi->te->h, "fi->te->h");
if (fi->te->fd)
(void) Fclose(fi->te->fd);
fi->te->fd = NULL;
@ -749,7 +759,7 @@ static int runScript(PSM_t psm, Header h,
prefixBuf = alloca(maxPrefixLength + 50);
if (script) {
const char * rootDir = rpmtsGetRootDir(ts);
const char * rootDir = rpmtsRootDir(ts);
FD_t fd;
/*@-branchstate@*/
@ -861,7 +871,7 @@ static int runScript(PSM_t psm, Header h,
}
}
rootDir = rpmtsGetRootDir(ts);
rootDir = rpmtsRootDir(ts);
if (rootDir != NULL) /* XXX can't happen */
switch(urlIsURL(rootDir)) {
case URL_IS_PATH:
@ -1237,7 +1247,7 @@ int psmStage(PSM_t psm, pkgStage stage)
case PSM_INIT:
rpmMessage(RPMMESS_DEBUG, _("%s: %s has %d files, test = %d\n"),
psm->stepName, rpmteNEVR(psm->te),
rpmfiFC(fi), (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST));
rpmfiFC(fi), (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST));
/*
* When we run scripts, we pass an argument which is the number of
@ -1264,7 +1274,7 @@ assert(psm->mi == NULL);
while ((psm->oh = rpmdbNextIterator(psm->mi))) {
fi->record = rpmdbGetIteratorOffset(psm->mi);
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_MULTILIB)
if (rpmtsFlags(ts) & RPMTRANS_FLAG_MULTILIB)
psm->oh = headerCopy(psm->oh);
else
psm->oh = NULL;
@ -1279,7 +1289,7 @@ assert(psm->mi == NULL);
memset(fi->fstates, RPMFILE_STATE_NORMAL, fc);
}
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
if (fc <= 0) break;
/*
@ -1316,6 +1326,8 @@ assert(psm->mi == NULL);
/* Retrieve installed header. */
rc = psmStage(psm, PSM_RPMDB_LOAD);
if (rc == 0)
psm->te->h = headerLink(fi->h, "psm->te->h");
}
if (psm->goal == PSM_PKGSAVE) {
/* Open output package for writing. */
@ -1338,7 +1350,7 @@ assert(psm->mi == NULL);
}
break;
case PSM_PRE:
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
/* Change root directory if requested and not already done. */
rc = psmStage(psm, PSM_CHROOT_IN);
@ -1347,11 +1359,11 @@ assert(psm->mi == NULL);
psm->scriptTag = RPMTAG_PREIN;
psm->progTag = RPMTAG_PREINPROG;
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOTRIGGERPREIN)) {
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERPREIN)) {
/* XXX FIXME: implement %triggerprein. */
}
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOPRE)) {
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPRE)) {
rc = psmStage(psm, PSM_SCRIPT);
if (rc) {
rpmError(RPMERR_SCRIPT,
@ -1369,7 +1381,7 @@ assert(psm->mi == NULL);
psm->sense = RPMSENSE_TRIGGERUN;
psm->countCorrection = -1;
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOTRIGGERUN)) {
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERUN)) {
/* Run triggers in other package(s) this package sets off. */
rc = psmStage(psm, PSM_TRIGGERS);
if (rc) break;
@ -1379,7 +1391,7 @@ assert(psm->mi == NULL);
if (rc) break;
}
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOPREUN))
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPREUN))
rc = psmStage(psm, PSM_SCRIPT);
}
if (psm->goal == PSM_PKGSAVE) {
@ -1475,21 +1487,23 @@ assert(psm->mi == NULL);
}
break;
case PSM_PROCESS:
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
if (psm->goal == PSM_PKGINSTALL) {
int i;
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
#ifdef DYING
if (fi->fc <= 0) break;
for (i = 0; i < fi->fc; i++)
#else
if (rpmfiFC(fi) <= 0) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
/* XXX Synthesize callbacks for packages with no files. */
if (rpmfiFC(fi) <= 0) {
void * ptr;
ptr = rpmtsNotify(ts, fi->te, RPMCALLBACK_INST_START, 0, 100);
ptr = rpmtsNotify(ts, fi->te, RPMCALLBACK_INST_PROGRESS, 100, 100);
break;
}
(void) rpmfiInit(fi, 0);
while ((i = rpmfiNext(fi)) >= 0)
#endif
{
while ((i = rpmfiNext(fi)) >= 0) {
uid_t uid;
gid_t gid;
@ -1570,8 +1584,8 @@ assert(psm->mi == NULL);
if (psm->goal == PSM_PKGERASE) {
int fc = rpmfiFC(fi);
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_APPLYONLY) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY) break;
if (fc <= 0) break;
psm->what = RPMCALLBACK_UNINST_START;
@ -1625,7 +1639,7 @@ assert(psm->mi == NULL);
}
break;
case PSM_POST:
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
if (psm->goal == PSM_PKGINSTALL) {
int_32 installTime = (int_32) time(NULL);
@ -1639,7 +1653,7 @@ assert(psm->mi == NULL);
xx = headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE,
&installTime, 1);
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_MULTILIB) {
if (rpmtsFlags(ts) & RPMTRANS_FLAG_MULTILIB) {
uint_32 multiLib, * newMultiLib, * p;
if (hge(fi->h, RPMTAG_MULTILIBS, NULL,
@ -1661,7 +1675,7 @@ assert(psm->mi == NULL);
* If this package has already been installed, remove it from
* the database before adding the new one.
*/
if (fi->record && !(rpmtsGetFlags(ts) & RPMTRANS_FLAG_APPLYONLY)) {
if (fi->record && !(rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY)) {
rc = psmStage(psm, PSM_RPMDB_REMOVE);
if (rc) break;
}
@ -1674,11 +1688,11 @@ assert(psm->mi == NULL);
psm->sense = RPMSENSE_TRIGGERIN;
psm->countCorrection = 0;
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOPOST)) {
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOST)) {
rc = psmStage(psm, PSM_SCRIPT);
if (rc) break;
}
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOTRIGGERIN)) {
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERIN)) {
/* Run triggers in other package(s) this package sets off. */
rc = psmStage(psm, PSM_TRIGGERS);
if (rc) break;
@ -1688,7 +1702,7 @@ assert(psm->mi == NULL);
if (rc) break;
}
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_APPLYONLY))
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY))
rc = markReplacedFiles(psm);
}
@ -1699,18 +1713,18 @@ assert(psm->mi == NULL);
psm->sense = RPMSENSE_TRIGGERPOSTUN;
psm->countCorrection = -1;
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOPOSTUN)) {
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOPOSTUN)) {
rc = psmStage(psm, PSM_SCRIPT);
/* XXX WTFO? postun failures don't cause erasure failure. */
}
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_NOTRIGGERPOSTUN)) {
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERPOSTUN)) {
/* Run triggers in other package(s) this package sets off. */
rc = psmStage(psm, PSM_TRIGGERS);
if (rc) break;
}
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_APPLYONLY))
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY))
rc = psmStage(psm, PSM_RPMDB_REMOVE);
}
if (psm->goal == PSM_PKGSAVE) {
@ -1759,8 +1773,12 @@ assert(psm->mi == NULL);
/*@=nullstate@*/
}
if (fi->h && (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE))
fi->h = headerFree(fi->h, "PSM_PKGSAVE_POST fi->h");
if (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE) {
if (psm->te->h)
psm->te->h = headerFree(psm->te->h, "psm->te->h");
if (fi->h)
fi->h = headerFree(fi->h, "PSM_PKGSAVE_POST fi->h");
}
psm->oh = headerFree(psm->oh, "PSM_PKGSAVE_POST psm->oh");
psm->pkgURL = _free(psm->pkgURL);
psm->rpmio_flags = _free(psm->rpmio_flags);
@ -1793,20 +1811,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,
rpmteKey(psm->te), ts->notifyData);
/*@=noeffectuncon @*/
}
/*@=type@*/
break;
{ void * ptr;
ptr = rpmtsNotify(ts, psm->te, psm->what, psm->amount, psm->total);
} break;
case PSM_DESTROY:
break;
case PSM_COMMIT:
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_PKGCOMMIT)) break;
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_APPLYONLY) break;
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_PKGCOMMIT)) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY) break;
rc = fsmSetup(fi->fsm, FSM_PKGCOMMIT, ts, fi,
NULL, NULL, &psm->failedFile);
@ -1814,7 +1826,7 @@ assert(psm->mi == NULL);
break;
case PSM_CHROOT_IN:
{ const char * rootDir = rpmtsGetRootDir(ts);
{ const char * rootDir = rpmtsRootDir(ts);
/* Change root directory if requested and not already done. */
if (rootDir != NULL && !rpmtsGetChrootDone(ts) && !psm->chrootDone) {
static int _loaded = 0;
@ -1896,12 +1908,12 @@ fprintf(stderr, "*** PSM_RDB_LOAD: header #%u not found\n", fi->record);
rc = (fi->h ? RPMRC_OK : RPMRC_FAIL);
break;
case PSM_RPMDB_ADD:
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
if (fi->h != NULL) /* XXX can't happen */
rc = rpmdbAdd(rpmtsGetRdb(ts), rpmtsGetTid(ts), fi->h);
break;
case PSM_RPMDB_REMOVE:
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST) break;
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
rc = rpmdbRemove(rpmtsGetRdb(ts), rpmtsGetTid(ts), fi->record);
break;

View File

@ -8,6 +8,10 @@
typedef /*@abstract@*/ struct availableList_s * availableList;
#ifdef __cplusplus
{
#endif
/**
* Initialize available packckages, items, and directory list.
* @param delta no. of entries to add on each realloc

View File

@ -11,6 +11,8 @@
#include "rpmdb.h"
#include "rpmps.h"
#define _RPMTS_INTERNAL
#include "rpmts.h"
#include "rpmlead.h"

View File

@ -432,7 +432,7 @@ int rpmInstallSource(rpmts ts, const char * arg,
* Describe database command line requests.
*/
struct rpmInstallArguments_s {
rpmtsFlags transFlags;
rpmtransFlags transFlags;
rpmprobFilterFlags probFilter;
rpmInstallInterfaceFlags installInterfaceFlags;
rpmEraseInterfaceFlags eraseInterfaceFlags;

View File

@ -5,6 +5,8 @@
#include <rpmlib.h>
#include "rpmps.h"
#define _RPMDS_INTERNAL
#include "rpmds.h"
#include "debug.h"

View File

@ -6,6 +6,7 @@
* Structure(s) used for dependency tag sets.
*/
#if defined(_RPMDS_INTERNAL)
/**
* A package dependency set.
*/
@ -31,6 +32,7 @@ struct rpmds_s {
int_32 Count; /*!< No. of elements */
/*@refs@*/ int nrefs; /*!< Reference count. */
};
#endif /* _RPMDS_INTERNAL */
#ifdef __cplusplus
extern "C" {

View File

@ -13,7 +13,10 @@
#include "cpio.h" /* XXX CPIO_FOO */
#include "fsm.h" /* XXX newFSM() */
#define _RPMFI_INTERNAL
#include "rpmfi.h"
#define _RPMTE_INTERNAL /* relocations */
#include "rpmte.h"
#include "rpmts.h"
@ -23,7 +26,6 @@
/*@access rpmfi @*/
/*@access rpmte @*/
/*@access rpmts @*/ /* XXX for ts->ignoreSet */
/*@unchecked@*/
static int _fi_debug = 0;
@ -50,11 +52,6 @@ fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
/*@-refcounttrans@*/ return fi; /*@=refcounttrans@*/
}
fnpyKey rpmfiKey(rpmfi fi)
{
return (fi != NULL ? rpmteKey(fi->te) : NULL);
}
int rpmfiFC(rpmfi fi)
{
return (fi != NULL ? fi->fc : 0);
@ -394,7 +391,7 @@ Header relocateFileList(const rpmts ts, rpmfi fi,
HME_t hme = fi->hme;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
static int _printed = 0;
int allowBadRelocate = (ts->ignoreSet & RPMPROB_FILTER_FORCERELOCATE);
int allowBadRelocate = (rpmtsFilterFlags(ts) & RPMPROB_FILTER_FORCERELOCATE);
rpmRelocation * relocations = NULL;
int numRelocations;
const char ** validRelocations;
@ -490,7 +487,7 @@ Header relocateFileList(const rpmts ts, rpmfi fi,
if (j == numValid && !allowBadRelocate && actions) {
rpmps ps = rpmtsGetProblems(ts);
rpmpsAppend(ps, RPMPROB_BADRELOCATE,
p->NEVR, p->key,
rpmteNEVR(p), rpmteKey(p),
relocations[i].oldPath, NULL, NULL, 0);
ps = rpmpsFree(ps);
}
@ -601,7 +598,7 @@ Header relocateFileList(const rpmts ts, rpmfi fi,
* If only adding libraries of different arch into an already
* installed package, skip all other files.
*/
if (p->multiLib && !isFileMULTILIB((fFlags[i]))) {
if (rpmteMultiLib(p) && !isFileMULTILIB((fFlags[i]))) {
if (actions) {
actions[i] = FA_SKIPMULTILIB;
rpmMessage(RPMMESS_DEBUG, _("excluding multilib path %s%s\n"),
@ -1028,7 +1025,7 @@ if (fi->actions == NULL)
if (ts != NULL)
if (fi != NULL)
if (fi->te != NULL && fi->te->type == TR_ADDED) {
if (fi->te != NULL && rpmteType(fi->te) == TR_ADDED) {
Header foo;
/* XXX DYING */
if (fi->actions == NULL)

View File

@ -6,6 +6,7 @@
* Structure(s) used for file info tag sets.
*/
#if defined(_RPMFI_INTERNAL)
/**
*/
typedef struct sharedFileInfo_s * sharedFileInfo;
@ -133,6 +134,8 @@ struct rpmfi_s {
/*@refs@*/ int nrefs; /*!< Reference count. */
};
#endif /* _RPMFI_INTERNAL */
#ifdef __cplusplus
extern "C" {
#endif
@ -171,15 +174,6 @@ rpmfi XrpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg,
/*@modifies fi @*/;
#define rpmfiLink(_fi, _msg) XrpmfiLink(_fi, _msg, __FILE__, __LINE__)
/**
* Retrieve key from transaction element file info.
* @param fi transaction element file info
* @return transaction element file info key
*/
/*@exposed@*/ /*@dependent@*/ /*@null@*/
fnpyKey rpmfiKey(rpmfi fi)
/*@*/;
/**
* Return file count from file info set.
* @param fi file info set

View File

@ -8,6 +8,8 @@
#include "rpmdb.h"
#include "rpmps.h"
#define _RPMTS_INTERNAL /* ts->goal, ts->dbmode, ts->suggests */
#include "rpmts.h"
#include "manifest.h"
@ -246,7 +248,7 @@ int rpmInstall(rpmts ts,
vsflags |= _RPMTS_VSF_NOSIGNATURES;
vsflags |= _RPMTS_VSF_VERIFY_LEGACY;
ts->dbmode = (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST)
ts->dbmode = (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
? O_RDONLY : (O_RDWR|O_CREAT);
{ int notifyFlags;
@ -308,7 +310,7 @@ restart:
fprintf(stdout, _("Retrieving %s\n"), fileURL);
{ char tfnbuf[64];
const char * rootDir = rpmtsGetRootDir(ts);
const char * rootDir = rpmtsRootDir(ts);
if (!(rootDir && * rootDir))
rootDir = "";
strcpy(tfnbuf, "rpm-xfer.XXXXXX");
@ -603,7 +605,7 @@ restart:
continue;
}
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST)) {
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)) {
eiu->rpmrc = rpmInstallSourcePackage(ts, eiu->fd, NULL, NULL);
if (eiu->rpmrc != RPMRC_OK) eiu->numFailed++;
}
@ -654,7 +656,7 @@ int rpmErase(rpmts ts,
ts->goal = TSM_ERASE;
/* XXX W2DO? O_EXCL??? */
ts->dbmode = (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST)
ts->dbmode = (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST)
? O_RDONLY : (O_RDWR|O_EXCL);
(void) rpmtsOpenDB(ts, ts->dbmode);
@ -704,7 +706,7 @@ int rpmErase(rpmts ts,
}
if (!stopUninstall) {
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) | RPMTRANS_FLAG_REVERSE));
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_REVERSE));
numFailed += rpmtsRun(ts, NULL, 0);
ps = rpmtsGetProblems(ts);
ps = rpmpsFree(ps);

View File

@ -65,8 +65,7 @@ void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
* sets to reduce errors. In general, installs/upgrades are done before
* strict removals, and prerequisite ordering is done on installs/upgrades.
*/
typedef /*@abstract@*/ /*@refcounted@*/
struct rpmts_s * rpmts;
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmts_s * rpmts;
/** \ingroup rpmtrans
* An added/available package retrieval key.
@ -855,7 +854,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
/** \ingroup rpmtrans
* Bit(s) to control rpmtsRun() operation.
*/
typedef enum rpmtsFlags_e {
typedef enum rpmtransFlags_e {
RPMTRANS_FLAG_NONE = 0,
RPMTRANS_FLAG_TEST = (1 << 0), /*!< from --test */
RPMTRANS_FLAG_BUILD_PROBS = (1 << 1), /*!< @todo Document. */
@ -899,7 +898,7 @@ typedef enum rpmtsFlags_e {
/*@=enummemuse@*/
RPMTRANS_FLAG_NOMD5 = (1 << 27), /*!< from --nomd5 */
RPMTRANS_FLAG_NOSUGGESTS = (1 << 28) /*!< from --nosuggests */
} rpmtsFlags;
} rpmtransFlags;
#define _noTransScripts \
( RPMTRANS_FLAG_NOPRE | \

View File

@ -7,14 +7,13 @@
#include <rpmlib.h>
#include "rpmps.h"
#include "rpmts.h"
#include "misc.h"
#include "debug.h"
/*@access fnpyKey@*/
/*@access rpmProblem@*/
/*@access rpmProblemSet@*/
/*@access fnpyKey @*/
/*@access rpmProblem @*/
/*@access rpmps @*/
/*@unchecked@*/
static int _ps_debug = 0;

View File

@ -84,10 +84,12 @@ void printDepProblems(FILE * fp, /*@null@*/ const rpmps ps)
* @param prob rpm problem
* @return formatted string (malloc'd)
*/
/*@-exportlocal@*/
/*@-redecl@*/ /* LCL: is confused. */
/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob)
/*@*/;
/*@=redecl@*/
/*@=exportlocal@*/
/**
* Unreference a problem set instance.
@ -101,11 +103,13 @@ rpmps rpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmps ps,
/*@modifies ps @*/;
/** @todo Remove debugging entry from the ABI. */
/*@-exportlocal@*/
/*@null@*/
rpmps XrpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmps ps,
const char * msg, const char * fn, unsigned ln)
/*@modifies ps @*/;
#define rpmpsUnlink(_ps, _msg) XrpmpsUnlink(_ps, _msg, __FILE__, __LINE__)
/*@=exportlocal@*/
/**
* Reference a problem set instance.
@ -144,9 +148,11 @@ rpmps rpmpsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmps ps)
* @param fp file handle
* @param prob rpm problem
*/
/*@-exportlocal@*/
void rpmProblemPrint(FILE *fp, rpmProblem prob)
/*@globals fileSystem @*/
/*@modifies prob, *fp, fileSystem @*/;
/*@=exportlocal@*/
/**
* Print problems to file handle.

View File

@ -11,6 +11,8 @@
#include "rpmds.h"
#include "rpmfi.h"
#define _RPMTE_INTERNAL
#include "rpmte.h"
#include "rpmts.h"
@ -65,9 +67,7 @@ static void delTE(rpmte p)
p->h = headerFree(p->h, "delTE");
/*@-abstract@*/
memset(p, 0, sizeof(*p)); /* XXX trash and burn */
/*@=abstract@*/
/*@-nullstate@*/ /* FIX: p->{NEVR,name} annotations */
return;
/*@=nullstate@*/
@ -102,13 +102,13 @@ static void addTE(rpmts ts, rpmte p, Header h,
ep = NULL;
xx = hge(h, RPMTAG_EPOCH, NULL, (void **)&ep, NULL);
/*@-branchstate@*/
/*@-branchstate@*/
if (ep) {
p->epoch = xmalloc(20);
sprintf(p->epoch, "%d", *ep);
} else
p->epoch = NULL;
/*@=branchstate@*/
/*@=branchstate@*/
p->this = rpmdsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
p->provides = rpmdsNew(h, RPMTAG_PROVIDENAME, scareMem);
@ -153,7 +153,7 @@ rpmte rpmteFree(rpmte te)
}
rpmte rpmteNew(const rpmts ts, Header h,
rpmTransactionType type,
rpmElementType type,
fnpyKey key,
rpmRelocation * relocs,
int dboffset,
@ -176,7 +176,7 @@ rpmte rpmteNew(const rpmts ts, Header h,
return te;
}
rpmTransactionType rpmteType(rpmte te)
rpmElementType rpmteType(rpmte te)
{
return (te != NULL ? te->type : -1);
}
@ -279,14 +279,14 @@ rpmte rpmteParent(rpmte te)
rpmte rpmteSetParent(rpmte te, rpmte pte)
{
rpmte opte = NULL;
/*@-branchstate@*/
/*@-branchstate@*/
if (te != NULL) {
opte = te->parent;
/*@-assignexpose -temptrans@*/
te->parent = pte;
/*@=assignexpose =temptrans@*/
}
/*@=branchstate@*/
/*@=branchstate@*/
return opte;
}
@ -442,8 +442,8 @@ rpmtei XrpmteiInit(rpmts ts, const char * fn, unsigned int ln)
tei = xcalloc(1, sizeof(*tei));
tei->ts = rpmtsLink(ts, "rpmtei");
tei->reverse = ((ts->transFlags & RPMTRANS_FLAG_REVERSE) ? 1 : 0);
tei->oc = (tei->reverse ? (ts->orderCount - 1) : 0);
tei->reverse = ((rpmtsFlags(ts) & RPMTRANS_FLAG_REVERSE) ? 1 : 0);
tei->oc = (tei->reverse ? (rpmtsNElements(ts) - 1) : 0);
tei->ocsave = tei->oc;
/*@-modfilesys@*/
if (_te_debug)
@ -458,37 +458,35 @@ fprintf(stderr, "*** tei %p ++ %s:%d\n", tei, fn, ln);
* @return transaction element, NULL on termination
*/
static /*@dependent@*/ /*@null@*/
rpmte teNextIterator(rpmtei tei)
rpmte rpmteiNextIterator(rpmtei tei)
/*@modifies tei @*/
{
rpmte te = NULL;
int oc = -1;
if (tei == NULL || tei->ts == NULL || tei->ts->order == NULL)
if (tei == NULL || tei->ts == NULL || rpmtsNElements(tei->ts) <= 0)
return te;
if (tei->reverse) {
if (tei->oc >= 0) oc = tei->oc--;
} else {
if (tei->oc < tei->ts->orderCount) oc = tei->oc++;
if (tei->oc < rpmtsNElements(tei->ts)) oc = tei->oc++;
}
tei->ocsave = oc;
/*@-abstract @*/
/*@-branchstate@*/
if (oc != -1)
te = tei->ts->order[oc];
/*@=abstract @*/
/*@-compdef -usereleased@*/ /* FIX: ts->order may be released */
te = rpmtsElement(tei->ts, oc);
/*@=branchstate@*/
return te;
/*@=compdef =usereleased@*/
}
rpmte rpmteiNext(rpmtei tei, rpmTransactionType type)
rpmte rpmteiNext(rpmtei tei, rpmElementType type)
{
rpmte p;
rpmte te;
while ((p = teNextIterator(tei)) != NULL) {
if (type == 0 || (p->type & type) != 0)
while ((te = rpmteiNextIterator(tei)) != NULL) {
if (type == 0 || (te->type & type) != 0)
break;
}
return p;
return te;
}

View File

@ -1,21 +1,36 @@
#ifndef H_RPMTE
#define H_RPMTE
/** \ingroup rpmdep rpmtrans
/** \ingroup rpmts rpmte
* \file lib/rpmte.h
* Structures used for an "rpmte" transaction element.
*/
/**
* Transaction element ordering chain linkage.
*/
typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
/**
* Transaction element iterator.
*/
typedef /*@abstract@*/ struct rpmtei_s * rpmtei;
/** \ingroup rpmte
* Transaction element type.
*/
typedef enum rpmElementType_e {
TR_ADDED = (1 << 0), /*!< Package will be installed. */
TR_REMOVED = (1 << 1) /*!< Package will be removed. */
} rpmElementType;
/*@-exportlocal@*/
/*@unchecked@*/
extern int _te_debug;
/*@=exportlocal@*/
/** \ingroup rpmdep
#if defined(_RPMTE_INTERNAL)
/** \ingroup rpmte
* Dependncy ordering information.
*/
/*@-fielduse@*/ /* LCL: confused by union? */
@ -36,18 +51,11 @@ struct tsortInfo_s {
};
/*@=fielduse@*/
/** \ingroup rpmdep
*/
typedef enum rpmTransactionType_e {
TR_ADDED = (1 << 0), /*!< Package will be installed. */
TR_REMOVED = (1 << 1) /*!< Package will be removed. */
} rpmTransactionType;
/** \ingroup rpmdep
/** \ingroup rpmte
* A single package instance to be installed/removed atomically.
*/
struct rpmte_s {
rpmTransactionType type; /*!< Package disposition (installed/removed). */
rpmElementType type; /*!< Package disposition (installed/removed). */
/*@refcounted@*/ /*@null@*/
Header h; /*!< Package header. */
@ -121,6 +129,8 @@ struct rpmtei_s {
int oc; /*!< iterator index. */
};
#endif /* _RPMTE_INTERNAL */
#ifdef __cplusplus
extern "C" {
#endif
@ -146,7 +156,7 @@ rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
* @return new transaction element
*/
/*@only@*/ /*@null@*/
rpmte rpmteNew(const rpmts ts, Header h, rpmTransactionType type,
rpmte rpmteNew(const rpmts ts, Header h, rpmElementType type,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
/*@null@*/ rpmRelocation * relocs,
int dboffset,
@ -158,7 +168,7 @@ rpmte rpmteNew(const rpmts ts, Header h, rpmTransactionType type,
* @param te transaction element
* @return type
*/
rpmTransactionType rpmteType(rpmte te)
rpmElementType rpmteType(rpmte te)
/*@*/;
/**
@ -488,7 +498,7 @@ rpmtei XrpmteiInit(rpmts ts,
* @return next transaction element of type, NULL on termination
*/
/*@dependent@*/ /*@null@*/
rpmte rpmteiNext(rpmtei tei, rpmTransactionType type)
rpmte rpmteiNext(rpmtei tei, rpmElementType type)
/*@modifies tei @*/;
#ifdef __cplusplus

View File

@ -14,7 +14,11 @@
#include "rpmds.h"
#include "rpmfi.h"
#include "rpmal.h"
#define _RPMTE_INTERNAL /* XXX te->h */
#include "rpmte.h"
#define _RPMTS_INTERNAL
#include "rpmts.h"
/* XXX FIXME: merge with existing (broken?) tests in system.h */
@ -411,13 +415,9 @@ int rpmtsSetVerifySigFlags(rpmts ts, int vsflags)
return ret;
}
const char * rpmtsGetRootDir(rpmts ts)
const char * rpmtsRootDir(rpmts ts)
{
const char * rootDir = NULL;
if (ts != NULL) {
rootDir = ts->rootDir;
}
return rootDir;
return (ts != NULL ? ts->rootDir : NULL);
}
void rpmtsSetRootDir(rpmts ts, const char * rootDir)
@ -548,7 +548,7 @@ int rpmtsInitDSI(const rpmts ts)
int rc;
int i;
if (ts->ignoreSet & RPMPROB_FILTER_DISKSPACE)
if (rpmtsFilterFlags(ts) & RPMPROB_FILTER_DISKSPACE)
return 0;
rc = rpmGetFilesystemList(&ts->filesystems, &ts->filesystemCount);
@ -702,18 +702,56 @@ void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
ps = rpmpsFree(ps);
}
rpmtsFlags rpmtsGetFlags(rpmts ts)
void * rpmtsNotify(rpmts ts, rpmte te,
rpmCallbackType what, unsigned long amount, unsigned long total)
{
rpmtsFlags otransFlags = 0;
if (ts != NULL) {
otransFlags = ts->transFlags;
void * ptr = NULL;
if (ts && ts->notify && te) {
assert(!(te->type == TR_ADDED && te->h == NULL));
/*@-type@*/ /* FIX: cast? */
/*@-noeffectuncon @*/ /* FIX: check rc */
ptr = ts->notify(te->h, what, amount, total,
rpmteKey(te), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
return otransFlags;
return ptr;
}
rpmtsFlags rpmtsSetFlags(rpmts ts, rpmtsFlags transFlags)
int rpmtsNElements(rpmts ts)
{
rpmtsFlags otransFlags = 0;
int nelements = 0;
if (ts != NULL && ts->order != NULL) {
nelements = ts->orderCount;
}
return nelements;
}
rpmte rpmtsElement(rpmts ts, int ix)
{
rpmte te = NULL;
if (ts != NULL && ts->order != NULL) {
if (ix >= 0 && ix < ts->orderCount)
te = ts->order[ix];
}
/*@-compdef@*/
return te;
/*@=compdef@*/
}
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
{
return (ts != NULL ? ts->ignoreSet : 0);
}
rpmtransFlags rpmtsFlags(rpmts ts)
{
return (ts != NULL ? ts->transFlags : 0);
}
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
{
rpmtransFlags otransFlags = 0;
if (ts != NULL) {
otransFlags = ts->transFlags;
ts->transFlags = transFlags;

View File

@ -14,6 +14,12 @@
extern int _ts_debug;
/*@=exportlocal@*/
#define _RPMTS_VSF_NODIGESTS (1 << 0)
#define _RPMTS_VSF_NOSIGNATURES (1 << 1)
#define _RPMTS_VSF_VERIFY_LEGACY (1 << 2)
#if defined(_RPMTS_INTERNAL)
/*@unchecked@*/
/*@-exportlocal@*/
extern int _cacheDependsRC;
@ -55,7 +61,7 @@ typedef enum tsStage_e {
* The set of packages to be installed/removed atomically.
*/
struct rpmts_s {
rpmtsFlags transFlags; /*!< Bit(s) to control operation. */
rpmtransFlags transFlags; /*!< Bit(s) to control operation. */
tsmStage goal; /*!< Transaction goal (i.e. mode) */
/*@null@*/
@ -122,9 +128,6 @@ struct rpmts_s {
int nodigests; /*!< Verify digests? */
int nosignatures; /*!< Verify signatures? */
int vsflags; /*!< Signature verification flags. */
#define _RPMTS_VSF_NODIGESTS (1 << 0)
#define _RPMTS_VSF_NOSIGNATURES (1 << 1)
#define _RPMTS_VSF_VERIFY_LEGACY (1 << 2)
/*@observer@*/ /*@dependent@*/ /*@null@*/
const char * fn; /*!< Current package fn. */
@ -144,6 +147,7 @@ struct rpmts_s {
/*@refs@*/ int nrefs; /*!< Reference count. */
};
#endif /* _RPMTS_INTERNAL */
#ifdef __cplusplus
extern "C" {
@ -326,7 +330,7 @@ int rpmtsSetVerifySigFlags(rpmts ts, int vsflags)
* @return transaction rootDir
*/
/*@observer@*/ /*@null@*/
const char * rpmtsGetRootDir(rpmts ts)
const char * rpmtsRootDir(rpmts ts)
/*@*/;
/** \ingroup rpmts
@ -445,12 +449,51 @@ void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
/*@modifies ts @*/;
/**
* Perform transaction progress notify callback.
* @param ts transaction set
* @param te current transaction element
* @param what type of call back
* @param amount current value
* @param total final value
* @return callback dependent pointer
*/
/*@null@*/
void * rpmtsNotify(rpmts ts, rpmte te,
rpmCallbackType what, unsigned long amount, unsigned long total)
/*@*/;
/**
* Return number of (ordered) transaction set elements.
* @param ts transaction set
* @return no. of transaction set elements
*/
int rpmtsNElements(rpmts ts)
/*@*/;
/**
* Return (ordered) transaction set element.
* @param ts transaction set
* @param ix transaction element index
* @return transaction element
*/
rpmte rpmtsElement(rpmts ts, int ix)
/*@*/;
/** \ingroup rpmts
* Get problem ignore bit mask, i.e. bits to filter encountered problems.
* @param ts transaction set
* @return ignore bit mask
*/
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
/*@*/;
/** \ingroup rpmts
* Get transaction flags, i.e. bits that control rpmtsRun().
* @param ts transaction set
* @return transaction flags
*/
rpmtsFlags rpmtsGetFlags(rpmts ts)
rpmtransFlags rpmtsFlags(rpmts ts)
/*@*/;
/** \ingroup rpmts
@ -459,7 +502,7 @@ rpmtsFlags rpmtsGetFlags(rpmts ts)
* @param transFlags new transaction flags
* @return previous transaction flags
*/
rpmtsFlags rpmtsSetFlags(rpmts ts, rpmtsFlags transFlags)
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
/*@modifies ts @*/;
/** \ingroup rpmts

View File

@ -10,6 +10,7 @@
#include "rpmdb.h"
#include "rpmps.h"
#define _RPMTS_INTERNAL
#include "rpmts.h"
#include "misc.h" /* XXX for dosetenv() and makeTempFile() */

View File

@ -12,8 +12,14 @@
#include "rpmps.h"
#include "rpmds.h"
#define _RPMFI_INTERNAL
#include "rpmfi.h"
#define _RPMTE_INTERNAL
#include "rpmte.h"
#define _RPMTS_INTERNAL
#include "rpmts.h"
#include "rpmdb.h"
@ -92,7 +98,7 @@ static fileAction decideFileFate(const rpmts 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 (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_ALLFILES)
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_ALLFILES)
&& (newFlags & RPMFILE_MISSINGOK))
{
rpmMessage(RPMMESS_DEBUG, _("%s skipped due to missingok flag\n"),
@ -588,7 +594,7 @@ assert(otherFi->actions[otherFileNum] != FA_UNKNOWN);
assert(otherFi != NULL);
/* Mark added overlapped non-identical files as a conflict. */
if ((ts->ignoreSet & RPMPROB_FILTER_REPLACENEWFILES)
if ((rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACENEWFILES)
&& filecmp(otherFi, fi))
{
rpmpsAppend(ps, RPMPROB_NEW_FILE_CONFLICT,
@ -709,7 +715,7 @@ static void skipFiles(const rpmts ts, rpmfi fi)
/*@globals rpmGlobalMacroContext @*/
/*@modifies fi, rpmGlobalMacroContext @*/
{
int noDocs = (rpmtsGetFlags(ts) & RPMTRANS_FLAG_NODOCS);
int noDocs = (rpmtsFlags(ts) & RPMTRANS_FLAG_NODOCS);
char ** netsharedPaths = NULL;
const char ** languages;
const char * dn, * bn;
@ -912,9 +918,9 @@ rpmfi rpmteiGetFi(const rpmtei tei)
if (tei != NULL && tei->ocsave != -1) {
/*@-type -abstract@*/ /* FIX: rpmte not opaque */
rpmte te = tei->ts->order[tei->ocsave];
rpmte te = rpmtsElement(tei->ts, tei->ocsave);
/*@-assignexpose@*/
if ((fi = te->fi) != NULL)
if (te != NULL && (fi = te->fi) != NULL)
fi->te = te;
/*@=assignexpose@*/
/*@=type =abstract@*/
@ -945,14 +951,14 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/* FIXME: what if the same package is included in ts twice? */
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));
if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS)
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers));
if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOTRIGGERS)
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransTriggers));
/* XXX MULTILIB is broken, as packages can and do execute /sbin/ldconfig. */
if (rpmtsGetFlags(ts) & (RPMTRANS_FLAG_JUSTDB | RPMTRANS_FLAG_MULTILIB))
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) | _noTransScripts | _noTransTriggers));
if (rpmtsFlags(ts) & (RPMTRANS_FLAG_JUSTDB | RPMTRANS_FLAG_MULTILIB))
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers));
ts->probs = rpmpsFree(ts->probs);
ts->probs = rpmpsCreate();
@ -994,21 +1000,21 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
continue; /* XXX can't happen */
fc = rpmfiFC(fi);
if (!(ts->ignoreSet & RPMPROB_FILTER_IGNOREARCH))
if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_IGNOREARCH))
if (!archOkay(rpmteA(p)))
rpmpsAppend(ps, RPMPROB_BADARCH,
rpmteNEVR(p), rpmteKey(p),
rpmteA(p), NULL,
NULL, 0);
if (!(ts->ignoreSet & RPMPROB_FILTER_IGNOREOS))
if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_IGNOREOS))
if (!osOkay(rpmteO(p)))
rpmpsAppend(ps, RPMPROB_BADOS,
rpmteNEVR(p), rpmteKey(p),
rpmteO(p), NULL,
NULL, 0);
if (!(ts->ignoreSet & RPMPROB_FILTER_OLDPACKAGE)) {
if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_OLDPACKAGE)) {
Header h;
mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(p), 0);
while ((h = rpmdbNextIterator(mi)) != NULL)
@ -1017,7 +1023,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
}
/* XXX multilib should not display "already installed" problems */
if (!(ts->ignoreSet & RPMPROB_FILTER_REPLACEPKG) && !rpmteMultiLib(p)) {
if (!(rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEPKG) && !rpmteMultiLib(p)) {
mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(p), 0);
xx = rpmdbSetIteratorRE(mi, RPMTAG_VERSION, RPMMIRE_DEFAULT,
rpmteV(p));
@ -1095,7 +1101,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
pi = rpmteiFree(pi);
if (!rpmtsGetChrootDone(ts)) {
const char * rootDir = rpmtsGetRootDir(ts);
const char * rootDir = rpmtsRootDir(ts);
xx = chdir("/");
/*@-superuser -noeffect @*/
if (rootDir != NULL)
@ -1232,7 +1238,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
switch (rpmteType(p)) {
case TR_ADDED:
xx = handleInstInstalledFiles(ts, p, fi, shared, nexti - i,
!(beingRemoved || (ts->ignoreSet & RPMPROB_FILTER_REPLACEOLDFILES)));
!(beingRemoved || (rpmtsFilterFlags(ts) & RPMPROB_FILTER_REPLACEOLDFILES)));
/*@switchbreak@*/ break;
case TR_REMOVED:
if (!beingRemoved)
@ -1291,7 +1297,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/* ===============================================
* If unfiltered problems exist, free memory and return.
*/
if ((rpmtsGetFlags(ts) & RPMTRANS_FLAG_BUILD_PROBS)
if ((rpmtsFlags(ts) & RPMTRANS_FLAG_BUILD_PROBS)
|| (ts->probs->numProblems &&
(okProbs != NULL || rpmpsTrim(ts->probs, okProbs)))
)
@ -1304,7 +1310,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/* ===============================================
* Save removed files before erasing.
*/
if (rpmtsGetFlags(ts) & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE)) {
if (rpmtsFlags(ts) & (RPMTRANS_FLAG_DIRSTASH | RPMTRANS_FLAG_REPACKAGE)) {
pi = rpmteiInit(ts);
while ((p = rpmteiNext(pi, 0)) != NULL) {
fi = rpmteiGetFi(pi);
@ -1312,7 +1318,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
case TR_ADDED:
/*@switchbreak@*/ break;
case TR_REMOVED:
if (!(rpmtsGetFlags(ts) & RPMTRANS_FLAG_REPACKAGE))
if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_REPACKAGE))
/*@switchbreak@*/ break;
psm->te = p;
psm->fi = rpmfiLink(fi, "tsRepackage");
@ -1334,7 +1340,6 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/*@-branchstate@*/ /* FIX: fi reload needs work */
while ((p = rpmteiNext(pi, 0)) != NULL) {
alKey pkgKey;
Header h;
int gotfd;
gotfd = 0;
@ -1349,7 +1354,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
pkgKey = rpmteAddedKey(p);
rpmMessage(RPMMESS_DEBUG, "========== +++ %s\n", rpmteNEVR(p));
h = NULL;
p->h = NULL;
/*@-type@*/ /* FIX: rpmte not opaque */
{
/*@-noeffectuncon@*/ /* FIX: notify annotations */
@ -1360,7 +1365,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
rpmRC rpmrc;
rpmrc = rpmReadPackageFile(ts, rpmteFd(p),
"rpmtsRun", &h);
"rpmtsRun", &p->h);
if (!(rpmrc == RPMRC_OK || rpmrc == RPMRC_BADSIZE)) {
/*@-noeffectuncon@*/ /* FIX: notify annotations */
@ -1389,7 +1394,7 @@ fi->actions = NULL;
fi->magic = RPMFIMAGIC;
fi->te = p;
fi->record = 0;
(void) rpmfiNew(ts, fi, h, RPMTAG_BASENAMES, 1);
(void) rpmfiNew(ts, fi, p->h, RPMTAG_BASENAMES, 1);
psm->fi = rpmfiLink(fi, "tsInstall");
fi->fstates = _free(fi->fstates);
fi->fstates = fstates;
@ -1399,9 +1404,9 @@ fi->actions = actions;
}
if (rpmteMultiLib(p))
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) | RPMTRANS_FLAG_MULTILIB));
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_MULTILIB));
else
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) & ~RPMTRANS_FLAG_MULTILIB));
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) & ~RPMTRANS_FLAG_MULTILIB));
if (psmStage(psm, PSM_PKGINSTALL)) {
ourrc++;
@ -1413,7 +1418,7 @@ fi->actions = actions;
lastKey = pkgKey;
}
h = headerFree(h, "TR_ADDED h free");
p->h = headerFree(p->h, "TR_ADDED h free");
if (gotfd) {
/*@-noeffectuncon @*/ /* FIX: check rc */

View File

@ -39,7 +39,7 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
struct stat sb;
/* Prepend the path to root (if specified). */
rootDir = rpmtsGetRootDir(ts);
rootDir = rpmtsRootDir(ts);
if (rootDir && *rootDir != '\0'
&& !(rootDir[0] == '/' && rootDir[1] == '\0'))
{

418
po/cs.po

File diff suppressed because it is too large Load Diff

418
po/da.po

File diff suppressed because it is too large Load Diff

418
po/de.po

File diff suppressed because it is too large Load Diff

418
po/fi.po

File diff suppressed because it is too large Load Diff

418
po/fr.po

File diff suppressed because it is too large Load Diff

418
po/gl.po

File diff suppressed because it is too large Load Diff

418
po/is.po

File diff suppressed because it is too large Load Diff

418
po/ja.po

File diff suppressed because it is too large Load Diff

418
po/ko.po

File diff suppressed because it is too large Load Diff

418
po/no.po

File diff suppressed because it is too large Load Diff

418
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

418
po/ro.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

418
po/ru.po

File diff suppressed because it is too large Load Diff

418
po/sk.po

File diff suppressed because it is too large Load Diff

420
po/sl.po

File diff suppressed because it is too large Load Diff

418
po/sr.po

File diff suppressed because it is too large Load Diff

418
po/sv.po

File diff suppressed because it is too large Load Diff

418
po/tr.po

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,9 @@
#include "rpmdb.h"
#include "rpmps.h"
#include "rpmts.h" /* XXX for ts->rpmdb */
#define _RPMTS_INTERNAL /* XXX for ts->rdb */
#include "rpmts.h"
#include "legacy.h"
#include "misc.h"

View File

@ -523,6 +523,7 @@ fi
%changelog
* Sun May 19 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.15
- Grand Renaming of rpm data types.
- fix: synthesize unpacking progress callbacks for packages w/o files.
* Thu May 16 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.14
- opaque (well mostly) rpmTransactionSet using methods.

View File

@ -68,7 +68,7 @@ do_tsort(const char *fileArgv[])
ts = rpmtsCreate();
if (!noChainsaw)
ts->transFlags = RPMTRANS_FLAG_CHAINSAW;
(void) rpmtsSetFlags(ts, rpmtsFlags(ts) | RPMTRANS_FLAG_CHAINSAW);
rc = rpmtsOpenDB(ts, O_RDONLY);
if (rc) {
@ -230,11 +230,11 @@ restart:
if (rc)
goto exit;
{ rpmds requires;
rpmtei pi; rpmte p;
rpmtei qi; rpmte q;
{ rpmtei pi;
rpmte p;
rpmte q;
unsigned char * selected =
alloca(sizeof(*selected) * (ts->orderCount + 1));
alloca(sizeof(*selected) * (rpmtsNElements(ts) + 1));
int oType = TR_ADDED;
fprintf(stdout, "digraph XXX {\n");
@ -255,112 +255,6 @@ fprintf(stdout, " { rank=max ; \"%s\" }\n", rpmteN(p));
}
pi = rpmteiFree(pi);
#ifdef NOTNOW
fprintf(stdout, "//===== Relations:\n");
pi = rpmteiInit(ts);
while ((p = rpmteiNext(pi, oType)) != NULL) {
int printed;
if ((requires = rpmteDS(p, RPMTAG_REQUIRENAME)) == NULL)
continue;
memset(selected, 0, sizeof(*selected) * ts->orderCount);
selected[rpmteiGetOc(pi)] = 1;
printed = 0;
requires = rpmdsInit(requires);
while (rpmdsNext(requires) >= 0) {
int_32 Flags;
const char * qName;
fnpyKey key;
alKey pkgKey;
int i;
Flags = rpmdsFlags(requires);
switch (rpmteType(p)) {
case TR_REMOVED:
/* Skip if not %preun/%postun requires or legacy prereq. */
if (isInstallPreReq(Flags)
#ifdef NOTYET
|| !( isErasePreReq(Flags)
|| isLegacyPreReq(Flags) )
#endif
)
/*@innercontinue@*/ continue;
/*@switchbreak@*/ break;
case TR_ADDED:
/* Skip if not %pre/%post requires or legacy prereq. */
if (isErasePreReq(Flags)
#ifdef NOTYET
|| !( isInstallPreReq(Flags)
|| isLegacyPreReq(Flags) )
#endif
)
/*@innercontinue@*/ continue;
/*@switchbreak@*/ break;
}
if ((qName = rpmdsN(requires)) == NULL)
continue; /* XXX can't happen */
if (!strncmp(qName, "rpmlib(", sizeof("rpmlib(")-1))
continue;
pkgKey = RPMAL_NOMATCH;
key = alSatisfiesDepend(ts->addedPackages, requires, &pkgKey);
if (pkgKey == RPMAL_NOMATCH)
continue;
for (qi = rpmteiInit(ts), i = 0;
(q = rpmteiNext(qi, 0)) != NULL; i++)
{
if (rpmteType(q) == TR_REMOVED)
continue;
if (pkgKey == rpmteAddedKey(q))
break;
}
qi = rpmteiFree(qi);
if (q == NULL || i == ts->orderCount)
continue;
if (selected[i] != 0)
continue;
selected[i] = 1;
if (rpmteTree(p) == rpmteTree(q)) {
int pdepth = rpmteDepth(p);
int qdepth = rpmteDepth(q);
#if 0
if (pdepth == qdepth)
continue;
if (pdepth < qdepth) {
if ((qdepth - pdepth) > 1) continue;
if (!strcmp(rpmteN(q), "glibc")) continue;
if (!strcmp(rpmteN(q), "bash")) continue;
}
#endif
if (pdepth > qdepth) {
if (!strcmp(rpmteN(q), "glibc")) continue;
if (!strcmp(rpmteN(q), "bash")) continue;
if (!strcmp(rpmteN(q), "info")) continue;
if (!strcmp(rpmteN(q), "mktemp")) continue;
}
}
if (!printed) {
fprintf(stdout, "// %s\n", rpmteN(p));
printed = 1;
}
fprintf(stdout, "//\t%s (0x%x)\n", rpmdsNewDNEVR(identifyDepend(Flags), requires), Flags);
fprintf(stdout, "\t\"%s\" -> \"%s\"\n", rpmteN(p), rpmteN(q));
}
}
pi = rpmteiFree(pi);
#endif /* NOTNOW */
fprintf(stdout, "}\n");
}