Pass ts and args to rpmInstall() and rpmErase().
authorjbj <devnull@localhost>
Wed, 13 Mar 2002 15:06:07 +0000 (15:06 +0000)
committerjbj <devnull@localhost>
Wed, 13 Mar 2002 15:06:07 +0000 (15:06 +0000)
CVS patchset: 5355
CVS date: 2002/03/13 15:06:07

lib/poptI.c
lib/rpmcli.h
lib/rpmds.c
lib/rpminstall.c
rpmdb/legacy.c
rpmqv.c

index d2f4d230a6fd5c8ba5fcd16c72670524ae8ce787..058b99a661b96aec35e828b850eaa0f64c77198f 100644 (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},
index 4242aae6141d017481ef49d8e6a5e29255bc947a..080fac164c0346db4bd0b65686ac833546e87dce 100644 (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
  */
index 34186741c28664ce0b5a9e41c6b5a8e808dc06b7..eece4ea50a5959e24a7427c7e5ca5e09bfb2d947 100644 (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;
index f3b8278418a737900247f292a3f07a764a105320..81359c1fbbcb99f3b0440285e683f422557e19a5 100644 (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;
index 48b128be27bd38e991bda9ca6c4da63406591767..6df200de83e78e89b351c25273856b28ae55369d 100644 (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);
diff --git a/rpmqv.c b/rpmqv.c
index 41c7eb7fccbed308d3f7f686eab30a483a62d248..8e79e421cedabd0ce8adc3535b93ab7ed30d6bd7 100755 (executable)
--- 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 */