From 4b04cc38167dd637c3c1f68bf6d858453ccf24a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 24 Oct 2023 16:42:12 +0200 Subject: [PATCH] Add "local_generator" This generator can be used by .spec file, which ships their own generators: ~~~ Source1: generator.req %global __local_generator_requires bash %{SOURCE1} ~~~ Resolves #782 --- build/rpmfc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/rpmfc.c b/build/rpmfc.c index f3064739c3..3fdd1049e0 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -1184,10 +1184,11 @@ static int initAttrs(rpmfc fc) /* Discover known attributes from pathnames + initialize them */ if (rpmGlob(attrPath, NULL, &files) == 0) { - nattrs = argvCount(files); + nattrs = argvCount(files) + 1; fc->atypes = xcalloc(nattrs + 1, sizeof(*fc->atypes)); - for (int i = 0; i < nattrs; i++) { - char *bn = basename(files[i]); + fc->atypes[0] = rpmfcAttrNew("local_generator"); + for (int i = 1; i < nattrs; i++) { + char *bn = basename(files[i - 1]); bn[strlen(bn)-strlen(".attr")] = '\0'; fc->atypes[i] = rpmfcAttrNew(bn); }