- Grand Renaming of rpm data types.

CVS patchset: 5439
CVS date: 2002/05/19 18:42:25
This commit is contained in:
jbj 2002-05-19 18:42:25 +00:00
parent 38385c8d63
commit 2126e4ad09
67 changed files with 8977 additions and 8848 deletions

View File

@ -111,8 +111,9 @@
- rework most of rpmdb.c prepatory to implementing duplicates.
- fix: 2 memory leaks in headerSprintf.
- fix: db mire's access out-of-bounds memory.
- plug most install mode leaks.
- plug install mode leaks.
- opaque (well mostly) rpmTransactionSet using methods.
- Grand Renaming of rpm data types.
4.0.3 -> 4.0.4:
- solaris: translate i86pc to i386 (#57182).

View File

@ -371,7 +371,6 @@ INPUT = \
@top_srcdir@/lib/package.c \
@top_srcdir@/lib/poptI.c \
@top_srcdir@/lib/poptQV.c \
@top_srcdir@/lib/problems.c \
@top_srcdir@/lib/psm.c \
@top_srcdir@/lib/psm.h \
@top_srcdir@/lib/query.c \
@ -386,6 +385,8 @@ INPUT = \
@top_srcdir@/lib/rpmlead.h \
@top_srcdir@/lib/rpmlib.h \
@top_srcdir@/lib/rpmlibprov.c \
@top_srcdir@/lib/rpmps.c \
@top_srcdir@/lib/rpmps.h \
@top_srcdir@/lib/rpmrc.c \
@top_srcdir@/lib/rpmte.c \
@top_srcdir@/lib/rpmte.h \

13
build.c
View File

@ -7,23 +7,24 @@
#include <rpmcli.h>
#include <rpmbuild.h>
#include "rpmps.h"
#include "rpmte.h"
#include "rpmts.h"
#include "build.h"
#include "debug.h"
/*@access rpmTransactionSet @*/ /* XXX compared with NULL @*/
/*@access rpmts @*/ /* XXX compared with NULL @*/
/*@access rpmdb @*/ /* XXX compared with NULL @*/
/*@access FD_t @*/ /* XXX compared with NULL @*/
/**
*/
static int checkSpec(rpmTransactionSet ts, Header h)
static int checkSpec(rpmts ts, Header h)
/*@globals fileSystem, internalState @*/
/*@modifies ts, h, fileSystem, internalState @*/
{
rpmProblemSet ps;
rpmps ps;
int rc;
if (!headerIsEntry(h, RPMTAG_REQUIRENAME)
@ -40,7 +41,7 @@ static int checkSpec(rpmTransactionSet ts, Header h)
printDepProblems(stderr, ps);
rc = 1;
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
/* XXX nuke the added package. */
rpmtsClean(ts);
@ -94,7 +95,7 @@ static int isSpecFile(const char * specfile)
/**
*/
static int buildForTarget(rpmTransactionSet ts, const char * arg, BTA_t ba)
static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext,
@ -288,7 +289,7 @@ exit:
return rc;
}
int build(rpmTransactionSet ts, const char * arg, BTA_t ba, const char * rcfile)
int build(rpmts ts, const char * arg, BTA_t ba, const char * rcfile)
{
char *t, *te;
int rc = 0;

View File

@ -5,7 +5,7 @@
extern "C" {
#endif
int build(rpmTransactionSet ts, const char * arg, BTA_t ba,
int build(rpmts ts, const char * arg, BTA_t ba,
/*@null@*/ const char * rcfile)
/*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
fileSystem, internalState @*/

View File

@ -15,7 +15,7 @@
typedef /*@abstract@*/ struct cpioSourceArchive_s {
unsigned int cpioArchiveSize;
FD_t cpioFdIn;
TFI_t cpioList;
rpmfi cpioList;
/*@only@*/ struct rpmlead * lead; /* XXX FIXME: exorcize lead/arch/os */
} * CSA_t;

View File

@ -25,7 +25,7 @@
#include "debug.h"
/*@access Header @*/
/*@access TFI_t @*/
/*@access rpmfi @*/
/*@access FD_t @*/
/*@access StringBuf @*/ /* compared with NULL */
@ -1097,7 +1097,7 @@ static int checkHardLinks(FileList fl)
* @param isSrc
*/
static void genCpioListAndHeader(/*@partial@*/ FileList fl,
TFI_t * cpioList, Header h, int isSrc)
rpmfi * cpioList, Header h, int isSrc)
/*@globals rpmGlobalMacroContext,
fileSystem @*/
/*@modifies h, *cpioList, fl->processingFailed, fl->fileList,
@ -1331,15 +1331,15 @@ static void genCpioListAndHeader(/*@partial@*/ FileList fl,
(void) rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
}
{ TFI_t fi = xcalloc(1, sizeof(*fi));
{ rpmfi fi = xcalloc(1, sizeof(*fi));
int scareMem = 1;
char * a, * d;
/* XXX FIXME drill rpmTransactionSet ts all the way down here */
/* XXX FIXME drill rpmts ts all the way down here */
/*@i@*/ fi->te = xcalloc(1, sizeof(*fi->te));
/*@i@*/ fi->te->type = TR_ADDED;
fi = fiNew(NULL, fi, h, RPMTAG_BASENAMES, scareMem);
fi = rpmfiNew(NULL, fi, h, RPMTAG_BASENAMES, scareMem);
if (fi == NULL) return; /* XXX can't happen */
fi->dnl = _free(fi->dnl);
@ -2006,7 +2006,7 @@ static int processPackageFiles(Spec spec, Package pkg,
(void) rpmlibNeedsFeature(pkg->header,
"PartialHardlinkSets", "4.0.4-1");
genCpioListAndHeader(&fl, (TFI_t *)&pkg->cpioList, pkg->header, 0);
genCpioListAndHeader(&fl, (rpmfi *)&pkg->cpioList, pkg->header, 0);
if (spec->timeCheck)
timeCheck(spec->timeCheck, pkg->header);
@ -2222,7 +2222,7 @@ int processSourceFiles(Spec spec)
if (! fl.processingFailed) {
if (spec->sourceHeader != NULL)
genCpioListAndHeader(&fl, (TFI_t *)&spec->sourceCpioList,
genCpioListAndHeader(&fl, (rpmfi *)&spec->sourceCpioList,
spec->sourceHeader, 1);
}
@ -2430,13 +2430,13 @@ DepMsg_t depMsgs[] = {
/**
*/
static int generateDepends(Spec spec, Package pkg, TFI_t cpioList, int multiLib)
static int generateDepends(Spec spec, Package pkg, rpmfi cpioList, int multiLib)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies cpioList, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
TFI_t fi = cpioList;
rpmfi fi = cpioList;
StringBuf writeBuf;
int writeBytes;
StringBuf readBuf;

View File

@ -8,6 +8,8 @@
#include <rpmio_internal.h>
#include <rpmbuild.h>
#include "rpmps.h"
#include "cpio.h"
#include "fsm.h"
#include "psm.h"
@ -22,8 +24,8 @@
#include "rpmlead.h"
#include "debug.h"
/*@access rpmTransactionSet @*/
/*@access TFI_t @*/ /* compared with NULL */
/*@access rpmts @*/
/*@access rpmfi @*/ /* compared with NULL */
/*@access Header @*/ /* compared with NULL */
/*@access FD_t @*/ /* compared with NULL */
/*@access StringBuf @*/ /* compared with NULL */
@ -56,8 +58,8 @@ static int cpio_doio(FD_t fdo, /*@unused@*/ Header h, CSA_t csa,
fileSystem@*/
/*@modifies fdo, csa, rpmGlobalMacroContext, fileSystem @*/
{
rpmTransactionSet ts = rpmtsCreate();
TFI_t fi = csa->cpioList;
rpmts ts = rpmtsCreate();
rpmfi fi = csa->cpioList;
const char *failedFile = NULL;
FD_t cfd;
int rc, ec;
@ -321,7 +323,7 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead,
spec->packages->header = headerFree(spec->packages->header, "spec->packages");
/* Read the rpm lead, signatures, and header */
{ rpmTransactionSet ts = rpmtsCreate();
{ rpmts ts = rpmtsCreate();
/* XXX W2DO? pass fileName? */
/*@-mustmod@*/ /* LCL: segfault */

View File

@ -129,7 +129,7 @@ struct SpecStruct {
/*@refcounted@*/
Header sourceHeader;
TFI_t sourceCpioList;
rpmfi sourceCpioList;
/*@dependent@*/ /*@null@*/ MacroContext macros;
@ -147,7 +147,7 @@ struct SpecStruct {
struct PackageStruct {
/*@refcounted@*/
Header header;
TFI_t cpioList;
rpmfi cpioList;
/*@owned@*/ struct Source * icon;

View File

@ -18,7 +18,7 @@ extern int specedit;
#define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}
/*@access Header @*/ /* compared with NULL */
/*@access TFI_t @*/ /* compared with NULL */
/*@access rpmfi @*/ /* compared with NULL */
/**
* @param p trigger entry chain
@ -163,9 +163,9 @@ Package freePackage(Package pkg)
pkg->fileList = freeStringBuf(pkg->fileList);
pkg->fileFile = _free(pkg->fileFile);
if (pkg->cpioList) {
TFI_t fi = pkg->cpioList;
rpmfi fi = pkg->cpioList;
pkg->cpioList = NULL;
fi = fiFree(fi, 1);
fi = rpmfiFree(fi, 1);
#ifdef DYING
/*@-refcounttrans@*/ /* FIX: fi needs to be only */
fi = _free(fi);
@ -513,9 +513,9 @@ Spec freeSpec(Spec spec)
spec->sourceHeader = headerFree(spec->sourceHeader, "spec->sourceHeader");
if (spec->sourceCpioList) {
TFI_t fi = spec->sourceCpioList;
rpmfi fi = spec->sourceCpioList;
spec->sourceCpioList = NULL;
fi = fiFree(fi, 1);
fi = rpmfiFree(fi, 1);
#ifdef DYING
/*@-refcounttrans@*/ /* FIX: fi needs to be only */
fi = _free(fi);

View File

@ -14,10 +14,10 @@ EXTRA_DIST = getdate.y
pkgincdir = $(pkgincludedir)
pkginc_HEADERS = \
misc.h rpmcli.h rpmlib.h stringbuf.h
misc.h rpmcli.h rpmlib.h \
rpmds.h rpmfi.h rpmps.h rpmte.h rpmts.h stringbuf.h
noinst_HEADERS = \
cpio.h fsm.h manifest.h psm.h \
rpmal.h rpmds.h rpmfi.h rpmlead.h rpmte.h rpmts.h signature.h
cpio.h fsm.h manifest.h psm.h rpmal.h rpmlead.h signature.h
mylibpaths = \
-L$(top_builddir)/lib \
@ -32,9 +32,9 @@ lib_LTLIBRARIES = librpm.la
librpm_la_SOURCES = \
cpio.c depends.c formats.c fs.c fsm.c getdate.c \
manifest.c misc.c package.c \
problems.c poptI.c poptQV.c psm.c query.c \
poptI.c poptQV.c psm.c query.c \
rpmal.c rpmchecksig.c rpmds.c rpmfi.c rpminstall.c \
rpmlead.c rpmlibprov.c rpmrc.c rpmte.c rpmts.c rpmvercmp.c \
rpmlead.c rpmlibprov.c rpmps.c rpmrc.c rpmte.c rpmts.c rpmvercmp.c \
signature.c stringbuf.c transaction.c \
verify.c
librpm_la_LDFLAGS = -release @VERSION@

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,8 @@
#include <rpmio_internal.h>
#include <rpmlib.h>
#include "rpmps.h"
#include "cpio.h"
#include "fsm.h"
#include "psm.h" /* XXX fiTypeString */
@ -23,9 +25,9 @@
/*@access FSMI_t @*/
/*@access FSM_t @*/
/*@access TFI_t @*/
/*@access transactionElement @*/
/*@access rpmTransactionSet @*/
/*@access rpmfi @*/
/*@access rpmte @*/
/*@access rpmts @*/
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
@ -38,14 +40,14 @@ int _fsm_debug = 0;
int strict_erasures = 0;
/*@=exportlocal =exportheadervar@*/
rpmTransactionSet fsmGetTs(const FSM_t fsm) {
rpmts fsmGetTs(const FSM_t fsm) {
const FSMI_t iter = fsm->iter;
/*@-compdef -refcounttrans -retexpose -usereleased @*/
return (iter ? iter->ts : NULL);
/*@=compdef =refcounttrans =retexpose =usereleased @*/
}
TFI_t fsmGetFi(const FSM_t fsm)
rpmfi fsmGetFi(const FSM_t fsm)
{
const FSMI_t iter = fsm->iter;
/*@-compdef -refcounttrans -retexpose -usereleased @*/
@ -116,7 +118,7 @@ static /*@null@*/ void * mapFreeIterator(/*@only@*//*@null@*/ void * p)
* @return file info iterator
*/
static void *
mapInitIterator(rpmTransactionSet ts, TFI_t fi)
mapInitIterator(rpmts ts, rpmfi fi)
/*@modifies ts, fi @*/
{
FSMI_t iter = NULL;
@ -142,7 +144,7 @@ static int mapNextIterator(/*@null@*/ void * a)
int i = -1;
if (iter) {
const TFI_t fi = iter->fi;
const rpmfi fi = iter->fi;
if (iter->reverse) {
if (iter->i >= 0) i = iter->i--;
} else {
@ -184,7 +186,7 @@ static int mapFind(/*@null@*/ FSMI_t iter, const char * fsmPath)
int ix = -1;
if (iter) {
const TFI_t fi = iter->fi;
const rpmfi fi = iter->fi;
if (fi && fi->fc > 0 && fi->apath && fsmPath && *fsmPath) {
const char ** p = NULL;
@ -204,7 +206,7 @@ static int mapFind(/*@null@*/ FSMI_t iter, const char * fsmPath)
* Directory name iterator.
*/
typedef struct dnli_s {
TFI_t fi;
rpmfi fi;
/*@only@*/ /*@null@*/ char * active;
int reverse;
int isave;
@ -254,7 +256,7 @@ static /*@only@*/ void * dnlInitIterator(/*@special@*/ const FSM_t fsm,
/*@uses fsm->iter @*/
/*@*/
{
TFI_t fi = fsmGetFi(fsm);
rpmfi fi = fsmGetFi(fsm);
DNLI_t dnli;
int i, j;
@ -338,7 +340,7 @@ static /*@observer@*/ const char * dnlNextIterator(/*@null@*/ DNLI_t dnli)
const char * dn = NULL;
if (dnli) {
TFI_t fi = dnli->fi;
rpmfi fi = dnli->fi;
int i = -1;
if (dnli->active)
@ -423,7 +425,7 @@ static int saveHardLink(/*@special@*/ /*@partial@*/ FSM_t fsm)
return 1;
/* Here come the bits, time to choose a non-skipped file name. */
{ TFI_t fi = fsmGetFi(fsm);
{ rpmfi fi = fsmGetFi(fsm);
for (j = fsm->li->linksLeft - 1; j >= 0; j--) {
ix = fsm->li->filex[j];
@ -484,7 +486,7 @@ FSM_t freeFSM(FSM_t fsm)
}
int fsmSetup(FSM_t fsm, fileStage goal,
const rpmTransactionSet ts, const TFI_t fi, FD_t cfd,
const rpmts ts, const rpmfi fi, FD_t cfd,
unsigned int * archiveSize, const char ** failedFile)
{
size_t pos = 0;
@ -505,7 +507,7 @@ int fsmSetup(FSM_t fsm, fileStage goal,
/*@-type@*/ /* FIX: cast? */
/*@-noeffectuncon @*/ /* FIX: check rc */
(void)ts->notify(fi->h, RPMCALLBACK_INST_START, 0, fi->archiveSize,
rpmfiGetKey(fi), ts->notifyData);
rpmfiKey(fi), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
@ -559,7 +561,7 @@ int fsmTeardown(FSM_t fsm)
int fsmMapPath(FSM_t fsm)
{
TFI_t fi = fsmGetFi(fsm); /* XXX const except for fstates */
rpmfi fi = fsmGetFi(fsm); /* XXX const except for fstates */
int rc = 0;
int i;
@ -653,7 +655,7 @@ assert(fi->te->type == TR_ADDED);
int fsmMapAttrs(FSM_t fsm)
{
struct stat * st = &fsm->sb;
TFI_t fi = fsmGetFi(fsm);
rpmfi fi = fsmGetFi(fsm);
int i = fsm->ix;
if (fi && i >= 0 && i < fi->fc) {
@ -685,7 +687,7 @@ int fsmMapAttrs(FSM_t fsm)
if (fsm->mapFlags & CPIO_MAP_GID)
st->st_gid = finalGid;
{ rpmTransactionSet ts = fsmGetTs(fsm);
{ rpmts ts = fsmGetTs(fsm);
if (ts != NULL && !(ts->transFlags & RPMTRANS_FLAG_NOMD5)) {
fsm->fmd5sum = (fi->fmd5s ? fi->fmd5s[i] : NULL);
@ -816,7 +818,7 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
t = stpcpy( stpcpy(t, fsm->dirName), fsm->baseName);
/*@=compdef@*/
} else if (fsm->mapFlags & CPIO_MAP_PATH) {
TFI_t fi = fsmGetFi(fsm);
rpmfi fi = fsmGetFi(fsm);
fsm->path =
(fi->apath ? fi->apath[fsm->ix] + fi->striplen : fi->bnl[fsm->ix]);
}
@ -892,14 +894,14 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
rc = fsmStage(fsm, FSM_PAD);
if (rc) goto exit;
{ const rpmTransactionSet ts = fsmGetTs(fsm);
TFI_t fi = fsmGetFi(fsm);
{ 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,
rpmfiGetKey(fi), ts->notifyData);
rpmfiKey(fi), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
@ -1197,7 +1199,7 @@ static int fsmMkdirs(/*@special@*/ FSM_t fsm)
/* Move pre-existing path marker forward. */
fsm->dnlx[dc] = (te - dn);
} else if (rc == CPIOERR_LSTAT_FAILED) {
TFI_t fi = fsmGetFi(fsm);
rpmfi fi = fsmGetFi(fsm);
*te = '\0';
st->st_mode = S_IFDIR | (fi->dperms & 07777);
rc = fsmStage(fsm, FSM_MKDIR);
@ -1431,7 +1433,7 @@ int fsmStage(FSM_t fsm, fileStage stage)
break;
case FSM_CREATE:
{ rpmTransactionSet ts = fsmGetTs(fsm);
{ rpmts ts = fsmGetTs(fsm);
#define _tsmask (RPMTRANS_FLAG_PKGCOMMIT | RPMTRANS_FLAG_COMMIT)
fsm->commit = ((ts && (ts->transFlags & _tsmask) &&
fsm->goal != FSM_PKGCOMMIT) ? 0 : 1);
@ -1508,7 +1510,7 @@ int fsmStage(FSM_t fsm, fileStage stage)
/* On non-install, mode must be known so that dirs don't get suffix. */
if (fsm->goal != FSM_PKGINSTALL) {
TFI_t fi = fsmGetFi(fsm);
rpmfi fi = fsmGetFi(fsm);
st->st_mode = fi->fmodes[fsm->ix];
}
@ -1692,14 +1694,14 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
break;
case FSM_NOTIFY: /* XXX move from fsm to psm -> tsm */
if (fsm->goal == FSM_PKGINSTALL || fsm->goal == FSM_PKGBUILD) {
rpmTransactionSet ts = fsmGetTs(fsm);
TFI_t fi = fsmGetFi(fsm);
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,
rpmfiGetKey(fi), ts->notifyData);
rpmfiKey(fi), ts->notifyData);
/*@=noeffectuncon @*/
/*@=type@*/
}
@ -1761,7 +1763,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
/* Remove erased files. */
if (fsm->goal == FSM_PKGERASE) {
if (fsm->action == FA_ERASE) {
TFI_t fi = fsmGetFi(fsm);
rpmfi fi = fsmGetFi(fsm);
if (S_ISDIR(st->st_mode)) {
rc = fsmStage(fsm, FSM_RMDIR);
if (!rc) break;
@ -1827,7 +1829,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
rc = fsmStage(fsm, FSM_CHMOD);
if (!rc) {
time_t mtime = st->st_mtime;
TFI_t fi = fsmGetFi(fsm);
rpmfi fi = fsmGetFi(fsm);
if (fi->fmtimes)
st->st_mtime = fi->fmtimes[fsm->ix];
rc = fsmStage(fsm, FSM_UTIME);

View File

@ -107,8 +107,8 @@ struct hardLink_s {
* Iterator across package file info, forward on install, backward on erase.
*/
struct fsmIterator_s {
rpmTransactionSet ts; /*!< transaction set. */
TFI_t fi; /*!< transaction element file info. */
rpmts ts; /*!< transaction set. */
rpmfi fi; /*!< transaction element file info. */
int reverse; /*!< reversed traversal? */
int isave; /*!< last returned iterator index. */
int i; /*!< iterator index. */
@ -239,8 +239,8 @@ extern "C" {
* @return 0 on success
*/
int fsmSetup(FSM_t fsm, fileStage goal,
const rpmTransactionSet ts,
const TFI_t fi,
const rpmts ts,
const rpmfi fi,
FD_t cfd,
/*@out@*/ unsigned int * archiveSize,
/*@out@*/ const char ** failedFile)
@ -262,7 +262,7 @@ int fsmTeardown(FSM_t fsm)
* @param fsm file state machine data
* @return transaction set
*/
rpmTransactionSet fsmGetTs(const FSM_t fsm)
rpmts fsmGetTs(const FSM_t fsm)
/*@*/;
/**
@ -270,7 +270,7 @@ rpmTransactionSet fsmGetTs(const FSM_t fsm)
* @param fsm file state machine data
* @return transaction element file info
*/
TFI_t fsmGetFi(/*@partial@*/ const FSM_t fsm)
rpmfi fsmGetFi(/*@partial@*/ const FSM_t fsm)
/*@*/;
/**

View File

@ -9,6 +9,7 @@
#include <rpmio_internal.h>
#include <rpmlib.h>
#include "rpmps.h"
#include "rpmts.h"
#include "misc.h" /* XXX stripTrailingChar() */
@ -20,7 +21,7 @@
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
/*@access rpmTransactionSet@*/
/*@access rpmts @*/
/*@access Header @*/ /* XXX compared with NULL */
/*@access FD_t @*/ /* XXX stealing digests */
@ -142,7 +143,7 @@ static unsigned char header_magic[8] = {
0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
};
int rpmReadPackageFile(rpmTransactionSet ts, FD_t fd,
int rpmReadPackageFile(rpmts ts, FD_t fd,
const char * fn, Header * hdrp)
{
byte buf[8*BUFSIZ];

116
lib/psm.c
View File

@ -8,6 +8,8 @@
#include <rpmio_internal.h>
#include <rpmlib.h>
#include "rpmps.h"
#include "cpio.h"
#include "fsm.h" /* XXX CPIO_FOO/FSM_FOO constants */
#include "psm.h"
@ -28,19 +30,19 @@
#include "rpmdb.h" /* XXX for db_chrootDone */
#include "debug.h"
/*@access Header@*/ /* compared with NULL */
/*@access rpmdbMatchIterator@*/ /* compared with NULL */
/*@access FD_t@*/ /* compared with NULL */
/*@access rpmdb@*/ /* compared with NULL */
/*@access Header @*/ /* compared with NULL */
/*@access rpmdbMatchIterator @*//* compared with NULL */
/*@access FD_t @*/ /* compared with NULL */
/*@access rpmdb @*/ /* compared with NULL */
/*@access FSM_t@*/ /* compared with NULL */
/*@access PSM_t@*/
/*@access FSM_t @*/ /* compared with NULL */
/*@access PSM_t @*/
/*@access TFI_t@*/
/*@access transactionElement@*/ /* XXX rpmInstallSourcePackage */
/*@access rpmfi @*/
/*@access rpmte @*/ /* XXX rpmInstallSourcePackage */
/*@access alKey@*/
/*@access rpmDepSet@*/
/*@access alKey @*/
/*@access rpmds @*/
int rpmVersionCompare(Header first, Header second)
{
@ -78,9 +80,9 @@ int rpmVersionCompare(Header first, Header second)
return rpmvercmp(one, two);
}
/*@observer@*/ const char *const fiTypeString(TFI_t fi)
/*@observer@*/ const char *const fiTypeString(rpmfi fi)
{
switch(teGetType(fi->te)) {
switch(rpmteType(fi->te)) {
case TR_ADDED: return " install";
case TR_REMOVED: return " erase";
default: return "???";
@ -110,7 +112,7 @@ static struct tagMacro {
* @param h header
* @return 0 always
*/
static int rpmInstallLoadMacros(TFI_t fi, Header h)
static int rpmInstallLoadMacros(rpmfi fi, Header h)
/*@globals rpmGlobalMacroContext @*/
/*@modifies rpmGlobalMacroContext @*/
{
@ -157,7 +159,7 @@ static int rpmInstallLoadMacros(TFI_t fi, Header h)
* @param newH header to
* @return 0 on success, 1 on failure
*/
static int mergeFiles(TFI_t fi, Header h, Header newH)
static int mergeFiles(rpmfi fi, Header h, Header newH)
/*@modifies h @*/
{
HGE_t hge = (HGE_t)fi->hge;
@ -344,8 +346,8 @@ static int markReplacedFiles(const PSM_t psm)
/*@globals fileSystem@*/
/*@modifies psm, fileSystem @*/
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
HGE_t hge = (HGE_t)fi->hge;
sharedFileInfo replaced = fi->replaced;
sharedFileInfo sfi;
@ -355,7 +357,7 @@ static int markReplacedFiles(const PSM_t psm)
unsigned int prev;
int num, xx;
if (!(tfiGetFC(fi) > 0 && fi->replaced))
if (!(rpmfiFC(fi) > 0 && fi->replaced))
return 0;
num = prev = 0;
@ -456,11 +458,11 @@ static rpmRC chkdir (const char * dpath, const char * dname)
return RPMRC_OK;
}
rpmRC rpmInstallSourcePackage(rpmTransactionSet ts, FD_t fd,
rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
const char ** specFilePtr, const char ** cookie)
{
int scareMem = 1;
TFI_t fi = NULL;
rpmfi fi = NULL;
const char * _sourcedir = NULL;
const char * _specdir = NULL;
const char * specFile = NULL;
@ -488,7 +490,7 @@ rpmRC rpmInstallSourcePackage(rpmTransactionSet ts, FD_t fd,
(void) rpmtsAddPackage(ts, h, NULL, 0, NULL);
fi = fiNew(ts, fi, h, RPMTAG_BASENAMES, scareMem);
fi = rpmfiNew(ts, fi, h, RPMTAG_BASENAMES, scareMem);
h = headerFree(h, "InstallSourcePackage");
if (fi == NULL) { /* XXX can't happen */
@ -629,7 +631,7 @@ exit:
(void) Fclose(fi->te->fd);
fi->te->fd = NULL;
fi->te = NULL;
fi = fiFree(fi, 1);
fi = rpmfiFree(fi, 1);
}
/*@=branchstate@*/
@ -690,8 +692,8 @@ static int runScript(PSM_t psm, Header h,
/*@globals rpmGlobalMacroContext, fileSystem, internalState@*/
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
HGE_t hge = fi->hge;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
const char ** argv = NULL;
@ -923,7 +925,7 @@ static rpmRC runInstScript(PSM_t psm)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/
{
TFI_t fi = psm->fi;
rpmfi fi = psm->fi;
HGE_t hge = fi->hge;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
void ** progArgv;
@ -978,11 +980,11 @@ static int handleOneTrigger(const PSM_t psm, Header sourceH, Header triggeredH,
fileSystem, internalState @*/
{
int scareMem = 1;
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
HGE_t hge = fi->hge;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
rpmDepSet trigger = NULL;
rpmds trigger = NULL;
const char ** triggerScripts;
const char ** triggerProgs;
int_32 * triggerIndices;
@ -992,17 +994,17 @@ static int handleOneTrigger(const PSM_t psm, Header sourceH, Header triggeredH,
xx = headerNVR(sourceH, &sourceName, NULL, NULL);
trigger = dsiInit(dsNew(triggeredH, RPMTAG_TRIGGERNAME, scareMem));
trigger = rpmdsInit(rpmdsNew(triggeredH, RPMTAG_TRIGGERNAME, scareMem));
if (trigger != NULL)
while (dsiNext(trigger) >= 0) {
while (rpmdsNext(trigger) >= 0) {
rpmTagType tit, tst, tpt;
const char * Name;
int_32 Flags = dsiGetFlags(trigger);
int_32 Flags = rpmdsFlags(trigger);
#ifdef LEGACY
int skip;
#endif
if ((Name = dsiGetN(trigger)) == NULL)
if ((Name = rpmdsN(trigger)) == NULL)
continue; /* XXX can't happen */
if (strcmp(Name, sourceName))
@ -1070,7 +1072,7 @@ static int handleOneTrigger(const PSM_t psm, Header sourceH, Header triggeredH,
break;
}
trigger = dsFree(trigger);
trigger = rpmdsFree(trigger);
return rc;
}
@ -1086,12 +1088,12 @@ static int runTriggers(PSM_t psm)
/*@modifies psm, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
int numPackage;
rpmRC rc = RPMRC_OK;
numPackage = rpmdbCountPackages(rpmtsGetRdb(ts), teGetN(psm->te)) + psm->countCorrection;
numPackage = rpmdbCountPackages(rpmtsGetRdb(ts), rpmteN(psm->te)) + psm->countCorrection;
if (numPackage < 0)
return 1;
@ -1101,7 +1103,7 @@ static int runTriggers(PSM_t psm)
int countCorrection = psm->countCorrection;
psm->countCorrection = 0;
mi = rpmtsInitIterator(ts, RPMTAG_TRIGGERNAME, teGetN(psm->te), 0);
mi = rpmtsInitIterator(ts, RPMTAG_TRIGGERNAME, rpmteN(psm->te), 0);
while((triggeredH = rpmdbNextIterator(mi)) != NULL) {
rc |= handleOneTrigger(psm, fi->h, triggeredH, numPackage, NULL);
}
@ -1124,8 +1126,8 @@ static int runImmedTriggers(PSM_t psm)
/*@modifies psm, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
HGE_t hge = fi->hge;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
const char ** triggerNames;
@ -1219,8 +1221,8 @@ static int runImmedTriggers(PSM_t psm)
/*@-nullpass@*/ /* FIX: testing null annotation for fi->h */
int psmStage(PSM_t psm, pkgStage stage)
{
const rpmTransactionSet ts = psm->ts;
TFI_t fi = psm->fi;
const rpmts ts = psm->ts;
rpmfi fi = psm->fi;
HGE_t hge = fi->hge;
HME_t hme = fi->hme;
HFD_t hfd = (fi->hfd ? fi->hfd : headerFreeData);
@ -1234,31 +1236,31 @@ int psmStage(PSM_t psm, pkgStage stage)
break;
case PSM_INIT:
rpmMessage(RPMMESS_DEBUG, _("%s: %s has %d files, test = %d\n"),
psm->stepName, teGetNEVR(psm->te),
tfiGetFC(fi), (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST));
psm->stepName, rpmteNEVR(psm->te),
rpmfiFC(fi), (rpmtsGetFlags(ts) & RPMTRANS_FLAG_TEST));
/*
* When we run scripts, we pass an argument which is the number of
* versions of this package that will be installed when we are
* finished.
*/
psm->npkgs_installed = rpmdbCountPackages(rpmtsGetRdb(ts), teGetN(psm->te));
psm->npkgs_installed = rpmdbCountPackages(rpmtsGetRdb(ts), rpmteN(psm->te));
if (psm->npkgs_installed < 0) {
rc = RPMRC_FAIL;
break;
}
if (psm->goal == PSM_PKGINSTALL) {
int fc = tfiGetFC(fi);
int fc = rpmfiFC(fi);
psm->scriptArg = psm->npkgs_installed + 1;
assert(psm->mi == NULL);
psm->mi = rpmtsInitIterator(ts, RPMTAG_NAME, teGetN(psm->te), 0);
psm->mi = rpmtsInitIterator(ts, RPMTAG_NAME, rpmteN(psm->te), 0);
xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_VERSION,
RPMMIRE_DEFAULT, teGetV(psm->te));
RPMMIRE_DEFAULT, rpmteV(psm->te));
xx = rpmdbSetIteratorRE(psm->mi, RPMTAG_RELEASE,
RPMMIRE_DEFAULT, teGetR(psm->te));
RPMMIRE_DEFAULT, rpmteR(psm->te));
while ((psm->oh = rpmdbNextIterator(psm->mi))) {
fi->record = rpmdbGetIteratorOffset(psm->mi);
@ -1355,7 +1357,7 @@ assert(psm->mi == NULL);
rpmError(RPMERR_SCRIPT,
_("%s: %s scriptlet failed (%d), skipping %s\n"),
psm->stepName, tag2sln(psm->scriptTag), rc,
teGetNEVR(psm->te));
rpmteNEVR(psm->te));
break;
}
}
@ -1442,7 +1444,7 @@ assert(psm->mi == NULL);
lead.osnum = osnum;
lead.signature_type = RPMSIGTYPE_HEADERSIG;
strncpy(lead.name, teGetNEVR(psm->te), sizeof(lead.name));
strncpy(lead.name, rpmteNEVR(psm->te), sizeof(lead.name));
rc = writeLead(psm->fd, &lead);
if (rc) {
@ -1483,9 +1485,9 @@ assert(psm->mi == NULL);
if (fi->fc <= 0) break;
for (i = 0; i < fi->fc; i++)
#else
if (tfiGetFC(fi) <= 0) break;
(void) tfiInit(fi, 0);
while ((i = tfiNext(fi)) >= 0)
if (rpmfiFC(fi) <= 0) break;
(void) rpmfiInit(fi, 0);
while ((i = rpmfiNext(fi)) >= 0)
#endif
{
uid_t uid;
@ -1517,13 +1519,13 @@ assert(psm->mi == NULL);
/* Retrieve type of payload compression. */
rc = psmStage(psm, PSM_RPMIO_FLAGS);
if (teGetFd(fi->te) == NULL) { /* XXX can't happen */
if (rpmteFd(fi->te) == NULL) { /* XXX can't happen */
rc = RPMRC_FAIL;
break;
}
/*@-nullpass@*/ /* LCL: fi->fd != NULL here. */
psm->cfd = Fdopen(fdDup(Fileno(teGetFd(fi->te))), psm->rpmio_flags);
psm->cfd = Fdopen(fdDup(Fileno(rpmteFd(fi->te))), psm->rpmio_flags);
/*@=nullpass@*/
if (psm->cfd == NULL) { /* XXX can't happen */
rc = RPMRC_FAIL;
@ -1566,7 +1568,7 @@ assert(psm->mi == NULL);
xx = psmStage(psm, PSM_NOTIFY);
}
if (psm->goal == PSM_PKGERASE) {
int fc = tfiGetFC(fi);
int fc = rpmfiFC(fi);
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_JUSTDB) break;
if (rpmtsGetFlags(ts) & RPMTRANS_FLAG_APPLYONLY) break;
@ -1627,7 +1629,7 @@ assert(psm->mi == NULL);
if (psm->goal == PSM_PKGINSTALL) {
int_32 installTime = (int_32) time(NULL);
int fc = tfiGetFC(fi);
int fc = rpmfiFC(fi);
if (fi->h == NULL) break; /* XXX can't happen */
if (fi->fstates != NULL && fc > 0)
@ -1795,7 +1797,7 @@ assert(psm->mi == NULL);
if (ts && ts->notify) {
/*@-noeffectuncon @*/ /* FIX: check rc */
(void) ts->notify(fi->h, psm->what, psm->amount, psm->total,
teGetKey(psm->te), ts->notifyData);
rpmteKey(psm->te), ts->notifyData);
/*@=noeffectuncon @*/
}
/*@=type@*/

View File

@ -56,11 +56,11 @@ typedef enum pkgStage_e {
*/
struct psm_s {
/*@refcounted@*/
rpmTransactionSet ts; /*!< transaction set */
rpmts ts; /*!< transaction set */
/*@dependent@*/
transactionElement te; /*!< transaction element */
rpmte te; /*!< current transaction element */
/*@refcounted@*/
TFI_t fi; /*!< transaction element file info */
rpmfi fi; /*!< transaction element file info */
FD_t cfd; /*!< Payload file handle. */
FD_t fd; /*!< Repackage file handle. */
Header oh; /*!< Repackage/multilib header. */
@ -101,7 +101,7 @@ extern "C" {
* @param fi
* @return formatted string
*/
/*@observer@*/ const char *const fiTypeString(/*@partial@*/TFI_t fi)
/*@observer@*/ const char *const fiTypeString(/*@partial@*/rpmfi fi)
/*@*/;
/**

View File

@ -16,6 +16,7 @@
#include <rpmbuild.h>
#include "rpmdb.h"
#include "rpmps.h"
#include "rpmts.h"
#include "manifest.h"
@ -154,7 +155,7 @@ static int countLinks(int_16 * fileRdevList, int_32 * fileInodeList, int nfiles,
return nlink;
}
int showQueryPackage(QVA_t qva, /*@unused@*/ rpmTransactionSet ts, Header h)
int showQueryPackage(QVA_t qva, /*@unused@*/ rpmts ts, Header h)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
HFD_t hfd = headerFreeData;
@ -538,7 +539,7 @@ void rpmDisplayQueryTags(FILE * fp)
}
}
int showMatches(QVA_t qva, rpmTransactionSet ts)
int showMatches(QVA_t qva, rpmts ts)
{
Header h;
int ec = 0;
@ -582,7 +583,7 @@ int (*parseSpecVec) (Spec *specp, const char *specFile, const char *rootdir,
/*@null@*/ Spec (*freeSpecVec) (Spec spec) = NULL;
/*@=redecl@*/
int rpmQueryVerify(QVA_t qva, rpmTransactionSet ts, const char * arg)
int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
{
const char ** av = NULL;
int res = 0;
@ -970,7 +971,7 @@ restart:
return res;
}
int rpmcliQuery(rpmTransactionSet ts, QVA_t qva, const char ** argv)
int rpmcliQuery(rpmts ts, QVA_t qva, const char ** argv)
{
const char * arg;
int vsflags;

View File

@ -6,6 +6,8 @@
#include <rpmlib.h>
#include "rpmps.h"
#include "rpmal.h"
#include "rpmds.h"
#include "rpmfi.h"
@ -29,9 +31,9 @@ static int _al_debug = 0;
*/
struct availablePackage_s {
/*@refcounted@*/ /*@null@*/
rpmDepSet provides; /*!< Provides: dependencies. */
rpmds provides; /*!< Provides: dependencies. */
/*@refcounted@*/ /*@null@*/
TFI_t fi; /*!< File info set. */
rpmfi fi; /*!< File info set. */
#ifdef DYING
uint_32 multiLib; /* MULTILIB */
@ -214,8 +216,8 @@ availableList alFree(availableList al)
if ((alp = al->list) != NULL)
for (i = 0; i < al->size; i++, alp++) {
alp->provides = dsFree(alp->provides);
alp->fi = fiFree(alp->fi, 1);
alp->provides = rpmdsFree(alp->provides);
alp->fi = rpmfiFree(alp->fi, 1);
}
if ((die = al->dirs) != NULL)
@ -287,7 +289,7 @@ void alDelPackage(availableList al, alKey pkgKey)
{
alNum pkgNum = alKey2Num(al, pkgKey);
availablePackage alp;
TFI_t fi;
rpmfi fi;
if (al == NULL || al->list == NULL)
return; /* XXX can't happen */
@ -301,7 +303,7 @@ fprintf(stderr, "*** del %p[%d]\n", al->list, pkgNum);
/* Delete directory/file info entries from added package list. */
if ((fi = alp->fi) != NULL)
if (tfiGetFC(fi) > 0) {
if (rpmfiFC(fi) > 0) {
int origNumDirs = al->numDirs;
int dx;
dirInfo dieNeedle =
@ -313,14 +315,14 @@ fprintf(stderr, "*** del %p[%d]\n", al->list, pkgNum);
/* XXX FIXME: We ought to relocate the directory list here */
if (al->dirs != NULL)
for (dx = tfiGetDC(fi) - 1; dx >= 0; dx--)
for (dx = rpmfiDC(fi) - 1; dx >= 0; dx--)
{
fileIndexEntry fie;
(void) tfiSetDX(fi, dx);
(void) rpmfiSetDX(fi, dx);
/*@-assignexpose -dependenttrans -observertrans@*/
dieNeedle->dirName = (char *) tfiGetDN(fi);
dieNeedle->dirName = (char *) rpmfiDN(fi);
/*@=assignexpose =dependenttrans =observertrans@*/
dieNeedle->dirNameLen = (dieNeedle->dirName != NULL
? strlen(dieNeedle->dirName) : 0);
@ -361,15 +363,15 @@ fprintf(stderr, "*** del %p[%d]\n", al->list, pkgNum);
}
}
alp->provides = dsFree(alp->provides);
alp->fi = fiFree(alp->fi, 1);
alp->provides = rpmdsFree(alp->provides);
alp->fi = rpmfiFree(alp->fi, 1);
memset(alp, 0, sizeof(*alp)); /* XXX trash and burn */
return;
}
alKey alAddPackage(availableList * alistp, alKey pkgKey, fnpyKey key,
rpmDepSet provides, TFI_t fi)
rpmds provides, rpmfi fi)
{
alNum pkgNum;
availableList al;
@ -407,8 +409,8 @@ fprintf(stderr, "*** add %p[%d]\n", al->list, pkgNum);
alp->fi = rpmfiLink(fi, "Files (alAddPackage)");
fi = rpmfiLink(alp->fi, "Files index (alAddPackage)");
fi = tfiInit(fi, 0);
if (tfiGetFC(fi) > 0) {
fi = rpmfiInit(fi, 0);
if (rpmfiFC(fi) > 0) {
int * dirMapping;
dirInfo dieNeedle =
memset(alloca(sizeof(*dieNeedle)), 0, sizeof(*dieNeedle));
@ -418,7 +420,7 @@ fprintf(stderr, "*** add %p[%d]\n", al->list, pkgNum);
int dx;
int dc;
dc = tfiGetDC(fi);
dc = rpmfiDC(fi);
/* XXX FIXME: We ought to relocate the directory list here */
@ -433,10 +435,10 @@ fprintf(stderr, "*** add %p[%d]\n", al->list, pkgNum);
for (dx = 0; dx < dc; dx++) {
(void) tfiSetDX(fi, dx);
(void) rpmfiSetDX(fi, dx);
/*@-assignexpose -dependenttrans -observertrans@*/
dieNeedle->dirName = (char *) tfiGetDN(fi);
dieNeedle->dirName = (char *) rpmfiDN(fi);
/*@=assignexpose =dependenttrans =observertrans@*/
dieNeedle->dirNameLen = (dieNeedle->dirName != NULL
? strlen(dieNeedle->dirName) : 0);
@ -461,17 +463,17 @@ fprintf(stderr, "+++ die[%3d] %p [%d] %s\n", al->numDirs, die, die->dirNameLen,
}
}
for (first = tfiNext(fi); first >= 0;) {
for (first = rpmfiNext(fi); first >= 0;) {
fileIndexEntry fie;
int next;
/* Find the first file of the next directory. */
dx = tfiGetDX(fi);
while ((next = tfiNext(fi)) >= 0) {
if (dx != tfiGetDX(fi))
dx = rpmfiDX(fi);
while ((next = rpmfiNext(fi)) >= 0) {
if (dx != rpmfiDX(fi))
/*@innerbreak@*/ break;
}
if (next < 0) next = tfiGetFC(fi); /* XXX reset end-of-list */
if (next < 0) next = rpmfiFC(fi); /* XXX reset end-of-list */
die = al->dirs + dirMapping[dx];
die->files = xrealloc(die->files,
@ -479,14 +481,14 @@ fprintf(stderr, "+++ die[%3d] %p [%d] %s\n", al->numDirs, die, die->dirNameLen,
fie = die->files + die->numFiles;
/* Rewind to first file, generate file index entry for each file. */
fi = tfiInit(fi, first);
while ((first = tfiNext(fi)) >= 0 && first < next) {
fi = rpmfiInit(fi, first);
while ((first = rpmfiNext(fi)) >= 0 && first < next) {
/*@-assignexpose -dependenttrans -observertrans @*/
fie->baseName = tfiGetBN(fi);
fie->baseName = rpmfiBN(fi);
/*@=assignexpose =dependenttrans =observertrans @*/
fie->baseNameLen = (fie->baseName ? strlen(fie->baseName) : 0);
fie->pkgNum = pkgNum;
fie->fileFlags = tfiGetFFlags(fi);
fie->fileFlags = rpmfiFFlags(fi);
die->numFiles++;
fie++;
}
@ -528,7 +530,7 @@ static int indexcmp(const void * one, const void * two)
return strcmp(a->entry, b->entry);
}
void alAddProvides(availableList al, alKey pkgKey, rpmDepSet provides)
void alAddProvides(availableList al, alKey pkgKey, rpmds provides)
{
alNum pkgNum = alKey2Num(al, pkgKey);
availableIndex ai = &al->index;
@ -540,12 +542,12 @@ void alAddProvides(availableList al, alKey pkgKey, rpmDepSet provides)
if (ai->index == NULL || ai->k < 0 || ai->k >= ai->size)
return;
if (dsiInit(provides) != NULL)
while (dsiNext(provides) >= 0) {
if (rpmdsInit(provides) != NULL)
while (rpmdsNext(provides) >= 0) {
const char * Name;
#ifdef DYING /* XXX FIXME: multilib colored dependency search */
const int_32 Flags = dsiGetFlags(provides);
const int_32 Flags = rpmdsFlags(provides);
/* If multilib install, skip non-multilib provides. */
if (al->list[i].multiLib && !isDependsMULTILIB(Flags)) {
@ -554,7 +556,7 @@ void alAddProvides(availableList al, alKey pkgKey, rpmDepSet provides)
}
#endif
if ((Name = dsiGetN(provides)) == NULL)
if ((Name = rpmdsN(provides)) == NULL)
continue; /* XXX can't happen */
aie = ai->index + ai->k;
@ -563,7 +565,7 @@ void alAddProvides(availableList al, alKey pkgKey, rpmDepSet provides)
aie->pkgKey = pkgKey;
aie->entry = Name;
aie->entryLen = strlen(Name);
ix = dsiGetIx(provides);
ix = rpmdsIx(provides);
/* XXX make sure that element index fits in unsigned short */
assert(ix < 0x10000);
@ -586,7 +588,7 @@ void alMakeIndex(availableList al)
for (i = 0; i < al->size; i++) {
alp = al->list + i;
if (alp->provides != NULL)
ai->size += dsiGetCount(alp->provides);
ai->size += rpmdsCount(alp->provides);
}
if (ai->size) {
@ -603,7 +605,7 @@ void alMakeIndex(availableList al)
}
fnpyKey *
alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
alAllFileSatisfiesDepend(const availableList al, const rpmds ds, alKey * keyp)
{
int found = 0;
const char * dirName;
@ -619,7 +621,7 @@ alAllFileSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * key
const char * fileName;
if (keyp) *keyp = RPMAL_NOMATCH;
if (al == NULL || (fileName = dsiGetN(ds)) == NULL || *fileName != '/')
if (al == NULL || (fileName = rpmdsN(ds)) == NULL || *fileName != '/')
return NULL;
/* Solaris 2.6 bsearch sucks down on this. */
@ -683,7 +685,7 @@ fprintf(stderr, "==> fie %p %s\n", fie, (fie->baseName ? fie->baseName : "(nil)"
continue;
#endif
dsiNotify(ds, _("(added files)"), 0);
rpmdsNotify(ds, _("(added files)"), 0);
alp = al->list + fie->pkgNum;
ret = xrealloc(ret, (found+2) * sizeof(*ret));
@ -702,7 +704,7 @@ exit:
}
fnpyKey *
alAllSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
alAllSatisfiesDepend(const availableList al, const rpmds ds, alKey * keyp)
{
availableIndex ai;
availableIndexEntry needle;
@ -715,7 +717,7 @@ alAllSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
if (keyp) *keyp = RPMAL_NOMATCH;
if (al == NULL || ds == NULL || (KName = dsiGetN(ds)) == NULL)
if (al == NULL || ds == NULL || (KName = rpmdsN(ds)) == NULL)
return ret;
if (*KName == '/') {
@ -754,13 +756,13 @@ alAllSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
if (alp->provides != NULL) /* XXX can't happen */
switch (match->type) {
case IET_PROVIDES:
/* XXX single step on dsiNext to regenerate DNEVR string */
(void) dsiSetIx(alp->provides, match->entryIx - 1);
if (dsiNext(alp->provides) >= 0)
rc = dsCompare(alp->provides, ds);
/* XXX single step on rpmdsNext to regenerate DNEVR string */
(void) rpmdsSetIx(alp->provides, match->entryIx - 1);
if (rpmdsNext(alp->provides) >= 0)
rc = rpmdsCompare(alp->provides, ds);
if (rc)
dsiNotify(ds, _("(added provide)"), 0);
rpmdsNotify(ds, _("(added provide)"), 0);
/*@switchbreak@*/ break;
}
@ -783,7 +785,7 @@ alAllSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
}
fnpyKey
alSatisfiesDepend(const availableList al, const rpmDepSet ds, alKey * keyp)
alSatisfiesDepend(const availableList al, const rpmds ds, alKey * keyp)
{
fnpyKey * tmp = alAllSatisfiesDepend(al, ds, keyp);

View File

@ -50,7 +50,7 @@ void alDelPackage(/*@null@*/ availableList al, /*@null@*/ alKey pkgKey)
alKey alAddPackage(availableList * alistp,
/*@dependent@*/ /*@null@*/ alKey pkgKey,
/*@dependent@*/ /*@null@*/ fnpyKey key,
/*@null@*/ rpmDepSet provides, /*@null@*/ TFI_t fi)
/*@null@*/ rpmds provides, /*@null@*/ rpmfi fi)
/*@modifies *alistp, provides, fi @*/;
/**
@ -62,7 +62,7 @@ alKey alAddPackage(availableList * alistp,
/*@-exportlocal@*/
void alAddProvides(availableList al,
/*@dependent@*/ /*@null@*/ alKey pkgKey,
/*@null@*/ rpmDepSet provides)
/*@null@*/ rpmds provides)
/*@modifies al, provides @*/;
/*@=exportlocal@*/
@ -83,7 +83,7 @@ void alMakeIndex(/*@null@*/ availableList al)
/*@-exportlocal@*/
/*@only@*/ /*@null@*/
fnpyKey * alAllFileSatisfiesDepend(/*@null@*/ const availableList al,
/*@null@*/ const rpmDepSet ds, /*@null@*/ alKey * keyp)
/*@null@*/ const rpmds ds, /*@null@*/ alKey * keyp)
/*@globals fileSystem @*/
/*@modifies al, *keyp, fileSystem @*/;
/*@=exportlocal@*/
@ -96,7 +96,7 @@ fnpyKey * alAllFileSatisfiesDepend(/*@null@*/ const availableList al,
* @return associated package key(s), NULL if none
*/
/*@only@*/ /*@null@*/
fnpyKey * alAllSatisfiesDepend(const availableList al, const rpmDepSet ds,
fnpyKey * alAllSatisfiesDepend(const availableList al, const rpmds ds,
/*@null@*/ alKey * keyp)
/*@globals fileSystem @*/
/*@modifies al, *keyp, fileSystem @*/;
@ -109,7 +109,7 @@ fnpyKey * alAllSatisfiesDepend(const availableList al, const rpmDepSet ds,
* @retval keyp added package key pointer (or NULL)
* @return associated package key, NULL if none
*/
fnpyKey alSatisfiesDepend(const availableList al, const rpmDepSet ds,
fnpyKey alSatisfiesDepend(const availableList al, const rpmds ds,
/*@null@*/ alKey * keyp)
/*@globals fileSystem @*/
/*@modifies al, *keyp, fileSystem @*/;

View File

@ -10,6 +10,7 @@
#include "rpmpgp.h"
#include "rpmdb.h"
#include "rpmps.h"
#include "rpmts.h"
#include "rpmlead.h"
@ -17,7 +18,7 @@
#include "misc.h" /* XXX for makeTempFile() */
#include "debug.h"
/*@access rpmTransactionSet @*/ /* ts->dig et al */
/*@access rpmts @*/ /* ts->dig et al */
/*?access Header @*/ /* XXX compared with NULL */
/*@access FD_t @*/ /* XXX stealing digests */
/*@access pgpDig @*/
@ -130,7 +131,7 @@ exit:
* @param argv array of package file names (NULL terminated)
* @return 0 on success
*/
static int rpmReSign(/*@unused@*/ rpmTransactionSet ts,
static int rpmReSign(/*@unused@*/ rpmts ts,
QVA_t qva, const char ** argv)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
@ -328,7 +329,7 @@ exit:
* @param argv array of pubkey file names (NULL terminated)
* @return 0 on success
*/
static int rpmImportPubkey(const rpmTransactionSet ts,
static int rpmImportPubkey(const rpmts ts,
/*@unused@*/ QVA_t qva,
/*@null@*/ const char ** argv)
/*@globals RPMVERSION, fileSystem, internalState @*/
@ -550,7 +551,7 @@ exit:
return rc;
}
int rpmVerifySignatures(QVA_t qva, rpmTransactionSet ts, FD_t fd,
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
const char * fn)
{
int res2, res3;
@ -853,7 +854,7 @@ int rpmVerifySignatures(QVA_t qva, rpmTransactionSet ts, FD_t fd,
return res;
}
int rpmcliSign(rpmTransactionSet ts, QVA_t qva, const char ** argv)
int rpmcliSign(rpmts ts, QVA_t qva, const char ** argv)
{
const char * arg;
int dbmode = (qva->qva_mode != RPMSIGN_IMPORT_PUBKEY)

View File

@ -199,7 +199,7 @@ typedef struct rpmQVKArguments_s * QVA_t;
* @param ts transaction set
* @param h header to use for query/verify
*/
typedef int (*QVF_t) (QVA_t qva, rpmTransactionSet ts, Header h)
typedef int (*QVF_t) (QVA_t qva, rpmts ts, Header h)
/*@globals fileSystem@*/
/*@modifies qva, ts, fileSystem @*/;
@ -273,7 +273,7 @@ extern struct poptOption rpmVerifyPoptTable[];
* @param ts transaction set
* @return result of last non-zero showPackage() return
*/
int showMatches(QVA_t qva, rpmTransactionSet ts)
int showMatches(QVA_t qva, rpmts ts)
/*@globals fileSystem@*/
/*@modifies qva, fileSystem @*/;
@ -297,7 +297,7 @@ void rpmDisplayQueryTags(FILE * fp)
* @param arg name of source to query/verify
* @return showPackage() result, 1 if rpmdbInitIterator() is NULL
*/
int rpmQueryVerify(QVA_t qva, rpmTransactionSet ts, const char * arg)
int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies qva, ts, rpmGlobalMacroContext,
@ -311,7 +311,7 @@ int rpmQueryVerify(QVA_t qva, rpmTransactionSet ts, const char * arg)
* @param h header to use for query
* @return 0 always
*/
int showQueryPackage(QVA_t qva, rpmTransactionSet ts, Header h)
int showQueryPackage(QVA_t qva, rpmts ts, Header h)
/*@modifies ts @*/;
/** \ingroup rpmcli
@ -322,7 +322,7 @@ int showQueryPackage(QVA_t qva, rpmTransactionSet ts, Header h)
* @param argv query argument(s) (or NULL)
* @return 0 on success, else no. of failures
*/
int rpmcliQuery(rpmTransactionSet ts, QVA_t qva, /*@null@*/ const char ** argv)
int rpmcliQuery(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies ts, qva, rpmGlobalMacroContext,
@ -337,7 +337,7 @@ int rpmcliQuery(rpmTransactionSet ts, QVA_t qva, /*@null@*/ const char ** argv)
* @param omitMask bit(s) to disable verify checks
* @return 0 on success (or not installed), 1 on error
*/
int rpmVerifyFile(const rpmTransactionSet ts, TFI_t fi,
int rpmVerifyFile(const rpmts ts, rpmfi fi,
/*@out@*/ rpmVerifyAttrs * result, rpmVerifyAttrs omitMask)
/*@globals fileSystem @*/
/*@modifies fi, *result, fileSystem @*/;
@ -349,7 +349,7 @@ int rpmVerifyFile(const rpmTransactionSet ts, TFI_t fi,
* @param h header to use for verify
* @return result of last non-zero verify return
*/
int showVerifyPackage(QVA_t qva, rpmTransactionSet ts, Header h)
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/;
@ -361,7 +361,7 @@ int showVerifyPackage(QVA_t qva, rpmTransactionSet ts, Header h)
* @param fn package file name
* @return 0 on success, 1 on failure
*/
int rpmVerifySignatures(QVA_t qva, rpmTransactionSet ts, FD_t fd,
int rpmVerifySignatures(QVA_t qva, rpmts ts, FD_t fd,
const char * fn)
/*@globals fileSystem, internalState @*/
/*@modifies qva, ts, fd,
@ -375,7 +375,7 @@ int rpmVerifySignatures(QVA_t qva, rpmTransactionSet ts, FD_t fd,
* @param argv verify argument(s) (or NULL)
* @return 0 on success, else no. of failures
*/
int rpmcliVerify(rpmTransactionSet ts, QVA_t qva, /*@null@*/ const char ** argv)
int rpmcliVerify(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies ts, qva, rpmGlobalMacroContext,
@ -420,7 +420,7 @@ extern int packagesTotal;
* @retval cookie
* @return 0 on success
*/
int rpmInstallSource(rpmTransactionSet ts, const char * arg,
int rpmInstallSource(rpmts ts, const char * arg,
/*@null@*/ /*@out@*/ const char ** specFilePtr,
/*@null@*/ /*@out@*/ const char ** cookie)
/*@globals rpmGlobalMacroContext,
@ -456,7 +456,7 @@ struct rpmInstallArguments_s {
* @param fileArgv array of package file names (NULL terminated)
* @return 0 on success
*/
int rpmInstall(rpmTransactionSet ts, struct rpmInstallArguments_s * ia,
int rpmInstall(rpmts ts, struct rpmInstallArguments_s * ia,
/*@null@*/ const char ** fileArgv)
/*@globals packagesTotal, rpmGlobalMacroContext,
fileSystem, internalState@*/
@ -470,7 +470,7 @@ int rpmInstall(rpmTransactionSet ts, struct rpmInstallArguments_s * ia,
* @param argv array of package file names (NULL terminated)
* @return 0 on success
*/
int rpmErase(rpmTransactionSet ts, const struct rpmInstallArguments_s * ia,
int rpmErase(rpmts ts, const struct rpmInstallArguments_s * ia,
/*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
@ -540,7 +540,7 @@ typedef /*@abstract@*/ struct IDTindex_s {
* @param tag rpm tag
* @return id index
*/
/*@only@*/ /*@null@*/ IDTX IDTXload(rpmTransactionSet ts, rpmTag tag)
/*@only@*/ /*@null@*/ IDTX IDTXload(rpmts ts, rpmTag tag)
/*@globals fileSystem@*/
/*@modifies ts, fileSystem @*/;
@ -551,7 +551,7 @@ typedef /*@abstract@*/ struct IDTindex_s {
* @param tag rpm tag
* @return id index
*/
/*@only@*/ /*@null@*/ IDTX IDTXglob(rpmTransactionSet ts,
/*@only@*/ /*@null@*/ IDTX IDTXglob(rpmts ts,
const char * globstr, rpmTag tag)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
@ -563,7 +563,7 @@ typedef /*@abstract@*/ struct IDTindex_s {
* @param argv array of arguments (NULL terminated)
* @return 0 on success
*/
int rpmRollback(rpmTransactionSet ts, struct rpmInstallArguments_s * ia,
int rpmRollback(rpmts ts, struct rpmInstallArguments_s * ia,
/*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
@ -633,7 +633,7 @@ extern struct poptOption rpmSignPoptTable[];
* @param argv array of arguments (NULL terminated)
* @return 0 on success
*/
int rpmcliSign(rpmTransactionSet ts, QVA_t qva, /*@null@*/ const char ** argv)
int rpmcliSign(rpmts ts, QVA_t qva, /*@null@*/ const char ** argv)
/*@globals RPMVERSION, rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies ts, qva, rpmGlobalMacroContext,

View File

@ -4,11 +4,12 @@
#include "system.h"
#include <rpmlib.h>
#include "rpmps.h"
#include "rpmds.h"
#include "debug.h"
/*@access rpmDepSet @*/
/*@access rpmds @*/
/**
* Enable noisy range comparison debugging message?
@ -19,7 +20,7 @@ static int _noisy_range_comparison_debug_message = 0;
/*@unchecked@*/
static int _ds_debug = 0;
rpmDepSet XrpmdsUnlink(rpmDepSet ds, const char * msg, const char * fn, unsigned ln)
rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln)
{
if (ds == NULL) return NULL;
/*@-modfilesystem@*/
@ -30,7 +31,7 @@ fprintf(stderr, "--> ds %p -- %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
return NULL;
}
rpmDepSet XrpmdsLink(rpmDepSet ds, const char * msg, const char * fn, unsigned ln)
rpmds XrpmdsLink(rpmds ds, const char * msg, const char * fn, unsigned ln)
{
if (ds == NULL) return NULL;
ds->nrefs++;
@ -43,7 +44,7 @@ fprintf(stderr, "--> ds %p ++ %d %s at %s:%u\n", ds, ds->nrefs, msg, fn, ln);
/*@-refcounttrans@*/ return ds; /*@=refcounttrans@*/
}
rpmDepSet dsFree(rpmDepSet ds)
rpmds rpmdsFree(rpmds ds)
{
HFD_t hfd = headerFreeData;
rpmTag tagEVR, tagF;
@ -102,12 +103,12 @@ fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
return NULL;
}
rpmDepSet dsNew(Header h, rpmTag tagN, int scareMem)
rpmds rpmdsNew(Header h, rpmTag tagN, int scareMem)
{
HGE_t hge =
(scareMem ? (HGE_t) headerGetEntryMinMemory : (HGE_t) headerGetEntry);
rpmTag tagEVR, tagF;
rpmDepSet ds = NULL;
rpmds ds = NULL;
const char * Type;
const char ** N;
rpmTagType Nt;
@ -176,7 +177,7 @@ exit:
/*@=nullstate@*/
}
char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds)
{
char * tbuf, * t;
size_t nb;
@ -216,10 +217,10 @@ char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
return tbuf;
}
rpmDepSet dsThis(Header h, rpmTag tagN, int_32 Flags)
rpmds rpmdsThis(Header h, rpmTag tagN, int_32 Flags)
{
HGE_t hge = (HGE_t) headerGetEntryMinMemory;
rpmDepSet ds = NULL;
rpmds ds = NULL;
const char * Type;
const char * n, * v, * r;
int_32 * ep;
@ -280,7 +281,7 @@ rpmDepSet dsThis(Header h, rpmTag tagN, int_32 Flags)
pre[0] = ds->Type[0];
pre[1] = '\0';
/*@-nullstate@*/ /* LCL: ds->Type may be NULL ??? */
ds->DNEVR = dsDNEVR(pre, ds);
ds->DNEVR = rpmdsNewDNEVR(pre, ds);
/*@=nullstate@*/
}
@ -288,9 +289,9 @@ exit:
return rpmdsLink(ds, (ds ? ds->Type : NULL));
}
rpmDepSet dsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
{
rpmDepSet ds = NULL;
rpmds ds = NULL;
const char * Type;
if (tagN == RPMTAG_PROVIDENAME) {
@ -326,24 +327,24 @@ rpmDepSet dsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
{ char t[2];
t[0] = ds->Type[0];
t[1] = '\0';
ds->DNEVR = dsDNEVR(t, ds);
ds->DNEVR = rpmdsNewDNEVR(t, ds);
}
exit:
return rpmdsLink(ds, (ds ? ds->Type : NULL));
}
int dsiGetCount(const rpmDepSet ds)
int rpmdsCount(const rpmds ds)
{
return (ds != NULL ? ds->Count : 0);
}
int dsiGetIx(const rpmDepSet ds)
int rpmdsIx(const rpmds ds)
{
return (ds != NULL ? ds->i : -1);
}
int dsiSetIx(rpmDepSet ds, int ix)
int rpmdsSetIx(rpmds ds, int ix)
{
int i = -1;
@ -354,7 +355,7 @@ int dsiSetIx(rpmDepSet ds, int ix)
return i;
}
const char * dsiGetDNEVR(const rpmDepSet ds)
const char * rpmdsDNEVR(const rpmds ds)
{
const char * DNEVR = NULL;
@ -365,7 +366,7 @@ const char * dsiGetDNEVR(const rpmDepSet ds)
return DNEVR;
}
const char * dsiGetN(const rpmDepSet ds)
const char * rpmdsN(const rpmds ds)
{
const char * N = NULL;
@ -376,7 +377,7 @@ const char * dsiGetN(const rpmDepSet ds)
return N;
}
const char * dsiGetEVR(const rpmDepSet ds)
const char * rpmdsEVR(const rpmds ds)
{
const char * EVR = NULL;
@ -387,7 +388,7 @@ const char * dsiGetEVR(const rpmDepSet ds)
return EVR;
}
int_32 dsiGetFlags(const rpmDepSet ds)
int_32 rpmdsFlags(const rpmds ds)
{
int_32 Flags = 0;
@ -398,7 +399,7 @@ int_32 dsiGetFlags(const rpmDepSet ds)
return Flags;
}
rpmTag dsiGetTagN(const rpmDepSet ds)
rpmTag rpmdsTagN(const rpmds ds)
{
rpmTag tagN = 0;
@ -408,7 +409,7 @@ rpmTag dsiGetTagN(const rpmDepSet ds)
return tagN;
}
void dsiNotify(rpmDepSet ds, const char * where, int rc)
void rpmdsNotify(rpmds ds, const char * where, int rc)
{
if (!(ds != NULL && ds->i >= 0 && ds->i < ds->Count))
return;
@ -421,7 +422,7 @@ void dsiNotify(rpmDepSet ds, const char * where, int rc)
(where != NULL ? where : ""));
}
int dsiNext(/*@null@*/ rpmDepSet ds)
int rpmdsNext(/*@null@*/ rpmds ds)
/*@modifies ds @*/
{
int i = -1;
@ -434,7 +435,7 @@ int dsiNext(/*@null@*/ rpmDepSet ds)
t[0] = ((ds->Type != NULL) ? ds->Type[0] : '\0');
t[1] = '\0';
/*@-nullstate@*/
ds->DNEVR = dsDNEVR(t, ds);
ds->DNEVR = rpmdsNewDNEVR(t, ds);
/*@=nullstate@*/
} else
@ -450,7 +451,7 @@ fprintf(stderr, "*** ds %p\t%s[%d]: %s\n", ds, (ds->Type ? ds->Type : "?Type?"),
return i;
}
rpmDepSet dsiInit(/*@returned@*/ /*@null@*/ rpmDepSet ds)
rpmds rpmdsInit(/*@returned@*/ /*@null@*/ rpmds ds)
/*@modifies ds @*/
{
if (ds != NULL)
@ -506,7 +507,7 @@ void parseEVR(char * evr,
if (rp) *rp = release;
}
int dsCompare(const rpmDepSet A, const rpmDepSet B)
int rpmdsCompare(const rpmds A, const rpmds B)
{
const char *aDepend = (A->DNEVR != NULL ? xstrdup(A->DNEVR+2) : "");
const char *bDepend = (B->DNEVR != NULL ? xstrdup(B->DNEVR+2) : "");
@ -582,16 +583,16 @@ exit:
return result;
}
void dsProblem(rpmProblemSet tsprobs, const char * pkgNEVR, const rpmDepSet ds,
const fnpyKey * suggestedKeys)
void rpmdsProblem(rpmps ps, const char * pkgNEVR,
const rpmds ds, const fnpyKey * suggestedKeys)
{
const char * Name = dsiGetN(ds);
const char * DNEVR = dsiGetDNEVR(ds);
const char * EVR = dsiGetEVR(ds);
const char * Name = rpmdsN(ds);
const char * DNEVR = rpmdsDNEVR(ds);
const char * EVR = rpmdsEVR(ds);
rpmProblemType type;
fnpyKey key;
if (tsprobs == NULL) return;
if (ps == NULL) return;
/*@-branchstate@*/
if (Name == NULL) Name = "?N?";
@ -605,21 +606,20 @@ void dsProblem(rpmProblemSet tsprobs, const char * pkgNEVR, const rpmDepSet ds,
type = (DNEVR[0] == 'C' && DNEVR[1] == ' ')
? RPMPROB_CONFLICT : RPMPROB_REQUIRES;
key = (suggestedKeys ? suggestedKeys[0] : NULL);
rpmProblemSetAppend(tsprobs, type, pkgNEVR, key,
NULL, NULL, DNEVR, 0);
rpmpsAppend(ps, type, pkgNEVR, key, NULL, NULL, DNEVR, 0);
}
int rangeMatchesDepFlags (Header h, const rpmDepSet req)
int rangeMatchesDepFlags (Header h, const rpmds req)
{
int scareMem = 1;
rpmDepSet provides = NULL;
rpmds provides = NULL;
int result = 0;
if (!(req->Flags[req->i] & RPMSENSE_SENSEMASK) || !req->EVR[req->i] || *req->EVR[req->i] == '\0')
return 1;
/* Get provides information from header */
provides = dsiInit(dsNew(h, RPMTAG_PROVIDENAME, scareMem));
provides = rpmdsInit(rpmdsNew(h, RPMTAG_PROVIDENAME, scareMem));
if (provides == NULL)
goto exit; /* XXX should never happen */
@ -635,13 +635,13 @@ int rangeMatchesDepFlags (Header h, const rpmDepSet req)
result = 0;
if (provides != NULL)
while (dsiNext(provides) >= 0) {
while (rpmdsNext(provides) >= 0) {
/* Filter out provides that came along for the ride. */
if (strcmp(provides->N[provides->i], req->N[req->i]))
continue;
result = dsCompare(provides, req);
result = rpmdsCompare(provides, req);
/* If this provide matches the require, we're done. */
if (result)
@ -649,12 +649,12 @@ int rangeMatchesDepFlags (Header h, const rpmDepSet req)
}
exit:
provides = dsFree(provides);
provides = rpmdsFree(provides);
return result;
}
int headerMatchesDepFlags(const Header h, const rpmDepSet req)
int headerMatchesDepFlags(const Header h, const rpmds req)
{
HGE_t hge = (HGE_t)headerGetEntryMinMemory;
const char * pkgN, * v, * r;
@ -662,8 +662,8 @@ int headerMatchesDepFlags(const Header h, const rpmDepSet req)
const char * pkgEVR;
char * t;
int_32 pkgFlags = RPMSENSE_EQUAL;
rpmDepSet pkg;
int rc = 1; /* XXX assume match as names should be the same already here */
rpmds pkg;
int rc = 1; /* XXX assume match, names already match here */
if (!((req->Flags[req->i] & RPMSENSE_SENSEMASK) && req->EVR[req->i] && *req->EVR[req->i]))
return rc;
@ -681,9 +681,9 @@ int headerMatchesDepFlags(const Header h, const rpmDepSet req)
}
(void) stpcpy( stpcpy( stpcpy(t, v) , "-") , r);
if ((pkg = dsSingle(RPMTAG_PROVIDENAME, pkgN, pkgEVR, pkgFlags)) != NULL) {
rc = dsCompare(pkg, req);
pkg = dsFree(pkg);
if ((pkg = rpmdsSingle(RPMTAG_PROVIDENAME, pkgN, pkgEVR, pkgFlags)) != NULL) {
rc = rpmdsCompare(pkg, req);
pkg = rpmdsFree(pkg);
}
return rc;

View File

@ -9,7 +9,7 @@
/**
* A package dependency set.
*/
struct rpmDepSet_s {
struct rpmds_s {
int i; /*!< Element index. */
/*@observer@*/
@ -43,14 +43,14 @@ extern "C" {
* @return NULL always
*/
/*@unused@*/ /*@null@*/
rpmDepSet rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
rpmds rpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
/*@null@*/ const char * msg)
/*@modifies ds @*/;
/** @todo Remove debugging entry from the ABI. */
/*@-exportlocal@*/
/*@null@*/
rpmDepSet XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
rpmds XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
/*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies ds @*/;
/*@=exportlocal@*/
@ -63,11 +63,11 @@ rpmDepSet XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds,
* @return new dependency set reference
*/
/*@unused@*/
rpmDepSet rpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg)
rpmds rpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg)
/*@modifies ds @*/;
/** @todo Remove debugging entry from the ABI. */
rpmDepSet XrpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg,
rpmds XrpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg,
const char * fn, unsigned ln)
/*@modifies ds @*/;
#define rpmdsLink(_ds, _msg) XrpmdsLink(_ds, _msg, __FILE__, __LINE__)
@ -78,7 +78,7 @@ rpmDepSet XrpmdsLink (/*@null@*/ rpmDepSet ds, /*@null@*/ const char * msg,
* @return NULL always
*/
/*@null@*/
rpmDepSet dsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds)
rpmds rpmdsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds)
/*@modifies ds@*/;
/**
* Create and load a dependency set.
@ -88,7 +88,7 @@ rpmDepSet dsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmDepSet ds)
* @return new dependency set
*/
/*@null@*/
rpmDepSet dsNew(Header h, rpmTag tagN, int scareMem)
rpmds rpmdsNew(Header h, rpmTag tagN, int scareMem)
/*@modifies h @*/;
/**
@ -98,7 +98,7 @@ rpmDepSet dsNew(Header h, rpmTag tagN, int scareMem)
* @return new formatted dependency (malloc'ed)
*/
/*@only@*/
char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
char * rpmdsNewDNEVR(const char * dspfx, const rpmds ds)
/*@*/;
/**
@ -109,7 +109,7 @@ char * dsDNEVR(const char * dspfx, const rpmDepSet ds)
* @return new dependency set
*/
/*@null@*/
rpmDepSet dsThis(Header h, rpmTag tagN, int_32 Flags)
rpmds rpmdsThis(Header h, rpmTag tagN, int_32 Flags)
/*@*/;
/**
@ -121,7 +121,7 @@ rpmDepSet dsThis(Header h, rpmTag tagN, int_32 Flags)
* @return new dependency set
*/
/*@null@*/
rpmDepSet dsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
rpmds rpmdsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
/*@*/;
/**
@ -129,7 +129,7 @@ rpmDepSet dsSingle(rpmTag tagN, const char * N, const char * EVR, int_32 Flags)
* @param ds dependency set
* @return current count
*/
int dsiGetCount(/*@null@*/ const rpmDepSet ds)
int rpmdsCount(/*@null@*/ const rpmds ds)
/*@*/;
/**
@ -137,7 +137,7 @@ int dsiGetCount(/*@null@*/ const rpmDepSet ds)
* @param ds dependency set
* @return current index
*/
int dsiGetIx(/*@null@*/ const rpmDepSet ds)
int rpmdsIx(/*@null@*/ const rpmds ds)
/*@*/;
/**
@ -146,7 +146,7 @@ int dsiGetIx(/*@null@*/ const rpmDepSet ds)
* @param ix new index
* @return current index
*/
int dsiSetIx(/*@null@*/ rpmDepSet ds, int ix)
int rpmdsSetIx(/*@null@*/ rpmds ds, int ix)
/*@modifies ds @*/;
/**
@ -155,7 +155,7 @@ int dsiSetIx(/*@null@*/ rpmDepSet ds, int ix)
* @return current dependency DNEVR, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const char * dsiGetDNEVR(/*@null@*/ const rpmDepSet ds)
const char * rpmdsDNEVR(/*@null@*/ const rpmds ds)
/*@*/;
/**
@ -164,7 +164,7 @@ const char * dsiGetDNEVR(/*@null@*/ const rpmDepSet ds)
* @return current dependency name, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const char * dsiGetN(/*@null@*/ const rpmDepSet ds)
const char * rpmdsN(/*@null@*/ const rpmds ds)
/*@*/;
/**
@ -173,7 +173,7 @@ const char * dsiGetN(/*@null@*/ const rpmDepSet ds)
* @return current dependency EVR, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const char * dsiGetEVR(/*@null@*/ const rpmDepSet ds)
const char * rpmdsEVR(/*@null@*/ const rpmds ds)
/*@*/;
/**
@ -181,7 +181,7 @@ const char * dsiGetEVR(/*@null@*/ const rpmDepSet ds)
* @param ds dependency set
* @return current dependency flags, 0 on invalid
*/
int_32 dsiGetFlags(/*@null@*/ const rpmDepSet ds)
int_32 rpmdsFlags(/*@null@*/ const rpmds ds)
/*@*/;
/**
@ -189,7 +189,7 @@ int_32 dsiGetFlags(/*@null@*/ const rpmDepSet ds)
* @param ds dependency set
* @return current dependency type, 0 on invalid
*/
rpmTag dsiGetTagN(/*@null@*/ const rpmDepSet ds)
rpmTag rpmdsTagN(/*@null@*/ const rpmds ds)
/*@*/;
/**
@ -199,7 +199,7 @@ rpmTag dsiGetTagN(/*@null@*/ const rpmDepSet ds)
* @param rc 0 == YES, otherwise NO
*/
/*@-globuse@*/ /* FIX: rpmMessage annotation is a lie */
void dsiNotify(/*@null@*/ rpmDepSet ds, /*@null@*/ const char * where, int rc)
void rpmdsNotify(/*@null@*/ rpmds ds, /*@null@*/ const char * where, int rc)
/*@globals fileSystem @*/
/*@modifies fileSystem @*/;
/*@=globuse@*/
@ -209,7 +209,7 @@ void dsiNotify(/*@null@*/ rpmDepSet ds, /*@null@*/ const char * where, int rc)
* @param ds dependency set
* @return dependency set iterator index, -1 on termination
*/
int dsiNext(/*@null@*/ rpmDepSet ds)
int rpmdsNext(/*@null@*/ rpmds ds)
/*@modifies ds @*/;
/**
@ -218,7 +218,7 @@ int dsiNext(/*@null@*/ rpmDepSet ds)
* @return dependency set
*/
/*@null@*/
rpmDepSet dsiInit(/*@null@*/ rpmDepSet ds)
rpmds rpmdsInit(/*@null@*/ rpmds ds)
/*@modifies ds @*/;
/**
@ -227,23 +227,26 @@ rpmDepSet dsiInit(/*@null@*/ rpmDepSet ds)
* @param B 2nd dependency
* @return 1 if dependencies overlap, 0 otherwise
*/
int dsCompare(const rpmDepSet A, const rpmDepSet B)
int rpmdsCompare(const rpmds A, const rpmds B)
/*@*/;
/**
* Report a Requires: or Conflicts: dependency problem.
* @param ps transaction set problems
* @param pkgNEVR package name/epoch/version/release
* @param ds dependency set
* @param suggestedKeys
*/
void dsProblem(/*@null@*/ rpmProblemSet tsprobs,
const char * pkgNEVR, const rpmDepSet ds,
void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds,
/*@only@*/ /*@null@*/ const fnpyKey * suggestedKeys)
/*@modifies tsprobs @*/;
/*@modifies ps @*/;
/**
* Compare package provides dependencies from header with a single dependency.
* @param h header
* @param req dependency set
*/
int rangeMatchesDepFlags (Header h, const rpmDepSet req)
int rangeMatchesDepFlags (Header h, const rpmds req)
/*@modifies h @*/;
/**
@ -253,7 +256,7 @@ int rangeMatchesDepFlags (Header h, const rpmDepSet req)
* @param req dependency
* @return 1 if dependency overlaps, 0 otherwise
*/
int headerMatchesDepFlags(const Header h, const rpmDepSet req)
int headerMatchesDepFlags(const Header h, const rpmds req)
/*@*/;
#ifdef __cplusplus

View File

@ -8,6 +8,8 @@
#include <rpmio_internal.h>
#include <rpmlib.h>
#include "rpmps.h"
#include "cpio.h" /* XXX CPIO_FOO */
#include "fsm.h" /* XXX newFSM() */
@ -19,14 +21,14 @@
#include "debug.h"
/*@access TFI_t @*/
/*@access transactionElement @*/
/*@access rpmTransactionSet @*/ /* XXX for ts->ignoreSet */
/*@access rpmfi @*/
/*@access rpmte @*/
/*@access rpmts @*/ /* XXX for ts->ignoreSet */
/*@unchecked@*/
static int _fi_debug = 0;
TFI_t XrpmfiUnlink(TFI_t fi, const char * msg, const char * fn, unsigned ln)
rpmfi XrpmfiUnlink(rpmfi fi, const char * msg, const char * fn, unsigned ln)
{
if (fi == NULL) return NULL;
/*@-modfilesystem@*/
@ -37,7 +39,7 @@ fprintf(stderr, "--> fi %p -- %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
return NULL;
}
TFI_t XrpmfiLink(TFI_t fi, const char * msg, const char * fn, unsigned ln)
rpmfi XrpmfiLink(rpmfi fi, const char * msg, const char * fn, unsigned ln)
{
if (fi == NULL) return NULL;
fi->nrefs++;
@ -48,33 +50,33 @@ fprintf(stderr, "--> fi %p ++ %d %s at %s:%u\n", fi, fi->nrefs, msg, fn, ln);
/*@-refcounttrans@*/ return fi; /*@=refcounttrans@*/
}
fnpyKey rpmfiGetKey(TFI_t fi)
fnpyKey rpmfiKey(rpmfi fi)
{
return (fi != NULL ? teGetKey(fi->te) : NULL);
return (fi != NULL ? rpmteKey(fi->te) : NULL);
}
int tfiGetFC(TFI_t fi)
int rpmfiFC(rpmfi fi)
{
return (fi != NULL ? fi->fc : 0);
}
int tfiGetDC(TFI_t fi)
int rpmfiDC(rpmfi fi)
{
return (fi != NULL ? fi->dc : 0);
}
#ifdef NOTYET
int tfiGetDI(TFI_t fi)
int rpmfiDI(rpmfi fi)
{
}
#endif
int tfiGetFX(TFI_t fi)
int rpmfiFX(rpmfi fi)
{
return (fi != NULL ? fi->i : -1);
}
int tfiSetFX(TFI_t fi, int fx)
int rpmfiSetFX(rpmfi fi, int fx)
{
int i = -1;
@ -86,12 +88,12 @@ int tfiSetFX(TFI_t fi, int fx)
return i;
}
int tfiGetDX(TFI_t fi)
int rpmfiDX(rpmfi fi)
{
return (fi != NULL ? fi->j : -1);
}
int tfiSetDX(TFI_t fi, int dx)
int rpmfiSetDX(rpmfi fi, int dx)
{
int j = -1;
@ -102,7 +104,7 @@ int tfiSetDX(TFI_t fi, int dx)
return j;
}
const char * tfiGetBN(TFI_t fi)
const char * rpmfiBN(rpmfi fi)
{
const char * BN = NULL;
@ -113,7 +115,7 @@ const char * tfiGetBN(TFI_t fi)
return BN;
}
const char * tfiGetDN(TFI_t fi)
const char * rpmfiDN(rpmfi fi)
{
const char * DN = NULL;
@ -124,7 +126,7 @@ const char * tfiGetDN(TFI_t fi)
return DN;
}
const char * tfiGetFN(TFI_t fi)
const char * rpmfiFN(rpmfi fi)
{
const char * FN = "";
@ -142,7 +144,7 @@ const char * tfiGetFN(TFI_t fi)
return FN;
}
int_32 tfiGetFFlags(TFI_t fi)
int_32 rpmfiFFlags(rpmfi fi)
{
int_32 FFlags = 0;
@ -153,7 +155,7 @@ int_32 tfiGetFFlags(TFI_t fi)
return FFlags;
}
int_32 tfiGetVFlags(TFI_t fi)
int_32 rpmfiVFlags(rpmfi fi)
{
int_32 VFlags = 0;
@ -164,7 +166,7 @@ int_32 tfiGetVFlags(TFI_t fi)
return VFlags;
}
int_16 tfiGetFMode(TFI_t fi)
int_16 rpmfiFMode(rpmfi fi)
{
int_16 fmode = 0;
@ -175,7 +177,7 @@ int_16 tfiGetFMode(TFI_t fi)
return fmode;
}
rpmfileState tfiGetFState(TFI_t fi)
rpmfileState rpmfiFState(rpmfi fi)
{
char fstate = 0;
@ -186,7 +188,7 @@ rpmfileState tfiGetFState(TFI_t fi)
return fstate;
}
const unsigned char * tfiGetMD5(TFI_t fi)
const unsigned char * rpmfiMD5(rpmfi fi)
{
unsigned char * md5 = NULL;
@ -197,7 +199,7 @@ const unsigned char * tfiGetMD5(TFI_t fi)
return md5;
}
const char * tfiGetFLink(TFI_t fi)
const char * rpmfiFLink(rpmfi fi)
{
const char * flink = NULL;
@ -208,7 +210,7 @@ const char * tfiGetFLink(TFI_t fi)
return flink;
}
int_32 tfiGetFSize(TFI_t fi)
int_32 rpmfiFSize(rpmfi fi)
{
int_32 fsize = 0;
@ -219,7 +221,7 @@ int_32 tfiGetFSize(TFI_t fi)
return fsize;
}
int_16 tfiGetFRdev(TFI_t fi)
int_16 rpmfiFRdev(rpmfi fi)
{
int_16 frdev = 0;
@ -230,7 +232,7 @@ int_16 tfiGetFRdev(TFI_t fi)
return frdev;
}
int_32 tfiGetFMtime(TFI_t fi)
int_32 rpmfiFMtime(rpmfi fi)
{
int_32 fmtime = 0;
@ -241,7 +243,7 @@ int_32 tfiGetFMtime(TFI_t fi)
return fmtime;
}
const char * tfiGetFUser(TFI_t fi)
const char * rpmfiFUser(rpmfi fi)
{
const char * fuser = NULL;
@ -252,7 +254,7 @@ const char * tfiGetFUser(TFI_t fi)
return fuser;
}
const char * tfiGetFGroup(TFI_t fi)
const char * rpmfiFGroup(rpmfi fi)
{
const char * fgroup = NULL;
@ -263,7 +265,7 @@ const char * tfiGetFGroup(TFI_t fi)
return fgroup;
}
int tfiNext(TFI_t fi)
int rpmfiNext(rpmfi fi)
{
int i = -1;
@ -285,7 +287,7 @@ fprintf(stderr, "*** fi %p\t%s[%d] %s%s\n", fi, (fi->Type ? fi->Type : "?Type?")
return i;
}
TFI_t tfiInit(TFI_t fi, int fx)
rpmfi rpmfiInit(rpmfi fi, int fx)
{
if (fi != NULL) {
if (fx >= 0 && fx < fi->fc) {
@ -303,7 +305,7 @@ TFI_t tfiInit(TFI_t fi, int fx)
/*@=refcounttrans@*/
}
int tdiNext(TFI_t fi)
int rpmfiNextD(rpmfi fi)
{
int j = -1;
@ -323,7 +325,7 @@ fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, (fi->Type ? fi->Type : "?Type?"), j);
return j;
}
TFI_t tdiInit(TFI_t fi, int dx)
rpmfi rpmfiInitD(rpmfi fi, int dx)
{
if (fi != NULL) {
if (dx >= 0 && dx < fi->fc)
@ -382,11 +384,11 @@ fileTypes whatis(uint_16 mode)
* @return header with relocated files
*/
static
Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
Header relocateFileList(const rpmts ts, rpmfi fi,
Header origH, fileAction * actions)
/*@modifies ts, fi, origH, actions @*/
{
transactionElement p = fi->te;
rpmte p = fi->te;
HGE_t hge = fi->hge;
HAE_t hae = fi->hae;
HME_t hme = fi->hme;
@ -486,11 +488,11 @@ Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
/* XXX actions check prevents problem from being appended twice. */
if (j == numValid && !allowBadRelocate && actions) {
rpmProblemSet ps = rpmtsGetProblems(ts);
rpmProblemSetAppend(ps, RPMPROB_BADRELOCATE,
rpmps ps = rpmtsGetProblems(ts);
rpmpsAppend(ps, RPMPROB_BADRELOCATE,
p->NEVR, p->key,
relocations[i].oldPath, NULL, NULL, 0);
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
}
del =
strlen(relocations[i].newPath) - strlen(relocations[i].oldPath);
@ -807,7 +809,7 @@ Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
return h;
}
TFI_t fiFree(TFI_t fi, int freefimem)
rpmfi rpmfiFree(rpmfi fi, int freefimem)
{
HFD_t hfd = headerFreeData;
@ -902,7 +904,7 @@ static inline unsigned char nibble(char c)
(_fi)->_data = memcpy(xmalloc((_fi)->fc * sizeof(*(_fi)->_data)), \
(_fi)->_data, (_fi)->fc * sizeof(*(_fi)->_data))
TFI_t fiNew(rpmTransactionSet ts, TFI_t fi,
rpmfi rpmfiNew(rpmts ts, rpmfi fi,
Header h, rpmTag tagN, int scareMem)
{
HGE_t hge =
@ -931,7 +933,7 @@ TFI_t fiNew(rpmTransactionSet ts, TFI_t fi,
}
/*@=branchstate@*/
fi->magic = TFIMAGIC;
fi->magic = RPMFIMAGIC;
fi->Type = Type;
fi->i = -1;
fi->tagN = tagN;
@ -1034,9 +1036,9 @@ if (fi->actions == NULL)
/*@-compdef@*/ /* FIX: fi-md5s undefined */
foo = relocateFileList(ts, fi, h, fi->actions);
/*@=compdef@*/
fi->h = headerFree(fi->h, "fiNew fi->h");
fi->h = headerLink(foo, "fiNew fi->h = foo");
foo = headerFree(foo, "fiNew foo");
fi->h = headerFree(fi->h, "rpmfiNew fi->h");
fi->h = headerLink(foo, "rpmfiNew fi->h = foo");
foo = headerFree(foo, "rpmfiNew foo");
}
if (!scareMem) {
@ -1072,7 +1074,7 @@ if (_fi_debug < 0)
fprintf(stderr, "*** fi %p\t%s[%d]\n", fi, Type, (fi ? fi->fc : 0));
/*@=modfilesystem@*/
/*@-compdef -nullstate@*/ /* FIX: TFI null annotations */
/*@-compdef -nullstate@*/ /* FIX: rpmfi null annotations */
return rpmfiLink(fi, (fi ? fi->Type : NULL));
/*@=compdef =nullstate@*/
}

View File

@ -22,7 +22,7 @@ struct sharedFileInfo_s {
/**
* A package filename set.
*/
struct TFI_s {
struct rpmfi_s {
int i; /*!< Current file index. */
int j; /*!< Current directory index. */
@ -78,7 +78,7 @@ struct TFI_s {
/*=============================*/
/*@dependent@*/
transactionElement te;
rpmte te;
HGE_t hge; /*!< Vector to headerGetEntry() */
HAE_t hae; /*!< Vector to headerAddEntry() */
@ -127,7 +127,7 @@ struct TFI_s {
uint_32 * replacedSizes; /*!< (TR_ADDED) */
unsigned int record; /*!< (TR_REMOVED) */
int magic;
#define TFIMAGIC 0x09697923
#define RPMFIMAGIC 0x09697923
/*=============================*/
/*@refs@*/ int nrefs; /*!< Reference count. */
@ -143,14 +143,14 @@ extern "C" {
* @return NULL always
*/
/*@unused@*/ /*@null@*/
TFI_t rpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ TFI_t fi,
rpmfi rpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
/*@null@*/ const char * msg)
/*@modifies fi @*/;
/** @todo Remove debugging entry from the ABI. */
/*@-exportlocal@*/
/*@null@*/
TFI_t XrpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ TFI_t fi,
rpmfi XrpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
/*@null@*/ const char * msg, const char * fn, unsigned ln)
/*@modifies fi @*/;
/*@=exportlocal@*/
@ -162,11 +162,11 @@ TFI_t XrpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ TFI_t fi,
* @return new file info set reference
*/
/*@unused@*/
TFI_t rpmfiLink (/*@null@*/ TFI_t fi, /*@null@*/ const char * msg)
rpmfi rpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg)
/*@modifies fi @*/;
/** @todo Remove debugging entry from the ABI. */
TFI_t XrpmfiLink (/*@null@*/ TFI_t fi, /*@null@*/ const char * msg,
rpmfi XrpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg,
const char * fn, unsigned ln)
/*@modifies fi @*/;
#define rpmfiLink(_fi, _msg) XrpmfiLink(_fi, _msg, __FILE__, __LINE__)
@ -177,7 +177,7 @@ TFI_t XrpmfiLink (/*@null@*/ TFI_t fi, /*@null@*/ const char * msg,
* @return transaction element file info key
*/
/*@exposed@*/ /*@dependent@*/ /*@null@*/
fnpyKey rpmfiGetKey(TFI_t fi)
fnpyKey rpmfiKey(rpmfi fi)
/*@*/;
/**
@ -185,7 +185,7 @@ fnpyKey rpmfiGetKey(TFI_t fi)
* @param fi file info set
* @return current file count
*/
int tfiGetFC(/*@null@*/ TFI_t fi)
int rpmfiFC(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -194,7 +194,7 @@ int tfiGetFC(/*@null@*/ TFI_t fi)
* @return current file index
*/
/*@unused@*/
int tfiGetFX(/*@null@*/ TFI_t fi)
int rpmfiFX(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -204,7 +204,7 @@ int tfiGetFX(/*@null@*/ TFI_t fi)
* @return current file index
*/
/*@unused@*/
int tfiSetFX(/*@null@*/ TFI_t fi, int fx)
int rpmfiSetFX(/*@null@*/ rpmfi fi, int fx)
/*@modifies fi @*/;
/**
@ -212,7 +212,7 @@ int tfiSetFX(/*@null@*/ TFI_t fi, int fx)
* @param fi file info set
* @return current directory count
*/
int tfiGetDC(/*@null@*/ TFI_t fi)
int rpmfiDC(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -220,7 +220,7 @@ int tfiGetDC(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return current directory index
*/
int tfiGetDX(/*@null@*/ TFI_t fi)
int rpmfiDX(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -229,7 +229,7 @@ int tfiGetDX(/*@null@*/ TFI_t fi)
* @param fx new directory index
* @return current directory index
*/
int tfiSetDX(/*@null@*/ TFI_t fi, int dx)
int rpmfiSetDX(/*@null@*/ rpmfi fi, int dx)
/*@modifies fi @*/;
/**
@ -238,7 +238,7 @@ int tfiSetDX(/*@null@*/ TFI_t fi, int dx)
* @return current base name, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const char * tfiGetBN(/*@null@*/ TFI_t fi)
const char * rpmfiBN(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -247,7 +247,7 @@ const char * tfiGetBN(/*@null@*/ TFI_t fi)
* @return current directory, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const char * tfiGetDN(/*@null@*/ TFI_t fi)
const char * rpmfiDN(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -256,7 +256,7 @@ const char * tfiGetDN(/*@null@*/ TFI_t fi)
* @return current file name
*/
/*@observer@*/
const char * tfiGetFN(/*@null@*/ TFI_t fi)
const char * rpmfiFN(/*@null@*/ rpmfi fi)
/*@modifies fi @*/;
/**
@ -264,7 +264,7 @@ const char * tfiGetFN(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return current file flags, 0 on invalid
*/
int_32 tfiGetFFlags(/*@null@*/ TFI_t fi)
int_32 rpmfiFFlags(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -272,7 +272,7 @@ int_32 tfiGetFFlags(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return current file verify flags, 0 on invalid
*/
int_32 tfiGetVFlags(/*@null@*/ TFI_t fi)
int_32 rpmfiVFlags(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -280,7 +280,7 @@ int_32 tfiGetVFlags(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return current file mode, 0 on invalid
*/
int_16 tfiGetFMode(/*@null@*/ TFI_t fi)
int_16 rpmfiFMode(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -288,7 +288,7 @@ int_16 tfiGetFMode(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return current file state, 0 on invalid
*/
rpmfileState tfiGetFState(/*@null@*/ TFI_t fi)
rpmfileState rpmfiFState(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -297,7 +297,7 @@ rpmfileState tfiGetFState(/*@null@*/ TFI_t fi)
* @return current file md5 digest, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const unsigned char * tfiGetMD5(/*@null@*/ TFI_t fi)
const unsigned char * rpmfiMD5(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -306,7 +306,7 @@ const unsigned char * tfiGetMD5(/*@null@*/ TFI_t fi)
* @return current file linkto, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const char * tfiGetFLink(/*@null@*/ TFI_t fi)
const char * rpmfiFLink(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -314,7 +314,7 @@ const char * tfiGetFLink(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return current file size, 0 on invalid
*/
int_32 tfiGetFSize(/*@null@*/ TFI_t fi)
int_32 rpmfiFSize(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -322,7 +322,7 @@ int_32 tfiGetFSize(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return current file rdev, 0 on invalid
*/
int_16 tfiGetFRdev(/*@null@*/ TFI_t fi)
int_16 rpmfiFRdev(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -330,7 +330,7 @@ int_16 tfiGetFRdev(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return current file modify time, 0 on invalid
*/
int_32 tfiGetFMtime(/*@null@*/ TFI_t fi)
int_32 rpmfiFMtime(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -339,7 +339,7 @@ int_32 tfiGetFMtime(/*@null@*/ TFI_t fi)
* @return current file owner, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const char * tfiGetFUser(/*@null@*/ TFI_t fi)
const char * rpmfiFUser(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -348,7 +348,7 @@ const char * tfiGetFUser(/*@null@*/ TFI_t fi)
* @return current file group, NULL on invalid
*/
/*@observer@*/ /*@null@*/
const char * tfiGetFGroup(/*@null@*/ TFI_t fi)
const char * rpmfiFGroup(/*@null@*/ rpmfi fi)
/*@*/;
/**
@ -356,7 +356,7 @@ const char * tfiGetFGroup(/*@null@*/ TFI_t fi)
* @param fi file info set
* @return file iterator index, -1 on termination
*/
int tfiNext(/*@null@*/ TFI_t fi)
int rpmfiNext(/*@null@*/ rpmfi fi)
/*@modifies fi @*/;
/**
@ -366,7 +366,7 @@ int tfiNext(/*@null@*/ TFI_t fi)
* @return file info set
*/
/*@null@*/
TFI_t tfiInit(/*@null@*/ TFI_t fi, int fx)
rpmfi rpmfiInit(/*@null@*/ rpmfi fi, int fx)
/*@modifies fi @*/;
/**
@ -375,7 +375,7 @@ TFI_t tfiInit(/*@null@*/ TFI_t fi, int fx)
* @return directory iterator index, -1 on termination
*/
/*@unused@*/
int tdiNext(/*@null@*/ TFI_t fi)
int rpmfiNextD(/*@null@*/ rpmfi fi)
/*@modifies fi @*/;
/**
@ -385,7 +385,7 @@ int tdiNext(/*@null@*/ TFI_t fi)
* @return file info set, NULL if dx is out of range
*/
/*@unused@*/ /*@null@*/
TFI_t tdiInit(/*@null@*/ TFI_t fi, int dx)
rpmfi rpmfiInitD(/*@null@*/ rpmfi fi, int dx)
/*@modifies fi @*/;
/**
@ -395,7 +395,7 @@ TFI_t tdiInit(/*@null@*/ TFI_t fi, int dx)
* @return NULL always
*/
/*@null@*/
TFI_t fiFree(/*@killref@*/ /*@only@*/ /*@null@*/ TFI_t fi, int freefimem)
rpmfi rpmfiFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi, int freefimem)
/*@modifies fi@*/;
/**
@ -408,7 +408,7 @@ TFI_t fiFree(/*@killref@*/ /*@only@*/ /*@null@*/ TFI_t fi, int freefimem)
* @return new file set
*/
/*@null@*/
TFI_t fiNew(rpmTransactionSet ts, /*@null@*/ TFI_t fi,
rpmfi rpmfiNew(rpmts ts, /*@null@*/ rpmfi fi,
Header h, rpmTag tagN, int scareMem)
/*@modifies ts, fi, h @*/;

View File

@ -7,14 +7,15 @@
#include <rpmcli.h>
#include "rpmdb.h"
#include "rpmps.h"
#include "rpmts.h"
#include "manifest.h"
#include "misc.h" /* XXX for rpmGlob() */
#include "debug.h"
/*@access rpmTransactionSet @*/ /* XXX ts->goal, ts->dbmode */
/*@access rpmProblemSet @*/ /* XXX compared with NULL */
/*@access rpmts @*/ /* XXX ts->goal, ts->dbmode */
/*@access rpmps @*/ /* XXX compared with NULL */
/*@access Header @*/ /* XXX compared with NULL */
/*@access rpmdb @*/ /* XXX compared with NULL */
/*@access FD_t @*/ /* XXX compared with NULL */
@ -213,12 +214,12 @@ struct rpmEIU {
};
/** @todo Generalize --freshen policies. */
int rpmInstall(rpmTransactionSet ts,
int rpmInstall(rpmts ts,
struct rpmInstallArguments_s * ia,
const char ** fileArgv)
{
struct rpmEIU * eiu = memset(alloca(sizeof(*eiu)), 0, sizeof(*eiu));
rpmProblemSet ps;
rpmps ps;
rpmprobFilterFlags probFilter;
rpmRelocation * relocations;
/*@only@*/ /*@null@*/ const char * fileURL = NULL;
@ -559,7 +560,7 @@ restart:
}
/*@=branchstate@*/
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
}
if (eiu->numRPMS && !(ia->installInterfaceFlags & INSTALL_NOORDER)) {
@ -582,9 +583,9 @@ restart:
eiu->numFailed += eiu->numRPMS;
} else if (rc > 0) {
eiu->numFailed += rc;
rpmProblemSetPrint(stderr, ps);
rpmpsPrint(stderr, ps);
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
}
if (eiu->numSRPMS && !stopInstall) {
@ -627,7 +628,7 @@ exit:
return eiu->numFailed;
}
int rpmErase(rpmTransactionSet ts,
int rpmErase(rpmts ts,
const struct rpmInstallArguments_s * ia,
const char ** argv)
{
@ -636,7 +637,7 @@ int rpmErase(rpmTransactionSet ts,
int numFailed = 0;
int stopUninstall = 0;
int numPackages = 0;
rpmProblemSet ps;
rpmps ps;
if (argv == NULL) return 0;
@ -699,20 +700,20 @@ int rpmErase(rpmTransactionSet ts,
numFailed += numPackages;
stopUninstall = 1;
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
}
if (!stopUninstall) {
(void) rpmtsSetFlags(ts, (rpmtsGetFlags(ts) | RPMTRANS_FLAG_REVERSE));
numFailed += rpmtsRun(ts, NULL, 0);
ps = rpmtsGetProblems(ts);
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
}
return numFailed;
}
int rpmInstallSource(rpmTransactionSet ts, const char * arg,
int rpmInstallSource(rpmts ts, const char * arg,
const char ** specFilePtr, const char ** cookie)
{
FD_t fd;
@ -808,7 +809,7 @@ IDTX IDTXsort(IDTX idtx)
return idtx;
}
IDTX IDTXload(rpmTransactionSet ts, rpmTag tag)
IDTX IDTXload(rpmts ts, rpmTag tag)
{
IDTX idtx = NULL;
rpmdbMatchIterator mi;
@ -852,7 +853,7 @@ IDTX IDTXload(rpmTransactionSet ts, rpmTag tag)
return IDTXsort(idtx);
}
IDTX IDTXglob(rpmTransactionSet ts, const char * globstr, rpmTag tag)
IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
{
IDTX idtx = NULL;
HGE_t hge = (HGE_t) headerGetEntry;
@ -926,14 +927,14 @@ IDTX IDTXglob(rpmTransactionSet ts, const char * globstr, rpmTag tag)
}
/** @todo Transaction handling, more, needs work. */
int rpmRollback(rpmTransactionSet ts,
int rpmRollback(rpmts ts,
/*@unused@*/ struct rpmInstallArguments_s * ia,
const char ** argv)
{
#ifdef NOTYET
rpmdb db = NULL;
rpmTransactionSet ts = NULL;
rpmProblemSet ps;
rpmts ts = NULL;
rpmps ps;
int ifmask= (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL|INSTALL_ERASE);
unsigned thistid = 0xffffffff;
unsigned prevtid;
@ -1066,10 +1067,10 @@ int rpmRollback(rpmTransactionSet ts,
if (rc != 0 && ps) {
rpmMessage(RPMMESS_ERROR, _("Failed dependencies:\n"));
printDepProblems(stderr, ps);
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
goto exit;
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
rc = rpmtsOrder(ts);
if (rc != 0)
@ -1078,8 +1079,8 @@ int rpmRollback(rpmTransactionSet ts,
rc = rpmtsRun(ts, NULL, (ia->probFilter|RPMPROB_FILTER_OLDPACKAGE));
ps = rpmtsGetProblems(ts);
if (rc > 0)
rpmProblemSetPrint(stderr, ps);
ps = rpmProblemSetFree(ps);
rpmpsPrint(stderr, ps);
ps = rpmpsFree(ps);
if (rc)
goto exit;

View File

@ -66,7 +66,7 @@ void * _free(/*@only@*/ /*@null@*/ /*@out@*/ const void * p)
* strict removals, and prerequisite ordering is done on installs/upgrades.
*/
typedef /*@abstract@*/ /*@refcounted@*/
struct rpmTransactionSet_s * rpmTransactionSet;
struct rpmts_s * rpmts;
/** \ingroup rpmtrans
* An added/available package retrieval key.
@ -84,17 +84,17 @@ typedef /*@abstract@*/ int alNum;
/** \ingroup rpmtrans
* Dependency tag sets from a header, so that a header can be discarded early.
*/
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmDepSet_s * rpmDepSet;
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmds_s * rpmds;
/** \ingroup rpmtrans
* File info tag sets from a header, so that a header can be discarded early.
*/
typedef /*@abstract@*/ /*@refcounted@*/ struct TFI_s * TFI_t;
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmfi_s * rpmfi;
/** \ingroup rpmtrans
* An element of a transaction set, i.e. a TR_ADDED or TR_REMOVED package.
*/
typedef /*@abstract@*/ struct transactionElement_s * transactionElement;
typedef /*@abstract@*/ struct rpmte_s * rpmte;
/** \ingroup rpmdb
* Database of headers and tag value indices.
@ -653,188 +653,6 @@ void rpmFreeRpmrc(void)
/*@globals internalState @*/
/*@modifies internalState @*/;
/*@}*/
/* ==================================================================== */
/** \name RPMPROBS */
/*@{*/
/**
* Raw data for an element of a problem set.
*/
typedef /*@abstract@*/ struct rpmProblem_s * rpmProblem;
/**
* Transaction problems found by rpmtsRun().
*/
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmProblemSet_s * rpmProblemSet;
/**
* Enumerate transaction set problem types.
*/
typedef enum rpmProblemType_e {
RPMPROB_BADARCH, /*!< package ... is for a different architecture */
RPMPROB_BADOS, /*!< package ... is for a different operating system */
RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
RPMPROB_BADRELOCATE,/*!< path ... is not relocateable for package ... */
RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
RPMPROB_BADPRETRANS /*!< (unimplemented) */
} rpmProblemType;
/**
*/
struct rpmProblem_s {
/*@only@*/ /*@null@*/
char * pkgNEVR;
/*@only@*/ /*@null@*/
char * altNEVR;
/*@exposed@*/ /*@null@*/
fnpyKey key;
rpmProblemType type;
int ignoreProblem;
/*@only@*/ /*@null@*/
char * str1;
unsigned long ulong1;
};
/**
*/
struct rpmProblemSet_s {
int numProblems; /*!< Current probs array size. */
int numProblemsAlloced; /*!< Allocated probs array size. */
rpmProblem probs; /*!< Array of specific problems. */
/*@refs@*/
int nrefs; /*!< Reference count. */
};
/**
*/
void printDepFlags(FILE *fp, const char *version, int flags)
/*@globals fileSystem @*/
/*@modifies *fp, fileSystem @*/;
/**
* Print a problem array.
* @param fp output file
* @param ps dependency problems
*/
void printDepProblems(FILE * fp, /*@null@*/ const rpmProblemSet ps)
/*@globals fileSystem @*/
/*@modifies *fp, fileSystem @*/;
/**
* Return formatted string representation of a problem.
* @param prob rpm problem
* @return formatted string (malloc'd)
*/
/*@-redecl@*/ /* LCL: is confused. */
/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob)
/*@*/;
/*@=redecl@*/
/**
* Unreference a problem set instance.
* @param ps problem set
* @param msg
* @return problem set
*/
/*@unused@*/
rpmProblemSet rpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmProblemSet ps,
const char * msg)
/*@modifies ps @*/;
/** @todo Remove debugging entry from the ABI. */
/*@null@*/
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__)
/**
* Reference a problem set instance.
* @param ps transaction set
* @param msg
* @return new transaction set reference
*/
/*@unused@*/
rpmProblemSet rpmpsLink (rpmProblemSet ps, const char * msg)
/*@modifies ps @*/;
/** @todo Remove debugging entry from the ABI. */
rpmProblemSet XrpmpsLink (rpmProblemSet ps,
const char * msg, const char * fn, unsigned ln)
/*@modifies ps @*/;
#define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
/**
* Create a problem set.
*/
rpmProblemSet rpmProblemSetCreate(void)
/*@*/;
/**
* Destroy a problem array.
* @param ps problem set
* @return NULL always
*/
/*@null@*/
rpmProblemSet rpmProblemSetFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmProblemSet ps)
/*@modifies ps @*/;
/**
* Output formatted string representation of a problem to file handle.
* @deprecated API: prob used to be passed by value, now passed by reference.
* @param fp file handle
* @param prob rpm problem
*/
void rpmProblemPrint(FILE *fp, rpmProblem prob)
/*@globals fileSystem @*/
/*@modifies prob, *fp, fileSystem @*/;
/**
* Print problems to file handle.
* @param fp file handle
* @param ps problem set
*/
void rpmProblemSetPrint(FILE *fp, /*@null@*/ rpmProblemSet ps)
/*@globals fileSystem @*/
/*@modifies *fp, ps, fileSystem @*/;
/**
* Append a problem to set.
*/
void rpmProblemSetAppend(/*@null@*/ rpmProblemSet ps, rpmProblemType type,
/*@null@*/ const char * pkgNEVR,
/*@exposed@*/ /*@null@*/ fnpyKey key,
/*@null@*/ const char * dn, /*@null@*/ const char * bn,
/*@null@*/ const char * altNEVR,
unsigned long ulong1)
/*@modifies ps @*/;
/**
* Filter a problem set.
*
* As the problem sets are generated in an order solely dependent
* on the ordering of the packages in the transaction, and that
* ordering can't be changed, the problem sets must be parallel to
* one another. Additionally, the filter set must be a subset of the
* target set, given the operations available on transaction set.
* This is good, as it lets us perform this trim in linear time, rather
* then logarithmic or quadratic.
*
* @param ps problem set
* @param filter problem filter (or NULL)
* @return 0 no problems, 1 if problems remain
*/
int rpmProblemSetTrim(/*@null@*/ rpmProblemSet ps,
/*@null@*/ rpmProblemSet filter)
/*@modifies ps @*/;
/*@}*/
/* ==================================================================== */
/** \name RPMTS */
@ -1013,7 +831,7 @@ typedef /*@abstract@*/ struct psm_s * PSM_t;
* @retval hdrp address of header (or NULL)
* @return 0 on success
*/
int rpmReadPackageFile(rpmTransactionSet ts, FD_t fd,
int rpmReadPackageFile(rpmts ts, FD_t fd,
const char * fn, /*@null@*/ /*@out@*/ Header * hdrp)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fd, *hdrp, fileSystem, internalState @*/;
@ -1026,7 +844,7 @@ int rpmReadPackageFile(rpmTransactionSet ts, FD_t fd,
* @retval cookie address of cookie pointer (or NULL)
* @return rpmRC return code
*/
rpmRC rpmInstallSourcePackage(rpmTransactionSet ts, FD_t fd,
rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
/*@null@*/ /*@out@*/ const char ** specFilePtr,
/*@null@*/ /*@out@*/ const char ** cookie)
/*@globals rpmGlobalMacroContext,
@ -1125,7 +943,7 @@ int rpmvercmp(const char * a, const char * b)
* @param key dependency
* @return 1 if dependency overlaps, 0 otherwise
*/
int rpmCheckRpmlibProvides(const rpmDepSet key)
int rpmCheckRpmlibProvides(const rpmds key)
/*@*/;
/** \ingroup rpmcli
@ -1299,7 +1117,7 @@ typedef enum rpmVerifySignatureReturn_e {
* @retval result detailed text result of signature verification
* @return result of signature verification
*/
rpmVerifySignatureReturn rpmVerifySignature(const rpmTransactionSet ts,
rpmVerifySignatureReturn rpmVerifySignature(const rpmts ts,
/*@out@*/ char * result)
/*@globals fileSystem, internalState @*/
/*@modifies ts, *result, fileSystem, internalState @*/;

View File

@ -6,6 +6,7 @@
#include <rpmlib.h>
#include "rpmps.h"
#include "rpmds.h"
#include "debug.h"
@ -65,18 +66,18 @@ void rpmShowRpmlibProvides(FILE * fp)
}
}
int rpmCheckRpmlibProvides(const rpmDepSet key)
int rpmCheckRpmlibProvides(const rpmds key)
{
const struct rpmlibProvides_s * rlp;
int rc = 0;
for (rlp = rpmlibProvides; rlp->featureName != NULL; rlp++) {
if (rlp->featureEVR && rlp->featureFlags) {
rpmDepSet pro;
pro = dsSingle(RPMTAG_PROVIDENAME, rlp->featureName,
rpmds pro;
pro = rpmdsSingle(RPMTAG_PROVIDENAME, rlp->featureName,
rlp->featureEVR, rlp->featureFlags);
rc = dsCompare(pro, key);
pro = dsFree(pro);
rc = rpmdsCompare(pro, key);
pro = rpmdsFree(pro);
}
if (rc)
break;

View File

@ -1,11 +1,12 @@
/**
* \file lib/problems.c
* \file lib/rpmps.c
*/
#include "system.h"
#include <rpmlib.h>
#include "rpmps.h"
#include "rpmts.h"
#include "misc.h"
@ -18,7 +19,7 @@
/*@unchecked@*/
static int _ps_debug = 0;
rpmProblemSet XrpmpsUnlink(rpmProblemSet ps, const char * msg,
rpmps XrpmpsUnlink(rpmps ps, const char * msg,
const char * fn, unsigned ln)
{
/*@-modfilesystem@*/
@ -31,7 +32,7 @@ fprintf(stderr, "--> ps %p -- %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln);
/*@=refcounttrans@*/
}
rpmProblemSet XrpmpsLink(rpmProblemSet ps, const char * msg,
rpmps XrpmpsLink(rpmps ps, const char * msg,
const char * fn, unsigned ln)
{
ps->nrefs++;
@ -44,13 +45,13 @@ fprintf(stderr, "--> ps %p ++ %d %s at %s:%u\n", ps, ps->nrefs, msg, fn, ln);
/*@=refcounttrans@*/
}
rpmProblemSet rpmProblemSetCreate(void)
rpmps rpmpsCreate(void)
{
rpmProblemSet ps = xcalloc(1, sizeof(*ps));
rpmps ps = xcalloc(1, sizeof(*ps));
return rpmpsLink(ps, "create");
}
rpmProblemSet rpmProblemSetFree(rpmProblemSet ps)
rpmps rpmpsFree(rpmps ps)
{
if (ps == NULL) return NULL;
ps = rpmpsUnlink(ps, "dereference");
@ -71,7 +72,7 @@ rpmProblemSet rpmProblemSetFree(rpmProblemSet ps)
return NULL;
}
void rpmProblemSetAppend(rpmProblemSet ps, rpmProblemType type,
void rpmpsAppend(rpmps ps, rpmProblemType type,
const char * pkgNEVR, fnpyKey key,
const char * dn, const char * bn,
const char * altNEVR, unsigned long ulong1)
@ -114,7 +115,7 @@ void rpmProblemSetAppend(rpmProblemSet ps, rpmProblemType type,
#define XSTRCMP(a, b) ((!(a) && !(b)) || ((a) && (b) && !strcmp((a), (b))))
int rpmProblemSetTrim(rpmProblemSet ps, rpmProblemSet filter)
int rpmpsTrim(rpmps ps, rpmps filter)
{
rpmProblem t;
rpmProblem f;
@ -291,7 +292,7 @@ void rpmProblemPrint(FILE *fp, rpmProblem prob)
msg = _free(msg);
}
void rpmProblemSetPrint(FILE *fp, rpmProblemSet ps)
void rpmpsPrint(FILE *fp, rpmps ps)
{
int i;
@ -329,8 +330,8 @@ static int sameProblem(const rpmProblem ap, const rpmProblem bp)
return 0;
}
/* XXX FIXME: merge into rpmProblemSetPrint */
void printDepProblems(FILE * fp, rpmProblemSet ps)
/* XXX FIXME: merge into rpmpsPrint */
void printDepProblems(FILE * fp, rpmps ps)
{
int i;

193
lib/rpmps.h Normal file
View File

@ -0,0 +1,193 @@
#ifndef H_RPMPS
#define H_RPMPS
/** \ingroup rpmps
* \file lib/rpmps.h
* Structures and prototypes used for an "rpmps" problem set.
*/
/**
* Raw data for an element of a problem set.
*/
typedef /*@abstract@*/ struct rpmProblem_s * rpmProblem;
/**
* Transaction problems found while processing a transaction set/
*/
typedef /*@abstract@*/ /*@refcounted@*/ struct rpmps_s * rpmps;
/**
* Enumerate transaction set problem types.
*/
typedef enum rpmProblemType_e {
RPMPROB_BADARCH, /*!< package ... is for a different architecture */
RPMPROB_BADOS, /*!< package ... is for a different operating system */
RPMPROB_PKG_INSTALLED, /*!< package ... is already installed */
RPMPROB_BADRELOCATE,/*!< path ... is not relocateable for package ... */
RPMPROB_REQUIRES, /*!< package ... has unsatisfied Requires: ... */
RPMPROB_CONFLICT, /*!< package ... has unsatisfied Conflicts: ... */
RPMPROB_NEW_FILE_CONFLICT, /*!< file ... conflicts between attemped installs of ... */
RPMPROB_FILE_CONFLICT,/*!< file ... from install of ... conflicts with file from package ... */
RPMPROB_OLDPACKAGE, /*!< package ... (which is newer than ...) is already installed */
RPMPROB_DISKSPACE, /*!< installing package ... needs ... on the ... filesystem */
RPMPROB_DISKNODES, /*!< installing package ... needs ... on the ... filesystem */
RPMPROB_BADPRETRANS /*!< (unimplemented) */
} rpmProblemType;
/**
*/
struct rpmProblem_s {
/*@only@*/ /*@null@*/
char * pkgNEVR;
/*@only@*/ /*@null@*/
char * altNEVR;
/*@exposed@*/ /*@null@*/
fnpyKey key;
rpmProblemType type;
int ignoreProblem;
/*@only@*/ /*@null@*/
char * str1;
unsigned long ulong1;
};
/**
*/
struct rpmps_s {
int numProblems; /*!< Current probs array size. */
int numProblemsAlloced; /*!< Allocated probs array size. */
rpmProblem probs; /*!< Array of specific problems. */
/*@refs@*/
int nrefs; /*!< Reference count. */
};
#ifdef __cplusplus
extern "C" {
#endif
/**
*/
void printDepFlags(FILE *fp, const char *version, int flags)
/*@globals fileSystem @*/
/*@modifies *fp, fileSystem @*/;
/**
* Print a problem array.
* @param fp output file
* @param ps dependency problems
*/
void printDepProblems(FILE * fp, /*@null@*/ const rpmps ps)
/*@globals fileSystem @*/
/*@modifies *fp, fileSystem @*/;
/**
* Return formatted string representation of a problem.
* @param prob rpm problem
* @return formatted string (malloc'd)
*/
/*@-redecl@*/ /* LCL: is confused. */
/*@only@*/ extern const char * rpmProblemString(const rpmProblem prob)
/*@*/;
/*@=redecl@*/
/**
* Unreference a problem set instance.
* @param ps problem set
* @param msg
* @return problem set
*/
/*@unused@*/
rpmps rpmpsUnlink (/*@killref@*/ /*@returned@*/ rpmps ps,
const char * msg)
/*@modifies ps @*/;
/** @todo Remove debugging entry from the ABI. */
/*@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__)
/**
* Reference a problem set instance.
* @param ps transaction set
* @param msg
* @return new transaction set reference
*/
/*@unused@*/
rpmps rpmpsLink (rpmps ps, const char * msg)
/*@modifies ps @*/;
/** @todo Remove debugging entry from the ABI. */
rpmps XrpmpsLink (rpmps ps,
const char * msg, const char * fn, unsigned ln)
/*@modifies ps @*/;
#define rpmpsLink(_ps, _msg) XrpmpsLink(_ps, _msg, __FILE__, __LINE__)
/**
* Create a problem set.
*/
rpmps rpmpsCreate(void)
/*@*/;
/**
* Destroy a problem set.
* @param ps problem set
* @return NULL always
*/
/*@null@*/
rpmps rpmpsFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmps ps)
/*@modifies ps @*/;
/**
* Output formatted string representation of a problem to file handle.
* @deprecated API: prob used to be passed by value, now passed by reference.
* @param fp file handle
* @param prob rpm problem
*/
void rpmProblemPrint(FILE *fp, rpmProblem prob)
/*@globals fileSystem @*/
/*@modifies prob, *fp, fileSystem @*/;
/**
* Print problems to file handle.
* @param fp file handle
* @param ps problem set
*/
void rpmpsPrint(FILE *fp, /*@null@*/ rpmps ps)
/*@globals fileSystem @*/
/*@modifies *fp, ps, fileSystem @*/;
/**
* Append a problem to set.
*/
void rpmpsAppend(/*@null@*/ rpmps ps, rpmProblemType type,
/*@null@*/ const char * pkgNEVR,
/*@exposed@*/ /*@null@*/ fnpyKey key,
/*@null@*/ const char * dn, /*@null@*/ const char * bn,
/*@null@*/ const char * altNEVR,
unsigned long ulong1)
/*@modifies ps @*/;
/**
* Filter a problem set.
*
* As the problem sets are generated in an order solely dependent
* on the ordering of the packages in the transaction, and that
* ordering can't be changed, the problem sets must be parallel to
* one another. Additionally, the filter set must be a subset of the
* target set, given the operations available on transaction set.
* This is good, as it lets us perform this trim in linear time, rather
* then logarithmic or quadratic.
*
* @param ps problem set
* @param filter problem filter (or NULL)
* @return 0 no problems, 1 if problems remain
*/
int rpmpsTrim(/*@null@*/ rpmps ps, /*@null@*/ rpmps filter)
/*@modifies ps @*/;
#ifdef __cplusplus
}
#endif
#endif /* H_RPMPS */

View File

@ -1,12 +1,14 @@
/** \ingroup rpmdep
* \file lib/rpmte.c
* Routine(s) to handle a transactionElement.
* Routine(s) to handle an "rpmte" transaction element.
*/
#include "system.h"
#include <rpmlib.h>
#include "psm.h"
#include "rpmps.h"
#include "rpmds.h"
#include "rpmfi.h"
#include "rpmte.h"
@ -18,13 +20,22 @@
int _te_debug = 0;
/*@access alKey @*/
/*@access teIterator @*/
/*@access transactionElement @*/
/*@access rpmTransactionSet @*/
/*@access rpmtei @*/
/*@access rpmte @*/
/*@access rpmts @*/
void rpmteCleanDS(rpmte te)
{
te->this = rpmdsFree(te->this);
te->provides = rpmdsFree(te->provides);
te->requires = rpmdsFree(te->requires);
te->conflicts = rpmdsFree(te->conflicts);
te->obsoletes = rpmdsFree(te->obsoletes);
}
/**
*/
static void delTE(transactionElement p)
static void delTE(rpmte p)
/*@modifies p @*/
{
rpmRelocation * r;
@ -37,12 +48,9 @@ static void delTE(transactionElement p)
p->relocs = _free(p->relocs);
}
p->this = dsFree(p->this);
p->provides = dsFree(p->provides);
p->requires = dsFree(p->requires);
p->conflicts = dsFree(p->conflicts);
p->obsoletes = dsFree(p->obsoletes);
p->fi = fiFree(p->fi, 1);
rpmteCleanDS(p);
p->fi = rpmfiFree(p->fi, 1);
/*@-noeffectuncon@*/
if (p->fd != NULL)
@ -67,7 +75,7 @@ static void delTE(transactionElement p)
/**
*/
static void addTE(rpmTransactionSet ts, transactionElement p, Header h,
static void addTE(rpmts ts, rpmte p, Header h,
/*@dependent@*/ /*@null@*/ fnpyKey key,
/*@null@*/ rpmRelocation * relocs)
/*@modifies ts, p, h @*/
@ -102,12 +110,12 @@ static void addTE(rpmTransactionSet ts, transactionElement p, Header h,
p->epoch = NULL;
/*@=branchstate@*/
p->this = dsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
p->provides = dsNew(h, RPMTAG_PROVIDENAME, scareMem);
p->fi = fiNew(ts, NULL, h, RPMTAG_BASENAMES, scareMem);
p->requires = dsNew(h, RPMTAG_REQUIRENAME, scareMem);
p->conflicts = dsNew(h, RPMTAG_CONFLICTNAME, scareMem);
p->obsoletes = dsNew(h, RPMTAG_OBSOLETENAME, scareMem);
p->this = rpmdsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
p->provides = rpmdsNew(h, RPMTAG_PROVIDENAME, scareMem);
p->fi = rpmfiNew(ts, NULL, h, RPMTAG_BASENAMES, scareMem);
p->requires = rpmdsNew(h, RPMTAG_REQUIRENAME, scareMem);
p->conflicts = rpmdsNew(h, RPMTAG_CONFLICTNAME, scareMem);
p->obsoletes = rpmdsNew(h, RPMTAG_OBSOLETENAME, scareMem);
p->key = key;
@ -134,7 +142,7 @@ static void addTE(rpmTransactionSet ts, transactionElement p, Header h,
}
}
transactionElement teFree(transactionElement te)
rpmte rpmteFree(rpmte te)
{
if (te != NULL) {
delTE(te);
@ -144,14 +152,14 @@ transactionElement teFree(transactionElement te)
return NULL;
}
transactionElement teNew(const rpmTransactionSet ts, Header h,
rpmte rpmteNew(const rpmts ts, Header h,
rpmTransactionType type,
fnpyKey key,
rpmRelocation * relocs,
int dboffset,
alKey pkgKey)
{
transactionElement te = xcalloc(1, sizeof(*te));
rpmte te = xcalloc(1, sizeof(*te));
addTE(ts, te, h, key, relocs);
switch (type) {
@ -168,48 +176,47 @@ transactionElement teNew(const rpmTransactionSet ts, Header h,
return te;
}
rpmTransactionType teGetType(transactionElement te)
rpmTransactionType rpmteType(rpmte te)
{
return te->type;
return (te != NULL ? te->type : -1);
}
const char * teGetN(transactionElement te)
/*@*/
const char * rpmteN(rpmte te)
{
return (te != NULL ? te->name : NULL);
}
const char * teGetE(transactionElement te)
const char * rpmteE(rpmte te)
{
return (te != NULL ? te->epoch : NULL);
}
const char * teGetV(transactionElement te)
const char * rpmteV(rpmte te)
{
return (te != NULL ? te->version : NULL);
}
const char * teGetR(transactionElement te)
const char * rpmteR(rpmte te)
{
return (te != NULL ? te->release : NULL);
}
const char * teGetA(transactionElement te)
const char * rpmteA(rpmte te)
{
return (te != NULL ? te->arch : NULL);
}
const char * teGetO(transactionElement te)
const char * rpmteO(rpmte te)
{
return (te != NULL ? te->os : NULL);
}
int teGetMultiLib(transactionElement te)
int rpmteMultiLib(rpmte te)
{
return (te != NULL ? te->multiLib : 0);
}
int teSetMultiLib(transactionElement te, int nmultiLib)
int rpmteSetMultiLib(rpmte te, int nmultiLib)
{
int omultiLib = 0;
if (te != NULL) {
@ -219,12 +226,12 @@ int teSetMultiLib(transactionElement te, int nmultiLib)
return omultiLib;
}
int teGetDepth(transactionElement te)
int rpmteDepth(rpmte te)
{
return (te != NULL ? te->depth : 0);
}
int teSetDepth(transactionElement te, int ndepth)
int rpmteSetDepth(rpmte te, int ndepth)
{
int odepth = 0;
if (te != NULL) {
@ -234,12 +241,12 @@ int teSetDepth(transactionElement te, int ndepth)
return odepth;
}
int teGetNpreds(transactionElement te)
int rpmteNpreds(rpmte te)
{
return (te != NULL ? te->npreds : 0);
}
int teSetNpreds(transactionElement te, int npreds)
int rpmteSetNpreds(rpmte te, int npreds)
{
int opreds = 0;
if (te != NULL) {
@ -249,12 +256,12 @@ int teSetNpreds(transactionElement te, int npreds)
return opreds;
}
int teGetTree(transactionElement te)
int rpmteTree(rpmte te)
{
return (te != NULL ? te->tree : 0);
}
int teSetTree(transactionElement te, int ntree)
int rpmteSetTree(rpmte te, int ntree)
{
int otree = 0;
if (te != NULL) {
@ -264,14 +271,14 @@ int teSetTree(transactionElement te, int ntree)
return otree;
}
transactionElement teGetParent(transactionElement te)
rpmte rpmteParent(rpmte te)
{
return (te != NULL ? te->parent : NULL);
}
transactionElement teSetParent(transactionElement te, transactionElement pte)
rpmte rpmteSetParent(rpmte te, rpmte pte)
{
transactionElement opte = NULL;
rpmte opte = NULL;
/*@-branchstate@*/
if (te != NULL) {
opte = te->parent;
@ -283,12 +290,12 @@ transactionElement teSetParent(transactionElement te, transactionElement pte)
return opte;
}
int teGetDegree(transactionElement te)
int rpmteDegree(rpmte te)
{
return (te != NULL ? te->degree : 0);
}
int teSetDegree(transactionElement te, int ndegree)
int rpmteSetDegree(rpmte te, int ndegree)
{
int odegree = 0;
if (te != NULL) {
@ -298,21 +305,21 @@ int teSetDegree(transactionElement te, int ndegree)
return odegree;
}
tsortInfo teGetTSI(transactionElement te)
tsortInfo rpmteTSI(rpmte te)
{
/*@-compdef -retalias -retexpose -usereleased @*/
return te->tsi;
/*@=compdef =retalias =retexpose =usereleased @*/
}
void teFreeTSI(transactionElement te)
void rpmteFreeTSI(rpmte te)
{
if (te != NULL && teGetTSI(te) != NULL) {
if (te != NULL && rpmteTSI(te) != NULL) {
tsortInfo tsi;
/* Clean up tsort remnants (if any). */
while ((tsi = teGetTSI(te)->tsi_next) != NULL) {
teGetTSI(te)->tsi_next = tsi->tsi_next;
while ((tsi = rpmteTSI(te)->tsi_next) != NULL) {
rpmteTSI(te)->tsi_next = tsi->tsi_next;
tsi->tsi_next = NULL;
tsi = _free(tsi);
}
@ -323,29 +330,20 @@ void teFreeTSI(transactionElement te)
/*@=nullstate@*/
}
void teNewTSI(transactionElement te)
void rpmteNewTSI(rpmte te)
{
if (te != NULL) {
teFreeTSI(te);
rpmteFreeTSI(te);
te->tsi = xcalloc(1, sizeof(*te->tsi));
}
}
void teCleanDS(transactionElement te)
{
te->this = dsFree(te->this);
te->provides = dsFree(te->provides);
te->requires = dsFree(te->requires);
te->conflicts = dsFree(te->conflicts);
te->obsoletes = dsFree(te->obsoletes);
}
alKey teGetAddedKey(transactionElement te)
alKey rpmteAddedKey(rpmte te)
{
return (te != NULL ? te->u.addedKey : RPMAL_NOMATCH);
}
alKey teSetAddedKey(transactionElement te, alKey npkgKey)
alKey rpmteSetAddedKey(rpmte te, alKey npkgKey)
{
alKey opkgKey = RPMAL_NOMATCH;
if (te != NULL) {
@ -356,34 +354,34 @@ alKey teSetAddedKey(transactionElement te, alKey npkgKey)
}
alKey teGetDependsOnKey(transactionElement te)
alKey rpmteDependsOnKey(rpmte te)
{
return (te != NULL ? te->u.removed.dependsOnKey : RPMAL_NOMATCH);
}
int teGetDBOffset(transactionElement te)
int rpmteDBOffset(rpmte te)
{
return (te != NULL ? te->u.removed.dboffset : 0);
}
const char * teGetNEVR(transactionElement te)
const char * rpmteNEVR(rpmte te)
{
return (te != NULL ? te->NEVR : NULL);
}
FD_t teGetFd(transactionElement te)
FD_t rpmteFd(rpmte te)
{
/*@-compdef -refcounttrans -retalias -retexpose -usereleased @*/
return (te != NULL ? te->fd : NULL);
/*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/
}
fnpyKey teGetKey(transactionElement te)
fnpyKey rpmteKey(rpmte te)
{
return (te != NULL ? te->key : NULL);
}
rpmDepSet teGetDS(transactionElement te, rpmTag tag)
rpmds rpmteDS(rpmte te, rpmTag tag)
{
/*@-compdef -refcounttrans -retalias -retexpose -usereleased @*/
if (te == NULL)
@ -408,7 +406,7 @@ rpmDepSet teGetDS(transactionElement te, rpmTag tag)
/*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/
}
TFI_t teGetFI(transactionElement te, rpmTag tag)
rpmfi rpmteFI(rpmte te, rpmTag tag)
{
/*@-compdef -refcounttrans -retalias -retexpose -usereleased @*/
if (te == NULL)
@ -421,12 +419,12 @@ TFI_t teGetFI(transactionElement te, rpmTag tag)
/*@=compdef =refcounttrans =retalias =retexpose =usereleased @*/
}
int teiGetOc(teIterator tei)
int rpmteiGetOc(rpmtei tei)
{
return tei->ocsave;
}
teIterator XteFreeIterator(/*@only@*//*@null@*/ teIterator tei,
rpmtei XrpmteiFree(/*@only@*//*@null@*/ rpmtei tei,
const char * fn, unsigned int ln)
{
if (tei)
@ -438,13 +436,12 @@ fprintf(stderr, "*** tei %p -- %s:%d\n", tei, fn, ln);
return _free(tei);
}
teIterator XteInitIterator(rpmTransactionSet ts,
const char * fn, unsigned int ln)
rpmtei XrpmteiInit(rpmts ts, const char * fn, unsigned int ln)
{
teIterator tei = NULL;
rpmtei tei = NULL;
tei = xcalloc(1, sizeof(*tei));
tei->ts = rpmtsLink(ts, "teIterator");
tei->ts = rpmtsLink(ts, "rpmtei");
tei->reverse = ((ts->transFlags & RPMTRANS_FLAG_REVERSE) ? 1 : 0);
tei->oc = (tei->reverse ? (ts->orderCount - 1) : 0);
tei->ocsave = tei->oc;
@ -455,9 +452,16 @@ fprintf(stderr, "*** tei %p ++ %s:%d\n", tei, fn, ln);
return tei;
}
transactionElement teNextIterator(teIterator tei)
/**
* Return next transaction element.
* @param tei transaction element iterator
* @return transaction element, NULL on termination
*/
static /*@dependent@*/ /*@null@*/
rpmte teNextIterator(rpmtei tei)
/*@modifies tei @*/
{
transactionElement te = NULL;
rpmte te = NULL;
int oc = -1;
if (tei == NULL || tei->ts == NULL || tei->ts->order == NULL)
@ -478,9 +482,9 @@ transactionElement teNextIterator(teIterator tei)
/*@=compdef =usereleased@*/
}
transactionElement teNext(teIterator tei, rpmTransactionType type)
rpmte rpmteiNext(rpmtei tei, rpmTransactionType type)
{
transactionElement p;
rpmte p;
while ((p = teNextIterator(tei)) != NULL) {
if (type == 0 || (p->type & type) != 0)

View File

@ -3,15 +3,15 @@
/** \ingroup rpmdep rpmtrans
* \file lib/rpmte.h
* Structures used for a transactionElement.
* Structures used for an "rpmte" transaction element.
*/
typedef /*@abstract@*/ struct tsortInfo_s * tsortInfo;
typedef /*@abstract@*/ struct teIterator_s * teIterator;
typedef /*@abstract@*/ struct rpmtei_s * rpmtei;
/*@unchecked@*/
/*@-exportlocal@*/
/*@unchecked@*/
extern int _te_debug;
/*@=exportlocal@*/
@ -23,14 +23,14 @@ struct tsortInfo_s {
union {
int count;
/*@exposed@*/ /*@dependent@*/ /*@null@*/
transactionElement suc;
rpmte suc;
} tsi_u;
#define tsi_count tsi_u.count
#define tsi_suc tsi_u.suc
/*@owned@*/ /*@null@*/
struct tsortInfo_s * tsi_next;
/*@exposed@*/ /*@dependent@*/ /*@null@*/
transactionElement tsi_chain;
rpmte tsi_chain;
int tsi_reqx;
int tsi_qcnt;
};
@ -46,7 +46,7 @@ typedef enum rpmTransactionType_e {
/** \ingroup rpmdep
* A single package instance to be installed/removed atomically.
*/
struct transactionElement_s {
struct rpmte_s {
rpmTransactionType type; /*!< Package disposition (installed/removed). */
/*@refcounted@*/ /*@null@*/
@ -66,7 +66,7 @@ struct transactionElement_s {
/*@only@*/ /*@null@*/
const char * os; /*!< Operating system hint. */
transactionElement parent; /*!< Parent transaction element. */
rpmte parent; /*!< Parent transaction element. */
int degree; /*!< No. of immediate children. */
int depth; /*!< Max. depth in dependency tree. */
int npreds; /*!< No. of predecessors. */
@ -75,17 +75,17 @@ struct transactionElement_s {
tsortInfo tsi; /*!< Dependency ordering chains. */
/*@refcounted@*/ /*@null@*/
rpmDepSet this; /*!< This package's provided NEVR. */
rpmds this; /*!< This package's provided NEVR. */
/*@refcounted@*/ /*@null@*/
rpmDepSet provides; /*!< Provides: dependencies. */
rpmds provides; /*!< Provides: dependencies. */
/*@refcounted@*/ /*@null@*/
rpmDepSet requires; /*!< Requires: dependencies. */
rpmds requires; /*!< Requires: dependencies. */
/*@refcounted@*/ /*@null@*/
rpmDepSet conflicts; /*!< Conflicts: dependencies. */
rpmds conflicts; /*!< Conflicts: dependencies. */
/*@refcounted@*/ /*@null@*/
rpmDepSet obsoletes; /*!< Obsoletes: dependencies. */
rpmds obsoletes; /*!< Obsoletes: dependencies. */
/*@refcounted@*/ /*@null@*/
TFI_t fi; /*!< File information. */
rpmfi fi; /*!< File information. */
uint_32 multiLib; /*!< (TR_ADDED) MULTILIB */
@ -113,12 +113,12 @@ struct transactionElement_s {
/**
* Iterator across transaction elements, forward on install, backward on erase.
*/
struct teIterator_s {
struct rpmtei_s {
/*@refcounted@*/
rpmTransactionSet ts; /*!< transaction set. */
int reverse; /*!< reversed traversal? */
int ocsave; /*!< last returned iterator index. */
int oc; /*!< iterator index. */
rpmts ts; /*!< transaction set. */
int reverse; /*!< reversed traversal? */
int ocsave; /*!< last returned iterator index. */
int oc; /*!< iterator index. */
};
#ifdef __cplusplus
@ -131,8 +131,9 @@ extern "C" {
* @return NULL always
*/
/*@null@*/
transactionElement teFree(/*@only@*/ /*@null@*/ transactionElement te)
rpmte rpmteFree(/*@only@*/ /*@null@*/ rpmte te)
/*@modifies te@*/;
/**
* Create a transaction element.
* @param ts transaction set
@ -145,8 +146,7 @@ transactionElement teFree(/*@only@*/ /*@null@*/ transactionElement te)
* @return new transaction element
*/
/*@only@*/ /*@null@*/
transactionElement teNew(const rpmTransactionSet ts, Header h,
rpmTransactionType type,
rpmte rpmteNew(const rpmts ts, Header h, rpmTransactionType type,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ fnpyKey key,
/*@null@*/ rpmRelocation * relocs,
int dboffset,
@ -158,7 +158,7 @@ transactionElement teNew(const rpmTransactionSet ts, Header h,
* @param te transaction element
* @return type
*/
rpmTransactionType teGetType(transactionElement te)
rpmTransactionType rpmteType(rpmte te)
/*@*/;
/**
@ -167,7 +167,7 @@ rpmTransactionType teGetType(transactionElement te)
* @return name string
*/
/*@observer@*/
const char * teGetN(transactionElement te)
const char * rpmteN(rpmte te)
/*@*/;
/**
@ -176,7 +176,7 @@ const char * teGetN(transactionElement te)
* @return epoch string
*/
/*@observer@*/ /*@null@*/
const char * teGetE(transactionElement te)
const char * rpmteE(rpmte te)
/*@*/;
/**
@ -185,7 +185,7 @@ const char * teGetE(transactionElement te)
* @return version string
*/
/*@observer@*/ /*@null@*/
const char * teGetV(transactionElement te)
const char * rpmteV(rpmte te)
/*@*/;
/**
@ -194,7 +194,7 @@ const char * teGetV(transactionElement te)
* @return release string
*/
/*@observer@*/ /*@null@*/
const char * teGetR(transactionElement te)
const char * rpmteR(rpmte te)
/*@*/;
/**
@ -203,7 +203,7 @@ const char * teGetR(transactionElement te)
* @return arch string
*/
/*@observer@*/ /*@null@*/
const char * teGetA(transactionElement te)
const char * rpmteA(rpmte te)
/*@*/;
/**
@ -212,7 +212,7 @@ const char * teGetA(transactionElement te)
* @return os string
*/
/*@observer@*/ /*@null@*/
const char * teGetO(transactionElement te)
const char * rpmteO(rpmte te)
/*@*/;
/**
@ -220,7 +220,7 @@ const char * teGetO(transactionElement te)
* @param te transaction element
* @return multilib flags
*/
int teGetMultiLib(transactionElement te)
int rpmteMultiLib(rpmte te)
/*@*/;
/**
@ -229,7 +229,7 @@ int teGetMultiLib(transactionElement te)
* @param nmultiLib new multilib flags
* @return previous multilib flags
*/
int teSetMultiLib(transactionElement te, int nmultiLib)
int rpmteSetMultiLib(rpmte te, int nmultiLib)
/*@modifies te @*/;
/**
@ -237,7 +237,7 @@ int teSetMultiLib(transactionElement te, int nmultiLib)
* @param te transaction element
* @return depth
*/
int teGetDepth(transactionElement te)
int rpmteDepth(rpmte te)
/*@*/;
/**
@ -246,7 +246,7 @@ int teGetDepth(transactionElement te)
* @param ndepth new depth
* @return previous depth
*/
int teSetDepth(transactionElement te, int ndepth)
int rpmteSetDepth(rpmte te, int ndepth)
/*@modifies te @*/;
/**
@ -254,7 +254,7 @@ int teSetDepth(transactionElement te, int ndepth)
* @param te transaction element
* @return no. of predecessors
*/
int teGetNpreds(transactionElement te)
int rpmteNpreds(rpmte te)
/*@*/;
/**
@ -263,7 +263,7 @@ int teGetNpreds(transactionElement te)
* @param npreds new no. of predecessors
* @return previous no. of predecessors
*/
int teSetNpreds(transactionElement te, int npreds)
int rpmteSetNpreds(rpmte te, int npreds)
/*@modifies te @*/;
/**
@ -271,7 +271,7 @@ int teSetNpreds(transactionElement te, int npreds)
* @param te transaction element
* @return tree index
*/
int teGetTree(transactionElement te)
int rpmteTree(rpmte te)
/*@*/;
/**
@ -280,7 +280,7 @@ int teGetTree(transactionElement te)
* @param ntree new tree index
* @return previous tree index
*/
int teSetTree(transactionElement te, int ntree)
int rpmteSetTree(rpmte te, int ntree)
/*@modifies te @*/;
/**
@ -289,7 +289,7 @@ int teSetTree(transactionElement te, int ntree)
* @return parent transaction element
*/
/*@observer@*/ /*@unused@*/
transactionElement teGetParent(transactionElement te)
rpmte rpmteParent(rpmte te)
/*@*/;
/**
@ -298,7 +298,7 @@ transactionElement teGetParent(transactionElement te)
* @param pte new parent transaction element
* @return previous parent transaction element
*/
transactionElement teSetParent(transactionElement te, transactionElement pte)
rpmte rpmteSetParent(rpmte te, rpmte pte)
/*@modifies te @*/;
/**
@ -306,7 +306,7 @@ transactionElement teSetParent(transactionElement te, transactionElement pte)
* @param te transaction element
* @return tree index
*/
int teGetDegree(transactionElement te)
int rpmteDegree(rpmte te)
/*@*/;
/**
@ -315,7 +315,7 @@ int teGetDegree(transactionElement te)
* @param ndegree new number of children
* @return previous number of children
*/
int teSetDegree(transactionElement te, int ndegree)
int rpmteSetDegree(rpmte te, int ndegree)
/*@modifies te @*/;
/**
@ -323,21 +323,21 @@ int teSetDegree(transactionElement te, int ndegree)
* @param te transaction element
* @return tsort info
*/
tsortInfo teGetTSI(transactionElement te)
tsortInfo rpmteTSI(rpmte te)
/*@*/;
/**
* Destroy tsort info of transaction element.
* @param te transaction element
*/
void teFreeTSI(transactionElement te)
void rpmteFreeTSI(rpmte te)
/*@modifies te @*/;
/**
* Initialize tsort info of transaction element.
* @param te transaction element
*/
void teNewTSI(transactionElement te)
void rpmteNewTSI(rpmte te)
/*@modifies te @*/;
/**
@ -345,7 +345,7 @@ void teNewTSI(transactionElement te)
* @param te transaction element
*/
/*@unused@*/
void teCleanDS(transactionElement te)
void rpmteCleanDS(rpmte te)
/*@modifies te @*/;
/**
@ -354,7 +354,7 @@ void teCleanDS(transactionElement te)
* @return pkgKey
*/
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey teGetAddedKey(transactionElement te)
alKey rpmteAddedKey(rpmte te)
/*@*/;
/**
@ -364,7 +364,7 @@ alKey teGetAddedKey(transactionElement te)
* @return previous pkgKey
*/
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey teSetAddedKey(transactionElement te,
alKey rpmteSetAddedKey(rpmte te,
/*@exposed@*/ /*@dependent@*/ /*@null@*/ alKey npkgKey)
/*@modifies te @*/;
@ -374,7 +374,7 @@ alKey teSetAddedKey(transactionElement te,
* @return dependent pkgKey
*/
/*@exposed@*/ /*@dependent@*/ /*@null@*/
alKey teGetDependsOnKey(transactionElement te)
alKey rpmteDependsOnKey(rpmte te)
/*@*/;
/**
@ -382,7 +382,7 @@ alKey teGetDependsOnKey(transactionElement te)
* @param te transaction element
* @return rpmdb instance
*/
int teGetDBOffset(transactionElement te)
int rpmteDBOffset(rpmte te)
/*@*/;
/**
@ -391,7 +391,7 @@ int teGetDBOffset(transactionElement te)
* @return name-version-release string
*/
/*@observer@*/
const char * teGetNEVR(transactionElement te)
const char * rpmteNEVR(rpmte te)
/*@*/;
/**
@ -399,7 +399,7 @@ const char * teGetNEVR(transactionElement te)
* @param te transaction element
* @return file handle
*/
FD_t teGetFd(transactionElement te)
FD_t rpmteFd(rpmte te)
/*@*/;
/**
@ -408,7 +408,7 @@ FD_t teGetFd(transactionElement te)
* @return key
*/
/*@exposed@*/
fnpyKey teGetKey(transactionElement te)
fnpyKey rpmteKey(rpmte te)
/*@*/;
/**
@ -417,7 +417,7 @@ fnpyKey teGetKey(transactionElement te)
* @param tag dependency tag
* @return dependency tag set
*/
rpmDepSet teGetDS(transactionElement te, rpmTag tag)
rpmds rpmteDS(rpmte te, rpmTag tag)
/*@*/;
/**
@ -426,7 +426,7 @@ rpmDepSet teGetDS(transactionElement te, rpmTag tag)
* @param tag file info tag
* @return file info tag set
*/
TFI_t teGetFI(transactionElement te, rpmTag tag)
rpmfi rpmteFI(rpmte te, rpmTag tag)
/*@*/;
/**
@ -434,7 +434,7 @@ TFI_t teGetFI(transactionElement te, rpmTag tag)
* @param tei transaction element iterator
* @return transaction element index
*/
int teiGetOc(teIterator tei)
int rpmteiGetOc(rpmtei tei)
/*@*/;
/**
@ -443,7 +443,7 @@ int teiGetOc(teIterator tei)
* @return NULL always
*/
/*@unused@*/ /*@null@*/
teIterator teFreeIterator(/*@only@*//*@null@*/ teIterator tei)
rpmtei rpmteiFree(/*@only@*//*@null@*/ rpmtei tei)
/*@*/;
/**
@ -454,10 +454,10 @@ teIterator teFreeIterator(/*@only@*//*@null@*/ teIterator tei)
* @return NULL always
*/
/*@null@*/
teIterator XteFreeIterator(/*@only@*//*@null@*/ teIterator tei,
rpmtei XrpmteiFree(/*@only@*//*@null@*/ rpmtei tei,
const char * fn, unsigned int ln)
/*@*/;
#define teFreeIterator(_tei) XteFreeIterator(_tei, __FILE__, __LINE__)
#define rpmteiFree(_tei) XrpmteiFree(_tei, __FILE__, __LINE__)
/**
* Create transaction element iterator.
@ -465,7 +465,7 @@ teIterator XteFreeIterator(/*@only@*//*@null@*/ teIterator tei,
* @return transaction element iterator
*/
/*@unused@*/ /*@only@*/
teIterator teInitIterator(rpmTransactionSet ts)
rpmtei rpmteiInit(rpmts ts)
/*@modifies ts @*/;
/**
@ -476,28 +476,19 @@ teIterator teInitIterator(rpmTransactionSet ts)
* @return transaction element iterator
*/
/*@unused@*/ /*@only@*/
teIterator XteInitIterator(rpmTransactionSet ts,
rpmtei XrpmteiInit(rpmts ts,
const char * fn, unsigned int ln)
/*@modifies ts @*/;
#define teInitIterator(_ts) XteInitIterator(_ts, __FILE__, __LINE__)
/**
* Return next transaction element
* @param tei transaction element iterator
* @return transaction element, NULL on termination
*/
/*@dependent@*/ /*@null@*/
transactionElement teNextIterator(teIterator tei)
/*@modifies tei @*/;
#define rpmteiInit(_ts) XrpmteiInit(_ts, __FILE__, __LINE__)
/**
* Return next transaction element of type.
* @param tei transaction element iterator
* @param type transaction element type selector
* @param type transaction element type selector (0 for any)
* @return next transaction element of type, NULL on termination
*/
/*@dependent@*/ /*@null@*/
transactionElement teNext(teIterator tei, rpmTransactionType type)
rpmte rpmteiNext(rpmtei tei, rpmTransactionType type)
/*@modifies tei @*/;
#ifdef __cplusplus

View File

@ -1,6 +1,6 @@
/** \ingroup rpmdep
* \file lib/rpmts.c
* Routine(s) to handle an rpmTransactionSet.
* Routine(s) to handle a "rpmts" transaction sets.
*/
#include "system.h"
@ -9,6 +9,7 @@
#include <rpmpgp.h> /* XXX rpmtsFree() needs pgpFreeDig */
#include "rpmdb.h" /* XXX stealing db->db_mode. */
#include "rpmps.h"
#include "rpmds.h"
#include "rpmfi.h"
@ -16,13 +17,41 @@
#include "rpmte.h"
#include "rpmts.h"
/* XXX FIXME: merge with existing (broken?) tests in system.h */
/* portability fiddles */
#if STATFS_IN_SYS_STATVFS
/*@-incondefs@*/
# include <sys/statvfs.h>
#if defined(__LCLINT__)
/*@-declundef -exportheader -protoparammatch @*/ /* LCL: missing annotation */
extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
/*@globals fileSystem @*/
/*@modifies *buf, fileSystem @*/;
/*@=declundef =exportheader =protoparammatch @*/
/*@=incondefs@*/
#endif
#else
# if STATFS_IN_SYS_VFS
# include <sys/vfs.h>
# else
# if STATFS_IN_SYS_MOUNT
# include <sys/mount.h>
# else
# if STATFS_IN_SYS_STATFS
# include <sys/statfs.h>
# endif
# endif
# endif
#endif
#include "debug.h"
/*@access rpmdb @*/ /* XXX db->db_chrootDone, NULL */
/*@access FD_t @*/ /* XXX compared with NULL */
/*@access rpmProblemSet @*/
/*@access rpmTransactionSet @*/
/*@access rpmps @*/
/*@access rpmDiskSpaceInfo @*/
/*@access rpmts @*/
/*@access fnpyKey @*/
/*@unchecked@*/
@ -45,7 +74,7 @@ char * hGetNEVR(Header h, const char ** np)
return NVR;
}
rpmTransactionSet XrpmtsUnlink(rpmTransactionSet ts, const char * msg, const char * fn, unsigned ln)
rpmts XrpmtsUnlink(rpmts ts, const char * msg, const char * fn, unsigned ln)
{
/*@-modfilesystem@*/
if (_ts_debug)
@ -55,7 +84,7 @@ fprintf(stderr, "--> ts %p -- %d %s at %s:%u\n", ts, ts->nrefs, msg, fn, ln);
return NULL;
}
rpmTransactionSet XrpmtsLink(rpmTransactionSet ts, const char * msg, const char * fn, unsigned ln)
rpmts XrpmtsLink(rpmts ts, const char * msg, const char * fn, unsigned ln)
{
ts->nrefs++;
/*@-modfilesystem@*/
@ -65,7 +94,7 @@ fprintf(stderr, "--> ts %p ++ %d %s at %s:%u\n", ts, ts->nrefs, msg, fn, ln);
/*@-refcounttrans@*/ return ts; /*@=refcounttrans@*/
}
int rpmtsCloseDB(rpmTransactionSet ts)
int rpmtsCloseDB(rpmts ts)
{
int rc = 0;
@ -76,7 +105,7 @@ int rpmtsCloseDB(rpmTransactionSet ts)
return rc;
}
int rpmtsOpenDB(rpmTransactionSet ts, int dbmode)
int rpmtsOpenDB(rpmts ts, int dbmode)
{
int rc = 0;
@ -101,13 +130,13 @@ int rpmtsOpenDB(rpmTransactionSet ts, int dbmode)
return rc;
}
rpmdbMatchIterator rpmtsInitIterator(const rpmTransactionSet ts, int rpmtag,
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, int rpmtag,
const void * keyp, size_t keylen)
{
return rpmdbInitIterator(ts->rdb, rpmtag, keyp, keylen);
}
static int rpmtsCloseSDB(rpmTransactionSet ts)
static int rpmtsCloseSDB(rpmts ts)
/*@globals fileSystem @*/
/*@modifies ts, fileSystem @*/
{
@ -120,7 +149,7 @@ static int rpmtsCloseSDB(rpmTransactionSet ts)
return rc;
}
static int rpmtsOpenSDB(rpmTransactionSet ts)
static int rpmtsOpenSDB(rpmts ts)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/
{
@ -157,7 +186,7 @@ static int sugcmp(const void * a, const void * b) /*@*/
return strcmp(astr, bstr);
}
int rpmtsSolve(rpmTransactionSet ts, rpmDepSet ds)
int rpmtsSolve(rpmts ts, rpmds ds)
{
const char * errstr;
const char * str;
@ -176,10 +205,10 @@ int rpmtsSolve(rpmTransactionSet ts, rpmDepSet ds)
if (ts->goal != TSM_INSTALL)
return rc;
if (dsiGetTagN(ds) != RPMTAG_REQUIRENAME)
if (rpmdsTagN(ds) != RPMTAG_REQUIRENAME)
return rc;
keyp = dsiGetN(ds);
keyp = rpmdsN(ds);
if (keyp == NULL)
return rc;
@ -253,7 +282,7 @@ exit:
/*@=nullstate@*/
}
int rpmtsAvailable(rpmTransactionSet ts, const rpmDepSet ds)
int rpmtsAvailable(rpmts ts, const rpmds ds)
{
fnpyKey * sugkey;
int rc = 1; /* assume not found */
@ -278,9 +307,9 @@ int rpmtsAvailable(rpmTransactionSet ts, const rpmDepSet ds)
/*@=nullstate@*/
}
rpmProblemSet rpmtsGetProblems(rpmTransactionSet ts)
rpmps rpmtsGetProblems(rpmts ts)
{
rpmProblemSet ps = NULL;
rpmps ps = NULL;
if (ts) {
if (ts->probs) {
if (ts->probs->numProblems > 0)
@ -290,16 +319,16 @@ rpmProblemSet rpmtsGetProblems(rpmTransactionSet ts)
return ps;
}
void rpmtsClean(rpmTransactionSet ts)
void rpmtsClean(rpmts ts)
{
if (ts) {
teIterator pi; transactionElement p;
rpmtei pi; rpmte p;
/* Clean up after dependency checks. */
pi = teInitIterator(ts);
while ((p = teNextIterator(pi)) != NULL)
teCleanDS(p);
pi = teFreeIterator(pi);
pi = rpmteiInit(ts);
while ((p = rpmteiNext(pi, 0)) != NULL)
rpmteCleanDS(p);
pi = rpmteiFree(pi);
ts->addedPackages = alFree(ts->addedPackages);
ts->numAddedPackages = 0;
@ -307,7 +336,7 @@ void rpmtsClean(rpmTransactionSet ts)
ts->suggests = _free(ts->suggests);
ts->nsuggests = 0;
ts->probs = rpmProblemSetFree(ts->probs);
ts->probs = rpmpsFree(ts->probs);
if (ts->sig != NULL)
ts->sig = headerFreeData(ts->sig, ts->sigtype);
@ -317,10 +346,10 @@ void rpmtsClean(rpmTransactionSet ts)
}
}
rpmTransactionSet rpmtsFree(rpmTransactionSet ts)
rpmts rpmtsFree(rpmts ts)
{
if (ts) {
teIterator pi; transactionElement p;
rpmtei pi; rpmte p;
int oc;
(void) rpmtsUnlink(ts, "tsCreate");
@ -336,7 +365,7 @@ rpmTransactionSet rpmtsFree(rpmTransactionSet ts)
ts->availablePackages = alFree(ts->availablePackages);
ts->numAvailablePackages = 0;
ts->di = _free(ts->di);
ts->dsi = _free(ts->dsi);
ts->removedPackages = _free(ts->removedPackages);
if (ts->scriptFd != NULL) {
ts->scriptFd =
@ -346,12 +375,12 @@ rpmTransactionSet rpmtsFree(rpmTransactionSet ts)
ts->rootDir = _free(ts->rootDir);
ts->currDir = _free(ts->currDir);
for (pi = teInitIterator(ts), oc = 0; (p = teNextIterator(pi)) != NULL; oc++) {
for (pi = rpmteiInit(ts), oc = 0; (p = rpmteiNext(pi, 0)) != NULL; oc++) {
/*@-type -unqualifiedtrans @*/
ts->order[oc] = teFree(ts->order[oc]);
ts->order[oc] = rpmteFree(ts->order[oc]);
/*@=type =unqualifiedtrans @*/
}
pi = teFreeIterator(pi);
pi = rpmteiFree(pi);
/*@-type +voidabstract @*/ /* FIX: double indirection */
ts->order = _free(ts->order);
/*@=type =voidabstract @*/
@ -371,7 +400,7 @@ rpmTransactionSet rpmtsFree(rpmTransactionSet ts)
return NULL;
}
int rpmtsSetVerifySigFlags(rpmTransactionSet ts, int vsflags)
int rpmtsSetVerifySigFlags(rpmts ts, int vsflags)
/*@modifies ts @*/
{
int ret = 0;
@ -382,7 +411,7 @@ int rpmtsSetVerifySigFlags(rpmTransactionSet ts, int vsflags)
return ret;
}
const char * rpmtsGetRootDir(rpmTransactionSet ts)
const char * rpmtsGetRootDir(rpmts ts)
{
const char * rootDir = NULL;
if (ts != NULL) {
@ -391,7 +420,7 @@ const char * rpmtsGetRootDir(rpmTransactionSet ts)
return rootDir;
}
void rpmtsSetRootDir(rpmTransactionSet ts, const char * rootDir)
void rpmtsSetRootDir(rpmts ts, const char * rootDir)
{
if (ts != NULL) {
size_t rootLen;
@ -419,7 +448,7 @@ void rpmtsSetRootDir(rpmTransactionSet ts, const char * rootDir)
}
}
const char * rpmtsGetCurrDir(rpmTransactionSet ts)
const char * rpmtsGetCurrDir(rpmts ts)
{
const char * currDir = NULL;
if (ts != NULL) {
@ -428,7 +457,7 @@ const char * rpmtsGetCurrDir(rpmTransactionSet ts)
return currDir;
}
void rpmtsSetCurrDir(rpmTransactionSet ts, const char * currDir)
void rpmtsSetCurrDir(rpmts ts, const char * currDir)
{
if (ts != NULL) {
ts->currDir = _free(ts->currDir);
@ -437,7 +466,7 @@ void rpmtsSetCurrDir(rpmTransactionSet ts, const char * currDir)
}
}
FD_t rpmtsGetScriptFd(rpmTransactionSet ts)
FD_t rpmtsGetScriptFd(rpmts ts)
{
FD_t scriptFd = NULL;
if (ts != NULL) {
@ -448,7 +477,7 @@ FD_t rpmtsGetScriptFd(rpmTransactionSet ts)
/*@=compdef =refcounttrans =usereleased@*/
}
void rpmtsSetScriptFd(rpmTransactionSet ts, FD_t scriptFd)
void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
{
if (ts != NULL) {
@ -461,7 +490,7 @@ void rpmtsSetScriptFd(rpmTransactionSet ts, FD_t scriptFd)
}
}
int rpmtsGetChrootDone(rpmTransactionSet ts)
int rpmtsGetChrootDone(rpmts ts)
{
int chrootDone = 0;
if (ts != NULL) {
@ -470,7 +499,7 @@ int rpmtsGetChrootDone(rpmTransactionSet ts)
return chrootDone;
}
int rpmtsSetChrootDone(rpmTransactionSet ts, int chrootDone)
int rpmtsSetChrootDone(rpmts ts, int chrootDone)
{
int ochrootDone = 0;
if (ts != NULL) {
@ -482,7 +511,7 @@ int rpmtsSetChrootDone(rpmTransactionSet ts, int chrootDone)
return ochrootDone;
}
int_32 rpmtsGetTid(rpmTransactionSet ts)
int_32 rpmtsGetTid(rpmts ts)
{
int_32 tid = 0;
if (ts != NULL) {
@ -491,7 +520,7 @@ int_32 rpmtsGetTid(rpmTransactionSet ts)
return tid;
}
int_32 rpmtsSetTid(rpmTransactionSet ts, int_32 tid)
int_32 rpmtsSetTid(rpmts ts, int_32 tid)
{
int_32 otid = 0;
if (ts != NULL) {
@ -501,7 +530,7 @@ int_32 rpmtsSetTid(rpmTransactionSet ts, int_32 tid)
return otid;
}
rpmdb rpmtsGetRdb(rpmTransactionSet ts)
rpmdb rpmtsGetRdb(rpmts ts)
{
rpmdb rdb = NULL;
if (ts != NULL) {
@ -512,7 +541,168 @@ rpmdb rpmtsGetRdb(rpmTransactionSet ts)
/*@=compdef =refcounttrans =usereleased @*/
}
rpmtsFlags rpmtsGetFlags(rpmTransactionSet ts)
int rpmtsInitDSI(const rpmts ts)
{
rpmDiskSpaceInfo dsi;
struct stat sb;
int rc;
int i;
if (ts->ignoreSet & RPMPROB_FILTER_DISKSPACE)
return 0;
rc = rpmGetFilesystemList(&ts->filesystems, &ts->filesystemCount);
if (rc || ts->filesystems == NULL || ts->filesystemCount <= 0)
return rc;
/* Get available space on mounted file systems. */
rpmMessage(RPMMESS_DEBUG, _("getting list of mounted filesystems\n"));
ts->dsi = _free(ts->dsi);
ts->dsi = xcalloc((ts->filesystemCount + 1), sizeof(*ts->dsi));
dsi = ts->dsi;
if (dsi != NULL)
for (i = 0; (i < ts->filesystemCount) && dsi; i++, dsi++) {
#if STATFS_IN_SYS_STATVFS
struct statvfs sfb;
memset(&sfb, 0, sizeof(sfb));
rc = statvfs(ts->filesystems[i], &sfb);
#else
struct statfs sfb;
memset(&sfb, 0, sizeof(sfb));
# if STAT_STATFS4
/* This platform has the 4-argument version of the statfs call. The last two
* should be the size of struct statfs and 0, respectively. The 0 is the
* filesystem type, and is always 0 when statfs is called on a mounted
* filesystem, as we're doing.
*/
rc = statfs(ts->filesystems[i], &sfb, sizeof(sfb), 0);
# else
rc = statfs(ts->filesystems[i], &sfb);
# endif
#endif
if (rc)
break;
rc = stat(ts->filesystems[i], &sb);
if (rc)
break;
dsi->dev = sb.st_dev;
dsi->bsize = sfb.f_bsize;
dsi->bneeded = 0;
dsi->ineeded = 0;
#ifdef STATFS_HAS_F_BAVAIL
dsi->bavail = sfb.f_bavail;
#else
/* FIXME: the statfs struct doesn't have a member to tell how many blocks are
* available for non-superusers. f_blocks - f_bfree is probably too big, but
* it's about all we can do.
*/
dsi->bavail = sfb.f_blocks - sfb.f_bfree;
#endif
/* XXX Avoid FAT and other file systems that have not inodes. */
dsi->iavail = !(sfb.f_ffree == 0 && sfb.f_files == 0)
? sfb.f_ffree : -1;
}
return rc;
}
void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize,
fileAction action)
{
rpmDiskSpaceInfo dsi;
uint_32 bneeded;
dsi = ts->dsi;
if (dsi) {
while (dsi->bsize && dsi->dev != dev)
dsi++;
if (dsi->bsize == 0)
dsi = NULL;
}
if (dsi == NULL)
return;
bneeded = BLOCK_ROUND(fileSize, dsi->bsize);
switch (action) {
case FA_BACKUP:
case FA_SAVE:
case FA_ALTNAME:
dsi->ineeded++;
dsi->bneeded += bneeded;
/*@switchbreak@*/ break;
/*
* FIXME: If two packages share a file (same md5sum), and
* that file is being replaced on disk, will dsi->bneeded get
* adjusted twice? Quite probably!
*/
case FA_CREATE:
dsi->bneeded += bneeded;
dsi->bneeded -= BLOCK_ROUND(prevSize, dsi->bsize);
/*@switchbreak@*/ break;
case FA_ERASE:
dsi->ineeded--;
dsi->bneeded -= bneeded;
/*@switchbreak@*/ break;
default:
/*@switchbreak@*/ break;
}
if (fixupSize)
dsi->bneeded -= BLOCK_ROUND(fixupSize, dsi->bsize);
}
void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
{
rpmDiskSpaceInfo dsi;
rpmps ps;
int fc;
int i;
if (ts->filesystems == NULL || ts->filesystemCount <= 0)
return;
dsi = ts->dsi;
if (dsi == NULL)
return;
fc = rpmfiFC( rpmteFI(te, RPMTAG_BASENAMES) );
if (fc <= 0)
return;
ps = rpmtsGetProblems(ts);
for (i = 0; i < ts->filesystemCount; i++, dsi++) {
/* XXX Avoid FAT and other file systems that have not inodes. */
if (dsi->iavail <= 0)
continue;
if (adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
rpmpsAppend(ps, RPMPROB_DISKSPACE,
rpmteNEVR(te), rpmteKey(te),
ts->filesystems[i], NULL, NULL,
(adj_fs_blocks(dsi->bneeded) - dsi->bavail) * dsi->bsize);
}
if (adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
rpmpsAppend(ps, RPMPROB_DISKNODES,
rpmteNEVR(te), rpmteKey(te),
ts->filesystems[i], NULL, NULL,
(adj_fs_blocks(dsi->ineeded) - dsi->iavail));
}
}
ps = rpmpsFree(ps);
}
rpmtsFlags rpmtsGetFlags(rpmts ts)
{
rpmtsFlags otransFlags = 0;
if (ts != NULL) {
@ -521,7 +711,7 @@ rpmtsFlags rpmtsGetFlags(rpmTransactionSet ts)
return otransFlags;
}
rpmtsFlags rpmtsSetFlags(rpmTransactionSet ts, rpmtsFlags transFlags)
rpmtsFlags rpmtsSetFlags(rpmts ts, rpmtsFlags transFlags)
{
rpmtsFlags otransFlags = 0;
if (ts != NULL) {
@ -531,7 +721,7 @@ rpmtsFlags rpmtsSetFlags(rpmTransactionSet ts, rpmtsFlags transFlags)
return otransFlags;
}
int rpmtsSetNotifyCallback(rpmTransactionSet ts,
int rpmtsSetNotifyCallback(rpmts ts,
rpmCallbackFunction notify, rpmCallbackData notifyData)
{
if (ts != NULL) {
@ -541,22 +731,22 @@ int rpmtsSetNotifyCallback(rpmTransactionSet ts,
return 0;
}
int rpmtsGetKeys(const rpmTransactionSet ts, fnpyKey ** ep, int * nep)
int rpmtsGetKeys(const rpmts ts, fnpyKey ** ep, int * nep)
{
int rc = 0;
if (nep) *nep = ts->orderCount;
if (ep) {
teIterator pi; transactionElement p;
rpmtei pi; rpmte p;
fnpyKey * e;
*ep = e = xmalloc(ts->orderCount * sizeof(*e));
pi = teInitIterator(ts);
while ((p = teNextIterator(pi)) != NULL) {
switch (teGetType(p)) {
pi = rpmteiInit(ts);
while ((p = rpmteiNext(pi, 0)) != NULL) {
switch (rpmteType(p)) {
case TR_ADDED:
/*@-dependenttrans@*/
*e = teGetKey(p);
*e = rpmteKey(p);
/*@=dependenttrans@*/
/*@switchbreak@*/ break;
case TR_REMOVED:
@ -566,20 +756,20 @@ int rpmtsGetKeys(const rpmTransactionSet ts, fnpyKey ** ep, int * nep)
}
e++;
}
pi = teFreeIterator(pi);
pi = rpmteiFree(pi);
}
return rc;
}
rpmTransactionSet rpmtsCreate(void)
rpmts rpmtsCreate(void)
{
rpmTransactionSet ts;
rpmts ts;
ts = xcalloc(1, sizeof(*ts));
ts->goal = TSM_UNKNOWN;
ts->filesystemCount = 0;
ts->filesystems = NULL;
ts->di = NULL;
ts->dsi = NULL;
ts->rdb = NULL;
ts->dbmode = O_RDONLY;

View File

@ -3,7 +3,7 @@
/** \ingroup rpmts
* \file lib/rpmts.h
* Structures and prototypes used for an rpmTransactionSet
* Structures and prototypes used for an "rpmts" transaction set.
*/
#include <rpmhash.h> /* XXX hashTable */
@ -19,6 +19,32 @@ extern int _ts_debug;
extern int _cacheDependsRC;
/*@=exportlocal@*/
/** \ingroup rpmts
*/
typedef /*@abstract@*/ struct diskspaceInfo_s * rpmDiskSpaceInfo;
/** \ingroup rpmts
*/
struct diskspaceInfo_s {
dev_t dev; /*!< File system device number. */
signed long bneeded; /*!< No. of blocks needed. */
signed long ineeded; /*!< No. of inodes needed. */
int bsize; /*!< File system block size. */
signed long bavail; /*!< No. of blocks available. */
signed long iavail; /*!< No. of inodes available. */
};
/** \ingroup rpmts
* Adjust for root only reserved space. On linux e2fs, this is 5%.
*/
#define adj_fs_blocks(_nb) (((_nb) * 21) / 20)
/* argon thought a shift optimization here was a waste of time... he's
probably right :-( */
#define BLOCK_ROUND(size, block) (((size) + (block) - 1) / (block))
/** \ingroup rpmts
*/
typedef enum tsStage_e {
TSM_UNKNOWN = 0,
TSM_INSTALL = 7,
@ -28,12 +54,12 @@ typedef enum tsStage_e {
/** \ingroup rpmts
* The set of packages to be installed/removed atomically.
*/
struct rpmTransactionSet_s {
struct rpmts_s {
rpmtsFlags transFlags; /*!< Bit(s) to control operation. */
tsmStage goal; /*!< Transaction goal (i.e. mode) */
/*@null@*/
int (*solve) (rpmTransactionSet ts, const rpmDepSet key)
int (*solve) (rpmts ts, const rpmds key)
/*@modifies ts @*/; /*!< Search for NEVRA key. */
int nsuggests; /*!< No. of depCheck suggestions. */
/*@only@*/ /*@null@*/
@ -47,7 +73,7 @@ struct rpmTransactionSet_s {
rpmCallbackData notifyData; /*!< Callback private data. */
/*@refcounted@*/ /*@null@*/
rpmProblemSet probs; /*!< Current problems in transaction. */
rpmps probs; /*!< Current problems in transaction. */
rpmprobFilterFlags ignoreSet;
/*!< Bits to filter current problems. */
@ -55,7 +81,7 @@ struct rpmTransactionSet_s {
/*@dependent@*/ /*@null@*/
const char ** filesystems; /*!< Mounted filesystem names. */
/*@only@*/ /*@null@*/
struct diskspaceInfo * di; /*!< Per filesystem disk/inode usage. */
rpmDiskSpaceInfo dsi; /*!< Per filesystem disk/inode usage. */
int dbmode; /*!< Database open mode. */
/*@refcounted@*/ /*@null@*/
@ -78,7 +104,7 @@ struct rpmTransactionSet_s {
int numAvailablePackages; /*!< No. available package instances. */
/*@owned@*/
transactionElement * order; /*!< Packages sorted by dependencies. */
rpmte * order; /*!< Packages sorted by dependencies. */
int orderCount; /*!< No. of transaction elements. */
int orderAlloced; /*!< No. of allocated transaction elements. */
@ -128,7 +154,7 @@ extern "C" {
* @param ts transaction set
* @return 0 on success
*/
int rpmtsCheck(rpmTransactionSet ts)
int rpmtsCheck(rpmts ts)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
@ -151,7 +177,7 @@ int rpmtsCheck(rpmTransactionSet ts)
* @param ts transaction set
* @return no. of (added) packages that could not be ordered
*/
int rpmtsOrder(rpmTransactionSet ts)
int rpmtsOrder(rpmts ts)
/*@globals fileSystem, internalState@*/
/*@modifies ts, fileSystem, internalState @*/;
@ -163,9 +189,7 @@ int rpmtsOrder(rpmTransactionSet ts)
* @param ignoreSet bits to filter problem types
* @return 0 on success, -1 on error, >0 with newProbs set
*/
int rpmtsRun(rpmTransactionSet ts,
rpmProblemSet okProbs,
rpmprobFilterFlags ignoreSet)
int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies ts, rpmGlobalMacroContext,
@ -178,13 +202,13 @@ int rpmtsRun(rpmTransactionSet ts,
* @return NULL always
*/
/*@unused@*/ /*@null@*/
rpmTransactionSet rpmtsUnlink (/*@killref@*/ /*@only@*/ rpmTransactionSet ts,
rpmts rpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
const char * msg)
/*@modifies ts @*/;
/** @todo Remove debugging entry from the ABI. */
/*@null@*/
rpmTransactionSet XrpmtsUnlink (/*@killref@*/ /*@only@*/ rpmTransactionSet ts,
rpmts XrpmtsUnlink (/*@killref@*/ /*@only@*/ rpmts ts,
const char * msg, const char * fn, unsigned ln)
/*@modifies ts @*/;
#define rpmtsUnlink(_ts, _msg) XrpmtsUnlink(_ts, _msg, __FILE__, __LINE__)
@ -196,11 +220,11 @@ rpmTransactionSet XrpmtsUnlink (/*@killref@*/ /*@only@*/ rpmTransactionSet ts,
* @return new transaction set reference
*/
/*@unused@*/
rpmTransactionSet rpmtsLink (rpmTransactionSet ts, const char * msg)
rpmts rpmtsLink (rpmts ts, const char * msg)
/*@modifies ts @*/;
/** @todo Remove debugging entry from the ABI. */
rpmTransactionSet XrpmtsLink (rpmTransactionSet ts,
rpmts XrpmtsLink (rpmts ts,
const char * msg, const char * fn, unsigned ln)
/*@modifies ts @*/;
#define rpmtsLink(_ts, _msg) XrpmtsLink(_ts, _msg, __FILE__, __LINE__)
@ -210,7 +234,7 @@ rpmTransactionSet XrpmtsLink (rpmTransactionSet ts,
* @param ts transaction set
* @return 0 on success
*/
int rpmtsCloseDB(rpmTransactionSet ts)
int rpmtsCloseDB(rpmts ts)
/*@globals fileSystem @*/
/*@modifies ts, fileSystem @*/;
@ -220,7 +244,7 @@ int rpmtsCloseDB(rpmTransactionSet ts)
* @param dbmode O_RDONLY or O_RDWR
* @return 0 on success
*/
int rpmtsOpenDB(rpmTransactionSet ts, int dbmode)
int rpmtsOpenDB(rpmts ts, int dbmode)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
@ -233,7 +257,7 @@ int rpmtsOpenDB(rpmTransactionSet ts, int dbmode)
* @return NULL on failure
*/
/*@only@*/ /*@null@*/
rpmdbMatchIterator rpmtsInitIterator(const rpmTransactionSet ts, int rpmtag,
rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, int rpmtag,
/*@null@*/ const void * keyp, size_t keylen)
/*@globals fileSystem @*/
/*@modifies ts, fileSystem @*/;
@ -245,7 +269,7 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmTransactionSet ts, int rpmtag,
* @return 0 if resolved (and added to ts), 1 not found
*/
/*@-exportlocal@*/
int rpmtsSolve(rpmTransactionSet ts, rpmDepSet ds)
int rpmtsSolve(rpmts ts, rpmds ds)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
/*@=exportlocal@*/
@ -257,7 +281,7 @@ int rpmtsSolve(rpmTransactionSet ts, rpmDepSet ds)
* @return 0 if resolved (and added to ts), 1 not found
*/
/*@unused@*/
int rpmtsAvailable(rpmTransactionSet ts, const rpmDepSet ds)
int rpmtsAvailable(rpmts ts, const rpmds ds)
/*@globals fileSystem @*/
/*@modifies ts, fileSystem @*/;
@ -267,14 +291,14 @@ int rpmtsAvailable(rpmTransactionSet ts, const rpmDepSet ds)
* @return current problem set (or NULL)
*/
/*@null@*/
rpmProblemSet rpmtsGetProblems(rpmTransactionSet ts)
rpmps rpmtsGetProblems(rpmts ts)
/*@modifies ts @*/;
/** \ingroup rpmts
* Re-create an empty transaction set.
* @param ts transaction set
*/
void rpmtsClean(rpmTransactionSet ts)
void rpmtsClean(rpmts ts)
/*@modifies ts @*/;
/** \ingroup rpmts
@ -283,8 +307,7 @@ void rpmtsClean(rpmTransactionSet ts)
* @return NULL always
*/
/*@null@*/
rpmTransactionSet
rpmtsFree(/*@killref@*/ /*@only@*//*@null@*/ rpmTransactionSet ts)
rpmts rpmtsFree(/*@killref@*/ /*@only@*//*@null@*/ rpmts ts)
/*@globals fileSystem @*/
/*@modifies ts, fileSystem @*/;
@ -294,7 +317,7 @@ rpmtsFree(/*@killref@*/ /*@only@*//*@null@*/ rpmTransactionSet ts)
* @param vsflags new verify signatures flags
* @retrun previous value
*/
int rpmtsSetVerifySigFlags(rpmTransactionSet ts, int vsflags)
int rpmtsSetVerifySigFlags(rpmts ts, int vsflags)
/*@modifies ts @*/;
/** \ingroup rpmts
@ -303,7 +326,7 @@ int rpmtsSetVerifySigFlags(rpmTransactionSet ts, int vsflags)
* @return transaction rootDir
*/
/*@observer@*/ /*@null@*/
const char * rpmtsGetRootDir(rpmTransactionSet ts)
const char * rpmtsGetRootDir(rpmts ts)
/*@*/;
/** \ingroup rpmts
@ -311,7 +334,7 @@ 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(rpmts ts, /*@null@*/ const char * rootDir)
/*@modifies ts @*/;
/** \ingroup rpmts
@ -320,7 +343,7 @@ void rpmtsSetRootDir(rpmTransactionSet ts, /*@null@*/ const char * rootDir)
* @return transaction currDir
*/
/*@observer@*/ /*@null@*/
const char * rpmtsGetCurrDir(rpmTransactionSet ts)
const char * rpmtsGetCurrDir(rpmts ts)
/*@*/;
/** \ingroup rpmts
@ -328,7 +351,7 @@ const char * rpmtsGetCurrDir(rpmTransactionSet ts)
* @param ts transaction set
* @param currDir new transaction currDir (or NULL)
*/
void rpmtsSetCurrDir(rpmTransactionSet ts, /*@null@*/ const char * currDir)
void rpmtsSetCurrDir(rpmts ts, /*@null@*/ const char * currDir)
/*@modifies ts @*/;
/** \ingroup rpmts
@ -337,7 +360,7 @@ void rpmtsSetCurrDir(rpmTransactionSet ts, /*@null@*/ const char * currDir)
* @return transaction script file handle
*/
/*@null@*/
FD_t rpmtsGetScriptFd(rpmTransactionSet ts)
FD_t rpmtsGetScriptFd(rpmts ts)
/*@*/;
/** \ingroup rpmts
@ -345,7 +368,7 @@ FD_t rpmtsGetScriptFd(rpmTransactionSet ts)
* @param ts transaction set
* @param scriptFd new script file handle (or NULL)
*/
void rpmtsSetScriptFd(rpmTransactionSet ts, /*@null@*/ FD_t scriptFd)
void rpmtsSetScriptFd(rpmts ts, /*@null@*/ FD_t scriptFd)
/*@modifies ts, scriptFd @*/;
/** \ingroup rpmts
@ -353,7 +376,7 @@ void rpmtsSetScriptFd(rpmTransactionSet ts, /*@null@*/ FD_t scriptFd)
* @param ts transaction set
* @return chrootDone flag
*/
int rpmtsGetChrootDone(rpmTransactionSet ts)
int rpmtsGetChrootDone(rpmts ts)
/*@*/;
/** \ingroup rpmts
@ -362,7 +385,7 @@ int rpmtsGetChrootDone(rpmTransactionSet ts)
* @param chrootDone new chrootDone flag
* @return previous chrootDone flag
*/
int rpmtsSetChrootDone(rpmTransactionSet ts, int chrootDone)
int rpmtsSetChrootDone(rpmts ts, int chrootDone)
/*@modifies ts @*/;
/** \ingroup rpmts
@ -370,7 +393,7 @@ int rpmtsSetChrootDone(rpmTransactionSet ts, int chrootDone)
* @param ts transaction set
* @return chrootDone flag
*/
int_32 rpmtsGetTid(rpmTransactionSet ts)
int_32 rpmtsGetTid(rpmts ts)
/*@*/;
/** \ingroup rpmts
@ -379,7 +402,7 @@ int_32 rpmtsGetTid(rpmTransactionSet ts)
* @param tid new transaction id
* @return previous transaction id
*/
int_32 rpmtsSetTid(rpmTransactionSet ts, int_32 tid)
int_32 rpmtsSetTid(rpmts ts, int_32 tid)
/*@modifies ts @*/;
/** \ingroup rpmts
@ -388,24 +411,55 @@ int_32 rpmtsSetTid(rpmTransactionSet ts, int_32 tid)
* @return transaction database handle
*/
/*@null@*/
rpmdb rpmtsGetRdb(rpmTransactionSet ts)
rpmdb rpmtsGetRdb(rpmts ts)
/*@*/;
/** \ingroup rpmts
* Get transaction flags, i.e. bits to control rpmtsRun().
* Initialize disk space info for each and every mounted file systems.
* @param ts transaction set
* @return 0 on success
*/
int rpmtsInitDSI(const rpmts ts)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState @*/;
/** \ingroup rpmts
* Update disk space info for a file.
* @param ts transaction set
* @param dev mount point device
* @param fileSize file size
* @param prevSize previous file size (if upgrading)
* @param fixupSize size difference (if
* @param action file disposition
*/
void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
uint_32 fileSize, uint_32 prevSize, uint_32 fixupSize,
fileAction action)
/*@modifies ts @*/;
/** \ingroup rpmts
* Check a transaction element for disk space problems.
* @param ts transaction set
* @param te current transaction element
*/
void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
/*@modifies ts @*/;
/** \ingroup rpmts
* Get transaction flags, i.e. bits that control rpmtsRun().
* @param ts transaction set
* @return transaction flags
*/
rpmtsFlags rpmtsGetFlags(rpmTransactionSet ts)
rpmtsFlags rpmtsGetFlags(rpmts ts)
/*@*/;
/** \ingroup rpmts
* Set transaction flags, i.e. bits to control rpmtsRun().
* Set transaction flags, i.e. bits that control rpmtsRun().
* @param ts transaction set
* @param transFlags new transaction flags
* @return previous transaction flags
*/
rpmtsFlags rpmtsSetFlags(rpmTransactionSet ts, rpmtsFlags transFlags)
rpmtsFlags rpmtsSetFlags(rpmts ts, rpmtsFlags transFlags)
/*@modifies ts @*/;
/** \ingroup rpmts
@ -419,7 +473,7 @@ rpmtsFlags rpmtsSetFlags(rpmTransactionSet ts, rpmtsFlags transFlags)
* @param notifyData progress callback private data
* @return 0 on success
*/
int rpmtsSetNotifyCallback(rpmTransactionSet ts,
int rpmtsSetNotifyCallback(rpmts ts,
/*@observer@*/ rpmCallbackFunction notify,
/*@observer@*/ rpmCallbackData notifyData)
/*@modifies ts @*/;
@ -429,7 +483,7 @@ int rpmtsSetNotifyCallback(rpmTransactionSet ts,
* @return new transaction set
*/
/*@only@*/
rpmTransactionSet rpmtsCreate(void)
rpmts rpmtsCreate(void)
/*@*/;
/** \ingroup rpmts
@ -449,7 +503,7 @@ rpmTransactionSet rpmtsCreate(void)
* @param relocs package file relocations
* @return 0 on success, 1 on I/O error, 2 needs capabilities
*/
int rpmtsAddPackage(rpmTransactionSet ts, Header h,
int rpmtsAddPackage(rpmts ts, Header h,
/*@exposed@*/ /*@null@*/ const fnpyKey key, int upgrade,
/*@null@*/ rpmRelocation * relocs)
/*@globals fileSystem, internalState @*/
@ -463,7 +517,7 @@ int rpmtsAddPackage(rpmTransactionSet ts, Header h,
* @param key package private data
*/
/*@unused@*/
void rpmtsAvailablePackage(rpmTransactionSet ts, Header h,
void rpmtsAvailablePackage(rpmts ts, Header h,
/*@exposed@*/ /*@null@*/ fnpyKey key)
/*@modifies h, ts @*/;
@ -474,7 +528,7 @@ void rpmtsAvailablePackage(rpmTransactionSet ts, Header h,
* @param dboffset rpm database instance
* @return 0 on success
*/
int rpmtsRemovePackage(rpmTransactionSet ts, Header h, int dboffset)
int rpmtsRemovePackage(rpmts ts, Header h, int dboffset)
/*@modifies ts, h @*/;
/** \ingroup rpmts
@ -486,7 +540,7 @@ int rpmtsRemovePackage(rpmTransactionSet ts, Header h, int dboffset)
* @return 0 always
*/
/*@unused@*/
int rpmtsGetKeys(rpmTransactionSet ts,
int rpmtsGetKeys(rpmts ts,
/*@null@*/ /*@out@*/ fnpyKey ** ep,
/*@null@*/ /*@out@*/ int * nep)
/*@modifies ts, ep, nep @*/;

View File

@ -8,6 +8,7 @@
#include <rpmlib.h>
#include <rpmmacro.h> /* XXX for rpmGetPath() */
#include "rpmdb.h"
#include "rpmps.h"
#include "rpmts.h"
@ -17,7 +18,7 @@
#include "signature.h"
#include "debug.h"
/*@access rpmTransactionSet@*/
/*@access rpmts @*/
/*@access Header@*/ /* XXX compared with NULL */
/*@access FD_t@*/ /* XXX compared with NULL */
/*@access DIGEST_CTX@*/ /* XXX compared with NULL */
@ -790,7 +791,7 @@ static /*@observer@*/ const char * rpmSigString(rpmVerifySignatureReturn res)
}
static rpmVerifySignatureReturn
verifySizeSignature(const rpmTransactionSet ts, /*@out@*/ char * t)
verifySizeSignature(const rpmts ts, /*@out@*/ char * t)
/*@modifies *t @*/
{
rpmVerifySignatureReturn res;
@ -824,7 +825,7 @@ exit:
}
static rpmVerifySignatureReturn
verifyMD5Signature(const rpmTransactionSet ts, /*@out@*/ char * t,
verifyMD5Signature(const rpmts ts, /*@out@*/ char * t,
/*@null@*/ DIGEST_CTX md5ctx)
/*@modifies *t @*/
{
@ -874,7 +875,7 @@ exit:
* @return RPMSIG_OK on success
*/
static rpmVerifySignatureReturn
verifySHA1Signature(const rpmTransactionSet ts, /*@out@*/ char * t,
verifySHA1Signature(const rpmts ts, /*@out@*/ char * t,
/*@null@*/ DIGEST_CTX sha1ctx)
/*@modifies *t @*/
{
@ -920,7 +921,7 @@ exit:
* @return RPMSIG_OK on success, RPMSIG_NOKEY if not found
*/
static rpmVerifySignatureReturn
rpmtsFindPubkey(rpmTransactionSet ts)
rpmtsFindPubkey(rpmts ts)
/*@globals fileSystem, internalState @*/
/*@modifies ts, fileSystem, internalState */
{
@ -1058,7 +1059,7 @@ static inline unsigned char nibble(char c)
* @return RPMSIG_OK on success
*/
static rpmVerifySignatureReturn
verifyPGPSignature(rpmTransactionSet ts, /*@out@*/ char * t,
verifyPGPSignature(rpmts ts, /*@out@*/ char * t,
/*@null@*/ DIGEST_CTX md5ctx)
/*@globals fileSystem, internalState @*/
/*@modifies ts, *t, fileSystem, internalState */
@ -1167,7 +1168,7 @@ exit:
* @return RPMSIG_OK on success
*/
static rpmVerifySignatureReturn
verifyGPGSignature(rpmTransactionSet ts, /*@out@*/ char * t,
verifyGPGSignature(rpmts ts, /*@out@*/ char * t,
/*@null@*/ DIGEST_CTX sha1ctx)
/*@globals fileSystem, internalState @*/
/*@modifies ts, *t, fileSystem, internalState */
@ -1249,7 +1250,7 @@ exit:
}
rpmVerifySignatureReturn
rpmVerifySignature(const rpmTransactionSet ts, char * result)
rpmVerifySignature(const rpmts ts, char * result)
{
rpmVerifySignatureReturn res;

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,7 @@ static const char * ftsInfoStr(int fts_info) {
return ftsInfoStrings[ fts_info ];
}
static int ftsPrint(FTS * ftsp, FTSENT * fts, rpmTransactionSet ts)
static int ftsPrint(FTS * ftsp, FTSENT * fts, rpmts ts)
{
struct ftsglob_s * bhg;
const char ** patterns;
@ -290,7 +290,7 @@ main(int argc, const char *argv[])
{
poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
const char * rootDir = "";
rpmTransactionSet ts = NULL;
rpmts ts = NULL;
FTS * ftsp;
int ftsOpts = (FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOSTAT);
FTSENT * fts;
@ -370,7 +370,7 @@ if (!_debug) {
#ifdef NOTYET
if (!_debug) {
{ rpmProblemSet ps;
{ rpmps ps;
xx = rpmtsCheck(ts);
@ -379,7 +379,7 @@ if (!_debug) {
rpmMessage(RPMMESS_ERROR, _("Failed dependencies:\n"));
printDepProblems(stderr, ps);
}
ps = rpmProblemSetFree(ts);
ps = rpmpsFree(ts);
}
(void) rpmtsOrder(ts);

View File

@ -7,6 +7,7 @@
#include <rpmio_internal.h> /* XXX PGPHASHALGO and RPMDIGEST_NONE */
#include <rpmlib.h>
#include "rpmps.h"
#include "psm.h"
#include "rpmfi.h"
@ -19,20 +20,20 @@
#include "misc.h" /* XXX for uidToUname() and gnameToGid() */
#include "debug.h"
/*@access rpmProblemSet @*/
/*@access rpmps @*/
/*@access rpmProblem @*/
/*@access PSM_t @*/ /* XXX for %verifyscript through psmStage() */
/*@access FD_t @*/ /* XXX compared with NULL */
#define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
int rpmVerifyFile(const rpmTransactionSet ts, const TFI_t fi,
int rpmVerifyFile(const rpmts ts, const rpmfi fi,
rpmVerifyAttrs * result, rpmVerifyAttrs omitMask)
{
unsigned short fmode = tfiGetFMode(fi);
rpmfileAttrs fileAttrs = tfiGetFFlags(fi);
rpmVerifyAttrs flags = tfiGetVFlags(fi);
const char * filespec = tfiGetFN(fi);
unsigned short fmode = rpmfiFMode(fi);
rpmfileAttrs fileAttrs = rpmfiFFlags(fi);
rpmVerifyAttrs flags = rpmfiVFlags(fi);
const char * filespec = rpmfiFN(fi);
const char * rootDir;
int rc;
struct stat sb;
@ -62,7 +63,7 @@ int rpmVerifyFile(const rpmTransactionSet ts, const TFI_t fi,
/*
* Check to see if the file was installed - if not pretend all is OK.
*/
switch (tfiGetFState(fi)) {
switch (rpmfiFState(fi)) {
case RPMFILE_STATE_NETSHARED:
case RPMFILE_STATE_REPLACED:
case RPMFILE_STATE_NOTINSTALLED:
@ -121,7 +122,7 @@ int rpmVerifyFile(const rpmTransactionSet ts, const TFI_t fi,
if (rc)
*result |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
else {
const unsigned char * md5 = tfiGetMD5(fi);
const unsigned char * md5 = rpmfiMD5(fi);
if (md5 == NULL || memcmp(md5sum, md5, sizeof(md5sum)))
*result |= RPMVERIFY_MD5;
}
@ -134,7 +135,7 @@ int rpmVerifyFile(const rpmTransactionSet ts, const TFI_t fi,
if ((size = Readlink(filespec, linkto, sizeof(linkto)-1)) == -1)
*result |= (RPMVERIFY_READLINKFAIL|RPMVERIFY_LINKTO);
else {
const char * flink = tfiGetFLink(fi);
const char * flink = rpmfiFLink(fi);
linkto[size] = '\0';
if (flink == NULL || strcmp(linkto, flink))
*result |= RPMVERIFY_LINKTO;
@ -142,7 +143,7 @@ int rpmVerifyFile(const rpmTransactionSet ts, const TFI_t fi,
}
if (flags & RPMVERIFY_FILESIZE) {
if (sb.st_size != tfiGetFSize(fi))
if (sb.st_size != rpmfiFSize(fi))
*result |= RPMVERIFY_FILESIZE;
}
@ -174,26 +175,26 @@ int rpmVerifyFile(const rpmTransactionSet ts, const TFI_t fi,
{
*result |= RPMVERIFY_RDEV;
} else if (S_ISDEV(fmode) && S_ISDEV(sb.st_mode)) {
if (sb.st_rdev != tfiGetFRdev(fi))
if (sb.st_rdev != rpmfiFRdev(fi))
*result |= RPMVERIFY_RDEV;
}
}
if (flags & RPMVERIFY_MTIME) {
if (sb.st_mtime != tfiGetFMtime(fi))
if (sb.st_mtime != rpmfiFMtime(fi))
*result |= RPMVERIFY_MTIME;
}
if (flags & RPMVERIFY_USER) {
const char * name = uidToUname(sb.st_uid);
const char * fuser = tfiGetFUser(fi);
const char * fuser = rpmfiFUser(fi);
if (name == NULL || fuser == NULL || strcmp(name, fuser))
*result |= RPMVERIFY_USER;
}
if (flags & RPMVERIFY_GROUP) {
const char * name = uidToUname(sb.st_gid);
const char * fgroup = tfiGetFGroup(fi);
const char * fgroup = rpmfiFGroup(fi);
if (name == NULL || fgroup == NULL || strcmp(name, fgroup))
*result |= RPMVERIFY_GROUP;
}
@ -210,8 +211,8 @@ int rpmVerifyFile(const rpmTransactionSet ts, const TFI_t fi,
* @param scriptFd file handle to use for stderr (or NULL)
* @return 0 on success
*/
static int rpmVerifyScript(/*@unused@*/ QVA_t qva, rpmTransactionSet ts,
TFI_t fi, /*@null@*/ FD_t scriptFd)
static int rpmVerifyScript(/*@unused@*/ QVA_t qva, rpmts ts,
rpmfi fi, /*@null@*/ FD_t scriptFd)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, fi, scriptFd, rpmGlobalMacroContext,
fileSystem, internalState @*/
@ -247,7 +248,7 @@ static int rpmVerifyScript(/*@unused@*/ QVA_t qva, rpmTransactionSet ts,
* @param fi file info set
* @return 0 no problems, 1 problems found
*/
static int verifyHeader(QVA_t qva, const rpmTransactionSet ts, TFI_t fi)
static int verifyHeader(QVA_t qva, const rpmts ts, rpmfi fi)
/*@globals fileSystem, internalState @*/
/*@modifies fi, fileSystem, internalState @*/
{
@ -264,13 +265,13 @@ static int verifyHeader(QVA_t qva, const rpmTransactionSet ts, TFI_t fi)
*te = '\0';
fi = rpmfiLink(fi, "verifyHeader");
fi = tfiInit(fi, 0);
fi = rpmfiInit(fi, 0);
if (fi != NULL) /* XXX lclint */
while ((i = tfiNext(fi)) >= 0) {
while ((i = rpmfiNext(fi)) >= 0) {
rpmfileAttrs fileAttrs;
int rc;
fileAttrs = tfiGetFFlags(fi);
fileAttrs = rpmfiFFlags(fi);
/* If not verifying %ghost, skip ghost files. */
if (!(qva->qva_fflags & RPMFILE_GHOST)
@ -280,7 +281,7 @@ static int verifyHeader(QVA_t qva, const rpmTransactionSet ts, TFI_t fi)
rc = rpmVerifyFile(ts, fi, &verifyResult, omitMask);
if (rc) {
if (!(fileAttrs & RPMFILE_MISSINGOK) || rpmIsVerbose()) {
sprintf(te, _("missing %s"), tfiGetFN(fi));
sprintf(te, _("missing %s"), rpmfiFN(fi));
te += strlen(te);
ec = rc;
}
@ -321,7 +322,7 @@ static int verifyHeader(QVA_t qva, const rpmTransactionSet ts, TFI_t fi)
(fileAttrs & RPMFILE_GHOST) ? 'g' :
(fileAttrs & RPMFILE_LICENSE) ? 'l' :
(fileAttrs & RPMFILE_README) ? 'r' : ' '),
tfiGetFN(fi));
rpmfiFN(fi));
te += strlen(te);
}
@ -345,12 +346,12 @@ static int verifyHeader(QVA_t qva, const rpmTransactionSet ts, TFI_t fi)
* @param h header
* @return 0 no problems, 1 problems found
*/
static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmTransactionSet ts,
static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmts ts,
Header h)
/*@globals fileSystem, internalState @*/
/*@modifies ts, h, fileSystem, internalState @*/
{
rpmProblemSet ps;
rpmps ps;
int rc = 0; /* assume no problems */
int xx;
int i;
@ -385,7 +386,7 @@ static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmTransactionSet ts,
/* XXX FIXME: should probably supply the "[R|C] " type prefix */
te = stpcpy(te, altNEVR+2);
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
if (te > t) {
*te++ = '\n';
@ -403,14 +404,14 @@ static int verifyDependencies(/*@unused@*/ QVA_t qva, rpmTransactionSet ts,
return rc;
}
int showVerifyPackage(QVA_t qva, rpmTransactionSet ts, Header h)
int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
{
int scareMem = 1; /* XXX only rpmVerifyScript needs now */
TFI_t fi;
rpmfi fi;
int ec = 0;
int rc;
fi = fiNew(ts, NULL, h, RPMTAG_BASENAMES, scareMem);
fi = rpmfiNew(ts, NULL, h, RPMTAG_BASENAMES, scareMem);
if (fi != NULL) {
if (qva->qva_flags & VERIFY_DEPS) {
@ -431,13 +432,13 @@ int showVerifyPackage(QVA_t qva, rpmTransactionSet ts, Header h)
rc = Fclose(fdo);
}
fi = fiFree(fi, 1);
fi = rpmfiFree(fi, 1);
}
return ec;
}
int rpmcliVerify(rpmTransactionSet ts, QVA_t qva, const char ** argv)
int rpmcliVerify(rpmts ts, QVA_t qva, const char ** argv)
{
const char * arg;
int vsflags;

View File

@ -34,7 +34,6 @@ lib/misc.c
lib/package.c
lib/poptI.c
lib/poptQV.c
lib/problems.c
lib/psm.c
lib/query.c
lib/rpmal.c
@ -42,6 +41,7 @@ lib/rpmchecksig.c
lib/rpmds.c
lib/rpminstall.c
lib/rpmlead.c
lib/rpmps.c
lib/rpmrc.c
lib/rpmte.c
lib/rpmts.c

725
po/cs.po

File diff suppressed because it is too large Load Diff

727
po/da.po

File diff suppressed because it is too large Load Diff

733
po/de.po

File diff suppressed because it is too large Load Diff

725
po/fi.po

File diff suppressed because it is too large Load Diff

721
po/fr.po

File diff suppressed because it is too large Load Diff

721
po/gl.po

File diff suppressed because it is too large Load Diff

721
po/is.po

File diff suppressed because it is too large Load Diff

743
po/ja.po

File diff suppressed because it is too large Load Diff

737
po/ko.po

File diff suppressed because it is too large Load Diff

725
po/no.po

File diff suppressed because it is too large Load Diff

729
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

721
po/ro.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

725
po/ru.po

File diff suppressed because it is too large Load Diff

725
po/sk.po

File diff suppressed because it is too large Load Diff

729
po/sl.po

File diff suppressed because it is too large Load Diff

725
po/sr.po

File diff suppressed because it is too large Load Diff

725
po/sv.po

File diff suppressed because it is too large Load Diff

725
po/tr.po

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
#include "rpmio_internal.h"
#include "rpmcli.h" /* XXX for rpmCheckSig */
#include "rpmps.h"
#include "rpmfi.h"
#include "rpmts.h" /* XXX for ts->rpmdb */
@ -178,21 +179,21 @@ static PyObject * hdrVerifyFile(hdrObject * s, PyObject * args) {
fileNumber = (int) PyInt_AsLong(args);
{ rpmTransactionSet ts;
{ rpmts ts;
int scareMem = 1;
TFI_t fi;
rpmfi fi;
int rc;
ts = rpmtsCreate();
fi = fiNew(ts, NULL, s->h, RPMTAG_BASENAMES, scareMem);
fi = tfiInit(fi, fileNumber);
if (fi != NULL && tfiNext(fi) >= 0) {
fi = rpmfiNew(ts, NULL, s->h, RPMTAG_BASENAMES, scareMem);
fi = rpmfiInit(fi, fileNumber);
if (fi != NULL && rpmfiNext(fi) >= 0) {
/* XXX this routine might use callbacks intelligently. */
rc = rpmVerifyFile(ts, fi, &verifyResult, RPMVERIFY_NONE);
} else
rc = 1;
fi = fiFree(fi, 1);
fi = rpmfiFree(fi, 1);
rpmtsFree(ts);
if (rc) {
@ -781,7 +782,7 @@ PyObject * rpmHeaderFromPackage(PyObject * self, PyObject * args) {
if (!PyArg_ParseTuple(args, "i", &rawFd)) return NULL;
fd = fdDup(rawFd);
{ rpmTransactionSet ts;
{ rpmts ts;
ts = rpmtsCreate();
rc = rpmReadPackageFile(ts, fd, "rpmHeaderFromPackage", &header);
rpmtsFree(ts);

View File

@ -19,6 +19,7 @@
#include "rpmcli.h" /* XXX for rpmCheckSig */
#include "rpmdb.h"
#include "rpmps.h"
#include "rpmts.h" /* XXX for ts->rpmdb */
#include "legacy.h"
@ -159,7 +160,7 @@ typedef struct rpmtsObject_s rpmtsObject;
struct rpmtsObject_s {
PyObject_HEAD;
rpmdbObject * dbo;
rpmTransactionSet ts;
rpmts ts;
PyObject * keyList; /* keeps reference counts correct */
FD_t scriptFd;
} ;
@ -235,7 +236,7 @@ static PyObject * py_rpmtsRemove(rpmtsObject * s, PyObject * args) {
/** \ingroup python
*/
static PyObject * py_rpmtsDepCheck(rpmtsObject * s, PyObject * args) {
rpmProblemSet ps;
rpmps ps;
rpmProblem p;
PyObject * list, * cf;
int i;
@ -306,7 +307,7 @@ static PyObject * py_rpmtsDepCheck(rpmtsObject * s, PyObject * args) {
Py_DECREF(cf);
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
return list;
}
@ -420,7 +421,7 @@ static PyObject * py_rpmtsRun(rpmtsObject * s, PyObject * args)
int flags, ignoreSet;
int rc, i;
PyObject * list;
rpmProblemSet ps;
rpmps ps;
struct tsCallbackType cbInfo;
if (!PyArg_ParseTuple(args, "iiOO", &flags, &ignoreSet, &cbInfo.cb,
@ -436,7 +437,7 @@ static PyObject * py_rpmtsRun(rpmtsObject * s, PyObject * args)
ps = rpmtsGetProblems(s->ts);
if (cbInfo.pythonError) {
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
return NULL;
}
@ -459,7 +460,7 @@ static PyObject * py_rpmtsRun(rpmtsObject * s, PyObject * args)
Py_DECREF(prob);
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
return list;
}
@ -837,7 +838,7 @@ static PyObject * checkSig (PyObject * self, PyObject * args) {
int rc = 255;
if (PyArg_ParseTuple(args, "si", &filename, &flags)) {
rpmTransactionSet ts;
rpmts ts;
const char * av[2];
QVA_t ka = memset(alloca(sizeof(*ka)), 0, sizeof(*ka));

View File

@ -20,7 +20,7 @@ Name: rpm
%define version @VERSION@
Version: %{version}
%{expand: %%define rpm_version %{version}}
Release: 0.14
Release: 0.15
Group: System Environment/Base
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz
Copyright: GPL
@ -521,6 +521,9 @@ fi
%{__prefix}/include/popt.h
%changelog
* Sun May 19 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.15
- Grand Renaming of rpm data types.
* Thu May 16 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.14
- opaque (well mostly) rpmTransactionSet using methods.

View File

@ -30,7 +30,7 @@ int main(int argc, char **argv)
}
fdo = fdDup(STDOUT_FILENO);
{ rpmTransactionSet ts = rpmtsCreate();
{ rpmts ts = rpmtsCreate();
/*@-mustmod@*/ /* LCL: segfault */
rc = rpmReadPackageFile(ts, fdi, "rpm2cpio", &h);

View File

@ -58,7 +58,7 @@
* will be added to headers.
*
* - Private header methods.
* - Private methods for the transaction element file info TFI_t may
* - Private methods for the transaction element file info rpmfi may
* be used as proof-of-concept, binary XML may be implemented
* as a header format representation soon thereafter.
* - DSA signature for header metadata.

View File

@ -14,6 +14,7 @@
#include <rpmbuild.h>
#include "rpmdb.h"
#include "rpmps.h"
#include "rpmts.h"
#define POPT_NODEPS 1025
@ -292,7 +293,7 @@ int main(int argc, const char ** argv)
/*@modifies __assert_program_name,
fileSystem, internalState@*/
{
rpmTransactionSet ts = NULL;
rpmts ts = NULL;
enum modes bigMode = MODE_UNKNOWN;
#ifdef IAM_RPMQV

View File

@ -5,6 +5,7 @@
#include <rpmurl.h>
#include "rpmdb.h"
#include "rpmps.h"
#include "rpmte.h"
#include "rpmts.h"
@ -45,7 +46,7 @@ static int
do_tsort(const char *fileArgv[])
{
const char * rootdir = "/";
rpmTransactionSet ts = NULL;
rpmts ts = NULL;
const char ** pkgURL = NULL;
char * pkgState = NULL;
const char ** fnp;
@ -210,7 +211,7 @@ restart:
if (numFailed) goto exit;
if (!noDeps) {
rpmProblemSet ps;
rpmps ps;
rc = rpmtsCheck(ts);
@ -218,20 +219,20 @@ restart:
if (ps) {
rpmMessage(RPMMESS_ERROR, _("Failed dependencies:\n"));
printDepProblems(stderr, ps);
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
rc = -1;
goto exit;
}
ps = rpmProblemSetFree(ps);
ps = rpmpsFree(ps);
}
rc = rpmtsOrder(ts);
if (rc)
goto exit;
{ rpmDepSet requires;
teIterator pi; transactionElement p;
teIterator qi; transactionElement q;
{ rpmds requires;
rpmtei pi; rpmte p;
rpmtei qi; rpmte q;
unsigned char * selected =
alloca(sizeof(*selected) * (ts->orderCount + 1));
int oType = TR_ADDED;
@ -241,43 +242,43 @@ fprintf(stdout, "digraph XXX {\n");
fprintf(stdout, " rankdir=LR\n");
fprintf(stdout, "//===== Packages:\n");
pi = teInitIterator(ts);
while ((p = teNext(pi, oType)) != NULL) {
fprintf(stdout, "//%5d%5d %s\n", teGetTree(p), teGetDepth(p), teGetN(p));
q = teGetParent(p);
pi = rpmteiInit(ts);
while ((p = rpmteiNext(pi, oType)) != NULL) {
fprintf(stdout, "//%5d%5d %s\n", rpmteTree(p), rpmteDepth(p), rpmteN(p));
q = rpmteParent(p);
if (q != NULL)
fprintf(stdout, " \"%s\" -> \"%s\"\n", teGetN(p), teGetN(q));
fprintf(stdout, " \"%s\" -> \"%s\"\n", rpmteN(p), rpmteN(q));
else {
fprintf(stdout, " \"%s\"\n", teGetN(p));
fprintf(stdout, " { rank=max ; \"%s\" }\n", teGetN(p));
fprintf(stdout, " \"%s\"\n", rpmteN(p));
fprintf(stdout, " { rank=max ; \"%s\" }\n", rpmteN(p));
}
}
pi = teFreeIterator(pi);
pi = rpmteiFree(pi);
#ifdef NOTNOW
fprintf(stdout, "//===== Relations:\n");
pi = teInitIterator(ts);
while ((p = teNext(pi, oType)) != NULL) {
pi = rpmteiInit(ts);
while ((p = rpmteiNext(pi, oType)) != NULL) {
int printed;
if ((requires = teGetDS(p, RPMTAG_REQUIRENAME)) == NULL)
if ((requires = rpmteDS(p, RPMTAG_REQUIRENAME)) == NULL)
continue;
memset(selected, 0, sizeof(*selected) * ts->orderCount);
selected[teiGetOc(pi)] = 1;
selected[rpmteiGetOc(pi)] = 1;
printed = 0;
requires = dsiInit(requires);
while (dsiNext(requires) >= 0) {
requires = rpmdsInit(requires);
while (rpmdsNext(requires) >= 0) {
int_32 Flags;
const char * qName;
fnpyKey key;
alKey pkgKey;
int i;
Flags = dsiGetFlags(requires);
Flags = rpmdsFlags(requires);
switch (teGetType(p)) {
switch (rpmteType(p)) {
case TR_REMOVED:
/* Skip if not %preun/%postun requires or legacy prereq. */
if (isInstallPreReq(Flags)
@ -300,7 +301,7 @@ fprintf(stdout, "//===== Relations:\n");
/*@switchbreak@*/ break;
}
if ((qName = dsiGetN(requires)) == NULL)
if ((qName = rpmdsN(requires)) == NULL)
continue; /* XXX can't happen */
if (!strncmp(qName, "rpmlib(", sizeof("rpmlib(")-1))
continue;
@ -310,15 +311,15 @@ fprintf(stdout, "//===== Relations:\n");
if (pkgKey == RPMAL_NOMATCH)
continue;
for (qi = teInitIterator(ts), i = 0;
(q = teNextIterator(qi)) != NULL; i++)
for (qi = rpmteiInit(ts), i = 0;
(q = rpmteiNext(qi, 0)) != NULL; i++)
{
if (teGetType(q) == TR_REMOVED)
if (rpmteType(q) == TR_REMOVED)
continue;
if (pkgKey == teGetAddedKey(q))
if (pkgKey == rpmteAddedKey(q))
break;
}
qi = teFreeIterator(qi);
qi = rpmteiFree(qi);
if (q == NULL || i == ts->orderCount)
continue;
@ -326,38 +327,38 @@ fprintf(stdout, "//===== Relations:\n");
continue;
selected[i] = 1;
if (teGetTree(p) == teGetTree(q)) {
int pdepth = teGetDepth(p);
int qdepth = teGetDepth(q);
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(teGetN(q), "glibc")) continue;
if (!strcmp(teGetN(q), "bash")) continue;
if (!strcmp(rpmteN(q), "glibc")) continue;
if (!strcmp(rpmteN(q), "bash")) continue;
}
#endif
if (pdepth > qdepth) {
if (!strcmp(teGetN(q), "glibc")) continue;
if (!strcmp(teGetN(q), "bash")) continue;
if (!strcmp(teGetN(q), "info")) continue;
if (!strcmp(teGetN(q), "mktemp")) continue;
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", teGetN(p));
fprintf(stdout, "// %s\n", rpmteN(p));
printed = 1;
}
fprintf(stdout, "//\t%s (0x%x)\n", dsDNEVR(identifyDepend(Flags), requires), Flags);
fprintf(stdout, "\t\"%s\" -> \"%s\"\n", teGetN(p), teGetN(q));
fprintf(stdout, "//\t%s (0x%x)\n", rpmdsNewDNEVR(identifyDepend(Flags), requires), Flags);
fprintf(stdout, "\t\"%s\" -> \"%s\"\n", rpmteN(p), rpmteN(q));
}
}
pi = teFreeIterator(pi);
pi = rpmteiFree(pi);
#endif /* NOTNOW */
fprintf(stdout, "}\n");

View File

@ -40,7 +40,7 @@ static int indent = 2;
typedef struct Item_s {
const char * path;
rpmDepSet this;
rpmds this;
Header h;
} * Item;
@ -50,7 +50,7 @@ static int nitems = 0;
static inline Item freeItem(Item item) {
if (item != NULL) {
item->path = _free(item->path);
item->this = dsFree(item->this);
item->this = rpmdsFree(item->this);
item->h = headerFree(item->h, NULL);
item = _free(item);
}
@ -65,7 +65,7 @@ static inline Item newItem(void) {
static int cmpItem(const void * a, const void * b) {
Item aitem = *(Item *)a;
Item bitem = *(Item *)b;
int rc = strcmp(dsiGetN(aitem->this), dsiGetN(bitem->this));
int rc = strcmp(rpmdsN(aitem->this), rpmdsN(bitem->this));
return rc;
}
@ -83,10 +83,10 @@ static void ftsPrintPaths(FILE * fp) {
fprintf(fp, "%s\n", items[i]->path);
}
static int ftsStashLatest(FTSENT * fts, rpmTransactionSet ts)
static int ftsStashLatest(FTSENT * fts, rpmts ts)
{
Header h = NULL;
rpmDepSet add;
rpmds add;
int ec = -1; /* assume not found */
int i = 0;
@ -108,7 +108,7 @@ static int ftsStashLatest(FTSENT * fts, rpmTransactionSet ts)
return ec; /* XXX -1 */
}
add = dsThis(h, RPMTAG_REQUIRENAME, (RPMSENSE_EQUAL|RPMSENSE_LESS));
add = rpmdsThis(h, RPMTAG_REQUIRENAME, (RPMSENSE_EQUAL|RPMSENSE_LESS));
if (items != NULL && nitems > 0) {
Item needle = memset(alloca(sizeof(*needle)), 0, sizeof(*needle));
@ -126,7 +126,7 @@ static int ftsStashLatest(FTSENT * fts, rpmTransactionSet ts)
/* Check that all saved items are newer than this item. */
if (found != NULL)
while (found < (items + nitems) && cmpItem(found, fneedle) == 0) {
ec = dsCompare(needle->this, (*found)->this);
ec = rpmdsCompare(needle->this, (*found)->this);
if (ec == 0) {
found++;
continue;
@ -153,7 +153,7 @@ static int ftsStashLatest(FTSENT * fts, rpmTransactionSet ts)
items[i] = newItem();
items[i]->path = xstrdup(fts->fts_path);
items[i]->this = dsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
items[i]->this = rpmdsThis(h, RPMTAG_PROVIDENAME, RPMSENSE_EQUAL);
items[i]->h = headerLink(h, NULL);
if (nitems > 1)
@ -167,7 +167,7 @@ static int ftsStashLatest(FTSENT * fts, rpmTransactionSet ts)
exit:
h = headerFree(h, NULL);
add = dsFree(add);
add = rpmdsFree(add);
return ec;
}
@ -195,7 +195,7 @@ static const char * ftsInfoStr(int fts_info) {
return ftsInfoStrings[ fts_info ];
}
static int ftsPrint(FTS * ftsp, FTSENT * fts, rpmTransactionSet ts)
static int ftsPrint(FTS * ftsp, FTSENT * fts, rpmts ts)
{
struct ftsglob_s * bhg;
const char ** patterns;
@ -419,7 +419,7 @@ main(int argc, const char *argv[])
{
poptContext optCon = poptGetContext(argv[0], argc, argv, optionsTable, 0);
const char * rootDir = "";
rpmTransactionSet ts = NULL;
rpmts ts = NULL;
FTS * ftsp;
FTSENT * fts;
const char ** av;