diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/poptALL.c | 25 | ||||
-rw-r--r-- | lib/poptQV.c | 24 | ||||
-rw-r--r-- | lib/query.c | 16 | ||||
-rw-r--r-- | lib/rpmcli.h | 6 | ||||
-rw-r--r-- | lib/tgi.c | 20 |
5 files changed, 54 insertions, 37 deletions
diff --git a/lib/poptALL.c b/lib/poptALL.c index ed1ef1fc6..2344924e8 100644 --- a/lib/poptALL.c +++ b/lib/poptALL.c @@ -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[] = { diff --git a/lib/poptQV.c b/lib/poptQV.c index 920eeffb7..a518e5e3f 100644 --- a/lib/poptQV.c +++ b/lib/poptQV.c @@ -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 }; diff --git a/lib/query.c b/lib/query.c index c81c6c3f6..510fe6a86 100644 --- a/lib/query.c +++ b/lib/query.c @@ -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 */ diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 2217f18ba..79b420b74 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -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; @@ -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:"), |