diff options
author | jbj <devnull@localhost> | 2004-10-25 01:10:13 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2004-10-25 01:10:13 +0000 |
commit | 7c25d1ffaed9ab2e626db874150d17bbc6424cee (patch) | |
tree | 645d39710f0b26f139e4899bac393a9e32560929 /lib | |
parent | 7138fa3bed4ef36fe94e2f6bdbac071685cbe86d (diff) | |
download | librpm-tizen-7c25d1ffaed9ab2e626db874150d17bbc6424cee.tar.gz librpm-tizen-7c25d1ffaed9ab2e626db874150d17bbc6424cee.tar.bz2 librpm-tizen-7c25d1ffaed9ab2e626db874150d17bbc6424cee.zip |
Add undocumented --hdlist and --ftswalk query/verify sources.
Bugs:
* @todo hdlist should use argv to open system hdlist path.
CVS patchset: 7508
CVS date: 2004/10/25 01:10:13
Diffstat (limited to 'lib')
-rw-r--r-- | lib/poptQV.c | 10 | ||||
-rw-r--r-- | lib/query.c | 31 | ||||
-rw-r--r-- | lib/rpmcli.h | 4 | ||||
-rw-r--r-- | lib/rpmgi.c | 15 |
4 files changed, 50 insertions, 10 deletions
diff --git a/lib/poptQV.c b/lib/poptQV.c index 52ecf5230..66ebe58a2 100644 --- a/lib/poptQV.c +++ b/lib/poptQV.c @@ -27,6 +27,8 @@ int specedit = 0; #define POPT_QUERYBYHDRID -1008 #define POPT_QUERYBYFILEID -1009 #define POPT_QUERYBYTID -1010 +#define POPT_HDLIST -1011 +#define POPT_FTSWALK -1012 /* ========== Query/Verify/Signature source args */ static void rpmQVSourceArgCallback( /*@unused@*/ poptContext con, @@ -69,6 +71,10 @@ static void rpmQVSourceArgCallback( /*@unused@*/ poptContext con, qva->qva_sourceCount++; break; case POPT_QUERYBYTID: qva->qva_source |= RPMQV_TID; 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: @@ -99,8 +105,12 @@ struct poptOption rpmQVSourcePoptTable[] = { 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", '\0', 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', diff --git a/lib/query.c b/lib/query.c index 9864c46a0..c81c6c3f6 100644 --- a/lib/query.c +++ b/lib/query.c @@ -442,6 +442,14 @@ int rpmQueryVerify(QVA_t qva, rpmts ts, const char * arg) res = rpmgiShowMatches(qva, ts); break; + case RPMQV_HDLIST: + res = rpmgiShowMatches(qva, ts); + break; + + case RPMQV_FTSWALK: + res = rpmgiShowMatches(qva, ts); + break; + case RPMQV_GROUP: qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_GROUP, arg, 0); if (qva->qva_mi == NULL) { @@ -670,11 +678,12 @@ 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: qva->qva_gi = rpmgiNew(ts, RPMDBI_PACKAGES, NULL, 0); - qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, 0, RPMGI_NONE); + qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, ftsOpts, RPMGI_NONE); /*@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */ ec = rpmQueryVerify(qva, ts, (const char *) argv); /*@=nullpass@*/ @@ -682,7 +691,25 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_t argv) break; case RPMQV_RPM: qva->qva_gi = rpmgiNew(ts, RPMDBI_ARGLIST, NULL, 0); - qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, 0, RPMGI_NONE); + qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, ftsOpts, RPMGI_NONE); + /*@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */ + ec = rpmQueryVerify(qva, ts, NULL); + /*@=nullpass@*/ + rpmtsEmpty(ts); + break; + case RPMQV_HDLIST: + qva->qva_gi = rpmgiNew(ts, RPMDBI_HDLIST, NULL, 0); + qva->qva_rc = rpmgiSetArgs(qva->qva_gi, argv, ftsOpts, RPMGI_NONE); + /*@-nullpass@*/ /* FIX: argv can be NULL, cast to pass argv array */ + ec = rpmQueryVerify(qva, ts, NULL); + /*@=nullpass@*/ + rpmtsEmpty(ts); + break; + case RPMQV_FTSWALK: + qva->qva_gi = rpmgiNew(ts, RPMDBI_FTSWALK, NULL, 0); + if (ftsOpts == 0) /* XXX always 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 */ ec = rpmQueryVerify(qva, ts, NULL); /*@=nullpass@*/ diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 89519059c..2217f18ba 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -106,7 +106,9 @@ typedef enum rpmQVSources_e { RPMQV_PKGID, /*!< ... from package id (header+payload MD5). */ RPMQV_HDRID, /*!< ... from header id (immutable header SHA1). */ RPMQV_FILEID, /*!< ... from file id (file MD5). */ - RPMQV_TID /*!< ... from install transaction id (time stamp). */ + 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 bdaa04cf7..11057f0f9 100644 --- a/lib/rpmgi.c +++ b/lib/rpmgi.c @@ -471,19 +471,20 @@ rpmRC rpmgiNext(/*@null@*/ rpmgi gi) } if (gi->fd != NULL) { Header h = headerRead(gi->fd, HEADER_MAGIC_YES); - if (h != NULL && !(gi->flags & RPMGI_NOHEADER)) - gi->h = headerLink(h); - sprintf(hnum, "%u", (unsigned)gi->i); - rpmrc = RPMRC_OK; - h = headerFree(h); + if (h != NULL) { + if (!(gi->flags & RPMGI_NOHEADER)) + gi->h = headerLink(h); + sprintf(hnum, "%u", (unsigned)gi->i); + gi->hdrPath = rpmExpand("hdlist h# ", hnum, NULL); + rpmrc = RPMRC_OK; + h = headerFree(h); + } } - if (rpmrc != RPMRC_OK) { if (gi->fd != NULL) (void) Fclose(gi->fd); gi->fd = NULL; goto enditer; } - gi->hdrPath = rpmExpand("hdlist h# ", hnum, NULL); break; case RPMDBI_ARGLIST: /* XXX gi->active initialize? */ |