From 976cf8dec79b51102ed51cb72681bbac0abf3f5d Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 13 Mar 2002 15:06:07 +0000 Subject: [PATCH] Pass ts and args to rpmInstall() and rpmErase(). CVS patchset: 5355 CVS date: 2002/03/13 15:06:07 --- lib/poptI.c | 5 ++++ lib/rpmcli.h | 73 ++++++++++++++++++++---------------------------- lib/rpmds.c | 1 - lib/rpminstall.c | 68 ++++++++++++++++++++++++++++---------------- rpmdb/legacy.c | 3 +- rpmqv.c | 11 +++----- 6 files changed, 86 insertions(+), 75 deletions(-) diff --git a/lib/poptI.c b/lib/poptI.c index d2f4d230a..058b99a66 100644 --- a/lib/poptI.c +++ b/lib/poptI.c @@ -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}, diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 4242aae61..080fac164 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -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 */ diff --git a/lib/rpmds.c b/lib/rpmds.c index 34186741c..eece4ea50 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -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; diff --git a/lib/rpminstall.c b/lib/rpminstall.c index f3b827841..81359c1fb 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -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; diff --git a/rpmdb/legacy.c b/rpmdb/legacy.c index 48b128be2..6df200de8 100644 --- a/rpmdb/legacy.c +++ b/rpmdb/legacy.c @@ -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); diff --git a/rpmqv.c b/rpmqv.c index 41c7eb7fc..8e79e421c 100755 --- a/rpmqv.c +++ b/rpmqv.c @@ -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 */