#include "system.h"
#include <rpmcli.h>
+#include <fts.h>
#include "debug.h"
/*@=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[] = {
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,
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 },
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
};
/*@-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;
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;
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) {
int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv)
{
int ec = 0;
- int ftsOpts = 0;
switch (qva->qva_source) {
case RPMQV_ALL:
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 */
/*@unchecked@*/
extern struct poptOption rpmcliAllPoptTable[];
+/*@unchecked@*/
+extern int ftsOpts;
+
+/*@unchecked@*/
+extern struct poptOption rpmcliFtsPoptTable[];
+
/*@unchecked@*/ /*@observer@*/ /*@null@*/
extern const char * rpmcliPipeOutput;
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 =
{ "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:"),
{ 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