add per-target macrofiles to search path.
authorjbj <devnull@localhost>
Thu, 1 Apr 1999 22:26:44 +0000 (22:26 +0000)
committerjbj <devnull@localhost>
Thu, 1 Apr 1999 22:26:44 +0000 (22:26 +0000)
take globalMacroContext out of macro api.
fix: flush all macros between builds.

CVS patchset: 2936
CVS date: 1999/04/01 22:26:44

21 files changed:
CHANGES
build.c
build/build.c
build/files.c
build/parseChangelog.c
build/parsePreamble.c
build/parsePrep.c
build/parseScript.c
build/parseSpec.c
build/spec.c
lib/macro.c
lib/rpmmacro.h
lib/rpmrc.c
macros.in
po/rpm.pot
rpm.c
rpmio/macro.c
rpmio/rpmmacro.h
rpmrc.in
tests/macros.in
tools/rpmgettext.c

diff --git a/CHANGES b/CHANGES
index 6397a4a..9410a6d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,9 @@
        - fix: specfile BuildRoot was masking rpmrc macro.
        - expand twiddles in macrofiles list.
        - add explicit macrofiles path to rpmrc.
+       - add per-target macrofiles to search path.
+       - take globalMacroContext out of macro api.
+       - fix: flush all macros between builds.
 
 2.91 -> 2.92
        - update with libtool-2.4f.
diff --git a/build.c b/build.c
index c017fd9..516cb19 100644 (file)
--- a/build.c
+++ b/build.c
@@ -4,12 +4,6 @@
 #include "popt/popt.h"
 #include "build.h"
 
-#ifdef DYING
-int buildForTarget(char *arg, int buildAmount, char *passPhrase,
-                 char *buildRoot, int fromTarball, int test, char *cookie,
-                 force);
-#endif
-
 static int buildForTarget(const char *arg, int buildAmount, const char *passPhrase,
                  const char *buildRoot, int fromTarball, int test, char *cookie,
                  int force)
@@ -110,7 +104,7 @@ static int buildForTarget(const char *arg, int buildAmount, const char *passPhra
        while (*cmd != '/') cmd--;
        *cmd = '\0';
 
-       addMacro(&globalMacroContext, "_sourcedir", NULL, buf, RMIL_TARBALL);
+       addMacro(NULL, "_sourcedir", NULL, buf, RMIL_TARBALL);
        xfree(specDir);
        xfree(tmpSpecFile);
        specfile = s;
@@ -197,6 +191,8 @@ int build(const char *arg, int buildAmount, const char *passPhrase,
            fromTarball, test, cookie, force);
        if (rc)
            return rc;
+
+       freeMacros(NULL);
     }
 
     return 0;
index 998493a..544f229 100644 (file)
@@ -2,10 +2,6 @@
 
 #include "rpmbuild.h"
 
-#ifdef DYING
-static void doRmSource(Spec spec);
-#endif
-
 static void doRmSource(Spec spec)
 {
     struct Source *p;
index b21e821..d47b587 100644 (file)
@@ -76,30 +76,6 @@ struct FileList {
     int fileListRecsUsed;
 };
 
-#ifdef DYING
-static int processPackageFiles(Spec spec, Package pkg,
-                              int installSpecialDoc, int test);
-static void freeFileList(FileListRec *fileList, int count);
-static int compareFileListRecs(const void *ap, const void *bp);
-static int isDoc(struct FileList *fl, const char *fileName);
-static int processBinaryFile(Package pkg, struct FileList *fl, const char *fileName);
-static int addFile(struct FileList *fl, const char *name, struct stat *statp);
-static int parseForSimple(Spec spec, Package pkg, char *buf,
-                         struct FileList *fl, const char **fileName);
-static int parseForVerify(char *buf, struct FileList *fl);
-static int parseForLang(char *buf, struct FileList *fl);
-static int parseForAttr(char *buf, struct FileList *fl);
-static int parseForConfig(char *buf, struct FileList *fl);
-static int parseForRegexLang(const char *fileName, char **lang);
-static int myGlobPatternP(const char *pattern);
-static int glob_error(const char *foo, int bar);
-static void timeCheck(int tc, Header h);
-static void genCpioListAndHeader(struct FileList *fl,
-                                struct cpioFileMapping **cpioList,
-                                int *cpioCount, Header h, int isSrc);
-static char *strtokWithQuotes(char *s, char *delim);
-#endif
-
 static void freeAttrRec(AttrRec *ar) {
     FREE(ar->ar_fmodestr);
     FREE(ar->ar_dmodestr);
index 1065825..276bae5 100644 (file)
@@ -2,12 +2,6 @@
 
 #include "rpmbuild.h"
 
-#ifdef DYING
-static void addChangelogEntry(Header h, int time, char *name, char *text);
-static int addChangelog(Header h, StringBuf sb);
-static int dateToTimet(const char * datestr, time_t * secs);
-#endif
-
 static void addChangelogEntry(Header h, int time, char *name, char *text)
 {
     if (headerIsEntry(h, RPMTAG_CHANGELOGTIME)) {
index da497f8..7416a4d 100644 (file)
@@ -36,19 +36,6 @@ static int requiredTags[] = {
     0
 };
 
-#ifdef DYING
-static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro,
-                            char *lang);
-static void initPreambleList(void);
-static int findPreambleTag(Spec spec, int *tag, char **macro, char *lang);
-static int checkForRequired(Header h, char *name);
-static int checkForDuplicates(Header h, char *name);
-static void fillOutMainPackage(Header h);
-static int checkForValidArchitectures(Spec spec);
-static int isMemberInEntry(Header header, char *name, int tag);
-static int readIcon(Header h, char *file);
-#endif /* DYING */
-    
 static void addOrAppendListEntry(Header h, int_32 tag, char *line)
 {
     int argc;
@@ -462,8 +449,8 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, char *macro,
            return RPMERR_BADSPEC;
        }
        macro = NULL;
-       delMacro(&globalMacroContext, "_docdir");
-       addMacro(&globalMacroContext, "_docdir", NULL, field, RMIL_SPEC);
+       delMacro(NULL, "_docdir");
+       addMacro(NULL, "_docdir", NULL, field, RMIL_SPEC);
        break;
       case RPMTAG_EPOCH:
        SINGLE_TOKEN_ONLY;
index af7f69d..fa2275b 100644 (file)
            { 0, 0, 0, 0, 0,    NULL, NULL}
     };
 
-#ifdef DYING
-static int doSetupMacro(Spec spec, char *line);
-static int doPatchMacro(Spec spec, char *line);
-static char *doPatch(Spec spec, int c, int strip, char *db,
-                    int reverse, int removeEmpties);
-static int checkOwners(const char *file);
-static char *doUntar(Spec spec, int c, int quietly);
-#endif
-
 static int checkOwners(const char *file)
 {
     struct stat sb;
index 03670d4..d80339a 100644 (file)
@@ -4,7 +4,38 @@
 
 #include "popt/popt.h"
 
-static int addTriggerIndex(Package pkg, char *file, char *script, char *prog);
+static int addTriggerIndex(Package pkg, char *file, char *script, char *prog)
+{
+    struct TriggerFileEntry *new;
+    struct TriggerFileEntry *list = pkg->triggerFiles;
+    struct TriggerFileEntry *last = NULL;
+    int index = 0;
+
+    while (list) {
+       last = list;
+       list = list->next;
+    }
+
+    if (last) {
+       index = last->index + 1;
+    }
+
+    new = malloc(sizeof(*new));
+
+    new->fileName = (file) ? strdup(file) : NULL;
+    new->script = (*script) ? strdup(script) : NULL;
+    new->prog = strdup(prog);
+    new->index = index;
+    new->next = NULL;
+
+    if (last) {
+       last->next = new;
+    } else {
+       pkg->triggerFiles = new;
+    }
+
+    return index;
+}
 
 /* these have to be global because of stupid compilers */
     static char *name;
@@ -255,36 +286,3 @@ int parseScript(Spec spec, int parsePart)
     
     return nextPart;
 }
-
-static int addTriggerIndex(Package pkg, char *file, char *script, char *prog)
-{
-    struct TriggerFileEntry *new;
-    struct TriggerFileEntry *list = pkg->triggerFiles;
-    struct TriggerFileEntry *last = NULL;
-    int index = 0;
-
-    while (list) {
-       last = list;
-       list = list->next;
-    }
-
-    if (last) {
-       index = last->index + 1;
-    }
-
-    new = malloc(sizeof(*new));
-
-    new->fileName = (file) ? strdup(file) : NULL;
-    new->script = (*script) ? strdup(script) : NULL;
-    new->prog = strdup(prog);
-    new->index = index;
-    new->next = NULL;
-
-    if (last) {
-       last->next = new;
-    } else {
-       pkg->triggerFiles = new;
-    }
-
-    return index;
-}
index f29dc8c..5278973 100644 (file)
@@ -63,10 +63,6 @@ int isPart(char *line)
     }
 }
 
-#ifdef DYING
-static int matchTok(char *token, char *line);
-#endif
-
 static int matchTok(char *token, char *line)
 {
     char buf[BUFSIZ], *bp, *tok;
@@ -308,7 +304,7 @@ int parseSpec(Spec *specp, const char *specFile, const char *buildRoot,
        spec->gotBuildRoot = 1;
        spec->buildRoot = strdup(buildRoot);
     }
-    addMacro(&globalMacroContext, "_docdir", NULL, "%{_defaultdocdir}", RMIL_SPEC);
+    addMacro(NULL, "_docdir", NULL, "%{_defaultdocdir}", RMIL_SPEC);
     spec->inBuildArchitectures = inBuildArch;
     spec->anyarch = anyarch;
     spec->force = force;
index fb81bfa..55074dd 100644 (file)
@@ -4,11 +4,8 @@
 #include "buildio.h"
 
 extern int specedit;
+extern MacroContext globalMacroContext;
 
-#ifdef DYING
-static void freeTriggerFiles(struct TriggerFileEntry *p);
-#endif
-    
 static inline void freeTriggerFiles(/*@only@*/ struct TriggerFileEntry *p)
 {
     struct TriggerFileEntry *o, *q = p;
@@ -172,11 +169,6 @@ void freePackages(Spec spec)
     }
 }
 
-#ifdef DYING
-static char *getSourceAux(Spec spec, int num, int flag, int full);
-static struct Source *findSource(Spec spec, int num, int flag);
-#endif
-
 static inline /*@owned@*/ struct Source *findSource(Spec spec, int num, int flag)
 {
     struct Source *p;
index d545d0d..008ccfe 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "rpmmacro.h"
 
+struct MacroContext globalMacroContext;
+
 typedef struct MacroBuf {
        const char *s;          /* text to expand */
        char *t;                /* expansion buffer */
@@ -97,6 +99,8 @@ dumpMacroTable(MacroContext *mc, FILE *f)
        int nempty = 0;
        int nactive = 0;
 
+       if (mc == NULL)
+               mc = &globalMacroContext;
        if (f == NULL)
                f = stderr;
     
@@ -126,6 +130,8 @@ findEntry(MacroContext *mc, const char *name, size_t namelen)
        MacroEntry keybuf, *key, **ret;
        char namebuf[1024];
 
+       if (mc == NULL)
+               mc = &globalMacroContext;
        if (! mc->firstFree)
                return NULL;
 
@@ -1077,6 +1083,8 @@ expandMacros(void *spec, MacroContext *mc, char *s, size_t slen)
 
        if (s == NULL || slen <= 0)
                return 0;
+       if (mc == NULL)
+               mc = &globalMacroContext;
 
        tbuf = alloca(slen + 1);
        memset(tbuf, 0, (slen + 1));
@@ -1107,6 +1115,9 @@ addMacro(MacroContext *mc, const char *n, const char *o, const char *b, int leve
 {
        MacroEntry **mep;
 
+       if (mc == NULL)
+               mc = &globalMacroContext;
+
        /* If new name, expand macro table */
        if ((mep = findEntry(mc, n, 0)) == NULL) {
                if (mc->firstFree == mc->macrosAllocated)
@@ -1127,6 +1138,8 @@ delMacro(MacroContext *mc, const char *name)
 {
        MacroEntry **mep = findEntry(mc, name, 0);
 
+       if (mc == NULL)
+               mc = &globalMacroContext;
        /* If name exists, pop entry */
        if ((mep = findEntry(mc, name, 0)) != NULL)
                popMacro(mep);
@@ -1147,18 +1160,11 @@ void
 initMacros(MacroContext *mc, const char *macrofiles)
 {
        char *m, *mfile, *me;
-       static int first = 1;
-
-       /* XXX initialization should be per macro context, not per execution */
-       if (first) {
-               mc->macroTable = NULL;
-               expandMacroTable(mc);
-               max_macro_depth = MAX_MACRO_DEPTH;      /* XXX Assume good ol' macro expansion */
-               first = 0;
-       }
 
        if (macrofiles == NULL)
                return;
+       if (mc == NULL)
+               mc = &globalMacroContext;
 
        for (mfile = m = strdup(macrofiles); *mfile; mfile = me) {
                FILE *fp;
@@ -1210,6 +1216,9 @@ freeMacros(MacroContext *mc)
 {
        int i;
     
+       if (mc == NULL)
+               mc = &globalMacroContext;
+
        for (i = 0; i < mc->firstFree; i++) {
                MacroEntry *me;
                while ((me = mc->macroTable[i]) != NULL) {
@@ -1222,6 +1231,7 @@ freeMacros(MacroContext *mc)
                }
        }
        FREE(mc->macroTable);
+       memset(mc, 0, sizeof(*mc));
 }
 
 /* =============================================================== */
@@ -1291,7 +1301,7 @@ rpmExpand(const char *arg, ...)
        *pe = '\0';
     }
     va_end(ap);
-    expandMacros(NULL, &globalMacroContext, buf, sizeof(buf));
+    expandMacros(NULL, NULL, buf, sizeof(buf));
     return strdup(buf);
 }
 
@@ -1350,7 +1360,7 @@ rpmGetPath(const char *path, ...)
        }
     }
     va_end(ap);
-    expandMacros(NULL, &globalMacroContext, buf, sizeof(buf));
+    expandMacros(NULL, NULL, buf, sizeof(buf));
     return strdup(buf);
 }
 
index 5c3883e..86be34f 100644 (file)
@@ -16,8 +16,6 @@ typedef /*@abstract@*/ struct MacroContext {
        int             firstFree;
 } MacroContext;
 
-extern MacroContext globalMacroContext;
-
 /*
  * Markers for types of macros added throughout rpm.
  */
index fafc957..eff06e1 100644 (file)
 
 static const char *defrcfiles = LIBRPMRC_FILENAME ":/etc/rpmrc:~/.rpmrc";
 
-#if UNUSED
-static const char *macrofiles = MACROFILES;
-#endif
-
-struct MacroContext globalMacroContext;
-
 struct machCacheEntry {
     char * name;
     int count;
@@ -94,10 +88,10 @@ static struct tableType tables[RPM_MACHTABLE_COUNT] = {
 /* The order of the flags is archSpecific, required, macroize, localize */
 
 static struct rpmOption optionTable[] = {
-    { "include",               RPMVAR_INCLUDE,                 0, 1,   1, 2 },
-    { "macrofiles",            RPMVAR_MACROFILES,              0, 0,   1, 1 },
+    { "include",               RPMVAR_INCLUDE,                 0, 1,   0, 2 },
+    { "macrofiles",            RPMVAR_MACROFILES,              0, 0,   0, 1 },
     { "optflags",              RPMVAR_OPTFLAGS,                1, 0,   1, 0 },
-    { "provides",               RPMVAR_PROVIDES,                0, 0,  1, 0 },
+    { "provides",               RPMVAR_PROVIDES,                0, 0,  0, 0 },
 };
 /*@=fullinitblock@*/
 static int optionTableSize = sizeof(optionTable) / sizeof(*optionTable);
@@ -449,7 +443,7 @@ static void setVarDefault(int var, const char *macroname, const char *val, const
     }
     if (body == NULL)
        body = val;
-    addMacro(&globalMacroContext, macroname, NULL, body, RMIL_DEFAULT);
+    addMacro(NULL, macroname, NULL, body, RMIL_DEFAULT);
 }
 
 static void setPathDefault(int var, const char *macroname, const char *subdir)
@@ -478,7 +472,7 @@ static void setPathDefault(int var, const char *macroname, const char *subdir)
        char *body = alloca(sizeof(_TOPDIRMACRO) + strlen(subdir));
        strcpy(body, _TOPDIRMACRO);
        strcat(body, subdir);
-       addMacro(&globalMacroContext, macroname, NULL, body, RMIL_DEFAULT);
+       addMacro(NULL, macroname, NULL, body, RMIL_DEFAULT);
 #undef _TOPDIRMACRO
     }
 }
@@ -491,7 +485,7 @@ RPM_ARCH=\"%{_arch}\"\n\
 RPM_OS=\"%{_os}\"\n\
 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\n\
 RPM_DOC_DIR=\"%{_docdir}\"\n\
-export RPM_DOC_DIR\
+export RPM_DOC_DIR\n\
 RPM_PACKAGE_NAME=\"%{name}\"\n\
 RPM_PACKAGE_VERSION=\"%{version}\"\n\
 RPM_PACKAGE_RELEASE=\"%{release}\"\n\
@@ -502,15 +496,11 @@ export RPM_BUILD_ROOT\n}\
 
 static void setDefaults(void) {
 
-    initMacros(&globalMacroContext, NULL); /* XXX initialize data structures */
-    addMacro(&globalMacroContext, "_usr", NULL, "/usr", RMIL_DEFAULT);
-    addMacro(&globalMacroContext, "_var", NULL, "/var", RMIL_DEFAULT);
+    addMacro(NULL, "_usr", NULL, "/usr", RMIL_DEFAULT);
+    addMacro(NULL, "_var", NULL, "/var", RMIL_DEFAULT);
 
-    addMacro(&globalMacroContext, "_preScriptEnvironment", NULL,
-       prescriptenviron, RMIL_DEFAULT);
+    addMacro(NULL, "_preScriptEnvironment",NULL, prescriptenviron,RMIL_DEFAULT);
 
-    setVarDefault(RPMVAR_MACROFILES,   "_macrofiles",
-               "/usr/lib/rpm/macros", "%{_usr}/lib/rpm/macros");
     setVarDefault(-1,                  "_topdir",
                "/usr/src/redhat",      "%{_usr}/src/redhat");
     setVarDefault(-1,                  "_tmppath",
@@ -520,7 +510,11 @@ static void setDefaults(void) {
     setVarDefault(-1,                  "_defaultdocdir",
                "/usr/doc",             "%{_usr}/doc");
 
-    setVarDefault(RPMVAR_OPTFLAGS,     "optflags",     "-O2",          NULL);
+    setVarDefault(-1,                  "_rpmfilename",
+       "%%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm",NULL);
+
+    setVarDefault(RPMVAR_OPTFLAGS,     "optflags",
+               "-O2",                  NULL);
     setVarDefault(-1,                  "sigtype",
                "none",                 NULL);
     setVarDefault(-1,                  "_buildshell",
@@ -573,7 +567,7 @@ int rpmReadRC(const char * rcfiles)
            r++;
        }
        strcat(fn, r);
-           
+
        /* Read another rcfile */
        fd = fdOpen(fn, O_RDONLY, 0);
        if (fdFileno(fd) < 0) {
@@ -596,7 +590,7 @@ int rpmReadRC(const char * rcfiles)
     rpmSetMachine(NULL, NULL); /* XXX WTFO? Why bother? */
 
     if ((r = rpmGetVar(RPMVAR_MACROFILES)) != NULL)
-       initMacros(&globalMacroContext, r);
+       initMacros(NULL, r);
 
     return rc;
 }
@@ -674,9 +668,9 @@ static int doReadRC(FD_t fd, const char * filename) {
                rpmRebuildTargetVars(NULL, NULL);
 
                strcpy(buf, start);
-               if (expandMacros(NULL, &globalMacroContext, buf, sizeof(buf))) {
-                   rpmError(RPMERR_RPMRC, _("expansion failed at %s:%d \"%s\""),
-                       filename, linenum, start);
+               if (expandMacros(NULL, NULL, buf, sizeof(buf))) {
+                   rpmError(RPMERR_RPMRC, _("%s expansion failed at %s:%d \"%s\""),
+                       option->name, filename, linenum, start);
                    return 1;
                }
 
@@ -689,6 +683,16 @@ static int doReadRC(FD_t fd, const char * filename) {
                fdClose(fdinc);
                if (rc) return rc;
              } break;
+           case RPMVAR_MACROFILES:
+               buf[0] = '\0';
+               strncat(buf, start, sizeof(buf) - strlen(buf));
+               if (expandMacros(NULL, NULL, buf, sizeof(buf))) {
+                   rpmError(RPMERR_RPMRC, _("%s expansion failed at %s:%d \"%s\""),
+                       option->name, filename, linenum, start);
+                   return 1;
+               }
+               start = buf;
+               break;
            default:
                break;
            }
@@ -718,7 +722,7 @@ static int doReadRC(FD_t fd, const char * filename) {
                    if (option->localize)
                        *s++ = '_';
                    strcpy(s, option->name);
-                   addMacro(&globalMacroContext, buf, NULL, chptr, RMIL_RPMRC);
+                   addMacro(NULL, buf, NULL, chptr, RMIL_RPMRC);
                }
            } else {
                start = NULL;   /* no arch */
@@ -728,7 +732,7 @@ static int doReadRC(FD_t fd, const char * filename) {
                    if (option->localize)
                        *s++ = '_';
                    strcpy(s, option->name);
-                   addMacro(&globalMacroContext, buf, NULL, chptr, RMIL_RPMRC);
+                   addMacro(NULL, buf, NULL, chptr, RMIL_RPMRC);
                }
            }
            rpmSetVarArch(option->var, chptr, start);
@@ -805,7 +809,7 @@ static void defaultMachine(char ** arch, char ** os) {
                  }
               sprintf(un.sysname,"sunos%s",un.release);
            }
-           
+
            else /* Solaris 2.x: n.x.x becomes n-3.x.x */
               sprintf(un.sysname,"solaris%1d%s",atoi(un.release)-3,un.release+1+(atoi(un.release)/10));
         }
@@ -842,7 +846,7 @@ static void defaultMachine(char ** arch, char ** os) {
                 }
                  free (chptr);
               }
-           }           
+           }
            if (!prelid)
               /* parsing /etc/.relid file failed */
               strcpy(un.sysname,"ncr-sysv4");
@@ -850,7 +854,7 @@ static void defaultMachine(char ** arch, char ** os) {
            strcpy(un.machine,"i486");
         }
 #endif /* __linux__ */
-                   
+
        /* get rid of the hyphens in the sysname */
        for (chptr = un.machine; *chptr; chptr++)
            if (*chptr == '/') *chptr = '-';
@@ -1120,7 +1124,6 @@ void rpmRebuildTargetVars(const char **buildtarget, const char ** canontarget)
 {
 
     char *ca = NULL, *co = NULL, *ct;
-    const char * target = NULL;
     int x;
 
     /* Rebuild the compat table to recalculate the current target arch.  */
@@ -1130,15 +1133,20 @@ void rpmRebuildTargetVars(const char **buildtarget, const char ** canontarget)
     rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
 
     if (buildtarget && *buildtarget) {
+       char *c;
        /* Set arch and os from specified build target */
-       ca = ct = strdup(*buildtarget);
-       if ((co = strrchr(ct, '-')) != NULL) {
-           *co++ = '\0';
-           if (!strcmp(co, "gnu") && (co = strrchr(ct, '-')) != NULL)
-               *co++ = '\0';
+       ca = strdup(*buildtarget);
+       if ((c = strchr(ca, '-')) != NULL)
+           *c++ = '\0';
+           
+       if ((co = strrchr(c, '-')) == NULL) {
+           co = c;
+       } else {
+           if (!strcmp(co, "-gnu"))
+               *co = '\0';
+           co = strrchr(c, '-');
        }
-       if (co == NULL)
-           co = "linux";
+       ct = strdup(*buildtarget);
     } else {
        /* Set build target from default arch and os */
        rpmGetArchInfo(&ca,NULL);
@@ -1146,32 +1154,34 @@ void rpmRebuildTargetVars(const char **buildtarget, const char ** canontarget)
 
        if (ca == NULL) defaultMachine(&ca, NULL);
        if (co == NULL) defaultMachine(NULL, &co);
-
+       ca = strdup(ca);
        for (x = 0; ca[x]; x++)
            ca[x] = tolower(ca[x]);
+       co = strdup(co);
        for (x = 0; co[x]; x++)
            co[x] = tolower(co[x]);
 
        ct = malloc(strlen(co)+strlen(ca)+2);
        sprintf(ct, "%s-%s", ca, co);
-       target = ct;
     }
 
 /*
  * XXX All this macro pokery/jiggery could be achieved by doing a delayed
- *     initMacros(&globalMacroContext, PER-PLATFORM-MACRO-FILE-NAMES);
+ *     initMacros(NULL, PER-PLATFORM-MACRO-FILE-NAMES);
  */
-    delMacro(&globalMacroContext, "_target");
-    addMacro(&globalMacroContext, "_target", NULL, target, RMIL_RPMRC);
-    delMacro(&globalMacroContext, "_target_cpu");
-    addMacro(&globalMacroContext, "_target_cpu", NULL, ca, RMIL_RPMRC);
-    delMacro(&globalMacroContext, "_target_os");
-    addMacro(&globalMacroContext, "_target_os", NULL, co, RMIL_RPMRC);
+    delMacro(NULL, "_target");
+    addMacro(NULL, "_target", NULL, ct, RMIL_RPMRC);
+    delMacro(NULL, "_target_cpu");
+    addMacro(NULL, "_target_cpu", NULL, ca, RMIL_RPMRC);
+    delMacro(NULL, "_target_os");
+    addMacro(NULL, "_target_os", NULL, co, RMIL_RPMRC);
 
     if (canontarget)
-       *canontarget = target;
-    if (ct != NULL && ct != target)
+       *canontarget = ct;
+    else
        free(ct);
+    free(ca);
+    free(co);
 }
 
 int rpmShowRC(FILE *f)
@@ -1223,7 +1233,7 @@ int rpmShowRC(FILE *f)
            fprintf(f, "%-21s : %s\n", opt->name, s ? s : "(not set)");
     }
 
-    dumpMacroTable(&globalMacroContext, f);
+    dumpMacroTable(NULL, f);
 
     return 0;
 }
index bed8bcb..9048254 100644 (file)
--- a/macros.in
+++ b/macros.in
@@ -1,4 +1,4 @@
-# $Id: macros.in,v 1.20 1999/03/30 19:34:01 jbj Exp $
+# $Id: macros.in,v 1.21 1999/04/01 22:26:47 jbj Exp $
 #==============================================================================
 # Macro naming conventions (preliminary):
 #
 #      run configure with correct prefix, platform, and CFLAGS.
 #
 %GNUconfigure  \
-  %{__libtoolize} --copy --force} \
+  %{__libtoolize} --copy --force \
   %{__aclocal} \
   %{__autoheader} \
   %{__automake} \
index 0f69775..aab225d 100644 (file)
@@ -7,7 +7,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-03-31 15:09-0500\n"
+"POT-Creation-Date: 1999-04-01 16:34-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -15,86 +15,86 @@ msgstr ""
 "Content-Type: text/plain; charset=CHARSET\n"
 "Content-Transfer-Encoding: ENCODING\n"
 
-#: ../build.c:45 ../build.c:58
+#: ../build.c:39 ../build.c:52
 #, c-format
 msgid "Failed to open tar pipe: %s\n"
 msgstr ""
 
 #. Give up
-#: ../build.c:66
+#: ../build.c:60
 #, c-format
 msgid "Failed to read spec file from %s\n"
 msgstr ""
 
-#: ../build.c:91
+#: ../build.c:85
 #, c-format
 msgid "Failed to rename %s to %s: %s\n"
 msgstr ""
 
-#: ../build.c:129
+#: ../build.c:123
 #, c-format
 msgid "File is not a regular file: %s\n"
 msgstr ""
 
-#: ../build.c:134
+#: ../build.c:128
 #, c-format
 msgid "Unable to open spec file: %s\n"
 msgstr ""
 
-#: ../build.c:142
+#: ../build.c:136
 #, c-format
 msgid "File contains non-printable characters(%c): %s\n"
 msgstr ""
 
-#: ../build.c:233
+#: ../build.c:229
 msgid "buildroot already specified"
 msgstr ""
 
-#: ../build.c:239
+#: ../build.c:235
 msgid "--buildarch has been obsoleted.  Use the --target option instead.\n"
 msgstr ""
 
-#: ../build.c:243
+#: ../build.c:239
 msgid "--buildos has been obsoleted.  Use the --target option instead.\n"
 msgstr ""
 
-#: ../build.c:264
+#: ../build.c:260
 msgid "override build architecture"
 msgstr ""
 
-#: ../build.c:266
+#: ../build.c:262
 msgid "override build operating system"
 msgstr ""
 
-#: ../build.c:268
+#: ../build.c:264
 msgid "override build root"
 msgstr ""
 
-#: ../build.c:270 ../rpm.c:454
+#: ../build.c:266 ../rpm.c:454
 msgid "remove build tree when done"
 msgstr ""
 
-#: ../build.c:272
+#: ../build.c:268
 msgid "do not execute any stages of the build"
 msgstr ""
 
-#: ../build.c:274
+#: ../build.c:270
 msgid "do not accept I18N msgstr's from specfile"
 msgstr ""
 
-#: ../build.c:276
+#: ../build.c:272
 msgid "remove sources and specfile when done"
 msgstr ""
 
-#: ../build.c:278 ../rpm.c:452
+#: ../build.c:274 ../rpm.c:452
 msgid "skip straight to specified stage (only for c,i)"
 msgstr ""
 
-#: ../build.c:280
+#: ../build.c:276
 msgid "override target platform"
 msgstr ""
 
-#: ../build.c:282
+#: ../build.c:278
 msgid "lookup I18N strings in specfile catalog"
 msgstr ""
 
@@ -1541,21 +1541,21 @@ msgstr ""
 msgid "error looking for package %s\n"
 msgstr ""
 
-#: ../build/build.c:85 ../build/pack.c:267
+#: ../build/build.c:81 ../build/pack.c:267
 msgid "Unable to open temp file"
 msgstr ""
 
-#: ../build/build.c:124
+#: ../build/build.c:120
 #, c-format
 msgid "Executing: %s\n"
 msgstr ""
 
-#: ../build/build.c:128
+#: ../build/build.c:124
 #, c-format
 msgid "Exec of %s failed (%s)"
 msgstr ""
 
-#: ../build/build.c:138
+#: ../build/build.c:134
 #, c-format
 msgid "Bad exit status from %s (%s)"
 msgstr ""
@@ -1605,172 +1605,172 @@ msgstr ""
 msgid "syntax error in expression"
 msgstr ""
 
-#: ../build/files.c:244
+#: ../build/files.c:220
 #, c-format
 msgid "TIMECHECK failure: %s\n"
 msgstr ""
 
-#: ../build/files.c:289 ../build/files.c:301 ../build/files.c:370
-#: ../build/files.c:382 ../build/files.c:413
+#: ../build/files.c:265 ../build/files.c:277 ../build/files.c:346
+#: ../build/files.c:358 ../build/files.c:389
 #, c-format
 msgid "Bad %s() syntax: %s"
 msgstr ""
 
-#: ../build/files.c:331
+#: ../build/files.c:307
 #, c-format
 msgid "Invalid %s token: %s"
 msgstr ""
 
-#: ../build/files.c:393
+#: ../build/files.c:369
 msgid "No files after %%defattr(): %s"
 msgstr ""
 
-#: ../build/files.c:423
+#: ../build/files.c:399
 #, c-format
 msgid "Bad %s() mode spec: %s"
 msgstr ""
 
-#: ../build/files.c:435
+#: ../build/files.c:411
 #, c-format
 msgid "Bad %s() dirmode spec: %s"
 msgstr ""
 
-#: ../build/files.c:486
+#: ../build/files.c:462
 msgid "Bad %%config() syntax: %s"
 msgstr ""
 
-#: ../build/files.c:504
+#: ../build/files.c:480
 msgid "Invalid %%config token: %s"
 msgstr ""
 
-#: ../build/files.c:527 ../build/files.c:539 ../build/files.c:552
+#: ../build/files.c:503 ../build/files.c:515 ../build/files.c:528
 msgid "Bad %%lang() syntax: %s"
 msgstr ""
 
-#: ../build/files.c:558
+#: ../build/files.c:534
 msgid "%%lang() entries are 2 characters: %s"
 msgstr ""
 
-#: ../build/files.c:564
+#: ../build/files.c:540
 msgid "Only one entry in %%lang(): %s"
 msgstr ""
 
-#: ../build/files.c:644
+#: ../build/files.c:620
 msgid "Hit limit for %%docdir"
 msgstr ""
 
-#: ../build/files.c:650
+#: ../build/files.c:626
 msgid "Only one arg for %%docdir"
 msgstr ""
 
 #. We already got a file -- error
-#: ../build/files.c:675
+#: ../build/files.c:651
 #, c-format
 msgid "Two files on one line: %s"
 msgstr ""
 
-#: ../build/files.c:688
+#: ../build/files.c:664
 #, c-format
 msgid "File must begin with \"/\": %s"
 msgstr ""
 
-#: ../build/files.c:700
+#: ../build/files.c:676
 msgid "Can't mix special %%doc with other forms: %s"
 msgstr ""
 
-#: ../build/files.c:788
+#: ../build/files.c:764
 #, c-format
 msgid "File listed twice: %s"
 msgstr ""
 
-#: ../build/files.c:940
+#: ../build/files.c:916
 #, c-format
 msgid "File doesn't match prefix (%s): %s"
 msgstr ""
 
-#: ../build/files.c:950 ../build/files.c:1073
+#: ../build/files.c:926 ../build/files.c:1049
 #, c-format
 msgid "File not found: %s"
 msgstr ""
 
-#: ../build/files.c:993
+#: ../build/files.c:969
 #, c-format
 msgid "Bad owner/group: %s\n"
 msgstr ""
 
-#: ../build/files.c:1007
+#: ../build/files.c:983
 #, c-format
 msgid "File %4d: 0%o %s.%s\t %s\n"
 msgstr ""
 
-#: ../build/files.c:1057
+#: ../build/files.c:1033
 #, c-format
 msgid "File needs leading \"/\": %s"
 msgstr ""
 
-#: ../build/files.c:1114
+#: ../build/files.c:1090
 msgid "Could not open %%files file: %s"
 msgstr ""
 
-#: ../build/files.c:1121 ../build/pack.c:452
+#: ../build/files.c:1097 ../build/pack.c:452
 #, c-format
 msgid "line: %s"
 msgstr ""
 
-#: ../build/files.c:1389 ../build/parsePrep.c:40
+#: ../build/files.c:1365 ../build/parsePrep.c:31
 #, c-format
 msgid "Bad owner/group: %s"
 msgstr ""
 
-#: ../build/files.c:1443
+#: ../build/files.c:1419
 #, c-format
 msgid "Couldn't exec %s"
 msgstr ""
 
-#: ../build/files.c:1447
+#: ../build/files.c:1423
 #, c-format
 msgid "Couldn't fork %s"
 msgstr ""
 
-#: ../build/files.c:1497
+#: ../build/files.c:1473
 #, c-format
 msgid "%s failed"
 msgstr ""
 
-#: ../build/files.c:1501
+#: ../build/files.c:1477
 #, c-format
 msgid "failed to write all data to %s"
 msgstr ""
 
-#: ../build/files.c:1535
+#: ../build/files.c:1511
 msgid "Finding provides...\n"
 msgstr ""
 
-#: ../build/files.c:1542
+#: ../build/files.c:1518
 msgid "Failed to find provides"
 msgstr ""
 
-#: ../build/files.c:1561
+#: ../build/files.c:1537
 msgid "Finding requires...\n"
 msgstr ""
 
-#: ../build/files.c:1568
+#: ../build/files.c:1544
 msgid "Failed to find requires"
 msgstr ""
 
-#: ../build/files.c:1602
+#: ../build/files.c:1578
 msgid "Provides:"
 msgstr ""
 
-#: ../build/files.c:1617
+#: ../build/files.c:1593
 msgid "Prereqs:"
 msgstr ""
 
-#: ../build/files.c:1629
+#: ../build/files.c:1605
 msgid "Requires:"
 msgstr ""
 
-#: ../build/files.c:1653
+#: ../build/files.c:1629
 #, c-format
 msgid "Processing files: %s\n"
 msgstr ""
@@ -1887,27 +1887,27 @@ msgstr ""
 msgid "line %d: second %s"
 msgstr ""
 
-#: ../build/parseChangelog.c:101
+#: ../build/parseChangelog.c:95
 msgid "%%changelog entries must start with *"
 msgstr ""
 
-#: ../build/parseChangelog.c:109
+#: ../build/parseChangelog.c:103
 msgid "incomplete %%changelog entry"
 msgstr ""
 
-#: ../build/parseChangelog.c:124
+#: ../build/parseChangelog.c:118
 msgid "bad date in %%changelog: %s"
 msgstr ""
 
-#: ../build/parseChangelog.c:129
+#: ../build/parseChangelog.c:123
 msgid "%%changelog not in decending chronological order"
 msgstr ""
 
-#: ../build/parseChangelog.c:137 ../build/parseChangelog.c:148
+#: ../build/parseChangelog.c:131 ../build/parseChangelog.c:142
 msgid "missing name in %%changelog"
 msgstr ""
 
-#: ../build/parseChangelog.c:155
+#: ../build/parseChangelog.c:149
 msgid "no description in %%changelog"
 msgstr ""
 
@@ -1916,19 +1916,19 @@ msgid "line %d: Error parsing %%description: %s"
 msgstr ""
 
 #: ../build/parseDescription.c:48 ../build/parseFiles.c:42
-#: ../build/parseScript.c:139
+#: ../build/parseScript.c:170
 #, c-format
 msgid "line %d: Bad option %s: %s"
 msgstr ""
 
 #: ../build/parseDescription.c:62 ../build/parseFiles.c:56
-#: ../build/parseScript.c:153
+#: ../build/parseScript.c:184
 #, c-format
 msgid "line %d: Too many names: %s"
 msgstr ""
 
 #: ../build/parseDescription.c:72 ../build/parseFiles.c:66
-#: ../build/parseScript.c:163
+#: ../build/parseScript.c:194
 #, c-format
 msgid "line %d: Package does not exist: %s"
 msgstr ""
@@ -1946,168 +1946,173 @@ msgstr ""
 msgid "line %d: Second %%files list"
 msgstr ""
 
-#: ../build/parsePreamble.c:156
+#: ../build/parsePreamble.c:143
 #, c-format
 msgid "Architecture is excluded: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:161
+#: ../build/parsePreamble.c:148
 #, c-format
 msgid "Architecture is not included: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:166
+#: ../build/parsePreamble.c:153
 #, c-format
 msgid "OS is excluded: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:171
+#: ../build/parsePreamble.c:158
 #, c-format
 msgid "OS is not included: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:206
+#: ../build/parsePreamble.c:193
 #, c-format
 msgid "%s field must be present in package: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:228
+#: ../build/parsePreamble.c:215
 #, c-format
 msgid "Duplicate %s entries in package: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:275
+#: ../build/parsePreamble.c:262
 #, c-format
 msgid "Unable to stat icon: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:286
+#: ../build/parsePreamble.c:273
 #, c-format
 msgid "Unable to read icon: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:296
+#: ../build/parsePreamble.c:283
 #, c-format
 msgid "Unknown icon type: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:359
+#: ../build/parsePreamble.c:346
 #, c-format
 msgid "line %d: Malformed tag: %s"
 msgstr ""
 
 #. Empty field
-#: ../build/parsePreamble.c:367
+#: ../build/parsePreamble.c:354
 #, c-format
 msgid "line %d: Empty tag: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:390 ../build/parsePreamble.c:397
+#: ../build/parsePreamble.c:377 ../build/parsePreamble.c:384
 #, c-format
 msgid "line %d: Illegal char '-' in %s: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:435
+#: ../build/parsePreamble.c:422
 #, c-format
 msgid "line %d: BuildRoot can not be \"/\": %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:448
+#: ../build/parsePreamble.c:435
 #, c-format
 msgid "line %d: Prefixes must not end with \"/\": %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:460
+#: ../build/parsePreamble.c:447
 #, c-format
 msgid "line %d: Docdir must begin with '/': %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:472
+#: ../build/parsePreamble.c:459
 #, c-format
 msgid "line %d: Epoch/Serial field must be a number: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:537
+#: ../build/parsePreamble.c:524
 #, c-format
 msgid "line %d: Bad BuildArchitecture format: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:547
+#: ../build/parsePreamble.c:534
 #, c-format
 msgid "Internal error: Bogus tag %d"
 msgstr ""
 
-#: ../build/parsePreamble.c:692
+#: ../build/parsePreamble.c:679
 #, c-format
 msgid "Bad package specification: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:698
+#: ../build/parsePreamble.c:685
 #, c-format
 msgid "Package already exists: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:725
+#: ../build/parsePreamble.c:712
 #, c-format
 msgid "line %d: Unknown tag: %s"
 msgstr ""
 
-#: ../build/parsePreamble.c:750
+#: ../build/parsePreamble.c:737
 msgid "Spec file can't use BuildRoot"
 msgstr ""
 
-#: ../build/parsePrep.c:36
+#: ../build/parsePrep.c:27
 #, c-format
 msgid "Bad source: %s: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:62
+#: ../build/parsePrep.c:53
 #, c-format
 msgid "No patch number %d"
 msgstr ""
 
-#: ../build/parsePrep.c:128
+#: ../build/parsePrep.c:119
 #, c-format
 msgid "No source number %d"
 msgstr ""
 
-#: ../build/parsePrep.c:183
+#: ../build/parsePrep.c:138
+#, c-format
+msgid "Couldn't download nosource %s: %s"
+msgstr ""
+
+#: ../build/parsePrep.c:193
 msgid "Error parsing %%setup: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:198
+#: ../build/parsePrep.c:208
 msgid "line %d: Bad arg to %%setup %c: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:219
+#: ../build/parsePrep.c:229
 msgid "line %d: Bad %%setup option %s: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:343
+#: ../build/parsePrep.c:353
 msgid "line %d: Need arg to %%patch -b: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:351
+#: ../build/parsePrep.c:361
 msgid "line %d: Need arg to %%patch -z: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:363
+#: ../build/parsePrep.c:373
 msgid "line %d: Need arg to %%patch -p: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:369
+#: ../build/parsePrep.c:379
 msgid "line %d: Bad arg to %%patch -p: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:376
+#: ../build/parsePrep.c:386
 msgid "Too many patches!"
 msgstr ""
 
-#: ../build/parsePrep.c:380
+#: ../build/parsePrep.c:390
 msgid "line %d: Bad arg to %%patch: %s"
 msgstr ""
 
-#: ../build/parsePrep.c:416
+#: ../build/parsePrep.c:426
 msgid "line %d: second %%prep"
 msgstr ""
 
@@ -2141,83 +2146,83 @@ msgstr ""
 msgid "line %d: %s: tokens must begin with alpha-numeric: %s"
 msgstr ""
 
-#: ../build/parseScript.c:107
+#: ../build/parseScript.c:138
 #, c-format
 msgid "line %d: triggers must have --: %s"
 msgstr ""
 
-#: ../build/parseScript.c:117 ../build/parseScript.c:181
+#: ../build/parseScript.c:148 ../build/parseScript.c:212
 #, c-format
 msgid "line %d: Error parsing %s: %s"
 msgstr ""
 
-#: ../build/parseScript.c:127
+#: ../build/parseScript.c:158
 #, c-format
 msgid "line %d: script program must begin with '/': %s"
 msgstr ""
 
-#: ../build/parseScript.c:172
+#: ../build/parseScript.c:203
 #, c-format
 msgid "line %d: Second %s"
 msgstr ""
 
-#: ../build/parseSpec.c:124
+#: ../build/parseSpec.c:120
 #, c-format
 msgid "Unable to open: %s\n"
 msgstr ""
 
-#: ../build/parseSpec.c:136
+#: ../build/parseSpec.c:132
 msgid "Unclosed %%if"
 msgstr ""
 
-#: ../build/parseSpec.c:192
+#: ../build/parseSpec.c:188
 #, c-format
 msgid "line %d: %s"
 msgstr ""
 
 #. Got an else with no %if !
-#: ../build/parseSpec.c:217
+#: ../build/parseSpec.c:213
 msgid "%s:%d: Got a %%else with no if"
 msgstr ""
 
 #. Got an end with no %if !
-#: ../build/parseSpec.c:227
+#: ../build/parseSpec.c:223
 msgid "%s:%d: Got a %%endif with no if"
 msgstr ""
 
-#: ../build/parseSpec.c:239 ../build/parseSpec.c:248
+#: ../build/parseSpec.c:235 ../build/parseSpec.c:244
 msgid "malformed %%include statement"
 msgstr ""
 
-#: ../build/parseSpec.c:327
+#: ../build/parseSpec.c:323
 #, c-format
 msgid "Timecheck value must be an integer: %s"
 msgstr ""
 
-#: ../build/parseSpec.c:410
+#: ../build/parseSpec.c:406
 msgid "No buildable architectures"
 msgstr ""
 
-#: ../build/parseSpec.c:455
+#: ../build/parseSpec.c:451
 msgid "Package has no %%description: %s"
 msgstr ""
 
-#: ../build/spec.c:31
+#: ../build/spec.c:28
 #, c-format
 msgid "archive = %s, fs = %s\n"
 msgstr ""
 
-#: ../build/spec.c:232
+#: ../build/spec.c:224
 #, c-format
 msgid "line %d: Bad number: %s"
 msgstr ""
 
-#: ../build/spec.c:238
+#: ../build/spec.c:230
 #, c-format
 msgid "line %d: Bad no%s number: %d"
 msgstr ""
 
-#: ../build/spec.c:294
+#: ../build/spec.c:286
 #, c-format
 msgid "line %d: Bad %s number: %s\n"
 msgstr ""
@@ -2450,73 +2455,73 @@ msgstr ""
 msgid "%%instchangelog value in macro file should be a number, but isn't"
 msgstr ""
 
-#: ../lib/install.c:276
+#: ../lib/install.c:275
 #, c-format
 msgid "package: %s-%s-%s files test = %d\n"
 msgstr ""
 
-#: ../lib/install.c:334
+#: ../lib/install.c:338
 msgid "stopping install as we're running --test\n"
 msgstr ""
 
-#: ../lib/install.c:339
+#: ../lib/install.c:343
 msgid "running preinstall script (if any)\n"
 msgstr ""
 
-#: ../lib/install.c:369
+#: ../lib/install.c:373
 #, c-format
 msgid "warning: %s created as %s"
 msgstr ""
 
-#: ../lib/install.c:405
+#: ../lib/install.c:409
 #, c-format
 msgid "warning: %s saved as %s"
 msgstr ""
 
-#: ../lib/install.c:409 ../lib/install.c:746 ../lib/uninstall.c:337
+#: ../lib/install.c:413 ../lib/install.c:750 ../lib/uninstall.c:337
 #, c-format
 msgid "rename of %s to %s failed: %s"
 msgstr ""
 
-#: ../lib/install.c:492
+#: ../lib/install.c:496
 msgid "running postinstall script (if any)\n"
 msgstr ""
 
 #. this would probably be a good place to check if disk space
 #. was used up - if so, we should return a different error
-#: ../lib/install.c:600
+#: ../lib/install.c:604
 #, c-format
 msgid "unpacking of archive failed%s%s: %s"
 msgstr ""
 
-#: ../lib/install.c:601
+#: ../lib/install.c:605
 msgid " on file "
 msgstr ""
 
-#: ../lib/install.c:640
+#: ../lib/install.c:644
 msgid "installing a source package\n"
 msgstr ""
 
-#: ../lib/install.c:646 ../lib/install.c:652
+#: ../lib/install.c:650 ../lib/install.c:656
 #, c-format
 msgid "cannot write to %s"
 msgstr ""
 
-#: ../lib/install.c:657
+#: ../lib/install.c:661
 #, c-format
 msgid "sources in: %s\n"
 msgstr ""
 
-#: ../lib/install.c:658
+#: ../lib/install.c:662
 #, c-format
 msgid "spec file in: %s\n"
 msgstr ""
 
-#: ../lib/install.c:691 ../lib/install.c:723
+#: ../lib/install.c:695 ../lib/install.c:727
 msgid "source package contains no .spec file"
 msgstr ""
 
-#: ../lib/install.c:744
+#: ../lib/install.c:748
 #, c-format
 msgid "renaming %s to %s\n"
 msgstr ""
@@ -2526,83 +2531,83 @@ msgstr ""
 msgid "cannot read header at %d for lookup"
 msgstr ""
 
-#: ../lib/macro.c:119
+#: ../lib/macro.c:123
 #, c-format
 msgid "======================== active %d empty %d\n"
 msgstr ""
 
 #. XXX just in case
-#: ../lib/macro.c:206
+#: ../lib/macro.c:212
 #, c-format
 msgid "%3d>%*s(empty)"
 msgstr ""
 
-#: ../lib/macro.c:241
+#: ../lib/macro.c:247
 #, c-format
 msgid "%3d<%*s(empty)\n"
 msgstr ""
 
-#: ../lib/macro.c:414
+#: ../lib/macro.c:420
 msgid "Macro %%%s has unterminated body"
 msgstr ""
 
-#: ../lib/macro.c:440
+#: ../lib/macro.c:446
 msgid "Macro %%%s has illegal name (%%define)"
 msgstr ""
 
-#: ../lib/macro.c:446
+#: ../lib/macro.c:452
 msgid "Macro %%%s has unterminated opts"
 msgstr ""
 
-#: ../lib/macro.c:451
+#: ../lib/macro.c:457
 msgid "Macro %%%s has empty body"
 msgstr ""
 
-#: ../lib/macro.c:456
+#: ../lib/macro.c:462
 msgid "Macro %%%s failed to expand"
 msgstr ""
 
-#: ../lib/macro.c:481
+#: ../lib/macro.c:487
 msgid "Macro %%%s has illegal name (%%undefine)"
 msgstr ""
 
-#: ../lib/macro.c:554
+#: ../lib/macro.c:560
 msgid "Macro %%%s (%s) was not used below level %d"
 msgstr ""
 
-#: ../lib/macro.c:636
+#: ../lib/macro.c:642
 #, c-format
 msgid "Unknown option %c in %s(%s)"
 msgstr ""
 
-#: ../lib/macro.c:798
+#: ../lib/macro.c:804
 #, c-format
 msgid "Recursion depth(%d) greater than max(%d)"
 msgstr ""
 
-#: ../lib/macro.c:854 ../lib/macro.c:870
+#: ../lib/macro.c:860 ../lib/macro.c:876
 #, c-format
 msgid "Unterminated %c: %s"
 msgstr ""
 
-#: ../lib/macro.c:899
+#: ../lib/macro.c:905
 msgid "Empty token"
 msgstr ""
 
-#: ../lib/macro.c:1021
+#: ../lib/macro.c:1027
 msgid "Macro %%%.*s not found, skipping"
 msgstr ""
 
-#: ../lib/macro.c:1097
+#: ../lib/macro.c:1105
 msgid "Target buffer overflow"
 msgstr ""
 
-#: ../lib/macro.c:1238 ../lib/macro.c:1246
+#: ../lib/macro.c:1248 ../lib/macro.c:1256
 #, c-format
 msgid "File %s: %s"
 msgstr ""
 
-#: ../lib/macro.c:1249
+#: ../lib/macro.c:1259
 #, c-format
 msgid "File %s is smaller than %d bytes"
 msgstr ""
@@ -2969,92 +2974,92 @@ msgstr ""
 msgid "read failed: %s (%d)"
 msgstr ""
 
-#: ../lib/rpmrc.c:184
+#: ../lib/rpmrc.c:178
 #, c-format
 msgid "missing second ':' at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:187
+#: ../lib/rpmrc.c:181
 #, c-format
 msgid "missing architecture name at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:335
+#: ../lib/rpmrc.c:329
 #, c-format
 msgid "Incomplete data line at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:339
+#: ../lib/rpmrc.c:333
 #, c-format
 msgid "Too many args in data line at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:346
+#: ../lib/rpmrc.c:340
 #, c-format
 msgid "Bad arch/os number: %s (%s:%d)"
 msgstr ""
 
-#: ../lib/rpmrc.c:380
+#: ../lib/rpmrc.c:374
 #, c-format
 msgid "Incomplete default line at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:385
+#: ../lib/rpmrc.c:379
 #, c-format
 msgid "Too many args in default line at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:568
+#: ../lib/rpmrc.c:562
 #, c-format
 msgid "Cannot expand %s"
 msgstr ""
 
-#: ../lib/rpmrc.c:583
+#: ../lib/rpmrc.c:577
 #, c-format
 msgid "Unable to open %s for reading: %s."
 msgstr ""
 
-#: ../lib/rpmrc.c:617
+#: ../lib/rpmrc.c:611
 #, c-format
 msgid "Failed to read %s: %s."
 msgstr ""
 
-#: ../lib/rpmrc.c:648
+#: ../lib/rpmrc.c:642
 #, c-format
 msgid "missing ':' at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:664 ../lib/rpmrc.c:712
+#: ../lib/rpmrc.c:658 ../lib/rpmrc.c:716
 #, c-format
 msgid "missing argument for %s at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:678
+#: ../lib/rpmrc.c:672 ../lib/rpmrc.c:690
 #, c-format
-msgid "expansion failed at %s:%d \"%s\""
+msgid "%s expansion failed at %s:%d \"%s\""
 msgstr ""
 
-#: ../lib/rpmrc.c:684
+#: ../lib/rpmrc.c:678
 #, c-format
 msgid "cannot open %s at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:702
+#: ../lib/rpmrc.c:706
 #, c-format
 msgid "missing architecture for %s at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:769
+#: ../lib/rpmrc.c:773
 #, c-format
 msgid "bad option '%s' at %s:%d"
 msgstr ""
 
-#: ../lib/rpmrc.c:1105
+#: ../lib/rpmrc.c:1109
 #, c-format
 msgid "Unknown system: %s\n"
 msgstr ""
 
-#: ../lib/rpmrc.c:1106
+#: ../lib/rpmrc.c:1110
 msgid "Please contact rpm-list@redhat.com\n"
 msgstr ""
 
diff --git a/rpm.c b/rpm.c
index a1d378a..cd31d40 100755 (executable)
--- a/rpm.c
+++ b/rpm.c
@@ -822,12 +822,12 @@ int main(int argc, char ** argv) {
          case GETOPT_DBPATH:
             if (optArg[0] != '/')
                 argerror(_("arguments to --dbpath must begin with a /"));
-           addMacro(&globalMacroContext,"_dbpath", NULL, optArg, RMIL_CMDLINE);
+           addMacro(NULL,"_dbpath", NULL, optArg, RMIL_CMDLINE);
            gotDbpath = 1;
            break;
 
          case GETOPT_DEFINEMACRO:
-           rpmDefineMacro(&globalMacroContext, optArg, RMIL_CMDLINE);
+           rpmDefineMacro(NULL, optArg, RMIL_CMDLINE);
            break;
 
          case GETOPT_PREFIX:   /* XXX FIXME */
@@ -840,7 +840,7 @@ int main(int argc, char ** argv) {
            if ((*tce) || (tce == optArg) || (timeCheck == ULONG_MAX)) {
                argerror("Argument to --timecheck must be integer");
            }
-           addMacro(&globalMacroContext, "_timecheck", NULL, optArg, RMIL_CMDLINE);
+           addMacro(NULL, "_timecheck", NULL, optArg, RMIL_CMDLINE);
            timeCheck = 1;
            break;
 
@@ -1089,16 +1089,16 @@ int main(int argc, char ** argv) {
                   "package verification"));
 
     if (ftpProxy) {
-       addMacro(&globalMacroContext, "_ftpproxy", NULL, ftpProxy, RMIL_CMDLINE);
+       addMacro(NULL, "_ftpproxy", NULL, ftpProxy, RMIL_CMDLINE);
     }
     if (ftpPort) {
-       addMacro(&globalMacroContext, "_ftpport", NULL, ftpPort, RMIL_CMDLINE);
+       addMacro(NULL, "_ftpport", NULL, ftpPort, RMIL_CMDLINE);
     }
     if (httpProxy) {
-       addMacro(&globalMacroContext, "_httpproxy", NULL, httpProxy, RMIL_CMDLINE);
+       addMacro(NULL, "_httpproxy", NULL, httpProxy, RMIL_CMDLINE);
     }
     if (httpPort) {
-       addMacro(&globalMacroContext, "_httpport", NULL, httpPort, RMIL_CMDLINE);
+       addMacro(NULL, "_httpport", NULL, httpPort, RMIL_CMDLINE);
     }
 
     if (signIt) {
index d545d0d..008ccfe 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "rpmmacro.h"
 
+struct MacroContext globalMacroContext;
+
 typedef struct MacroBuf {
        const char *s;          /* text to expand */
        char *t;                /* expansion buffer */
@@ -97,6 +99,8 @@ dumpMacroTable(MacroContext *mc, FILE *f)
        int nempty = 0;
        int nactive = 0;
 
+       if (mc == NULL)
+               mc = &globalMacroContext;
        if (f == NULL)
                f = stderr;
     
@@ -126,6 +130,8 @@ findEntry(MacroContext *mc, const char *name, size_t namelen)
        MacroEntry keybuf, *key, **ret;
        char namebuf[1024];
 
+       if (mc == NULL)
+               mc = &globalMacroContext;
        if (! mc->firstFree)
                return NULL;
 
@@ -1077,6 +1083,8 @@ expandMacros(void *spec, MacroContext *mc, char *s, size_t slen)
 
        if (s == NULL || slen <= 0)
                return 0;
+       if (mc == NULL)
+               mc = &globalMacroContext;
 
        tbuf = alloca(slen + 1);
        memset(tbuf, 0, (slen + 1));
@@ -1107,6 +1115,9 @@ addMacro(MacroContext *mc, const char *n, const char *o, const char *b, int leve
 {
        MacroEntry **mep;
 
+       if (mc == NULL)
+               mc = &globalMacroContext;
+
        /* If new name, expand macro table */
        if ((mep = findEntry(mc, n, 0)) == NULL) {
                if (mc->firstFree == mc->macrosAllocated)
@@ -1127,6 +1138,8 @@ delMacro(MacroContext *mc, const char *name)
 {
        MacroEntry **mep = findEntry(mc, name, 0);
 
+       if (mc == NULL)
+               mc = &globalMacroContext;
        /* If name exists, pop entry */
        if ((mep = findEntry(mc, name, 0)) != NULL)
                popMacro(mep);
@@ -1147,18 +1160,11 @@ void
 initMacros(MacroContext *mc, const char *macrofiles)
 {
        char *m, *mfile, *me;
-       static int first = 1;
-
-       /* XXX initialization should be per macro context, not per execution */
-       if (first) {
-               mc->macroTable = NULL;
-               expandMacroTable(mc);
-               max_macro_depth = MAX_MACRO_DEPTH;      /* XXX Assume good ol' macro expansion */
-               first = 0;
-       }
 
        if (macrofiles == NULL)
                return;
+       if (mc == NULL)
+               mc = &globalMacroContext;
 
        for (mfile = m = strdup(macrofiles); *mfile; mfile = me) {
                FILE *fp;
@@ -1210,6 +1216,9 @@ freeMacros(MacroContext *mc)
 {
        int i;
     
+       if (mc == NULL)
+               mc = &globalMacroContext;
+
        for (i = 0; i < mc->firstFree; i++) {
                MacroEntry *me;
                while ((me = mc->macroTable[i]) != NULL) {
@@ -1222,6 +1231,7 @@ freeMacros(MacroContext *mc)
                }
        }
        FREE(mc->macroTable);
+       memset(mc, 0, sizeof(*mc));
 }
 
 /* =============================================================== */
@@ -1291,7 +1301,7 @@ rpmExpand(const char *arg, ...)
        *pe = '\0';
     }
     va_end(ap);
-    expandMacros(NULL, &globalMacroContext, buf, sizeof(buf));
+    expandMacros(NULL, NULL, buf, sizeof(buf));
     return strdup(buf);
 }
 
@@ -1350,7 +1360,7 @@ rpmGetPath(const char *path, ...)
        }
     }
     va_end(ap);
-    expandMacros(NULL, &globalMacroContext, buf, sizeof(buf));
+    expandMacros(NULL, NULL, buf, sizeof(buf));
     return strdup(buf);
 }
 
index 5c3883e..86be34f 100644 (file)
@@ -16,8 +16,6 @@ typedef /*@abstract@*/ struct MacroContext {
        int             firstFree;
 } MacroContext;
 
-extern MacroContext globalMacroContext;
-
 /*
  * Markers for types of macros added throughout rpm.
  */
index 4f52fda..0cf7504 100644 (file)
--- a/rpmrc.in
+++ b/rpmrc.in
@@ -1,4 +1,4 @@
-# $Id: rpmrc.in,v 2.5 1999/03/31 20:38:00 jbj Exp $
+# $Id: rpmrc.in,v 2.6 1999/04/01 22:26:49 jbj Exp $
 
 #############################################################
 
@@ -185,8 +185,8 @@ buildarch_compat: armv4l: noarch
 buildarch_compat: parisc: noarch
 
 #############################################################
+#macrofiles:   @RPMCONFIGDIR@/macros:@SYSCONFIGDIR@/macros:~/.rpmmacros
 
-macrofiles:    @RPMCONFIGDIR@/macros:@SYSCONFIGDIR@/macros:~/.rpmmacros
+macrofiles:    @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros
 
-#macrofiles:   @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros
 #include: @RPMCONFIGDIR@/%{_target}/rpmrc
index 22aab99..b91978a 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: macros.in,v 1.12 1999/03/20 21:10:10 jbj Exp $
+# $Id: macros.in,v 1.13 1999/04/01 22:27:03 jbj Exp $
 #==============================================================================
 # Macro naming conventions (preliminary):
 #
 
 #==============================================================================
 # ---- path macros
-#
-%__bzip2                 %(which bzip2)
-%__cat                   %(which cat)
-%__chgrp                 %(which chgrp)
-%__chmod                 %(which chmod)
-%__chown                 %(which chown)
-%__gzip                  %(which gzip)
-%__install               %(which install)
-%__libtoolize            %(which libtoolize)
-%__make                  %(which make)
-%__mkdir                 %(which mkdir)
-%__patch                 %(which patch)
-%__ranlib                %(which ranlib)
-%__rm                    %(which rm)
-%__strip                 %(which strip)
-%__tar                   %(which tar)
+#      XXX The use of which here is overly simple.
+#
+%__bzip2               %(which bzip2)
+%__cat                 %(which cat)
+%__chgrp               %(which chgrp)
+%__chmod               %(which chmod)
+%__chown               %(which chown)
+%__cpio                        %(which cpio)
+%__gzip                        %(which gzip)
+%__install             %(which install)
+%__make                        %(which make)
+%__mkdir               %(which mkdir)
+%__patch               %(which patch)
+%__ranlib              %(which ranlib)
+%__rm                  %(which rm)
+%__strip               %(which strip)
+%__tar                 %(which tar)
+
+# XXX avoid weird failures from which if tools are not installed
+%__libtoolize          libtoolize
+%__aclocal             aclocal
+%__autoheader          autoheader
+%__automake            automake
+%__autoconf            autoconf
 
 #==============================================================================
 # ---- Required rpmrc macros.
 #      (e.g. per-platform, per-system, per-packager) macro files.
 #
 %_builddir             %{_topdir}/BUILD
-%_buildshell           @testdir@/bin/sh
-%_bzip2bin             @testdir@@BZIP2BIN@
+%_buildshell           /bin/sh
+%_bzip2bin             @BZIP2BIN@
 %_dbpath               %{_var}/lib/rpm
 %_defaultdocdir                %{_usr}/doc
 #
 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
-#%_fixowner            chown -R root
-#%_fixgroup            chgrp -R @ROOT_GROUP@
+%_fixowner             [ `id -u` = '0' ] && chown -R root
+%_fixgroup             [ `id -u` = '0' ] && chgrp -R @ROOT_GROUP@
 %_fixperms             chmod -R @FIXPERMS@
 #
-%_gzipbin              @testdir@@GZIPBIN@
+%_gzipbin              @GZIPBIN@
 %_instchangelog                5
+%_pgpbin               @PGPBIN@
 %_rpmdir               %{_topdir}/RPMS
 #
 # XXX Note escaped %% for use in headerSprintf
@@ -87,6 +96,7 @@
 #%_pgp_path
 #%_provides
 #%_timecheck
+#%vendor
 
 #==============================================================================
 # ---- per-platform macros.
 #      will be used if the per-platform macro file does not exist..
 #
 %_arch                 @RPMCANONARCH@
-%vendor                        @RPMCANONVENDOR@
+%_vendor               @RPMCANONVENDOR@
 %_os                   @RPMCANONOS@
-%_target_platform      %{_target_cpu}-%{vendor}-%{_target_os}
+%_target_platform      %{_target_cpu}-%{_vendor}-%{_target_os}
 #
 # XXX use the rpmrc instantiated macro for now
 #%optflags             -O2
        RPM_SOURCE_DIR=\"%{_sourcedir}\"\
        RPM_BUILD_DIR=\"%{_builddir}\"\
        RPM_OPT_FLAGS=\"%{optflags}\"\
-       RPM_ARCH=\"%{_target_cpu}\"\
-       RPM_OS=\"%{_target_os}\"\
+       RPM_ARCH=\"%{_arch}\"\
+       RPM_OS=\"%{_os}\"\
        export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
        RPM_DOC_DIR=\"%{_docdir}\"\
        export RPM_DOC_DIR\
 %configure     \
   %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
   CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
+
+#------------------------------------------------------------------------------
+# The GNUconfigure macro does the following:
+#      update config.guess and config.sub.
+#      regenerate all autoconf/automake files
+#      run configure with correct prefix, platform, and CFLAGS.
+#
+%GNUconfigure  \
+  %{__libtoolize} --copy --force \
+  %{__aclocal} \
+  %{__autoheader} \
+  %{__automake} \
+  %{__autoconf} \
+  CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
index df144d2..264bc4e 100644 (file)
@@ -1017,7 +1017,7 @@ main(int argc, char **argv)
     }
 
     /* XXX I don't want to read rpmrc */
-    addMacro(&globalMacroContext, "_tmppath", NULL, "/tmp", RMIL_DEFAULT);
+    addMacro(NULL, "_tmppath", NULL, "/tmp", RMIL_DEFAULT);
 
     fdi = fdDup(STDIN_FILENO);