Pass ts and args to rpmInstall() and rpmErase().

CVS patchset: 5355
CVS date: 2002/03/13 15:06:07
This commit is contained in:
jbj 2002-03-13 15:06:07 +00:00
parent 2c45013b70
commit 976cf8dec7
6 changed files with 86 additions and 75 deletions

View File

@ -182,6 +182,11 @@ struct poptOption rpmInstallPoptTable[] = {
RPMTRANS_FLAG_NOPOSTUN,
N_("do not execute %%postun scriptlet (if any)"), NULL },
{ "nodigest", '\0', POPT_BIT_SET, &rpmIArgs.qva_flags, VERIFY_DIGEST,
N_("don't verify digest(s)"), NULL },
{ "nosignature", '\0', POPT_BIT_SET, &rpmIArgs.qva_flags, VERIFY_SIGNATURE,
N_("don't verify signature(s)"), NULL },
{ "notriggers", '\0', POPT_BIT_SET, &rpmIArgs.transFlags,
_noTransTriggers,
N_("do not execute any scriptlet(s) triggered by this package"), NULL},

View File

@ -423,27 +423,6 @@ extern int packagesTotal;
/*@globals fileSystem, internalState @*/
/*@modifies fileSystem, internalState @*/;
/** \ingroup rpmcli
* Install/upgrade/freshen binary rpm package.
* @param ts transaction set
* @param fileArgv array of package file names (NULL terminated)
* @param transFlags bits to control rpmRunTransactions()
* @param interfaceFlags bits to control rpmInstall()
* @param probFilter bits to filter problem types
* @param relocations package file relocations
* @return 0 on success
*/
int rpmInstall(rpmTransactionSet ts,
/*@null@*/ const char ** fileArgv,
rpmtransFlags transFlags,
rpmInstallInterfaceFlags interfaceFlags,
rpmprobFilterFlags probFilter,
/*@null@*/ rpmRelocation * relocations)
/*@globals packagesTotal, rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies ts, *relocations, packagesTotal, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Install source rpm package.
* @param ts transaction set
@ -460,22 +439,6 @@ int rpmInstallSource(rpmTransactionSet ts, const char * arg,
/*@modifies ts, *specFile, *cookie, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Erase binary rpm package.
* @param ts transaction set
* @param argv array of package file names (NULL terminated)
* @param transFlags bits to control rpmRunTransactions()
* @param interfaceFlags bits to control rpmInstall()
* @return 0 on success
*/
int rpmErase(rpmTransactionSet ts, /*@null@*/ const char ** argv,
rpmtransFlags transFlags,
rpmEraseInterfaceFlags interfaceFlags)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Describe database command line requests.
*/
@ -484,11 +447,12 @@ struct rpmInstallArguments_s {
rpmprobFilterFlags probFilter;
rpmInstallInterfaceFlags installInterfaceFlags;
rpmEraseInterfaceFlags eraseInterfaceFlags;
/*@only@*/ /*@null@*/
/*@owned@*/ /*@null@*/
rpmRelocation * relocations;
int numRelocations;
int noDeps;
int incldocs;
rpmQueryFlags qva_flags; /*!< from --nodigest/--nosignature */
/*@null@*/
const char * prefix;
/*@observer@*/ /*@null@*/
@ -496,6 +460,33 @@ struct rpmInstallArguments_s {
uint_32 rbtid; /*!< from --rollback */
};
/** \ingroup rpmcli
* Install/upgrade/freshen binary rpm package.
* @param ts transaction set
* @param ia mode flags and parameters
* @param fileArgv array of package file names (NULL terminated)
* @return 0 on success
*/
int rpmInstall(rpmTransactionSet ts, struct rpmInstallArguments_s * ia,
/*@null@*/ const char ** fileArgv)
/*@globals packagesTotal, rpmGlobalMacroContext,
fileSystem, internalState@*/
/*@modifies ts, ia, packagesTotal, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/** \ingroup rpmcli
* Erase binary rpm package.
* @param ts transaction set
* @param argv array of package file names (NULL terminated)
* @param transFlags bits to control rpmRunTransactions()
* @param interfaceFlags bits to control rpmInstall()
* @return 0 on success
*/
int rpmErase(rpmTransactionSet ts, const struct rpmInstallArguments_s * ia,
/*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
/**
* A rollback transaction id element.
*/
@ -586,10 +577,8 @@ typedef /*@abstract@*/ struct IDTindex_s {
*/
int rpmRollback(rpmTransactionSet ts, struct rpmInstallArguments_s * ia,
/*@null@*/ const char ** argv)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext,
fileSystem, internalState @*/;
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
/*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
/** \ingroup rpmcli
*/

View File

@ -59,7 +59,6 @@ if (_ds_debug < 0)
fprintf(stderr, "*** ds %p\t%s[%d]\n", ds, ds->Type, ds->Count);
/*@=modfilesystem@*/
if (ds->tagN == RPMTAG_PROVIDENAME) {
tagEVR = RPMTAG_PROVIDEVERSION;
tagF = RPMTAG_PROVIDEFLAGS;

View File

@ -187,30 +187,37 @@ struct rpmEIU {
FD_t fd;
int numFailed;
int numPkgs;
/*@only@*/ str_t * pkgURL;
/*@dependent@*/ /*@null@*/ str_t * fnp;
/*@only@*/ char * pkgState;
/*@only@*/
str_t * pkgURL;
/*@dependent@*/ /*@null@*/
str_t * fnp;
/*@only@*/
char * pkgState;
int prevx;
int pkgx;
int numRPMS;
int numSRPMS;
/*@only@*/ /*@null@*/ str_t * sourceURL;
/*@only@*/ /*@null@*/
str_t * sourceURL;
int isSource;
int argc;
/*@only@*/ /*@null@*/ str_t * argv;
/*@temp@*/ rpmRelocation * relocations;
/*@only@*/ /*@null@*/
str_t * argv;
/*@dependent@*/
rpmRelocation * relocations;
rpmRC rpmrc;
};
/** @todo Generalize --freshen policies. */
int rpmInstall(rpmTransactionSet ts, const char ** fileArgv,
rpmtransFlags transFlags,
rpmInstallInterfaceFlags interfaceFlags,
rpmprobFilterFlags probFilter,
rpmRelocation * relocations)
int rpmInstall(rpmTransactionSet ts,
struct rpmInstallArguments_s * ia,
const char ** fileArgv)
{
struct rpmEIU * eiu = memset(alloca(sizeof(*eiu)), 0, sizeof(*eiu));
int notifyFlags = interfaceFlags | (rpmIsVerbose() ? INSTALL_LABEL : 0 );
rpmInstallInterfaceFlags interfaceFlags;
rpmprobFilterFlags probFilter;
rpmRelocation * relocations;
int notifyFlags;
/*@only@*/ /*@null@*/ const char * fileURL = NULL;
int stopInstall = 0;
const char ** av = NULL;
@ -222,10 +229,18 @@ int rpmInstall(rpmTransactionSet ts, const char ** fileArgv,
if (fileArgv == NULL) goto exit;
/*@-branchstate@*/
ts->transFlags = transFlags;
ts->dbmode = (transFlags & RPMTRANS_FLAG_TEST)
ts->transFlags = ia->transFlags;
interfaceFlags = ia->installInterfaceFlags;
probFilter = ia->probFilter;
relocations = ia->relocations;
ts->nodigests = (ia->qva_flags & VERIFY_DIGEST);
ts->nosignatures = (ia->qva_flags & VERIFY_SIGNATURE);
ts->dbmode = (ts->transFlags & RPMTRANS_FLAG_TEST)
? O_RDONLY : (O_RDWR|O_CREAT);
ts->notify = rpmShowProgress;
notifyFlags = interfaceFlags | (rpmIsVerbose() ? INSTALL_LABEL : 0 );
ts->notifyData = (void *) ((long)notifyFlags);
if ((eiu->relocations = relocations) != NULL) {
@ -545,7 +560,7 @@ restart:
/*@-nullstate@*/ /* FIX: ts->rootDir may be NULL? */
rc = rpmRunTransactions(ts, ts->notify, ts->notifyData,
NULL, &probs, transFlags, probFilter);
NULL, &probs, ts->transFlags, probFilter);
/*@=nullstate@*/
if (rc < 0) {
@ -572,7 +587,7 @@ restart:
continue;
}
if (!(transFlags & RPMTRANS_FLAG_TEST)) {
if (!(ts->transFlags & RPMTRANS_FLAG_TEST)) {
#if !defined(__LCLINT__) /* LCL: segfault */
eiu->rpmrc = rpmInstallSourcePackage(ts, eiu->fd, NULL,
ts->notify, ts->notifyData, NULL);
@ -600,11 +615,10 @@ exit:
return eiu->numFailed;
}
int rpmErase(rpmTransactionSet ts, const char ** argv,
rpmtransFlags transFlags,
rpmEraseInterfaceFlags interfaceFlags)
int rpmErase(rpmTransactionSet ts,
const struct rpmInstallArguments_s * ia,
const char ** argv)
{
int count;
const char ** arg;
int numFailed = 0;
@ -613,12 +627,18 @@ int rpmErase(rpmTransactionSet ts, const char ** argv,
int stopUninstall = 0;
int numPackages = 0;
rpmProblemSet probs;
rpmEraseInterfaceFlags interfaceFlags;
if (argv == NULL) return 0;
ts->transFlags = transFlags;
ts->transFlags = ia->transFlags;
interfaceFlags = ia->eraseInterfaceFlags;
ts->nodigests = (ia->qva_flags & VERIFY_DIGEST);
ts->nosignatures = (ia->qva_flags & VERIFY_SIGNATURE);
/* XXX W2DO? O_EXCL??? */
ts->dbmode = (transFlags & RPMTRANS_FLAG_TEST)
ts->dbmode = (ts->transFlags & RPMTRANS_FLAG_TEST)
? O_RDONLY : (O_RDWR|O_EXCL);
(void) rpmtsOpenDB(ts, ts->dbmode);
@ -668,9 +688,9 @@ int rpmErase(rpmTransactionSet ts, const char ** argv,
}
if (!stopUninstall) {
transFlags |= RPMTRANS_FLAG_REVERSE;
ts->transFlags |= RPMTRANS_FLAG_REVERSE;
numFailed += rpmRunTransactions(ts, NULL, NULL, NULL, &probs,
transFlags, 0);
ts->transFlags, 0);
}
return numFailed;

View File

@ -36,7 +36,8 @@ int domd5(const char * fn, unsigned char * digest, int asAscii)
xx = close(fdno);
return 1;
}
(void) madvise(mapped, st->st_size, MADV_SEQUENTIAL);
xx = madvise(mapped, st->st_size, MADV_SEQUENTIAL);
ctx = rpmDigestInit(PGPHASHALGO_MD5, RPMDIGEST_NONE);
xx = rpmDigestUpdate(ctx, mapped, st->st_size);

11
rpmqv.c
View File

@ -1045,8 +1045,7 @@ ia->transFlags |= RPMTRANS_FLAG_NOMD5;
ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
ec += rpmRollback(ts, ia, NULL);
} else {
ec += rpmErase(ts, (const char **)poptGetArgs(optCon),
ia->transFlags, ia->eraseInterfaceFlags);
ec += rpmErase(ts, ia, (const char **) poptGetArgs(optCon));
}
break;
@ -1087,12 +1086,10 @@ ia->transFlags |= RPMTRANS_FLAG_NOMD5;
ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE;
/*@i@*/ ec += rpmRollback(ts, ia, NULL);
} else {
/*@-compdef@*/ /* FIX: ia->relocations[0].newPath undefined */
ec += rpmInstall(ts, (const char **)poptGetArgs(optCon),
ia->transFlags, ia->installInterfaceFlags,
ia->probFilter, ia->relocations);
/*@-compmempass@*/ /* FIX: ia->relocations[0].newPath undefined */
ec += rpmInstall(ts, ia, (const char **)poptGetArgs(optCon));
/*@=compmempass@*/
}
/*@=compdef@*/
break;
#endif /* IAM_RPMEIU */