Add cli-switch to query for license files

This commit is contained in:
Panu Matilainen 2012-11-08 10:26:18 +02:00
parent 5998b02665
commit 4b19c17f53
4 changed files with 13 additions and 2 deletions

View File

@ -607,6 +607,9 @@ This uses the \fB--queryformat\fR if one was specified.
Orders the package listing by install time such that the latest
packages are at the top.
.TP
\fB-L, --licensefiles\fR
List only license files (implies \fB-l\fR).
.TP
\fB-l, --list\fR
List files in package.
.TP

View File

@ -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',

View File

@ -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;

View File

@ -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.