Add support for various types of dependencies to rpmdeps tool

Options added to rpmdeps tool:
--recommends
--suggests
--supplements
--enhances
--conflicts
--obsoletes
This commit is contained in:
Lubos Kardos 2015-09-21 14:13:22 +02:00
parent 54f24ec548
commit 7a84b45c62
3 changed files with 108 additions and 0 deletions

View File

@ -789,6 +789,36 @@ rpmds rpmfcRequires(rpmfc fc)
return rpmfcDependencies(fc, RPMTAG_REQUIRENAME); return rpmfcDependencies(fc, RPMTAG_REQUIRENAME);
} }
rpmds rpmfcRecommends(rpmfc fc)
{
return rpmfcDependencies(fc, RPMTAG_RECOMMENDNAME);
}
rpmds rpmfcSuggests(rpmfc fc)
{
return rpmfcDependencies(fc, RPMTAG_SUGGESTNAME);
}
rpmds rpmfcSupplements(rpmfc fc)
{
return rpmfcDependencies(fc, RPMTAG_SUPPLEMENTNAME);
}
rpmds rpmfcEnhances(rpmfc fc)
{
return rpmfcDependencies(fc, RPMTAG_ENHANCENAME);
}
rpmds rpmfcConflicts(rpmfc fc)
{
return rpmfcDependencies(fc, RPMTAG_CONFLICTNAME);
}
rpmds rpmfcObsoletes(rpmfc fc)
{
return rpmfcDependencies(fc, RPMTAG_OBSOLETENAME);
}
static rpmRC rpmfcApplyInternal(rpmfc fc) static rpmRC rpmfcApplyInternal(rpmfc fc)
{ {
const char * s; const char * s;

View File

@ -106,6 +106,48 @@ rpmds rpmfcProvides(rpmfc fc);
*/ */
rpmds rpmfcRequires(rpmfc fc); rpmds rpmfcRequires(rpmfc fc);
/** \ingroup rpmfc
* Retrieve file classification recommends
* @param fc file classifier
* @return rpmds dependency set of fc recommends
*/
rpmds rpmfcRecommends(rpmfc fc);
/** \ingroup rpmfc
* Retrieve file classification suggests
* @param fc file classifier
* @return rpmds dependency set of fc suggests
*/
rpmds rpmfcSuggests(rpmfc fc);
/** \ingroup rpmfc
* Retrieve file classification supplements
* @param fc file classifier
* @return rpmds dependency set of fc supplements
*/
rpmds rpmfcSupplements(rpmfc fc);
/** \ingroup rpmfc
* Retrieve file classification enhances
* @param fc file classifier
* @return rpmds dependency set of fc enhances
*/
rpmds rpmfcEnhances(rpmfc fc);
/** \ingroup rpmfc
* Retrieve file classification conflicts
* @param fc file classifier
* @return rpmds dependency set of fc conflicts
*/
rpmds rpmfcConflicts(rpmfc fc);
/** \ingroup rpmfc
* Retrieve file classification obsoletes
* @param fc file classifier
* @return rpmds dependency set of fc obsoletes
*/
rpmds rpmfcObsoletes(rpmfc fc);
/** \ingroup rpmfc /** \ingroup rpmfc
* Retrieve file classification dependencies * Retrieve file classification dependencies
* @param fc file classifier * @param fc file classifier

View File

@ -14,6 +14,18 @@ static int print_provides;
static int print_requires; static int print_requires;
static int print_recommends;
static int print_suggests;
static int print_supplements;
static int print_enhances;
static int print_conflicts;
static int print_obsoletes;
static void rpmdsPrint(const char * msg, rpmds ds, FILE * fp) static void rpmdsPrint(const char * msg, rpmds ds, FILE * fp)
{ {
if (fp == NULL) fp = stderr; if (fp == NULL) fp = stderr;
@ -36,6 +48,18 @@ static struct poptOption optionsTable[] = {
NULL, NULL }, NULL, NULL },
{ "requires", 'R', POPT_ARG_VAL, &print_requires, -1, { "requires", 'R', POPT_ARG_VAL, &print_requires, -1,
NULL, NULL }, NULL, NULL },
{ "recommends", '\0', POPT_ARG_VAL, &print_recommends, -1,
NULL, NULL },
{ "suggests", '\0', POPT_ARG_VAL, &print_suggests, -1,
NULL, NULL },
{ "supplements", '\0', POPT_ARG_VAL, &print_supplements, -1,
NULL, NULL },
{ "enhances", '\0', POPT_ARG_VAL, &print_enhances, -1,
NULL, NULL },
{ "conflicts", '\0', POPT_ARG_VAL, &print_conflicts, -1,
NULL, NULL },
{ "obsoletes", '\0', POPT_ARG_VAL, &print_obsoletes, -1,
NULL, NULL },
POPT_AUTOALIAS POPT_AUTOALIAS
POPT_AUTOHELP POPT_AUTOHELP
@ -89,6 +113,18 @@ main(int argc, char *argv[])
rpmdsPrint(NULL, rpmfcProvides(fc), stdout); rpmdsPrint(NULL, rpmfcProvides(fc), stdout);
if (print_requires) if (print_requires)
rpmdsPrint(NULL, rpmfcRequires(fc), stdout); rpmdsPrint(NULL, rpmfcRequires(fc), stdout);
if (print_recommends)
rpmdsPrint(NULL, rpmfcRecommends(fc), stdout);
if (print_suggests)
rpmdsPrint(NULL, rpmfcSuggests(fc), stdout);
if (print_supplements)
rpmdsPrint(NULL, rpmfcSupplements(fc), stdout);
if (print_enhances)
rpmdsPrint(NULL, rpmfcEnhances(fc), stdout);
if (print_conflicts)
rpmdsPrint(NULL, rpmfcConflicts(fc), stdout);
if (print_obsoletes)
rpmdsPrint(NULL, rpmfcObsoletes(fc), stdout);
ec = 0; ec = 0;