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(¯o_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;
}