When adding macros/mandriva in the past, I tried adding %{load:
/etc/rpm/macros.d/*.macros}
to it for loading macros rather than specifying it during ./configure,
but I quickly discovered that support for wildcards wasn't supported and didn't
care much about it since, figguring that I'd look into implementing it sometime
later.

I guess that the mandriva macros probably served as inspiration for
adding this to the other vendor macros recently checked in as well,
so as I take blame for this, I might as well implement the actual support
for this at the same time.

I dunno if there's any specific reason for why this wasn't implemented
earlier..?

If there's none, the usefulness of adding support for this is rather obvious and
if noone objects, I'll commit the following patch. :)

--
Regards,
Per Øyvind
--- rpmio/macro.c	2011-01-09 07:26:56.780028249 +0100
+++ /home/peroyvind/RPM/rpm/BUILD/rpm-5.3.11/rpmio/macro.c	2011-05-25 19:04:13.076558612 +0200
@@ -2788,6 +2788,9 @@ rpmLoadMacroFile(MacroContext mc, const
 	/* Parse %{load:...} immediately recursively. */
 	if (s[1] == '{' && !strncmp(s+2, "load:", sizeof("load:")-1)) {
 	    char * se = (char *) matchchar(s, '{', '}');
+	    const char ** argv = NULL;
+	    int argc = 0;
+	    int i;
 	    if (se == NULL) {
 		rpmlog(RPMLOG_WARNING,
 		    _("%s:%u Missing '}' in \"%s\", skipping.\n"),
@@ -2804,7 +2807,10 @@ rpmLoadMacroFile(MacroContext mc, const
 		continue;
 	    }
 	    se = rpmMCExpand(mc, s, NULL);
-	    rc = rpmLoadMacroFile(mc, se, nesting - 1);
+	    rc = rpmGlob(se, &argc, &argv);
+	    for(i = 0; i < argc; i++)
+		rc |= rpmLoadMacroFile(mc, argv[i], nesting - 1);
+	    argv = _free(argv);
 	    se = _free(se);
 	    if (rc != 0)
 		goto exit;

Reply via email to