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