Add built-in %getconfdir macro for getting rpmConfigDir() value
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 27 Mar 2009 12:01:47 +0000 (14:01 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 27 Mar 2009 12:01:47 +0000 (14:01 +0200)
- define %_rpmconfigdir via %getconfdir in the main macro config, this
  avoids it getting lost on macro reloads as happens when building
  several packages at once

macros.in
rpmio/macro.c

index b829573..5d13845 100644 (file)
--- a/macros.in
+++ b/macros.in
 #      These are the default values that can be overridden by other
 #      (e.g. per-platform, per-system, per-packager, per-package) macros.
 #
+#      The directory where rpm's configuration and scripts live
+%_rpmconfigdir         %{getconfdir}
+
 #      The directory where sources/patches will be unpacked and built.
 %_builddir             %{_topdir}/BUILD
 
index c9b6259..c55b9e2 100644 (file)
@@ -985,6 +985,9 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn,
        b = be;
     } else if (STREQ("getenv", f, fn)) {
        b = getenv(buf);
+    } else if (STREQ("getconfdir", f, fn)) {
+       sprintf(buf, "%s", rpmConfigDir());
+       b = buf;
     } else if (STREQ("S", f, fn)) {
        for (b = buf; (c = *b) && risdigit(c);)
            b++;
@@ -1256,6 +1259,7 @@ expandMacro(MacroBuf mb)
            STREQ("url2path", f, fn) ||
            STREQ("u2p", f, fn) ||
            STREQ("getenv", f, fn) ||
+           STREQ("getconfdir", f, fn) ||
            STREQ("S", f, fn) ||
            STREQ("P", f, fn) ||
            STREQ("F", f, fn)) {