23f0aa5e5d
- resolves: #1231247
158 lines
6.0 KiB
Diff
158 lines
6.0 KiB
Diff
diff --git a/doc/rpm.8 b/doc/rpm.8
|
|
index e583009..283e8ac 100644
|
|
--- a/doc/rpm.8
|
|
+++ b/doc/rpm.8
|
|
@@ -58,6 +58,8 @@ rpm \- RPM Package Manager
|
|
[\fB--hdrid \fISHA1\fB\fR] [\fB--pkgid \fIMD5\fB\fR] [\fB--tid \fITID\fB\fR]
|
|
[\fB--querybynumber \fIHDRNUM\fB\fR] [\fB--triggeredby \fIPACKAGE_NAME\fB\fR]
|
|
[\fB--whatprovides \fICAPABILITY\fB\fR] [\fB--whatrequires \fICAPABILITY\fB\fR]
|
|
+ [\fB--whatrecommends \fICAPABILITY\fB\fR] [\fB--whatsuggests \fICAPABILITY\fB\fR]
|
|
+ [\fB--whatsupplements \fICAPABILITY\fB\fR] [\fB--whatenhances \fICAPABILITY\fB\fR]
|
|
|
|
.SS "query-options"
|
|
.PP
|
|
@@ -588,6 +590,18 @@ Query all packages that provide the \fICAPABILITY\fR capability.
|
|
.TP
|
|
\fB--whatrequires \fICAPABILITY\fB\fR
|
|
Query all packages that require \fICAPABILITY\fR for proper functioning.
|
|
+.TP
|
|
+\fB--whatrecommends \fICAPABILITY\fB\fR
|
|
+Query all packages that recommend \fICAPABILITY\fR.
|
|
+.TP
|
|
+\fB--whatsuggests \fICAPABILITY\fB\fR
|
|
+Query all packages that suggest \fICAPABILITY\fR.
|
|
+.TP
|
|
+\fB--whatsupplements \fICAPABILITY\fB\fR
|
|
+Query all packages that supplement \fICAPABILITY\fR.
|
|
+.TP
|
|
+\fB--whatenhances \fICAPABILITY\fB\fR
|
|
+Query all packages that enhance \fICAPABILITY\fR.
|
|
.SS "PACKAGE QUERY OPTIONS:"
|
|
.PP
|
|
.TP
|
|
diff --git a/lib/poptQV.c b/lib/poptQV.c
|
|
index 3db17b0..80edce7 100644
|
|
--- a/lib/poptQV.c
|
|
+++ b/lib/poptQV.c
|
|
@@ -21,6 +21,10 @@ struct rpmQVKArguments_s rpmQVKArgs;
|
|
#define POPT_QUERYBYPKGID -1007
|
|
#define POPT_QUERYBYHDRID -1008
|
|
#define POPT_QUERYBYTID -1010
|
|
+#define POPT_WHATRECOMMENDS -1011
|
|
+#define POPT_WHATSUGGESTS -1012
|
|
+#define POPT_WHATSUPPLEMENTS -1013
|
|
+#define POPT_WHATENHANCES -1014
|
|
|
|
/* ========== Query/Verify/Signature source args */
|
|
static void rpmQVSourceArgCallback( poptContext con,
|
|
@@ -45,6 +49,10 @@ static void rpmQVSourceArgCallback( poptContext con,
|
|
case 'p': qva->qva_source |= RPMQV_RPM; break;
|
|
case POPT_WHATPROVIDES: qva->qva_source |= RPMQV_WHATPROVIDES; break;
|
|
case POPT_WHATREQUIRES: qva->qva_source |= RPMQV_WHATREQUIRES; break;
|
|
+ case POPT_WHATRECOMMENDS: qva->qva_source |= RPMQV_WHATRECOMMENDS; break;
|
|
+ case POPT_WHATSUGGESTS: qva->qva_source |= RPMQV_WHATSUGGESTS; break;
|
|
+ case POPT_WHATSUPPLEMENTS: qva->qva_source |= RPMQV_WHATSUPPLEMENTS; break;
|
|
+ case POPT_WHATENHANCES: qva->qva_source |= RPMQV_WHATENHANCES; break;
|
|
case POPT_TRIGGEREDBY: qva->qva_source |= RPMQV_TRIGGEREDBY; break;
|
|
case POPT_QUERYBYPKGID: qva->qva_source |= RPMQV_PKGID; break;
|
|
case POPT_QUERYBYHDRID: qva->qva_source |= RPMQV_HDRID; break;
|
|
@@ -93,6 +101,14 @@ struct poptOption rpmQVSourcePoptTable[] = {
|
|
N_("query/verify the package(s) which require a dependency"), "CAPABILITY" },
|
|
{ "whatprovides", '\0', 0, 0, POPT_WHATPROVIDES,
|
|
N_("query/verify the package(s) which provide a dependency"), "CAPABILITY" },
|
|
+ { "whatrecommends", '\0', 0, 0, POPT_WHATRECOMMENDS,
|
|
+ N_("query/verify the package(s) which recommends a dependency"), "CAPABILITY" },
|
|
+ { "whatsuggests", '\0', 0, 0, POPT_WHATSUGGESTS,
|
|
+ N_("query/verify the package(s) which suggests a dependency"), "CAPABILITY" },
|
|
+ { "whatsupplements", '\0', 0, 0, POPT_WHATSUPPLEMENTS,
|
|
+ N_("query/verify the package(s) which supplements a dependency"), "CAPABILITY" },
|
|
+ { "whatenhances", '\0', 0, 0, POPT_WHATENHANCES,
|
|
+ N_("query/verify the package(s) which enhances a dependency"), "CAPABILITY" },
|
|
|
|
{ "noglob", '\0', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN, &giFlags, RPMGI_NOGLOB,
|
|
N_("do not glob arguments"), NULL},
|
|
diff --git a/lib/query.c b/lib/query.c
|
|
index 896ebe3..b15b99b 100644
|
|
--- a/lib/query.c
|
|
+++ b/lib/query.c
|
|
@@ -384,6 +384,34 @@ static rpmdbMatchIterator initQueryIterator(QVA_t qva, rpmts ts, const char * ar
|
|
}
|
|
break;
|
|
|
|
+ case RPMQV_WHATRECOMMENDS:
|
|
+ mi = rpmtsInitIterator(ts, RPMDBI_RECOMMENDNAME, arg, 0);
|
|
+ if (mi == NULL) {
|
|
+ rpmlog(RPMLOG_NOTICE, _("no package recommends %s\n"), arg);
|
|
+ }
|
|
+ break;
|
|
+
|
|
+ case RPMQV_WHATSUGGESTS:
|
|
+ mi = rpmtsInitIterator(ts, RPMDBI_SUGGESTNAME, arg, 0);
|
|
+ if (mi == NULL) {
|
|
+ rpmlog(RPMLOG_NOTICE, _("no package suggests %s\n"), arg);
|
|
+ }
|
|
+ break;
|
|
+
|
|
+ case RPMQV_WHATSUPPLEMENTS:
|
|
+ mi = rpmtsInitIterator(ts, RPMDBI_SUPPLEMENTNAME, arg, 0);
|
|
+ if (mi == NULL) {
|
|
+ rpmlog(RPMLOG_NOTICE, _("no package supplements %s\n"), arg);
|
|
+ }
|
|
+ break;
|
|
+
|
|
+ case RPMQV_WHATENHANCES:
|
|
+ mi = rpmtsInitIterator(ts, RPMDBI_ENHANCENAME, arg, 0);
|
|
+ if (mi == NULL) {
|
|
+ rpmlog(RPMLOG_NOTICE, _("no package enhances %s\n"), arg);
|
|
+ }
|
|
+ break;
|
|
+
|
|
case RPMQV_WHATPROVIDES:
|
|
if (arg[0] != '/' && arg[0] != '.') {
|
|
mi = rpmtsInitIterator(ts, RPMDBI_PROVIDENAME, arg, 0);
|
|
diff --git a/lib/rpmcli.h b/lib/rpmcli.h
|
|
index 48e8250..4adb3d1 100644
|
|
--- a/lib/rpmcli.h
|
|
+++ b/lib/rpmcli.h
|
|
@@ -91,6 +91,10 @@ enum rpmQVSources_e {
|
|
RPMQV_HDRID, /*!< ... from header id (immutable header SHA1). */
|
|
RPMQV_TID, /*!< ... from install transaction id (time stamp). */
|
|
RPMQV_SPECSRPM, /*!< ... from spec file source (query only). */
|
|
+ RPMQV_WHATRECOMMENDS, /*!< ... from recommends db search. */
|
|
+ RPMQV_WHATSUGGESTS, /*!< ... from suggests db search. */
|
|
+ RPMQV_WHATSUPPLEMENTS, /*!< ... from supplements db search. */
|
|
+ RPMQV_WHATENHANCES, /*!< ... from enhances db search. */
|
|
};
|
|
|
|
typedef rpmFlags rpmQVSources;
|
|
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
|
|
index b6d3247..baa1974 100644
|
|
--- a/lib/rpmdb.c
|
|
+++ b/lib/rpmdb.c
|
|
@@ -493,6 +493,10 @@ static rpmdb newRpmdb(const char * root, const char * home,
|
|
RPMDBI_INSTALLTID,
|
|
RPMDBI_SIGMD5,
|
|
RPMDBI_SHA1HEADER,
|
|
+ RPMDBI_RECOMMENDNAME,
|
|
+ RPMDBI_SUGGESTNAME,
|
|
+ RPMDBI_SUPPLEMENTNAME,
|
|
+ RPMDBI_ENHANCENAME,
|
|
};
|
|
|
|
if (!(db_home && db_home[0] != '%')) {
|
|
diff --git a/lib/rpmtag.h b/lib/rpmtag.h
|
|
index 12a2a50..1dc1c2b 100644
|
|
--- a/lib/rpmtag.h
|
|
+++ b/lib/rpmtag.h
|
|
@@ -353,6 +353,10 @@ typedef enum rpmDbiTag_e {
|
|
RPMDBI_SIGMD5 = RPMTAG_SIGMD5,
|
|
RPMDBI_SHA1HEADER = RPMTAG_SHA1HEADER,
|
|
RPMDBI_INSTFILENAMES = RPMTAG_INSTFILENAMES,
|
|
+ RPMDBI_RECOMMENDNAME = RPMTAG_RECOMMENDNAME,
|
|
+ RPMDBI_SUGGESTNAME = RPMTAG_SUGGESTNAME,
|
|
+ RPMDBI_SUPPLEMENTNAME = RPMTAG_SUPPLEMENTNAME,
|
|
+ RPMDBI_ENHANCENAME = RPMTAG_ENHANCENAME,
|
|
} rpmDbiTag;
|
|
|
|
/** \ingroup signature
|