summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/rpm.83
-rw-r--r--lib/poptQV.c3
-rw-r--r--lib/query.c4
-rw-r--r--lib/rpmcli.h5
4 files changed, 13 insertions, 2 deletions
diff --git a/doc/rpm.8 b/doc/rpm.8
index ce35fdc4f..13dbb48cb 100644
--- a/doc/rpm.8
+++ b/doc/rpm.8
@@ -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
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.