From 2d2bda29c159f16689c05fd4dda20a3f70597e1d Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 27 Mar 2009 14:01:47 +0200 Subject: [PATCH] Add built-in %getconfdir macro for getting rpmConfigDir() value - 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 | 3 +++ rpmio/macro.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/macros.in b/macros.in index b829573..5d13845 100644 --- a/macros.in +++ b/macros.in @@ -141,6 +141,9 @@ # 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 diff --git a/rpmio/macro.c b/rpmio/macro.c index c9b6259..c55b9e2 100644 --- a/rpmio/macro.c +++ b/rpmio/macro.c @@ -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)) { -- 2.7.4