Eliminate --wtfwalk .. err, --ftswalk and everything implementing it
- that's what find + xargs are for, this is just useless cruft
This commit is contained in:
parent
f510c8704c
commit
d87d831cdf
|
@ -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,
|
||||
|
|
|
@ -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" },
|
||||
|
||||
|
|
10
lib/query.c
10
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));
|
||||
|
|
|
@ -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
|
||||
|
|
128
lib/rpmgi.c
128
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);
|
||||
}
|
||||
|
|
16
lib/rpmgi.h
16
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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
3
rpmqv.c
3
rpmqv.c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue