From 9c7bcba82ac3bbf792d6b86bcb45c60405b0db00 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 1 Jun 2009 12:53:08 +0300 Subject: [PATCH] Deal with multiple scriptlet dependency bits in deptype format extension - rpmbuild permits Requires(post,postun) style notation which gets lumped into single dependency, report them all --- lib/formats.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/lib/formats.c b/lib/formats.c index 50642c2..ff9818f 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -228,31 +228,40 @@ static char * triggertypeFormat(rpmtd td, char * formatPrefix) */ static char * deptypeFormat(rpmtd td, char * formatPrefix) { - char * val; + char *val = NULL; if (rpmtdClass(td) != RPM_NUMERIC_CLASS) { val = xstrdup(_("(not a number)")); } else { + ARGV_t sdeps = NULL; uint64_t item = rpmtdGetNumber(td); if (item & RPMSENSE_SCRIPT_PRE) - val = xstrdup("pre"); - else if (item & RPMSENSE_SCRIPT_POST) - val = xstrdup("post"); - else if (item & RPMSENSE_SCRIPT_PREUN) - val = xstrdup("preun"); - else if (item & RPMSENSE_SCRIPT_POSTUN) - val = xstrdup("postun"); - else if (item & RPMSENSE_SCRIPT_VERIFY) - val = xstrdup("verify"); - else if (item & RPMSENSE_RPMLIB) - val = xstrdup("rpmlib"); - else if (item & RPMSENSE_INTERP) - val = xstrdup("interp"); - else if ((item & RPMSENSE_FIND_REQUIRES) || - (item & RPMSENSE_FIND_PROVIDES)) - val = xstrdup("auto"); - else - val = xstrdup("manual"); + argvAdd(&sdeps, "pre"); + if (item & RPMSENSE_SCRIPT_POST) + argvAdd(&sdeps, "post"); + if (item & RPMSENSE_SCRIPT_PREUN) + argvAdd(&sdeps, "preun"); + if (item & RPMSENSE_SCRIPT_POSTUN) + argvAdd(&sdeps, "postun"); + if (item & RPMSENSE_SCRIPT_VERIFY) + argvAdd(&sdeps, "verify"); + + if (sdeps) { + val = argvJoin(sdeps, ","); + argvFree(sdeps); + } else { + if (item & RPMSENSE_RPMLIB) + val = xstrdup("rpmlib"); + else if (item & RPMSENSE_INTERP) + val = xstrdup("interp"); + else if ((item & RPMSENSE_FIND_REQUIRES) || + (item & RPMSENSE_FIND_PROVIDES)) + val = xstrdup("auto"); + else if (item & RPMSENSE_PREREQ) + val = xstrdup("prereq"); + else + val = xstrdup("manual"); + } } return val; } -- 2.7.4