diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-11-08 10:26:18 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-11-08 11:00:04 +0200 |
commit | a6b04e778c68f6122549a96391455c2917b36150 (patch) | |
tree | 66aad34d39cb73beeca5feb76ee55134b5c242d4 /lib | |
parent | 6c4a0d29ee862b3dbb888679f178d15fb6ed73b2 (diff) | |
download | librpm-tizen-a6b04e778c68f6122549a96391455c2917b36150.tar.gz librpm-tizen-a6b04e778c68f6122549a96391455c2917b36150.tar.bz2 librpm-tizen-a6b04e778c68f6122549a96391455c2917b36150.zip |
Add cli-switch to query for license files
(cherry picked from commit 4b19c17f53f56c841903e5d6a09efdb10b2ca400)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/poptQV.c | 3 | ||||
-rw-r--r-- | lib/query.c | 4 | ||||
-rw-r--r-- | lib/rpmcli.h | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/lib/poptQV.c b/lib/poptQV.c index 1cb5517b9..3db17b0ab 100644 --- a/lib/poptQV.c +++ b/lib/poptQV.c @@ -114,6 +114,7 @@ static void queryArgCallback(poptContext con, switch (opt->val) { case 'c': qva->qva_flags |= QUERY_FOR_CONFIG | QUERY_FOR_LIST; break; case 'd': qva->qva_flags |= QUERY_FOR_DOCS | QUERY_FOR_LIST; break; + case 'L': qva->qva_flags |= QUERY_FOR_LICENSE | QUERY_FOR_LIST; break; case 'l': qva->qva_flags |= QUERY_FOR_LIST; break; case 's': qva->qva_flags |= QUERY_FOR_STATE | QUERY_FOR_LIST; break; @@ -171,6 +172,8 @@ struct poptOption rpmQueryPoptTable[] = { N_("list all configuration files"), NULL }, { "docfiles", 'd', 0, 0, 'd', N_("list all documentation files"), NULL }, + { "licensefiles", 'L', 0, 0, 'L', + N_("list all license files"), NULL }, { "dump", '\0', 0, 0, POPT_DUMP, N_("dump basic file information"), NULL }, { NULL, 'i', POPT_ARGFLAG_DOC_HIDDEN, 0, 'i', diff --git a/lib/query.c b/lib/query.c index 7ecebafe6..6f2d593a7 100644 --- a/lib/query.c +++ b/lib/query.c @@ -146,6 +146,10 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h) if ((qva->qva_flags & QUERY_FOR_CONFIG) && !(fflags & RPMFILE_CONFIG)) continue; + /* If querying only licenses, skip non-license files. */ + if ((qva->qva_flags & QUERY_FOR_LICENSE) && !(fflags & RPMFILE_LICENSE)) + continue; + /* If not querying %ghost, skip ghost files. */ if ((qva->qva_fflags & RPMFILE_GHOST) && (fflags & RPMFILE_GHOST)) continue; diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 1e92c500f..cdb1f8ab4 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -123,14 +123,15 @@ enum rpmQueryFlags_e { QUERY_FOR_STATE = (1 << 24), /*!< query: from --state */ QUERY_FOR_DOCS = (1 << 25), /*!< query: from --docfiles */ QUERY_FOR_CONFIG = (1 << 26), /*!< query: from --configfiles */ - QUERY_FOR_DUMPFILES = (1 << 27) /*!< query: from --dump */ + QUERY_FOR_DUMPFILES = (1 << 27), /*!< query: from --dump */ + QUERY_FOR_LICENSE = (1 << 28) /*!< query: from --licensefiles */ }; typedef rpmFlags rpmQueryFlags; #define _QUERY_FOR_BITS \ (QUERY_FOR_LIST|QUERY_FOR_STATE|QUERY_FOR_DOCS|QUERY_FOR_CONFIG|\ - QUERY_FOR_DUMPFILES) + QUERY_FOR_LICENSE|QUERY_FOR_DUMPFILES) /** \ingroup rpmcli * Bit(s) from common command line options. |