Wire ftsOpts globally.
authorjbj <devnull@localhost>
Mon, 25 Oct 2004 15:26:51 +0000 (15:26 +0000)
committerjbj <devnull@localhost>
Mon, 25 Oct 2004 15:26:51 +0000 (15:26 +0000)
CVS patchset: 7510
CVS date: 2004/10/25 15:26:51

lib/poptALL.c
lib/poptQV.c
lib/query.c
lib/rpmcli.h
lib/tgi.c
rpmqv.c

index ed1ef1f..2344924 100644 (file)
@@ -6,6 +6,7 @@
 #include "system.h"
 
 #include <rpmcli.h>
+#include <fts.h>
 
 #include "debug.h"
 
@@ -215,6 +216,30 @@ static void rpmcliAllArgCallback( /*@unused@*/ poptContext con,
     /*@=branchstate@*/
 }
 
+/*@unchecked@*/
+int ftsOpts = 0;
+
+/*@unchecked@*/
+struct poptOption rpmcliFtsPoptTable[] = {
+ { "comfollow", '\0', POPT_BIT_SET,    &ftsOpts, FTS_COMFOLLOW,
+       N_("FTS_COMFOLLOW: follow command line symlinks"), NULL },
+ { "logical", '\0', POPT_BIT_SET,      &ftsOpts, FTS_LOGICAL,
+       N_("FTS_LOGICAL: logical walk"), NULL },
+ { "nochdir", '\0', POPT_BIT_SET,      &ftsOpts, FTS_NOCHDIR,
+       N_("FTS_NOCHDIR: don't change directories"), NULL },
+ { "nostat", '\0', POPT_BIT_SET,       &ftsOpts, FTS_NOSTAT,
+       N_("FTS_NOSTAT: don't get stat info"), NULL },
+ { "physical", '\0', POPT_BIT_SET,     &ftsOpts, FTS_PHYSICAL,
+       N_("FTS_PHYSICAL: physical walk"), NULL },
+ { "seedot", '\0', POPT_BIT_SET,       &ftsOpts, FTS_SEEDOT,
+       N_("FTS_SEEDOT: return dot and dot-dot"), NULL },
+ { "xdev", '\0', POPT_BIT_SET,         &ftsOpts, FTS_XDEV,
+       N_("FTS_XDEV: don't cross devices"), NULL },
+ { "whiteout", '\0', POPT_BIT_SET,     &ftsOpts, FTS_WHITEOUT,
+       N_("FTS_WHITEOUT: return whiteout information"), NULL },
+   POPT_TABLEEND
+};
+
 /*@-bitwisesigned -compmempass @*/
 /*@unchecked@*/
 struct poptOption rpmcliAllPoptTable[] = {
index 920eeff..a518e5e 100644 (file)
@@ -103,20 +103,23 @@ struct poptOption rpmQVSourcePoptTable[] = {
        N_("rpm checksig mode"), NULL },
  { "file", 'f', 0, 0, 'f',
        N_("query/verify package(s) owning file"), "FILE" },
- { "fileid", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_QUERYBYFILEID,
-       N_("query/verify package(s) with file identifier"), "MD5" },
- { "ftswalk", 'W', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_FTSWALK,
-       N_("query/verify package(s) from TOP file tree walk"), "TOP" },
  { "group", 'g', 0, 0, 'g',
        N_("query/verify package(s) in group"), "GROUP" },
- { "hdlist", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_HDLIST,
-       N_("query/verify package(s) from system hdlist"), "TOP" },
- { "hdrid", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_QUERYBYHDRID,
-       N_("query/verify package(s) with header identifier"), "SHA1" },
  { "package", 'p', 0, 0, 'p',
        N_("query/verify a package file"), NULL },
- { "pkgid", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_QUERYBYPKGID,
+
+ { "ftswalk", 'W', 0, 0, POPT_FTSWALK,
+       N_("query/verify package(s) from TOP file tree walk"), "TOP" },
+ { "hdlist", 'H', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_HDLIST,
+       N_("query/verify package(s) from system HDLIST"), "HDLIST" },
+
+ { "pkgid", '\0', 0, 0, POPT_QUERYBYPKGID,
        N_("query/verify package(s) with package identifier"), "MD5" },
+ { "hdrid", '\0', 0, 0, POPT_QUERYBYHDRID,
+       N_("query/verify package(s) with header identifier"), "SHA1" },
+ { "fileid", '\0', 0, 0, POPT_QUERYBYFILEID,
+       N_("query/verify package(s) with file identifier"), "MD5" },
+
  { "query", 'q', POPT_ARGFLAG_DOC_HIDDEN, NULL, 'q',
        N_("rpm query mode"), NULL },
  { "querybynumber", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_QUERYBYNUMBER,
@@ -125,7 +128,7 @@ struct poptOption rpmQVSourcePoptTable[] = {
        N_("query a spec file"), N_("<spec>") },
  { "tid", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_QUERYBYTID,
        N_("query/verify package(s) from install transaction"), "TID" },
- { "triggeredby", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_TRIGGEREDBY, 
+ { "triggeredby", '\0', 0, 0, POPT_TRIGGEREDBY, 
        N_("query the package(s) triggered by the package"), "PACKAGE" },
  { "verify", 'V', POPT_ARGFLAG_DOC_HIDDEN, NULL, 'V',
        N_("rpm verify mode"), NULL },
@@ -133,6 +136,7 @@ struct poptOption rpmQVSourcePoptTable[] = {
        N_("query/verify the package(s) which require a dependency"), "CAPABILITY" },
  { "whatprovides", '\0', 0, 0, POPT_WHATPROVIDES, 
        N_("query/verify the package(s) which provide a dependency"), "CAPABILITY" },
+
    POPT_TABLEEND
 };
 
index c81c6c3..510fe6a 100644 (file)
@@ -414,10 +414,7 @@ static inline unsigned char nibble(char c)
 /*@-bounds@*/ /* LCL: segfault (realpath annotation?) */
 int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
 {
-    const char ** av = NULL;
     int res = 0;
-    Header h;
-    int rc;
     const char * s;
     int i;
     int provides_checked = 0;
@@ -433,11 +430,6 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
        res = rpmgiShowMatches(qva, ts);
        break;
 
-    case RPMQV_SPECFILE:
-       res = ((qva->qva_specQuery != NULL)
-               ? qva->qva_specQuery(ts, qva, arg) : 1);
-       break;
-
     case RPMQV_ALL:
        res = rpmgiShowMatches(qva, ts);
        break;
@@ -450,6 +442,11 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
        res = rpmgiShowMatches(qva, ts);
        break;
 
+    case RPMQV_SPECFILE:
+       res = ((qva->qva_specQuery != NULL)
+               ? qva->qva_specQuery(ts, qva, arg) : 1);
+       break;
+
     case RPMQV_GROUP:
        qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_GROUP, arg, 0);
        if (qva->qva_mi == NULL) {
@@ -678,7 +675,6 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg)
 int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv)
 {
     int ec = 0;
-    int ftsOpts = 0;
 
     switch (qva->qva_source) {
     case RPMQV_ALL:
@@ -707,7 +703,7 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv)
        break;
     case RPMQV_FTSWALK:
        qva->qva_gi = rpmgiNew(ts, RPMDBI_FTSWALK, NULL, 0);
-       if (ftsOpts == 0)       /* XXX always 0 */
+       if (ftsOpts == 0)
            ftsOpts = (FTS_COMFOLLOW | FTS_LOGICAL | FTS_NOSTAT);
        qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, ftsOpts, RPMGI_NONE);
        /*@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */
index 2217f18..79b420b 100644 (file)
@@ -28,6 +28,12 @@ extern "C" {
 /*@unchecked@*/
 extern struct poptOption               rpmcliAllPoptTable[];
 
+/*@unchecked@*/
+extern int ftsOpts;
+
+/*@unchecked@*/
+extern struct poptOption               rpmcliFtsPoptTable[];
+
 /*@unchecked@*/ /*@observer@*/ /*@null@*/
 extern const char * rpmcliPipeOutput;
 
index 32ed8ec..9fa5aab 100644 (file)
--- a/lib/tgi.c
+++ b/lib/tgi.c
@@ -16,7 +16,6 @@ static const char * gitagstr = "packages";
 static const char * gikeystr = NULL;
 static rpmtransFlags transFlags = 0;
 static rpmgiFlags giflags = 0;
-static int ftsOpts = 0;
 
 static const char * queryFormat = NULL;
 static const char * defaultQueryFormat =
@@ -70,22 +69,9 @@ static struct poptOption optionsTable[] = {
  { "queryformat", '\0', POPT_ARG_STRING, &queryFormat, 0,
         N_("use the following query format"), "QUERYFORMAT" },
 
- { "comfollow", '\0', POPT_BIT_SET,    &ftsOpts, FTS_COMFOLLOW,
-       N_("follow command line symlinks"), NULL },
- { "logical", '\0', POPT_BIT_SET,      &ftsOpts, FTS_LOGICAL,
-       N_("logical walk"), NULL },
- { "nochdir", '\0', POPT_BIT_SET,      &ftsOpts, FTS_NOCHDIR,
-       N_("don't change directories"), NULL },
- { "nostat", '\0', POPT_BIT_SET,       &ftsOpts, FTS_NOSTAT,
-       N_("don't get stat info"), NULL },
- { "physical", '\0', POPT_BIT_SET,     &ftsOpts, FTS_PHYSICAL,
-       N_("physical walk"), NULL },
- { "seedot", '\0', POPT_BIT_SET,       &ftsOpts, FTS_SEEDOT,
-       N_("return dot and dot-dot"), NULL },
- { "xdev", '\0', POPT_BIT_SET,         &ftsOpts, FTS_XDEV,
-       N_("don't cross devices"), NULL },
- { "whiteout", '\0', POPT_BIT_SET,     &ftsOpts, FTS_WHITEOUT,
-       N_("return whiteout information"), NULL },
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliFtsPoptTable, 0,
+        N_("File tree walk options for fts(3):"),
+        NULL },
 
  { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
         N_("Common options for all rpm modes and executables:"),
diff --git a/rpmqv.c b/rpmqv.c
index 7c5f457..5634179 100755 (executable)
--- a/rpmqv.c
+++ b/rpmqv.c
@@ -74,6 +74,14 @@ static struct poptOption optionsTable[] = {
  { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0,
        N_("Verify options (with -V or --verify):"),
        NULL },
+#ifdef NOTYET
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliQVSourcePoptTable, 0,
+        N_("Source options (with --query or --verify):"),
+        NULL },
+#endif
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliFtsPoptTable, 0,
+        N_("File tree walk options (with --ftswalk):"),
+        NULL },
 #endif /* IAM_RPMQV */
 
 #ifdef IAM_RPMK