- Macro-expand load macro argument

This commit is contained in:
Panu Matilainen 2014-07-01 13:39:03 +03:00
parent 9787eb5021
commit 7674f0d76b
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,30 @@
commit d4ab1d82d7888f41b866751d0ef340a82be7cff2
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Tue Jul 1 12:04:40 2014 +0300
Macro-expand %{load:...} argument to make the thing more useful...
diff --git a/rpmio/macro.c b/rpmio/macro.c
index b00155c..1d9bd1c 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -1093,16 +1093,15 @@ expandMacro(MacroBuf mb, const char *src, size_t slen)
/* Expand builtin macros */
if (STREQ("load", f, fn)) {
- if (g && gn > 0) {
- char arg[gn + 1];
- strncpy(arg, g, gn);
- arg[gn] = '\0';
+ char *arg = NULL;
+ if (g && gn > 0 && expandThis(mb, g, gn, &arg) == 0) {
/* Print failure iff %{load:...} or %{!?load:...} */
if (loadMacroFile(mb->mc, arg) && chkexist == negate) {
rpmlog(RPMLOG_ERR,
_("failed to load macro file %s"), arg);
}
}
+ free(arg);
s = se;
continue;
}

View File

@ -49,6 +49,7 @@ Patch4: rpm-4.8.1-use-gpg2.patch
# Patches already upstream:
Patch100: rpm-4.11.90-hardlink-groups.patch
Patch101: rpm-4.11.90-expand-load-arg.patch
# These are not yet upstream
Patch302: rpm-4.7.1-geode-i686.patch
@ -286,6 +287,7 @@ Requires: rpm-libs%{_isa} = %{version}-%{release}
%patch4 -p1 -b .use-gpg2
%patch100 -p1 -b .hardlink-groups
%patch101 -p1 -b .expand-load-arg
%patch302 -p1 -b .geode
%patch304 -p1 -b .ldflags
@ -541,6 +543,7 @@ exit 0
%changelog
* Tue Jul 01 2014 Panu Matilainen <pmatilai@redhat.com> - 4.11.90-0.git12844.3
- Drop no longer needed temporary UsrMove patch
- Macro-expand load macro argument
* Mon Jun 30 2014 Panu Matilainen <pmatilai@redhat.com> - 4.11.90-0.git12844.2
- Fix multiple interleaved hardlink groups during build