From 52fe6f978c7027a193c222e7b826b4a6bbab3fc4 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 23 May 2011 13:40:39 +0300 Subject: [PATCH] Add support for fileattr dependency namespacing - This allows automatically wrapping generated dependencies into macro-expanded namespaces, eg foo(depname) by specifying __attr_namespace in the file attribute definition. - Current generator scripts hardcode their namespaces but doing this on rpm-level gives extra flexibility eg when building for alternative versions/environments and frees generators from having to take care of the formatting. --- build/rpmfc.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build/rpmfc.c b/build/rpmfc.c index 7107c89..f71110f 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -472,6 +472,7 @@ static int rpmfcHelper(rpmfc fc, const char *nsdep, const char *depname, { ARGV_t pav = NULL; const char * fn = fc->fn[fc->ix]; + char *namespace = rpmfcAttrMacro(nsdep, NULL, "namespace"); int pac; regex_t *exclude = NULL; regex_t *exclude_from = NULL; @@ -513,7 +514,13 @@ static int rpmfcHelper(rpmfc fc, const char *nsdep, const char *depname, EVR = pav[i]; } - ds = rpmdsSingle(tagN, N, EVR, Flags); + if (namespace) { + char *NSN = rpmExpand(namespace, "(", N, ")", NULL); + ds = rpmdsSingle(tagN, NSN, EVR, Flags); + free(NSN); + } else { + ds = rpmdsSingle(tagN, N, EVR, Flags); + } /* Add to package and file dependencies unless filtered */ if (regMatch(exclude, rpmdsDNEVR(ds)+2) == 0) { @@ -529,6 +536,7 @@ static int rpmfcHelper(rpmfc fc, const char *nsdep, const char *depname, exit: regFree(exclude); regFree(exclude_from); + free(namespace); return 0; } -- 2.7.4