From 7a84b45c62cd25c4c68ad295ac5f360b1daebf6a Mon Sep 17 00:00:00 2001 From: Lubos Kardos Date: Mon, 21 Sep 2015 14:13:22 +0200 Subject: [PATCH] Add support for various types of dependencies to rpmdeps tool Options added to rpmdeps tool: --recommends --suggests --supplements --enhances --conflicts --obsoletes --- build/rpmfc.c | 30 ++++++++++++++++++++++++++++++ build/rpmfc.h | 42 ++++++++++++++++++++++++++++++++++++++++++ tools/rpmdeps.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) diff --git a/build/rpmfc.c b/build/rpmfc.c index 7565b18..3637f5c 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -789,6 +789,36 @@ rpmds rpmfcRequires(rpmfc fc) 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) { const char * s; diff --git a/build/rpmfc.h b/build/rpmfc.h index bd1c660..dae8ea5 100644 --- a/build/rpmfc.h +++ b/build/rpmfc.h @@ -107,6 +107,48 @@ rpmds rpmfcProvides(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 * Retrieve file classification dependencies * @param fc file classifier * @param tagN name tag of the wanted dependency diff --git a/tools/rpmdeps.c b/tools/rpmdeps.c index c3112eb..ff785f0 100644 --- a/tools/rpmdeps.c +++ b/tools/rpmdeps.c @@ -14,6 +14,18 @@ static int print_provides; 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) { if (fp == NULL) fp = stderr; @@ -36,6 +48,18 @@ static struct poptOption optionsTable[] = { NULL, NULL }, { "requires", 'R', POPT_ARG_VAL, &print_requires, -1, 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_AUTOHELP @@ -89,6 +113,18 @@ main(int argc, char *argv[]) rpmdsPrint(NULL, rpmfcProvides(fc), stdout); if (print_requires) 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; -- 1.9.3