augment --showrc with -v, only display set variables without -v.
add macrofiles variable, permit second entry to initMacros(). CVS patchset: 2463 CVS date: 1998/10/15 23:29:25
This commit is contained in:
parent
200977cdf3
commit
9f20ee028b
4
CHANGES
4
CHANGES
|
@ -1,5 +1,7 @@
|
|||
2.5.5 -> 2.90
|
||||
- add config.h defines for scripts like find-requires.
|
||||
- augment --showrc with -v, only display set variables without -v.
|
||||
- add macrofiles variable, permit second entry to initMacros().
|
||||
- add config.h defines for paths to find-requires et. al.
|
||||
- add readRPM to libbuild, headerGetLangs to librpm.
|
||||
- permit rpm to be built in a sub-directory (--srcdir=DIR).
|
||||
- configure using automake.
|
||||
|
|
12
lib/macro.c
12
lib/macro.c
|
@ -1126,11 +1126,15 @@ void
|
|||
initMacros(MacroContext *mc, const char *macrofile)
|
||||
{
|
||||
char *m, *mfile, *me;
|
||||
static int first = 1;
|
||||
|
||||
mc->macroTable = NULL;
|
||||
expandMacroTable(mc);
|
||||
|
||||
max_macro_depth = 2; /* XXX Assume good ol' macro expansion */
|
||||
/* XXX initialization should be per macro context, not per execution */
|
||||
if (first) {
|
||||
mc->macroTable = NULL;
|
||||
expandMacroTable(mc);
|
||||
max_macro_depth = 2; /* XXX Assume good ol' macro expansion */
|
||||
first = 0;
|
||||
}
|
||||
|
||||
if (macrofile == NULL)
|
||||
return;
|
||||
|
|
75
lib/rpmlib.h
75
lib/rpmlib.h
|
@ -197,15 +197,15 @@ extern const struct headerSprintfExtension rpmHeaderFormats[];
|
|||
|
||||
/* Stuff for maintaining "variables" like SOURCEDIR, BUILDDIR, etc */
|
||||
|
||||
#define RPMVAR_SOURCEDIR 0
|
||||
#define RPMVAR_BUILDDIR 1
|
||||
/* #define RPMVAR_DOCDIR 2 -- No longer used */
|
||||
#define RPMVAR_OPTFLAGS 3
|
||||
#define RPMVAR_TOPDIR 4
|
||||
#define RPMVAR_SPECDIR 5
|
||||
#define RPMVAR_ROOT 6
|
||||
#define RPMVAR_RPMDIR 7
|
||||
#define RPMVAR_SRPMDIR 8
|
||||
#define RPMVAR_SOURCEDIR 0
|
||||
#define RPMVAR_BUILDDIR 1
|
||||
/* #define RPMVAR_DOCDIR 2 -- No longer used */
|
||||
#define RPMVAR_OPTFLAGS 3
|
||||
#define RPMVAR_TOPDIR 4
|
||||
#define RPMVAR_SPECDIR 5
|
||||
#define RPMVAR_ROOT 6
|
||||
#define RPMVAR_RPMDIR 7
|
||||
#define RPMVAR_SRPMDIR 8
|
||||
/* #define RPMVAR_ARCHSENSITIVE 9 -- No longer used */
|
||||
#define RPMVAR_REQUIREDISTRIBUTION 10
|
||||
/* #define RPMVAR_REQUIREGROUP 11 -- No longer used */
|
||||
|
@ -215,39 +215,40 @@ extern const struct headerSprintfExtension rpmHeaderFormats[];
|
|||
#define RPMVAR_MESSAGELEVEL 15
|
||||
#define RPMVAR_REQUIREICON 16
|
||||
#define RPMVAR_TIMECHECK 17
|
||||
#define RPMVAR_SIGTYPE 18
|
||||
#define RPMVAR_PGP_PATH 19
|
||||
#define RPMVAR_PGP_NAME 20
|
||||
/* #define RPMVAR_PGP_SECRING 21 -- No longer used */
|
||||
/* #define RPMVAR_PGP_PUBRING 22 -- No longer used */
|
||||
#define RPMVAR_EXCLUDEDOCS 23
|
||||
/* #define RPMVAR_BUILDARCH 24 -- No longer used */
|
||||
/* #define RPMVAR_BUILDOS 25 -- No longer used */
|
||||
#define RPMVAR_BUILDROOT 26
|
||||
#define RPMVAR_DBPATH 27
|
||||
#define RPMVAR_PACKAGER 28
|
||||
#define RPMVAR_FTPPROXY 29
|
||||
#define RPMVAR_TMPPATH 30
|
||||
/* #define RPMVAR_CPIOBIN 31 -- No longer used */
|
||||
#define RPMVAR_SIGTYPE 18
|
||||
#define RPMVAR_PGP_PATH 19
|
||||
#define RPMVAR_PGP_NAME 20
|
||||
/* #define RPMVAR_PGP_SECRING 21 -- No longer used */
|
||||
/* #define RPMVAR_PGP_PUBRING 22 -- No longer used */
|
||||
#define RPMVAR_EXCLUDEDOCS 23
|
||||
/* #define RPMVAR_BUILDARCH 24 -- No longer used */
|
||||
/* #define RPMVAR_BUILDOS 25 -- No longer used */
|
||||
#define RPMVAR_BUILDROOT 26
|
||||
#define RPMVAR_DBPATH 27
|
||||
#define RPMVAR_PACKAGER 28
|
||||
#define RPMVAR_FTPPROXY 29
|
||||
#define RPMVAR_TMPPATH 30
|
||||
/* #define RPMVAR_CPIOBIN 31 -- No longer used */
|
||||
#define RPMVAR_FTPPORT 32
|
||||
#define RPMVAR_NETSHAREDPATH 33
|
||||
#define RPMVAR_DEFAULTDOCDIR 34
|
||||
#define RPMVAR_FIXPERMS 35
|
||||
#define RPMVAR_GZIPBIN 36
|
||||
#define RPMVAR_RPMFILENAME 37
|
||||
#define RPMVAR_PROVIDES 38
|
||||
#define RPMVAR_BUILDSHELL 39
|
||||
#define RPMVAR_INSTCHANGELOG 40
|
||||
#define RPMVAR_BZIP2BIN 41
|
||||
#define RPMVAR_LANGPATT 42
|
||||
#define RPMVAR_INCLUDE 43
|
||||
#define RPMVAR_ARCH 44
|
||||
#define RPMVAR_OS 45
|
||||
#define RPMVAR_BUILDPLATFORM 46
|
||||
#define RPMVAR_BUILDARCH 47
|
||||
#define RPMVAR_BUILDOS 48
|
||||
#define RPMVAR_GZIPBIN 36
|
||||
#define RPMVAR_RPMFILENAME 37
|
||||
#define RPMVAR_PROVIDES 38
|
||||
#define RPMVAR_BUILDSHELL 39
|
||||
#define RPMVAR_INSTCHANGELOG 40
|
||||
#define RPMVAR_BZIP2BIN 41
|
||||
#define RPMVAR_LANGPATT 42
|
||||
#define RPMVAR_INCLUDE 43
|
||||
#define RPMVAR_ARCH 44
|
||||
#define RPMVAR_OS 45
|
||||
#define RPMVAR_BUILDPLATFORM 46
|
||||
#define RPMVAR_BUILDARCH 47
|
||||
#define RPMVAR_BUILDOS 48
|
||||
#define RPMVAR_MACROFILES 49
|
||||
|
||||
#define RPMVAR_NUM 49 /* number of RPMVAR entries */
|
||||
#define RPMVAR_NUM 50 /* number of RPMVAR entries */
|
||||
|
||||
char * rpmGetVar(int var);
|
||||
int rpmGetBooleanVar(int var);
|
||||
|
|
23
lib/rpmrc.c
23
lib/rpmrc.c
|
@ -11,6 +11,10 @@
|
|||
|
||||
#include "misc.h"
|
||||
|
||||
static char *usrlibrpmrc = LIBRPMRC_FILENAME;
|
||||
static char *etcrpmrc = "/etc/rpmrc";
|
||||
static char *macrofiles = MACROFILES;
|
||||
|
||||
struct MacroContext globalMacroContext;
|
||||
|
||||
struct machCacheEntry {
|
||||
|
@ -104,6 +108,7 @@ static struct rpmOption optionTable[] = {
|
|||
{ "include", RPMVAR_INCLUDE, 0, 1, 1, 2 },
|
||||
{ "instchangelog", RPMVAR_INSTCHANGELOG, 0, 0, 0, 0 },
|
||||
{ "langpatt", RPMVAR_LANGPATT, 0, 0, 1, 0 },
|
||||
{ "macrofiles", RPMVAR_MACROFILES, 0, 0, 1, 1 },
|
||||
{ "messagelevel", RPMVAR_MESSAGELEVEL, 0, 0, 1, 0 },
|
||||
{ "netsharedpath", RPMVAR_NETSHAREDPATH, 0, 0, 1, 0 },
|
||||
{ "optflags", RPMVAR_OPTFLAGS, 1, 0, 1, 0 },
|
||||
|
@ -512,7 +517,7 @@ static void setPathDefault(int var, char *macroname, char *subdir) {
|
|||
static void setDefaults(void) {
|
||||
|
||||
/* Read in all macro files (and also set maximum recursion depth) */
|
||||
initMacros(&globalMacroContext, MACROFILES);
|
||||
initMacros(&globalMacroContext, macrofiles);
|
||||
|
||||
rpmSetVar(RPMVAR_OPTFLAGS, "-O2");
|
||||
rpmSetVar(RPMVAR_SIGTYPE, "none");
|
||||
|
@ -533,21 +538,21 @@ int rpmReadRC(char * file) {
|
|||
first = 0;
|
||||
}
|
||||
|
||||
fd = open(LIBRPMRC_FILENAME, O_RDONLY);
|
||||
fd = open(usrlibrpmrc, O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
rc = doReadRC(fd, LIBRPMRC_FILENAME);
|
||||
rc = doReadRC(fd, usrlibrpmrc);
|
||||
close(fd);
|
||||
if (rc) return rc;
|
||||
} else {
|
||||
rpmError(RPMERR_RPMRC, _("Unable to open %s for reading: %s."),
|
||||
LIBRPMRC_FILENAME, strerror(errno));
|
||||
usrlibrpmrc, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (file)
|
||||
fn = file;
|
||||
else
|
||||
fn = "/etc/rpmrc";
|
||||
fn = etcrpmrc;
|
||||
|
||||
fd = open(fn, O_RDONLY);
|
||||
if (fd >= 0) {
|
||||
|
@ -583,6 +588,9 @@ int rpmReadRC(char * file) {
|
|||
setPathDefault(RPMVAR_SOURCEDIR, "_sourcedir", "SOURCES");
|
||||
setPathDefault(RPMVAR_SPECDIR, "_specdir", "SPECS");
|
||||
|
||||
if ((fn = rpmGetVar(RPMVAR_MACROFILES)) != NULL)
|
||||
initMacros(&globalMacroContext, fn);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1305,11 +1313,12 @@ int rpmShowRC(FILE *f)
|
|||
fprintf(f," %s", equivTable->list[i].name);
|
||||
fprintf(f, "\n");
|
||||
|
||||
fprintf(f, "RPMRC VALUES:\n");
|
||||
fprintf(f, "\nRPMRC VALUES:\n");
|
||||
opt = optionTable;
|
||||
while (count < optionTableSize) {
|
||||
s = rpmGetVar(opt->var);
|
||||
fprintf(f, "%-21s : %s\n", opt->name, s ? s : "(not set)");
|
||||
if (s != NULL || rpmGetVerbosity() < RPMMESS_NORMAL)
|
||||
fprintf(f, "%-21s : %s\n", opt->name, s ? s : "(not set)");
|
||||
opt++;
|
||||
count++;
|
||||
}
|
||||
|
|
8
rpm.c
8
rpm.c
|
@ -580,6 +580,8 @@ int main(int argc, char ** argv) {
|
|||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
textdomain(PACKAGE);
|
||||
|
||||
rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
|
||||
|
||||
/* Make a first pass through the arguments, looking for --rcfile */
|
||||
/* as well as --arch and --os. We need to handle that before */
|
||||
/* dealing with the rest of the arguments. */
|
||||
|
@ -592,6 +594,10 @@ int main(int argc, char ** argv) {
|
|||
optArg = poptGetOptArg(optCon);
|
||||
|
||||
switch(arg) {
|
||||
case 'v':
|
||||
rpmIncreaseVerbosity(); /* XXX silly use by showrc */
|
||||
|
||||
break;
|
||||
case GETOPT_BUILDARCH:
|
||||
fprintf(stderr, "--buildarch has been obsoleted. Use the --buildplatform option\n");
|
||||
fprintf(stderr, "with a platform specific rpmrc file with a Buildarch: tag set\n");
|
||||
|
@ -623,6 +629,8 @@ int main(int argc, char ** argv) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
rpmSetVerbosity(RPMMESS_NORMAL); /* XXX silly use by showrc */
|
||||
|
||||
poptResetContext(optCon);
|
||||
|
||||
while ((arg = poptGetNextOpt(optCon)) > 0) {
|
||||
|
|
|
@ -1126,11 +1126,15 @@ void
|
|||
initMacros(MacroContext *mc, const char *macrofile)
|
||||
{
|
||||
char *m, *mfile, *me;
|
||||
static int first = 1;
|
||||
|
||||
mc->macroTable = NULL;
|
||||
expandMacroTable(mc);
|
||||
|
||||
max_macro_depth = 2; /* XXX Assume good ol' macro expansion */
|
||||
/* XXX initialization should be per macro context, not per execution */
|
||||
if (first) {
|
||||
mc->macroTable = NULL;
|
||||
expandMacroTable(mc);
|
||||
max_macro_depth = 2; /* XXX Assume good ol' macro expansion */
|
||||
first = 0;
|
||||
}
|
||||
|
||||
if (macrofile == NULL)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue