From b910492639f20d8d37b5839da72d4fca6a04671e Mon Sep 17 00:00:00 2001 From: marc Date: Mon, 26 Jan 1998 15:52:56 +0000 Subject: [PATCH] Fix bug where macros were being improperly set for Patch: and Source: lines. CVS patchset: 1978 CVS date: 1998/01/26 15:52:56 --- CHANGES | 2 ++ build/macro.c | 14 +++++++------- build/parsePreamble.c | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index 1f29b3e..3338492 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ - handle files with spaces (put double quotes around them) - new rpmrc setting, buildshell, can be used to set shell used for build scripts (default is /bin/sh) + - fix bug where macros were being improperly set for + Patch: and Source: lines 2.4.99 -> 2.4.100: - fixed handling of --rebuild and --recompile diff --git a/build/macro.c b/build/macro.c index 1731916..9d9656b 100644 --- a/build/macro.c +++ b/build/macro.c @@ -4,19 +4,19 @@ #include #include #include +#include #include "macro.h" #include "misc.h" #ifdef DEBUG_MACROS -#include #define rpmError fprintf #define RPMERR_BADSPEC stderr -static void dumpTable(void); #else #include "lib/rpmlib.h" #endif +static void dumpTable(struct MacroContext *mc); static void expandMacroTable(struct MacroContext *mc); static int compareMacros(const void *ap, const void *bp); static struct MacroEntry *findEntry(struct MacroContext *mc, char *name); @@ -285,17 +285,17 @@ static void expandMacroTable(struct MacroContext *mc) /***********************************************************************/ -#ifdef DEBUG_MACROS -static void dumpTable() +static void dumpTable(struct MacroContext *mc) { int i; - for (i = 0; i < firstFree; i++) { - printf("%s->%s.\n", macroTable[i].name, - macroTable[i].expansion); + for (i = 0; i < mc->firstFree; i++) { + printf("%s->%s.\n", mc->macroTable[i].name, + mc->macroTable[i].expansion); } } +#ifdef DEBUG_MACROS void main(void) { char buf[1024]; diff --git a/build/parsePreamble.c b/build/parsePreamble.c index 9457d0f..0b27fcf 100644 --- a/build/parsePreamble.c +++ b/build/parsePreamble.c @@ -324,10 +324,6 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro, multiToken = 1; } - if (macro) { - addMacro(&spec->macros, macro, field); - } - switch (tag) { case RPMTAG_NAME: case RPMTAG_VERSION: @@ -407,6 +403,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro, case RPMTAG_SOURCE: case RPMTAG_PATCH: SINGLE_TOKEN_ONLY; + macro = NULL; if ((rc = addSource(spec, pkg, field, tag))) { return rc; } @@ -465,6 +462,10 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro, return RPMERR_INTERNAL; } + if (macro) { + addMacro(&spec->macros, macro, field); + } + return 0; } -- 2.7.4