summaryrefslogtreecommitdiff
path: root/build/parsePreamble.c
diff options
context:
space:
mode:
authorJindrich Novy <jnovy@redhat.com>2010-01-16 12:43:16 +0100
committerJindrich Novy <jnovy@redhat.com>2010-01-16 12:43:16 +0100
commite811ef56aa88588e16e0a80d48381a62631f8fc4 (patch)
treef9947762a59253f661fb7bd180196e57b25e6a6e /build/parsePreamble.c
parenta9483191a55f43aacb983f8a6d3df2190b1a51dd (diff)
downloadrpm-e811ef56aa88588e16e0a80d48381a62631f8fc4.tar.gz
rpm-e811ef56aa88588e16e0a80d48381a62631f8fc4.tar.bz2
rpm-e811ef56aa88588e16e0a80d48381a62631f8fc4.zip
Correctly expand %{obsoletes}, %{requires}, etc. in spec (RhBug:555926)
- tags declared multiple times in spec were simply overwritten so referencing it via %{} just showed contents of the last one
Diffstat (limited to 'build/parsePreamble.c')
-rw-r--r--build/parsePreamble.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index e31af742f..269736e31 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -688,8 +688,23 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
return RPMRC_FAIL;
}
- if (macro)
- addMacro(spec->macros, macro, NULL, field, RMIL_SPEC);
+ if (macro) {
+ char *macro_expanded = NULL,
+ *macro_token = NULL,
+ *field_set = NULL;
+
+ rasprintf(&macro_token, "%%%s", macro);
+ macro_expanded = rpmExpand(macro_token);
+ if (!strcmp(macro_expanded, macro_token)) {
+ field_set = xstrdup(field);
+ } else {
+ rasprintf(&field_set, "%s %s", macro_expanded, field);
+ }
+ addMacro(spec->macros, macro, NULL, field_set, RMIL_SPEC);
+ free(macro_expanded);
+ free(macro_token);
+ free(field_set);
+ }
return RPMRC_OK;
}