- update trpm.
authorjbj <devnull@localhost>
Mon, 29 Jul 2002 23:06:06 +0000 (23:06 +0000)
committerjbj <devnull@localhost>
Mon, 29 Jul 2002 23:06:06 +0000 (23:06 +0000)
- factor all mode-specific options into mode-specific tables.
- treat an unspecified epoch as Epoch: 0 everywhere.

CVS patchset: 5578
CVS date: 2002/07/29 23:06:06

17 files changed:
CHANGES
build/poptBT.c
lib/depends.c
lib/poptALL.c
lib/poptI.c
lib/poptQV.c
lib/psm.c
lib/rpmds.c
lib/rpmds.h
lib/rpmts.c
lib/transaction.c
lib/verify.c
popt/popt.c
rpm.spec.in
rpmpopt.in
rpmqv.c
scripts/trpm

diff --git a/CHANGES b/CHANGES
index f723265..783ac74 100644 (file)
--- a/CHANGES
+++ b/CHANGES
        - popt: display sub-table options only once on --usage.
        - wire --nosignatures et al as common options, rework CLI options.
        - python: don't segfault in ts.GetKeys() on erased packages.
+       - update trpm.
+       - factor all mode-specific options into mode-specific tables.
+       - treat an unspecified epoch as Epoch: 0 everywhere.
 
 4.0.3 -> 4.0.4:
        - solaris: translate i86pc to i386 (#57182).
index 6314eac..c651a09 100644 (file)
 /*@unchecked@*/
 struct rpmBuildArguments_s         rpmBTArgs;
 
-#define        POPT_USECATALOG         -1000
-#define        POPT_NOLANG             -1001
-#define        POPT_RMSOURCE           -1002
-#define        POPT_RMBUILD            -1003
-#define        POPT_BUILDROOT          -1004
-#define        POPT_TARGETPLATFORM     -1007
-#define        POPT_NOBUILD            -1008
-#define        POPT_SHORTCIRCUIT       -1009
-#define        POPT_RMSPEC             -1010
-#define        POPT_SIGN               -1012
+#define        POPT_USECATALOG         -1011
+#define        POPT_NOLANG             -1012
+#define        POPT_RMSOURCE           -1013
+#define        POPT_RMBUILD            -1014
+#define        POPT_BUILDROOT          -1015
+#define        POPT_TARGETPLATFORM     -1016
+#define        POPT_NOBUILD            -1017
+#define        POPT_SHORTCIRCUIT       -1018
+#define        POPT_RMSPEC             -1019
+#define        POPT_SIGN               -1020
 
 #define        POPT_REBUILD            0x4220
 #define        POPT_RECOMPILE          0x4320
index 1cbeb22..70c9db2 100644 (file)
@@ -301,7 +301,7 @@ int rpmtsAddInstallElement(rpmts ts, Header h,
                 * If no obsoletes version info is available, match all names.
                 */
                if (rpmdsEVR(obsoletes) == NULL
-                || headerMatchesDepFlags(h2, obsoletes))
+                || rpmdsAnyMatchesDep(h2, obsoletes, _rpmds_nopromote))
                    xx = removePackage(ts, h2, rpmdbGetIteratorOffset(mi), pkgKey);
            }
            mi = rpmdbFreeIterator(mi);
@@ -323,12 +323,12 @@ int rpmtsAddEraseElement(rpmts ts, Header h, int dboffset)
 
 /**
  * Check dep for an unsatisfied dependency.
- * @todo Eliminate rpmrc provides.
  * @param ts           transaction set
  * @param dep          dependency
+ * @param adding       dependency is from added package set?
  * @return             0 if satisfied, 1 if not satisfied, 2 if error
  */
-static int unsatisfiedDepend(rpmts ts, rpmds dep)
+static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding)
        /*@globals _cacheDependsRC, rpmGlobalMacroContext,
                fileSystem, internalState @*/
        /*@modifies ts, _cacheDependsRC, rpmGlobalMacroContext,
@@ -339,6 +339,7 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep)
     rpmdbMatchIterator mi;
     const char * Name;
     Header h;
+    int _cacheThisRC = 1;
     int rc;
     int xx;
 
@@ -437,8 +438,15 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep)
     }
 
     /* Search added packages for the dependency. */
-    if (rpmalSatisfiesDepend(ts->addedPackages, dep, NULL) != NULL)
+    if (rpmalSatisfiesDepend(ts->addedPackages, dep, NULL) != NULL) {
+       /*
+        * XXX Ick, context sensitive answers from dependency cache.
+        * XXX Always resolve added dependencies within context to disambiguate.
+        */
+       if (_rpmds_nopromote)
+           _cacheThisRC = 0;
        goto exit;
+    }
 
     /* XXX only the installer does not have the database open here. */
     if (rpmtsGetRdb(ts) != NULL) {
@@ -464,7 +472,7 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep)
        (void) rpmdbPruneIterator(mi,
                        ts->removedPackages, ts->numRemovedPackages, 1);
        while ((h = rpmdbNextIterator(mi)) != NULL) {
-           if (rangeMatchesDepFlags(h, dep)) {
+           if (rpmdsAnyMatchesDep(h, dep, _rpmds_nopromote)) {
                rpmdsNotify(dep, _("(db provides)"), rc);
                mi = rpmdbFreeIterator(mi);
                goto exit;
@@ -477,7 +485,7 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep)
        (void) rpmdbPruneIterator(mi,
                        ts->removedPackages, ts->numRemovedPackages, 1);
        while ((h = rpmdbNextIterator(mi)) != NULL) {
-           if (rangeMatchesDepFlags(h, dep)) {
+           if (rpmdsAnyMatchesDep(h, dep, _rpmds_nopromote)) {
                rpmdsNotify(dep, _("(db package)"), rc);
                mi = rpmdbFreeIterator(mi);
                goto exit;
@@ -492,8 +500,10 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep)
      * Search for an unsatisfied dependency.
      */
 /*@-boundsread@*/
-    if (!(rpmtsFlags(ts) & RPMTRANS_FLAG_NOSUGGEST) && ts->solve != NULL)
-       xx = (*ts->solve) (ts, dep);
+    if (adding && !(rpmtsFlags(ts) & RPMTRANS_FLAG_NOSUGGEST)) {
+       if (ts->solve != NULL)
+           xx = (*ts->solve) (ts, dep);
+    }
 /*@=boundsread@*/
 
 unsatisfied:
@@ -504,7 +514,7 @@ exit:
     /*
      * If dbiOpen/dbiPut fails (e.g. permissions), we can't cache.
      */
-    if (_cacheDependsRC) {
+    if (_cacheDependsRC && _cacheThisRC) {
        dbiIndex dbi;
        dbi = dbiOpen(rpmtsGetRdb(ts), RPMDBI_DEPENDS, 0);
        if (dbi == NULL) {
@@ -581,7 +591,7 @@ static int checkPackageDeps(rpmts ts, const char * pkgNEVR,
        if (multiLib && !isDependsMULTILIB(Flags))
            continue;
 
-       rc = unsatisfiedDepend(ts, requires);
+       rc = unsatisfiedDepend(ts, requires, adding);
 
        switch (rc) {
        case 0:         /* requirements are satisfied. */
@@ -625,7 +635,7 @@ static int checkPackageDeps(rpmts ts, const char * pkgNEVR,
        if (multiLib && !isDependsMULTILIB(Flags))
            continue;
 
-       rc = unsatisfiedDepend(ts, conflicts);
+       rc = unsatisfiedDepend(ts, conflicts, adding);
 
        /* 1 == unsatisfied, 0 == satsisfied */
        switch (rc) {
@@ -672,7 +682,9 @@ static int checkPackageSet(rpmts ts, const char * dep,
 
        pkgNEVR = hGetNEVR(h, NULL);
        requires = rpmdsNew(h, RPMTAG_REQUIRENAME, scareMem);
+       (void) rpmdsSetNoPromote(requires, _rpmds_nopromote);
        conflicts = rpmdsNew(h, RPMTAG_CONFLICTNAME, scareMem);
+       (void) rpmdsSetNoPromote(requires, _rpmds_nopromote);
        rc = checkPackageDeps(ts, pkgNEVR, requires, conflicts, dep, 0, adding);
        conflicts = rpmdsFree(conflicts);
        requires = rpmdsFree(requires);
index b90576f..b4aa445 100644 (file)
@@ -9,17 +9,20 @@
 
 #include "debug.h"
 
-#ifdef  NOTYET
-#define POPT_RCFILE            -1022
-#endif
 #define POPT_SHOWVERSION       -999
 #define POPT_SHOWRC            -998
+#ifdef  NOTYET
+#define POPT_RCFILE            -997
+#endif
 
 /*@unchecked@*/
 static int _debug = 0;
 
 /*@-exportheadervar@*/
 /*@unchecked@*/
+extern int _rpmds_nopromote;
+
+/*@unchecked@*/
 extern int _fps_debug;
 
 /*@unchecked@*/
@@ -227,6 +230,9 @@ struct poptOption rpmcliAllPoptTable[] = {
        N_("disable use of libio(3) API"), NULL},
 #endif
 
+ { "promoteepoch", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_rpmds_nopromote, 0,
+       NULL, NULL},
+
  { "fpsdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_fps_debug, -1,
        NULL, NULL},
  { "fsmdebug", '\0', POPT_ARG_VAL|POPT_ARGFLAG_DOC_HIDDEN, &_fsm_debug, -1,
index a0c1e6e..f3fc208 100644 (file)
@@ -16,12 +16,14 @@ extern time_t get_date(const char * p, void * now); /* XXX expedient lies */
 /*@unchecked@*/
 struct rpmInstallArguments_s rpmIArgs;
 
-#define        POPT_RELOCATE           -1016
-#define        POPT_EXCLUDEPATH        -1019
-#define        POPT_ROLLBACK           -1024
-
-/*@exits@*/ static void argerror(const char * desc)
-       /*@*/
+#define        POPT_RELOCATE           -1021
+#define        POPT_EXCLUDEPATH        -1022
+#define        POPT_ROLLBACK           -1023
+
+/*@exits@*/
+static void argerror(const char * desc)
+       /*@globals stderr, fileSystem @*/
+       /*@modifies stderr, fileSystem @*/
 {
     /*@-modfilesys -globs @*/
     fprintf(stderr, _("%s: %s\n"), __progname, desc);
@@ -36,8 +38,8 @@ static void installArgCallback( /*@unused@*/ poptContext con,
                /*@unused@*/ enum poptCallbackReason reason,
                const struct poptOption * opt, const char * arg,
                /*@unused@*/ const void * data)
-       /*@globals rpmIArgs @*/
-       /*@modifies rpmIArgs @*/
+       /*@globals rpmIArgs, stderr, fileSystem @*/
+       /*@modifies rpmIArgs, stderr, fileSystem @*/
 {
     struct rpmInstallArguments_s * ia = &rpmIArgs;
 
@@ -45,6 +47,11 @@ static void installArgCallback( /*@unused@*/ poptContext con,
     /*@-branchstate@*/
     if (opt->arg == NULL)
     switch (opt->val) {
+
+    case 'i':
+       ia->installInterfaceFlags |= INSTALL_INSTALL;
+       break;
+
     case POPT_EXCLUDEPATH:
        if (arg == NULL || *arg != '/') 
            argerror(_("exclude paths must begin with a /"));
@@ -196,11 +203,19 @@ struct poptOption rpmInstallPoptTable[] = {
        N_("don't check disk space before installing"), NULL},
  { "includedocs", '\0', POPT_ARGFLAG_DOC_HIDDEN, &rpmIArgs.incldocs, 0,
        N_("install documentation"), NULL},
+
+#ifdef DYING
  { "install", '\0', POPT_BIT_SET,
        &rpmIArgs.installInterfaceFlags, INSTALL_INSTALL,
        N_("install package(s)"), N_("<packagefile>+") },
+#else
+ { "install", 'i', 0, NULL, 'i',
+       N_("install package(s)"), N_("<packagefile>+") },
+#endif
+
  { "justdb", '\0', POPT_BIT_SET, &rpmIArgs.transFlags, RPMTRANS_FLAG_JUSTDB,
        N_("update the database, but do not modify the filesystem"), NULL},
+
 #ifdef DYING
  { "nodeps", '\0', 0, &rpmIArgs.noDeps, 0,
        N_("do not verify package dependencies"), NULL },
@@ -208,6 +223,7 @@ struct poptOption rpmInstallPoptTable[] = {
  { "nodeps", '\0', 0, NULL, RPMCLI_POPT_NODEPS,
        N_("do not verify package dependencies"), NULL },
 #endif
+
  { "nomd5", '\0', 0, NULL, RPMCLI_POPT_NOMD5,
        N_("don't verify MD5 digest of files"), NULL },
  { "noorder", '\0', POPT_BIT_SET,
index 6b519b7..4e3b17f 100644 (file)
@@ -46,7 +46,7 @@ static void rpmQVSourceArgCallback( /*@unused@*/ poptContext con,
     case 'I':  /* from --import */
     case 'K':  /* from --checksig, -K */
     case 'R':  /* from --resign */
-       if (qva->qva_mode == ' ') {
+       if (qva->qva_mode == ' ' || qva->qva_mode == '\0') {
            qva->qva_mode = opt->val;
            qva->qva_char = ' ';
        }
@@ -167,6 +167,15 @@ static void queryArgCallback(/*@unused@*/poptContext con,
        }
        break;
 
+    case 'i':
+       if (qva->qva_mode == 'q') {
+           /*@-nullassign -readonlytrans@*/
+           const char * infoCommand[] = { "--info", NULL };
+           /*@=nullassign =readonlytrans@*/
+           (void) poptStuffArgs(con, infoCommand);
+       }
+       break;
+
     case RPMCLI_POPT_NODIGEST:
        qva->qva_flags |= VERIFY_DIGEST;
        break;
@@ -221,6 +230,8 @@ struct poptOption rpmQueryPoptTable[] = {
        N_("list all documentation files"), NULL },
  { "dump", '\0', 0, 0, POPT_DUMP,
        N_("dump basic file information"), NULL },
+ { NULL, 'i', POPT_ARGFLAG_DOC_HIDDEN, 0, 'i',
+       NULL, NULL },
  { "list", 'l', 0, 0, 'l',
        N_("list files in package"), NULL },
 
index aec50da..37910bb 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -923,6 +923,8 @@ exit:
 }
 
 /**
+ * Execute triggers.
+ * @todo Trigger on any provides, not just package NVR.
  * @param psm          package state machine data
  * @param sourceH
  * @param triggeredH
@@ -954,7 +956,11 @@ static int handleOneTrigger(const PSM_t psm, Header sourceH, Header triggeredH,
     xx = headerNVR(sourceH, &sourceName, NULL, NULL);
 
     trigger = rpmdsInit(rpmdsNew(triggeredH, RPMTAG_TRIGGERNAME, scareMem));
-    if (trigger != NULL)
+    if (trigger == NULL)
+       return rc;
+
+    (void) rpmdsSetNoPromote(trigger, 1);
+
     while ((i = rpmdsNext(trigger)) >= 0) {
        rpmTagType tit, tst, tpt;
        const char * Name;
@@ -968,7 +974,7 @@ static int handleOneTrigger(const PSM_t psm, Header sourceH, Header triggeredH,
        if (!(Flags & psm->sense))
            continue;
 
-       if (!headerMatchesDepFlags(sourceH, trigger))
+       if (!rpmdsNVRMatchesDep(sourceH, trigger, 1))
            continue;
 
        if (!(  hge(triggeredH, RPMTAG_TRIGGERINDEX, &tit,
index bbcaa87..efcc92f 100644 (file)
@@ -19,6 +19,12 @@ static int _noisy_range_comparison_debug_message = 0;
 /*@unchecked@*/
 int _rpmds_debug = 0;
 
+/*@unchecked@*/
+int _rpmds_nopromote = 1;
+
+/*@unchecked@*/
+int _rpmds_unspecified_epoch_noise = 0;
+
 rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln)
 {
     if (ds == NULL) return NULL;
@@ -157,6 +163,7 @@ rpmds rpmdsNew(Header h, rpmTag tagN, int scareMem)
        ds->N = N;
        ds->Nt = Nt;
        ds->Count = Count;
+       ds->nopromote = 0;
 
        xx = hge(h, tagEVR, &ds->EVRt, (void **) &ds->EVR, NULL);
        xx = hge(h, tagF, &ds->Ft, (void **) &ds->Flags, NULL);
@@ -436,6 +443,26 @@ rpmTag rpmdsTagN(const rpmds ds)
     return tagN;
 }
 
+int rpmdsNoPromote(const rpmds ds)
+{
+    int nopromote = 0;
+
+    if (ds != NULL)
+       nopromote = ds->nopromote;
+    return nopromote;
+}
+
+int rpmdsSetNoPromote(const rpmds ds, int nopromote)
+{
+    int onopromote = 0;
+
+    if (ds != NULL) {
+       onopromote = ds->nopromote;
+       ds->nopromote = nopromote;
+    }
+    return onopromote;
+}
+
 void rpmdsNotify(rpmds ds, const char * where, int rc)
 {
     if (!(ds != NULL && ds->i >= 0 && ds->i < ds->Count))
@@ -579,14 +606,13 @@ int rpmdsCompare(const rpmds A, const rpmds B)
     if (aE && *aE && bE && *bE)
        sense = rpmvercmp(aE, bE);
     else if (aE && *aE && atol(aE) > 0) {
-#ifndef        LEGACY_COMPATIBILITY_NEEDS_THIS
-       /* XXX legacy epoch-less requires/conflicts compatibility */
-       rpmMessage(RPMMESS_DEBUG, _("the \"B\" dependency needs an epoch (assuming same as \"A\")\n\tA %s\tB %s\n"),
+       if (!B->nopromote) {
+           int lvl = (_rpmds_unspecified_epoch_noise  ? RPMMESS_WARNING : RPMMESS_DEBUG);
+           rpmMessage(lvl, _("The \"B\" dependency needs an epoch (assuming same epoch as \"A\")\n\tA = \"%s\"\tB = \"%s\"\n"),
                aDepend, bDepend);
-       sense = 0;
-#else
-       sense = 1;
-#endif
+           sense = 0;
+       } else
+           sense = 1;
     } else if (bE && *bE && atol(bE) > 0)
        sense = -1;
 
@@ -652,7 +678,7 @@ void rpmdsProblem(rpmps ps, const char * pkgNEVR, const rpmds ds,
     rpmpsAppend(ps, type, pkgNEVR, key, NULL, NULL, DNEVR, adding);
 }
 
-int rangeMatchesDepFlags (Header h, const rpmds req)
+int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
 {
     int scareMem = 1;
     rpmds provides = NULL;
@@ -667,6 +693,8 @@ int rangeMatchesDepFlags (Header h, const rpmds req)
     provides = rpmdsInit(rpmdsNew(h, RPMTAG_PROVIDENAME, scareMem));
     if (provides == NULL)
        goto exit;      /* XXX should never happen */
+    if (nopromote)
+       (void) rpmdsSetNoPromote(provides, nopromote);
 
     /*
      * Rpm prior to 3.0.3 did not have versioned provides.
@@ -701,7 +729,7 @@ exit:
     return result;
 }
 
-int headerMatchesDepFlags(const Header h, const rpmds req)
+int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
 {
     HGE_t hge = (HGE_t)headerGetEntryMinMemory;
     const char * pkgN, * v, * r;
@@ -733,6 +761,8 @@ int headerMatchesDepFlags(const Header h, const rpmds req)
 /*@=boundswrite@*/
 
     if ((pkg = rpmdsSingle(RPMTAG_PROVIDENAME, pkgN, pkgEVR, pkgFlags)) != NULL) {
+       if (nopromote)
+           (void) rpmdsSetNoPromote(pkg, nopromote);
        rc = rpmdsCompare(pkg, req);
        pkg = rpmdsFree(pkg);
     }
index 41c60ec..bffc6f2 100644 (file)
 extern int _rpmds_debug;
 /*@=exportlocal@*/
 
+/**
+ */
+/*@-exportlocal@*/
+/*@unchecked@*/
+extern int _rpmds_nopromote;
+/*@=exportlocal@*/
+
 #if defined(_RPMDS_INTERNAL)
 /**
  * A package dependency set.
@@ -39,6 +46,7 @@ struct rpmds_s {
     int_32 * Flags;            /*!< Flags identifying context/comparison. */
     rpmTagType Nt, EVRt, Ft;   /*!< Tag data types. */
     int_32 Count;              /*!< No. of elements */
+    int nopromote;             /*!< Don't promote Epoch: in rpmdsCompare()? */
 /*@refs@*/
     int nrefs;                 /*!< Reference count. */
 };
@@ -206,6 +214,30 @@ rpmTag rpmdsTagN(/*@null@*/ const rpmds ds)
        /*@*/;
 
 /**
+ * Return current "Don't promote Epoch:" flag.
+ *
+ * This flag controls for Epoch: promotion when a dependency set is
+ * compared. If the flag is set (for already installed packages), then
+ * an unspecified value will be treated as Epoch: 0. Otherwise (for added
+ * packages), the Epoch: portion of the comparison is skipped if the value
+ * is not specified, i.e. an unspecified Epoch: is assumed to be equal
+ * in dependency comparisons.
+ *
+ * @param ds           dependency set
+ * @return             current "Don't promote Epoch:" flag
+ */
+int rpmdsNoPromote(/*@null@*/ const rpmds ds)
+       /*@*/;
+
+/**
+ * Set "Don't promote Epoch:" flag.
+ * @param ds           dependency set
+ * @return             previous "Don't promote Epoch:" flag
+ */
+int rpmdsSetNoPromote(/*@null@*/ const rpmds ds, int nopromote)
+       /*@*/;
+
+/**
  * Notify of results of dependency match.
  * @param ds           dependency set
  * @param where                where dependency was resolved (or NULL)
@@ -260,18 +292,21 @@ void rpmdsProblem(/*@null@*/ rpmps ps, const char * pkgNEVR, const rpmds ds,
  * Compare package provides dependencies from header with a single dependency.
  * @param h            header
  * @param req          dependency set
+ * @param nopromote    Don't promote Epoch: in comparison?
+ * @return             1 if any dependency overlaps, 0 otherwise
  */
-int rangeMatchesDepFlags (Header h, const rpmds req)
+int rpmdsAnyMatchesDep (const Header h, const rpmds req, int nopromote)
         /*@modifies h @*/;
 
 /**
  * Compare package name-version-release from header with a single dependency.
  * @deprecated Remove from API when obsoletes is correctly implemented.
  * @param h            header
- * @param req          dependency
+ * @param req          dependency set
+ * @param nopromote    Don't promote Epoch: in comparison?
  * @return             1 if dependency overlaps, 0 otherwise
  */
-int headerMatchesDepFlags(const Header h, const rpmds req)
+int rpmdsNVRMatchesDep(const Header h, const rpmds req, int nopromote)
        /*@*/;
 
 #ifdef __cplusplus
index 70d4c7b..33fb49e 100644 (file)
@@ -382,7 +382,7 @@ int rpmtsSolve(rpmts ts, rpmds ds)
        time_t htime;
        int_32 * ip;
 
-       if (rpmtag == RPMTAG_PROVIDENAME && !rangeMatchesDepFlags(h, ds))
+       if (rpmtag == RPMTAG_PROVIDENAME && !rpmdsAnyMatchesDep(h, ds, 1))
            continue;
 
        htime = 0;
index 61ff5d6..d765dfc 100644 (file)
@@ -701,7 +701,7 @@ static int ensureOlder(rpmts ts,
 /*@=boundswrite@*/
     
     req = rpmdsSingle(RPMTAG_REQUIRENAME, rpmteN(p), reqEVR, reqFlags);
-    rc = headerMatchesDepFlags(h, req);
+    rc = rpmdsNVRMatchesDep(h, req, _rpmds_nopromote);
     req = rpmdsFree(req);
 
     if (rc == 0) {
index a528a92..f39405c 100644 (file)
@@ -23,6 +23,9 @@
 
 #define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
 
+/*@unchecked@*/
+extern int _rpmds_unspecified_epoch_noise;
+
 int rpmVerifyFile(const rpmts ts, const rpmfi fi,
                rpmVerifyAttrs * res, rpmVerifyAttrs omitMask)
 {
@@ -432,8 +435,11 @@ int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
     if (fi != NULL) {
 
        if (qva->qva_flags & VERIFY_DEPS) {
+           int save_noise = _rpmds_unspecified_epoch_noise;
+           _rpmds_unspecified_epoch_noise = 1;
            if ((rc = verifyDependencies(qva, ts, h)) != 0)
                ec = rc;
+           _rpmds_unspecified_epoch_noise = save_noise;
        }
        if (qva->qva_flags & VERIFY_FILES) {
            if ((rc = verifyHeader(qva, ts, fi)) != 0)
index d71e2bf..812861e 100644 (file)
 #include "findme.h"
 #include "poptint.h"
 
+#ifdef MYDEBUG
+/*@unchecked@*/
+int _popt_debug = 0;
+#endif
+
 #ifndef HAVE_STRERROR
 static char * strerror(int errno) {
     extern int sys_nerr;
@@ -427,7 +432,8 @@ static int execCommand(poptContext con)
     if (argv[0] == NULL)
        return POPT_ERROR_NOARG;
 
-#ifdef MYDEBUG
+#ifdef MYDEBUG
+if (_popt_debug)
     {  const char ** avp;
        fprintf(stderr, "==> execvp(%s) argv[%d]:", argv[0], argc);
        for (avp = argv; *avp; avp++)
index d7f5437..e0a3b36 100644 (file)
@@ -515,10 +515,13 @@ fi
 %{__prefix}/include/popt.h
 
 %changelog
-* Sat Jul 27 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.58
+* Mon Jul 29 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.58
 - popt: display sub-table options only once on --usage.
 - wire --nosignatures et al as common options, rework CLI options.
 - python: don't segfault in ts.GetKeys() on erased packages.
+- update trpm.
+- factor all mode-specific options into mode-specific tables.
+- treat an unspecified epoch as Epoch: 0 everywhere.
 
 * Thu Jul 25 2002 Jeff Johnson <jbj@redhat.com> 4.1-0.57
 - python: remove the old initdb/rebuilddb methods, use ts.fooDB().
index 9c669d6..a65642c 100644 (file)
@@ -117,7 +117,7 @@ rpm alias --rebuilddbapi     --define '_dbapi_rebuild !#:+'
 rpm alias --rebuilddbpath       --define '_dbapath_rebuild !#:+'
 
 #==============================================================================
-#      [--dbpath <dir>]        "use <dir> as the directory for the database"
+#      [--dbpath DIRECTORY"    "use database in DIRECTORY"
 rpm    alias --dbpath          --define '_dbpath !#:+'
 #      [--ftpport <port>]      "port number of ftp server (or proxy)"
 rpm    alias --ftpport         --define '_ftpport !#:+'
@@ -165,6 +165,7 @@ rpm exec --verifydb         rpmd --verifydb
 rpm    exec --addsign          rpmk --addsign
 rpm    exec -K                 rpmk -K
 rpm    exec --checksig         rpmk --checksig
+rpm    exec --import           rpmk --import
 rpm    exec --resign           rpmk --resign
 
 rpm    exec -q                 rpmq -q
@@ -182,8 +183,8 @@ rpm alias --without         --define "_without_!#:+    --without-!#:+" \
        --POPTargs=$"<option>"
 #==============================================================================
 rpmb   alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmb   alias --ftpport         --define '_ftpport !#:+'
 rpmb   alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmb   alias --httpport        --define '_httpport !#:+'
@@ -197,8 +198,8 @@ rpmb        alias --without         --define "_without_!#:+    --without-!#:+" \
        --POPTargs=$"<option>"
 #==============================================================================
 rpmbuild       alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmbuild alias --ftpport               --define '_ftpport !#:+'
 rpmbuild alias --ftpproxy      --define '_ftpproxy !#:+'
 rpmbuild alias --httpport      --define '_httpport !#:+'
@@ -212,56 +213,56 @@ rpmbuild alias --without  --define "_without_!#:+  --without-!#:+" \
        --POPTargs=$"<option>"
 #==============================================================================
 rpmd   alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmd   alias --ftpport         --define '_ftpport !#:+'
 rpmd   alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmd   alias --httpport        --define '_httpport !#:+'
 rpmd   alias --httpproxy       --define '_httpproxy !#:+'
 #==============================================================================
 rpmdb  alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmdb  alias --ftpport         --define '_ftpport !#:+'
 rpmdb  alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmdb  alias --httpport        --define '_httpport !#:+'
 rpmdb  alias --httpproxy       --define '_httpproxy !#:+'
 #==============================================================================
 rpme   alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpme   alias --ftpport         --define '_ftpport !#:+'
 rpme   alias --ftpproxy        --define '_ftpproxy !#:+'
 rpme   alias --httpport        --define '_httpport !#:+'
 rpme   alias --httpproxy       --define '_httpproxy !#:+'
 #==============================================================================
 rpmi   alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmi   alias --ftpport         --define '_ftpport !#:+'
 rpmi   alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmi   alias --httpport        --define '_httpport !#:+'
 rpmi   alias --httpproxy       --define '_httpproxy !#:+'
 #==============================================================================
 rpmk   alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmk   alias --ftpport         --define '_ftpport !#:+'
 rpmk   alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmk   alias --httpport        --define '_httpport !#:+'
 rpmk   alias --httpproxy       --define '_httpproxy !#:+'
 #==============================================================================
 rpmsign        alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmsign        alias --ftpport         --define '_ftpport !#:+'
 rpmsign        alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmsign        alias --httpport        --define '_httpport !#:+'
 rpmsign        alias --httpproxy       --define '_httpproxy !#:+'
 #==============================================================================
 rpmq   alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmq   alias --ftpport         --define '_ftpport !#:+'
 rpmq   alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmq   alias --httpport        --define '_httpport !#:+'
@@ -333,8 +334,8 @@ rpmq        alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
        --POPTdesc=$"list all files from each package"
 #==============================================================================
 rpmquery       alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmquery       alias --ftpport         --define '_ftpport !#:+'
 rpmquery       alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmquery       alias --httpport        --define '_httpport !#:+'
@@ -405,16 +406,16 @@ rpmquery  alias --filesbypkg --qf '[%-25{=NAME} %{FILENAMES}\n]' \
        --POPTdesc=$"list all files from each package"
 #==============================================================================
 rpmu   alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmu   alias --ftpport         --define '_ftpport !#:+'
 rpmu   alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmu   alias --httpport        --define '_httpport !#:+'
 rpmu   alias --httpproxy       --define '_httpproxy !#:+'
 #==============================================================================
 rpmv   alias --dbpath          --define '_dbpath !#:+' \
-       --POPTdesc=$"use <dir> as the directory for the database" \
-       --POPTargs=$"<dir>"
+       --POPTdesc=$"use database in DIRECTORY" \
+       --POPTargs=$"DIRECTORY"
 rpmv   alias --ftpport         --define '_ftpport !#:+'
 rpmv   alias --ftpproxy        --define '_ftpproxy !#:+'
 rpmv   alias --httpport        --define '_httpport !#:+'
diff --git a/rpmqv.c b/rpmqv.c
index 47269bf..26495bf 100755 (executable)
--- a/rpmqv.c
+++ b/rpmqv.c
@@ -68,11 +68,6 @@ enum modes {
 /*@unchecked@*/
 static struct poptOption optionsTable[] = {
 
- /* XXX colliding options */
-#if defined(IAM_RPMQV) || defined(IAM_RPMEIU)
- {  NULL, 'i', POPT_ARGFLAG_DOC_HIDDEN, 0, 'i',                        NULL, NULL},
-#endif
-
 #ifdef IAM_RPMQV
  { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmQueryPoptTable, 0,
        N_("Query options (with -q or --query):"),
@@ -173,7 +168,7 @@ int main(int argc, const char ** argv)
     rpmts ts = NULL;
     enum modes bigMode = MODE_UNKNOWN;
 
-#ifdef IAM_RPMQV
+#if defined(IAM_RPMQV)
     QVA_t qva = &rpmQVKArgs;
 #endif
 
@@ -230,11 +225,13 @@ int main(int argc, const char ** argv)
     /*@-nullpass@*/
 #ifdef IAM_RPMBT
     if (!strcmp(__progname, "rpmb"))   bigMode = MODE_BUILD;
+    if (!strcmp(__progname, "lt-rpmb"))        bigMode = MODE_BUILD;
     if (!strcmp(__progname, "rpmt"))   bigMode = MODE_TARBUILD;
     if (!strcmp(__progname, "rpmbuild"))       bigMode = MODE_BUILD;
 #endif
 #ifdef IAM_RPMQV
     if (!strcmp(__progname, "rpmq"))   bigMode = MODE_QUERY;
+    if (!strcmp(__progname, "lt-rpmq"))        bigMode = MODE_QUERY;
     if (!strcmp(__progname, "rpmv"))   bigMode = MODE_VERIFY;
     if (!strcmp(__progname, "rpmquery"))       bigMode = MODE_QUERY;
     if (!strcmp(__progname, "rpmverify"))      bigMode = MODE_VERIFY;
@@ -242,10 +239,34 @@ int main(int argc, const char ** argv)
 #ifdef RPMEIU
     if (!strcmp(__progname, "rpme"))   bigMode = MODE_ERASE;
     if (!strcmp(__progname, "rpmi"))   bigMode = MODE_INSTALL;
+    if (!strcmp(__progname, "lt-rpmi"))        bigMode = MODE_INSTALL;
     if (!strcmp(__progname, "rpmu"))   bigMode = MODE_INSTALL;
 #endif
     /*@=nullpass@*/
 
+#if defined(IAM_RPMQV)
+    /* Jumpstart option from argv[0] if necessary. */
+    switch (bigMode) {
+    case MODE_QUERY:   qva->qva_mode = 'q';    break;
+    case MODE_VERIFY:  qva->qva_mode = 'V';    break;
+    case MODE_QUERYTAGS:qva->qva_mode = 'Q';   break;
+    case MODE_CHECKSIG:        qva->qva_mode = 'K';    break;
+    case MODE_RESIGN:  qva->qva_mode = 'R';    break;
+    case MODE_INSTALL:
+    case MODE_ERASE:
+    case MODE_BUILD:
+    case MODE_REBUILD:
+    case MODE_RECOMPILE:
+    case MODE_TARBUILD:
+    case MODE_INITDB:
+    case MODE_REBUILDDB:
+    case MODE_VERIFYDB:
+    case MODE_UNKNOWN:
+    default:
+       break;
+    }
+#endif
+
     /* XXX Eliminate query linkage loop */
     /*@-type@*/        /* FIX: casts? */
     parseSpecVec = parseSpec;
@@ -276,35 +297,6 @@ int main(int argc, const char ** argv)
        optArg = poptGetOptArg(optCon);
 
        switch (arg) {
-           
-/* XXX options used in multiple rpm modes */
-
-#if defined(IAM_RPMQV) || defined(IAM_RPMEIU)
-       case 'i':
-#ifdef IAM_RPMQV
-           if (bigMode == MODE_QUERY || qva->qva_mode == 'q') {
-               /*@-nullassign -readonlytrans@*/
-               const char * infoCommand[] = { "--info", NULL };
-               /*@=nullassign =readonlytrans@*/
-               (void) poptStuffArgs(optCon, infoCommand);
-           } else
-#endif
-#ifdef IAM_RPMEIU
-           if (bigMode == MODE_INSTALL ||
-               (ia->installInterfaceFlags &
-                   (INSTALL_UPGRADE|INSTALL_FRESHEN|INSTALL_INSTALL)))
-               /*@-ifempty@*/ ;
-           else if (bigMode == MODE_UNKNOWN) {
-               /*@-nullassign -readonlytrans@*/
-               const char * installCommand[] = { "--install", NULL };
-               /*@=nullassign =readonlytrans@*/
-               (void) poptStuffArgs(optCon, installCommand);
-           } else
-#endif
-               /*@-ifempty@*/ ;
-           /*@switchbreak@*/ break;
-#endif /* IAM_RPMQV || IAM_RPMEIU */
-
        default:
            fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
            exit(EXIT_FAILURE);
index 637929f..6466428 100755 (executable)
@@ -1,14 +1,22 @@
 #!/bin/sh
 
+ulimit -S -c unlimited
 dbg=   # echo
 
 rpm=/bin/rpm
+#rpm=/X/src/rpm/rpm
 #rpmi=mrpm
-rpmi=/bin/rpm
 #rpmi="strace -o xxx /bin/rpm"
+rpmi="$rpm"
 rpmb=/usr/bin/rpmbuild
 rpmq=/usr/bin/rpmquery
 rpmdb=/usr/bin/rpmdb
+rpmk=/usr/bin/rpmsign
+
+pgppubkey=/usr/lib/rpm/RPM-PGP-KEY
+gpgpubkey=/usr/lib/rpm/RPM-GPG-KEY
+betapubkey=/usr/lib/rpm/BETA-GPG-KEY
+jbjpubkey=/usr/lib/rpm/JBJ-GPG-KEY
 
 #rpm=/X/src/rpm402/rpm
 #rpmb=/X/src/rpm402/rpmb
@@ -66,8 +74,12 @@ gdbm-1
 grep-
 gzip-
 info-
+less-
+libacl-2
+libattr-2
 mount-
 ncurses-[45]
+pcre-
 procps-2
 psmisc-
 sed-
@@ -98,19 +110,31 @@ words-
 baseglob="
 $min2glob
 ash-
+bdflush-
 console-tools-
-gmp-[23]
+cyrus-sasl-[12]
+cyrus-sasl-md5-
+glib2-2
+gmp-[234]
 initscripts-
 iputils-
 iproute-
+kbd-
 kernel-2
+krb5-libs-
+libuser-
 losetup-
+lvm-
 mkinitrd-
 modutils-
+net-tools-
+openldap-2
+openssl-0
 pam-0
 pamconfig-
 sh-utils-
 sysklogd-
+usermode-1
 util-linux-
 vixie-cron-
 rpm-[34]
@@ -128,6 +152,7 @@ db3-devel-
 db4-devel-
 gdbm-devel-
 glibc-devel-
+glibc-kernheaders-
 gmp-devel-
 kernel-headers-
 readline-devel-[24]
@@ -147,24 +172,48 @@ db3-utils-
 db4-utils-
 egcs-1
 egcs-c++-1
-gcc-2
-gcc-c++-2
+expat-1
+gcc-[23]
+gcc-c++-[23]
 gettext-
 krb5-configs-
-krb5-libs-
+libgcc-3
 libstdc++-
 libtool-
 make-
 m4-
 ncurses-devel-
-openssl-0
 patch-
 perl-5
-python-1
+perl-CGI-
+python-[12]
 rpm-build-
+file-3
 tcsh-
 "
-classes="min0 min1 min2 base devel build"
+
+mozillaglob="
+$buildglob
+mozilla-
+compat-libstdc++-7
+indexhtml-
+redhat-menus-
+gtk+-1
+XFree86-libs-[34]
+ORBit-0
+fontconfig-0
+freetype-2
+XFree86-Mesa-libGL-
+libpng-
+libjpeg-
+vorbis-tools-
+libvorbis-
+libogg-
+libao-0
+curl-
+"
+
+classes="min0 min1 min2 base devel build mozilla"
 notallpat="(kernel-[^2h])"
 
 for cmd in $*
@@ -177,7 +226,7 @@ do
     debug)             dbg=echo        ;;
     dmalloc)           eval `dmalloc -b $dmopts`       ;;
     db1)               db1="--define '%_dbapi 1'"      ;;
-    5.2|6.2|7.0|7.1|7.2)
+    5.2|6.2|7.*|8.*)
        dist=$cmd
        root=$top/$dist
        rc="--rcfile $top/rpmrc-$dist $db1"
@@ -230,7 +279,14 @@ EOF
        ;;
     --initdb)
        $dbg $sudo mkdir -p $root/var/lib/rpm
+       $dbg $sudo mkdir -p $root/etc
+       $dbg $sudo touch $root/etc/fstab
+       $dbg $sudo touch $root/etc/mtab
        $dbg $sudo $rpmdb $rc --root $root --initdb
+#      $dbg $sudo $rpmk $rc --root $root --import $pgppubkey
+#      $dbg $sudo $rpmk $rc --root $root --import $gpgpubkey
+#      $dbg $sudo $rpmk $rc --root $root --import $betapubkey
+#      $dbg $sudo $rpmk $rc --root $root --import $jbjpubkey
        ;;
     --savedb)
        ( $dbg cd $root/var/lib && $dbg $sudo tar czvf rpmdb.tar.gz rpm ; )