summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rpmrc.c2
-rw-r--r--macros.in2
-rw-r--r--rpmio/macro.c3
3 files changed, 5 insertions, 2 deletions
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index f478a24de..b7fdd2c05 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -475,7 +475,7 @@ static void setDefaults(void)
addMacro(NULL, "_preScriptEnvironment",NULL, prescriptenviron,RMIL_DEFAULT);
addMacroDefault("_topdir",
- "/usr/src/packages", "%(echo $HOME)/rpmbuild");
+ "/usr/src/packages", "%{getenv:HOME}/rpmbuild");
addMacroDefault("_tmppath",
LOCALSTATEDIR "/tmp", "%{_var}/tmp");
addMacroDefault("_dbpath",
diff --git a/macros.in b/macros.in
index c3c5025f1..c59739910 100644
--- a/macros.in
+++ b/macros.in
@@ -229,7 +229,7 @@ package or when debugging this package.\
%_tmppath %{_var}/tmp
# Path to top of build area.
-%_topdir %(echo $HOME)/rpmbuild
+%_topdir %{getenv:HOME}/rpmbuild
# The path to the unzip executable (legacy, use %{__unzip} instead).
%_unzipbin %{__unzip}
diff --git a/rpmio/macro.c b/rpmio/macro.c
index afe41cb2f..c9b6259ae 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -983,6 +983,8 @@ doFoo(MacroBuf mb, int negate, const char * f, size_t fn,
break;
}
b = be;
+ } else if (STREQ("getenv", f, fn)) {
+ b = getenv(buf);
} else if (STREQ("S", f, fn)) {
for (b = buf; (c = *b) && risdigit(c);)
b++;
@@ -1253,6 +1255,7 @@ expandMacro(MacroBuf mb)
STREQ("uncompress", f, fn) ||
STREQ("url2path", f, fn) ||
STREQ("u2p", f, fn) ||
+ STREQ("getenv", f, fn) ||
STREQ("S", f, fn) ||
STREQ("P", f, fn) ||
STREQ("F", f, fn)) {