diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-03-19 16:52:19 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-03-19 16:52:19 +0200 |
commit | d87d831cdfd3a8b389dfc71d5b671c5e7dcf74d9 (patch) | |
tree | 8ab1abacedd8c07bf8a951e788be5da56c7e88e3 | |
parent | f510c8704cbd08719e5f868976cfd4242b6fca13 (diff) | |
download | rpm-d87d831cdfd3a8b389dfc71d5b671c5e7dcf74d9.tar.gz rpm-d87d831cdfd3a8b389dfc71d5b671c5e7dcf74d9.tar.bz2 rpm-d87d831cdfd3a8b389dfc71d5b671c5e7dcf74d9.zip |
Eliminate --wtfwalk .. err, --ftswalk and everything implementing it
- that's what find + xargs are for, this is just useless cruft
-rw-r--r-- | lib/poptALL.c | 22 | ||||
-rw-r--r-- | lib/poptQV.c | 5 | ||||
-rw-r--r-- | lib/query.c | 10 | ||||
-rw-r--r-- | lib/rpmcli.h | 5 | ||||
-rw-r--r-- | lib/rpmgi.c | 128 | ||||
-rw-r--r-- | lib/rpmgi.h | 16 | ||||
-rw-r--r-- | lib/rpmtag.h | 1 | ||||
-rw-r--r-- | lib/tagname.c | 6 | ||||
-rw-r--r-- | rpmqv.c | 3 |
9 files changed, 5 insertions, 191 deletions
diff --git a/lib/poptALL.c b/lib/poptALL.c index d4c02b466..0b331c509 100644 --- a/lib/poptALL.c +++ b/lib/poptALL.c @@ -170,28 +170,6 @@ static void rpmcliAllArgCallback( poptContext con, } } -int ftsOpts = 0; - -struct poptOption rpmcliFtsPoptTable[] = { - { "comfollow", '\0', POPT_BIT_SET, &ftsOpts, RPMGI_COMFOLLOW, - N_("follow command line symlinks"), NULL }, - { "logical", '\0', POPT_BIT_SET, &ftsOpts, RPMGI_LOGICAL, - N_("logical walk"), NULL }, - { "nochdir", '\0', POPT_BIT_SET, &ftsOpts, RPMGI_NOCHDIR, - N_("don't change directories"), NULL }, - { "nostat", '\0', POPT_BIT_SET, &ftsOpts, RPMGI_NOSTAT, - N_("don't get stat info"), NULL }, - { "physical", '\0', POPT_BIT_SET, &ftsOpts, RPMGI_PHYSICAL, - N_("physical walk"), NULL }, - { "seedot", '\0', POPT_BIT_SET, &ftsOpts, RPMGI_SEEDOT, - N_("return dot and dot-dot"), NULL }, - { "xdev", '\0', POPT_BIT_SET, &ftsOpts, RPMGI_XDEV, - N_("don't cross devices"), NULL }, - { "whiteout", '\0', POPT_BIT_SET, &ftsOpts, RPMGI_WHITEOUT, - N_("return whiteout information"), NULL }, - POPT_TABLEEND -}; - struct poptOption rpmcliAllPoptTable[] = { /* FIX: cast? */ { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA | POPT_CBFLAG_CONTINUE, diff --git a/lib/poptQV.c b/lib/poptQV.c index ed512b955..42d913c73 100644 --- a/lib/poptQV.c +++ b/lib/poptQV.c @@ -24,7 +24,6 @@ struct rpmQVKArguments_s rpmQVKArgs; #define POPT_QUERYBYFILEID -1009 #define POPT_QUERYBYTID -1010 #define POPT_HDLIST -1011 -#define POPT_FTSWALK -1012 /* ========== Query/Verify/Signature source args */ static void rpmQVSourceArgCallback( poptContext con, @@ -67,8 +66,6 @@ static void rpmQVSourceArgCallback( poptContext con, qva->qva_sourceCount++; break; case POPT_HDLIST: qva->qva_source |= RPMQV_HDLIST; qva->qva_sourceCount++; break; - case POPT_FTSWALK:qva->qva_source |= RPMQV_FTSWALK; - qva->qva_sourceCount++; break; /* XXX SPECFILE is not verify sources */ case POPT_SPECFILE: @@ -100,8 +97,6 @@ struct poptOption rpmQVSourcePoptTable[] = { { "package", 'p', 0, 0, 'p', N_("query/verify a package file"), NULL }, - { "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" }, diff --git a/lib/query.c b/lib/query.c index 1d4d69745..7622a4364 100644 --- a/lib/query.c +++ b/lib/query.c @@ -316,7 +316,6 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg) case RPMQV_RPM: case RPMQV_ALL: case RPMQV_HDLIST: - case RPMQV_FTSWALK: res = rpmgiShowMatches(qva, ts); break; @@ -535,7 +534,7 @@ static int rpmcliArgIterHelper(rpmts ts, QVA_t qva, rpmTag tag, ARGV_const_t arg int ec = 0; qva->qva_gi = rpmgiNew(ts, tag, NULL, 0); - rpmgiSetArgs(qva->qva_gi, argv, ftsOpts, gFlgs); + rpmgiSetArgs(qva->qva_gi, argv, gFlgs); /* FIX: argv can be NULL, cast to pass argv array */ ec = rpmQueryVerify(qva, ts, (tag == RPMDBI_PACKAGES)? (const char *) argv : NULL); @@ -557,14 +556,9 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv) case RPMQV_HDLIST: ec = rpmcliArgIterHelper(ts, qva, RPMDBI_HDLIST, argv, giFlags); break; - case RPMQV_FTSWALK: - if (ftsOpts == 0) - ftsOpts = (RPMGI_COMFOLLOW | RPMGI_LOGICAL | RPMGI_NOSTAT); - ec = rpmcliArgIterHelper(ts, qva, RPMDBI_FTSWALK, argv, giFlags); - break; default: qva->qva_gi = rpmgiNew(ts, RPMDBI_ARGLIST, NULL, 0); - rpmgiSetArgs(qva->qva_gi, argv, ftsOpts, + rpmgiSetArgs(qva->qva_gi, argv, (giFlags | (RPMGI_NOGLOB|RPMGI_NOHEADER))); while (rpmgiNext(qva->qva_gi) == RPMRC_OK) { ec += rpmQueryVerify(qva, ts, rpmgiHdrPath(qva->qva_gi)); diff --git a/lib/rpmcli.h b/lib/rpmcli.h index cc0e1390b..5a6b7052f 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -30,10 +30,6 @@ extern int _noDirTokens; */ extern struct poptOption rpmcliAllPoptTable[]; -extern int ftsOpts; - -extern struct poptOption rpmcliFtsPoptTable[]; - extern const char * rpmcliPipeOutput; extern const char * rpmcliRcfile; @@ -100,7 +96,6 @@ typedef enum rpmQVSources_e { RPMQV_FILEID, /*!< ... from file id (file MD5). */ RPMQV_TID, /*!< ... from install transaction id (time stamp). */ RPMQV_HDLIST, /*!< ... from system hdlist. */ - RPMQV_FTSWALK /*!< ... from fts(3) walk. */ } rpmQVSources; /** \ingroup rpmcli diff --git a/lib/rpmgi.c b/lib/rpmgi.c index 1b614bf79..1628f4099 100644 --- a/lib/rpmgi.c +++ b/lib/rpmgi.c @@ -15,7 +15,6 @@ #include <rpm/rpmfileutil.h> #include <rpm/rpmlog.h> -#include "rpmio/fts.h" #include "lib/manifest.h" #include "debug.h" @@ -47,38 +46,8 @@ struct rpmgi_s { ARGV_t argv; int argc; - - int ftsOpts; - FTS * ftsp; - FTSENT * fts; -}; - -static const char * const ftsInfoStrings[] = { - "UNKNOWN", - "D", - "DC", - "DEFAULT", - "DNR", - "DOT", - "DP", - "ERR", - "F", - "INIT", - "NS", - "NSOK", - "SL", - "SLNONE", - "W", }; -static const char * ftsInfoStr(int fts_info) -{ - - if (!(fts_info >= 1 && fts_info <= 14)) - fts_info = 0; - return ftsInfoStrings[ fts_info ]; -} - /** * Open a file after macro expanding path. * @todo There are two error messages printed on header, then manifest failures. @@ -203,67 +172,6 @@ static rpmRC rpmgiLoadReadHeader(rpmgi gi) return rpmrc; } -/** - * Filter file tree walk path. - * @param gi generalized iterator - * @return RPMRC_OK on success - */ -static rpmRC rpmgiWalkPathFilter(rpmgi gi) -{ - FTSENT * fts = gi->fts; - rpmRC rpmrc = RPMRC_NOTFOUND; - static const int indent = 2; - - -if (_rpmgi_debug < 0) -rpmlog(RPMLOG_DEBUG, "FTS_%s\t%*s %s%s\n", ftsInfoStr(fts->fts_info), - indent * (fts->fts_level < 0 ? 0 : fts->fts_level), "", - fts->fts_name, - ((fts->fts_info == FTS_D || fts->fts_info == FTS_DP) ? "/" : "")); - - switch (fts->fts_info) { - case FTS_F: - /* Ignore all but *.rpm files. */ - if (!rpmFileHasSuffix(fts->fts_name, ".rpm")) - break; - rpmrc = RPMRC_OK; - break; - default: - break; - } - return rpmrc; -} - -/** - * Read header from next package, lazily walking file tree. - * @param gi generalized iterator - * @return RPMRC_OK on success - */ -static rpmRC rpmgiWalkReadHeader(rpmgi gi) -{ - rpmRC rpmrc = RPMRC_NOTFOUND; - - if (gi->ftsp != NULL) - while ((gi->fts = Fts_read(gi->ftsp)) != NULL) { - rpmrc = rpmgiWalkPathFilter(gi); - if (rpmrc == RPMRC_OK) - break; - } - - if (rpmrc == RPMRC_OK) { - Header h = NULL; - if (!(gi->flags & RPMGI_NOHEADER)) { - /* XXX rpmrc = rpmgiLoadReadHeader(gi); */ - if (gi->fts != NULL) /* XXX can't happen */ - h = rpmgiReadHeader(gi, gi->fts->fts_path); - } - if (h != NULL) - gi->h = headerLink(h); - h = headerFree(h); - } - - return rpmrc; -} /** * Append globbed arg list to iterator. @@ -280,7 +188,7 @@ static rpmRC rpmgiGlobArgv(rpmgi gi, ARGV_const_t argv) /* XXX Expand globs only if requested or for gi specific tags */ if ((gi->flags & RPMGI_NOGLOB) - || !(gi->tag == RPMDBI_HDLIST || gi->tag == RPMDBI_ARGLIST || gi->tag == RPMDBI_FTSWALK)) + || !(gi->tag == RPMDBI_HDLIST || gi->tag == RPMDBI_ARGLIST)) { if (argv != NULL) { while (argv[ac] != NULL) @@ -370,12 +278,6 @@ rpmgi rpmgiFree(rpmgi gi) gi->argv = argvFree(gi->argv); - if (gi->ftsp != NULL) { - int xx; - xx = Fts_close(gi->ftsp); - gi->ftsp = NULL; - gi->fts = NULL; - } if (gi->fd != NULL) { (void) Fclose(gi->fd); gi->fd = NULL; @@ -413,9 +315,6 @@ rpmgi rpmgiNew(rpmts ts, rpmTag tag, const void * keyp, size_t keylen) gi->fd = NULL; gi->argv = argvNew(); gi->argc = 0; - gi->ftsOpts = 0; - gi->ftsp = NULL; - gi->fts = NULL; return gi; } @@ -528,28 +427,6 @@ fprintf(stderr, "*** gi %p\t%p[%d]: %s\n", gi, gi->argv, gi->i, gi->argv[gi->i]) gi->hdrPath = xstrdup(gi->argv[gi->i]); break; - case RPMDBI_FTSWALK: - if (gi->argv == NULL) /* HACK */ - goto enditer; - - if (!gi->active) { - gi->ftsp = Fts_open((char *const *)gi->argv, gi->ftsOpts, NULL); - /* XXX NULL with open(2)/malloc(3) errno set */ - gi->active = 1; - } - - /* Read next header, lazily walking file tree. */ - rpmrc = rpmgiWalkReadHeader(gi); - - if (rpmrc != RPMRC_OK) { - xx = Fts_close(gi->ftsp); - gi->ftsp = NULL; - goto enditer; - } - - if (gi->fts != NULL) - gi->hdrPath = xstrdup(gi->fts->fts_path); - break; } return rpmrc; @@ -573,9 +450,8 @@ Header rpmgiHeader(rpmgi gi) return (gi != NULL ? gi->h : NULL); } -rpmRC rpmgiSetArgs(rpmgi gi, ARGV_const_t argv, int ftsOpts, rpmgiFlags flags) +rpmRC rpmgiSetArgs(rpmgi gi, ARGV_const_t argv, rpmgiFlags flags) { - gi->ftsOpts = ftsOpts; gi->flags = flags; return rpmgiGlobArgv(gi, argv); } diff --git a/lib/rpmgi.h b/lib/rpmgi.h index 4fcf8f844..5e188ab83 100644 --- a/lib/rpmgi.h +++ b/lib/rpmgi.h @@ -25,18 +25,6 @@ typedef enum rpmgiFlags_e { RPMGI_NOHEADER = (1 << 4) } rpmgiFlags; -/** \ingroup rpmgi - * rpmgi FTS-flags - */ -#define RPMGI_COMFOLLOW 0x0001 /* follow command line symlinks */ -#define RPMGI_LOGICAL 0x0002 /* logical walk */ -#define RPMGI_NOCHDIR 0x0004 /* don't change directories */ -#define RPMGI_NOSTAT 0x0008 /* don't get stat info */ -#define RPMGI_PHYSICAL 0x0010 /* physical walk */ -#define RPMGI_SEEDOT 0x0020 /* return dot and dot-dot */ -#define RPMGI_XDEV 0x0040 /* don't cross devices */ -#define RPMGI_WHITEOUT 0x0080 /* return whiteout information */ - extern rpmgiFlags giFlags; /** \ingroup rpmgi @@ -82,12 +70,10 @@ Header rpmgiHeader(rpmgi gi); * Load iterator args. * @param gi generalized iterator * @param argv arg list - * @param ftsOpts fts(3) flags * @param flags iterator flags * @return RPMRC_OK on success */ -rpmRC rpmgiSetArgs(rpmgi gi, ARGV_const_t argv, - int ftsOpts, rpmgiFlags flags); +rpmRC rpmgiSetArgs(rpmgi gi, ARGV_const_t argv, rpmgiFlags flags); /** \ingroup rpmgi diff --git a/lib/rpmtag.h b/lib/rpmtag.h index 5f68971c4..2adf40bfe 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -18,7 +18,6 @@ extern "C" { #define RPMDBI_AVAILABLE 5 /* Available package headers. */ #define RPMDBI_HDLIST 6 /* (rpmgi) Header list. */ #define RPMDBI_ARGLIST 7 /* (rpmgi) Argument list. */ -#define RPMDBI_FTSWALK 8 /* (rpmgi) File tree walk. */ /** * Header private tags. diff --git a/lib/tagname.c b/lib/tagname.c index abf278eeb..5f2c6fbb4 100644 --- a/lib/tagname.c +++ b/lib/tagname.c @@ -147,9 +147,6 @@ static const char * _tagName(rpmTag tag) case RPMDBI_ARGLIST: name = "Arglist"; break; - case RPMDBI_FTSWALK: - name = "Ftswalk"; - break; /* XXX make sure rpmdb indices are identically named. */ case RPMTAG_CONFLICTS: @@ -207,7 +204,6 @@ static rpmTagType _tagType(rpmTag tag) case RPMDBI_AVAILABLE: case RPMDBI_HDLIST: case RPMDBI_ARGLIST: - case RPMDBI_FTSWALK: break; default: if (_rpmTags.byValue == NULL) @@ -258,8 +254,6 @@ static rpmTag _tagValue(const char * tagstr) return RPMDBI_HDLIST; if (!rstrcasecmp(tagstr, "Arglist")) return RPMDBI_ARGLIST; - if (!rstrcasecmp(tagstr, "Ftswalk")) - return RPMDBI_FTSWALK; if (_rpmTags.byName == NULL) xx = tagLoadIndex(&_rpmTags.byName, &_rpmTags.byNameSize, tagCmpName); @@ -86,9 +86,6 @@ static struct poptOption optionsTable[] = { { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmVerifyPoptTable, 0, N_("Verify options (with -V or --verify):"), NULL }, - { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliFtsPoptTable, 0, - N_("File tree walk options (with --ftswalk):"), - NULL }, #endif /* IAM_RPMQV */ #ifdef IAM_RPMK |