Fix bug where macros were being improperly set for Patch: and Source: lines.
authormarc <devnull@localhost>
Mon, 26 Jan 1998 15:52:56 +0000 (15:52 +0000)
committermarc <devnull@localhost>
Mon, 26 Jan 1998 15:52:56 +0000 (15:52 +0000)
CVS patchset: 1978
CVS date: 1998/01/26 15:52:56

CHANGES
build/macro.c
build/parsePreamble.c

diff --git a/CHANGES b/CHANGES
index 1f29b3e..3338492 100644 (file)
--- 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
index 1731916..9d9656b 100644 (file)
@@ -4,19 +4,19 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
+#include <stdio.h>
 
 #include "macro.h"
 #include "misc.h"
 
 #ifdef DEBUG_MACROS
-#include <stdio.h>
 #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];
index 9457d0f..0b27fcf 100644 (file)
@@ -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;
 }