More build popts moved to build.c
Fix access of freed memory. CVS patchset: 2571 CVS date: 1998/12/01 23:28:26
This commit is contained in:
parent
d1b089000e
commit
d13e728542
64
build.c
64
build.c
|
@ -5,12 +5,12 @@
|
|||
#include "build.h"
|
||||
|
||||
#ifdef DYING
|
||||
int buildplatform(char *arg, int buildAmount, char *passPhrase,
|
||||
int buildForTarget(char *arg, int buildAmount, char *passPhrase,
|
||||
char *buildRoot, int fromTarball, int test, char *cookie,
|
||||
force);
|
||||
#endif
|
||||
|
||||
int buildplatform(char *arg, int buildAmount, char *passPhrase,
|
||||
static int buildForTarget(char *arg, int buildAmount, char *passPhrase,
|
||||
char *buildRoot, int fromTarball, int test, char *cookie,
|
||||
int force)
|
||||
{
|
||||
|
@ -156,30 +156,28 @@ int buildplatform(char *arg, int buildAmount, char *passPhrase,
|
|||
|
||||
int build(char *arg, int buildAmount, char *passPhrase,
|
||||
char *buildRoot, int fromTarball, int test, char *cookie,
|
||||
char * rcfile, char * arch, char * os,
|
||||
char *buildplatforms, int force)
|
||||
char * rcfile, char *targets, int force)
|
||||
{
|
||||
char *platform, *t;
|
||||
char *target, *t;
|
||||
int rc;
|
||||
|
||||
if (buildplatforms == NULL) {
|
||||
rc = buildplatform(arg, buildAmount, passPhrase, buildRoot,
|
||||
if (targets == NULL) {
|
||||
rc = buildForTarget(arg, buildAmount, passPhrase, buildRoot,
|
||||
fromTarball, test, cookie, force);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* parse up the build operators */
|
||||
|
||||
printf("building these platforms: %s\n", buildplatforms);
|
||||
printf("Building target platforms: %s\n", targets);
|
||||
|
||||
t = buildplatforms;
|
||||
while((platform = strtok(t, ",")) != NULL) {
|
||||
t = targets;
|
||||
while((target = strtok(t, ",")) != NULL) {
|
||||
t = NULL;
|
||||
printf("building %s\n", platform);
|
||||
printf("Building for target %s\n", target);
|
||||
|
||||
rpmSetVar(RPMVAR_BUILDPLATFORM,platform);
|
||||
rpmReadConfigFiles(rcfile, arch, os, 1, platform);
|
||||
rc = buildplatform(arg, buildAmount, passPhrase, buildRoot,
|
||||
rpmReadConfigFiles(rcfile, target);
|
||||
rc = buildForTarget(arg, buildAmount, passPhrase, buildRoot,
|
||||
fromTarball, test, cookie, force);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
@ -193,8 +191,14 @@ int build(char *arg, int buildAmount, char *passPhrase,
|
|||
#define POPT_RMSOURCE 1002
|
||||
#define POPT_RMBUILD 1003
|
||||
#define POPT_BUILDROOT 1004
|
||||
#define POPT_BUILDARCH 1005
|
||||
#define POPT_BUILDOS 1006
|
||||
#define POPT_TARGETPLATFORM 1007
|
||||
#define POPT_NOBUILD 1008
|
||||
#define POPT_SHORTCIRCUIT 1009
|
||||
|
||||
extern int noLang;
|
||||
static int noBuild = 0;
|
||||
static int useCatalog = 0;
|
||||
|
||||
static void buildArgCallback(poptContext con, enum poptCallbackReason reason,
|
||||
|
@ -203,7 +207,9 @@ static void buildArgCallback(poptContext con, enum poptCallbackReason reason,
|
|||
{
|
||||
switch (opt->val) {
|
||||
case POPT_USECATALOG: data->useCatalog = 1; break;
|
||||
case POPT_NOBUILD: data->noBuild = 1; break;
|
||||
case POPT_NOLANG: data->noLang = 1; break;
|
||||
case POPT_SHORTCIRCUIT: data->shortCircuit = 1; break;
|
||||
case POPT_RMSOURCE: data->buildAmount |= RPMBUILD_RMSOURCE; break;
|
||||
case POPT_RMBUILD: data->buildAmount |= RPMBUILD_RMBUILD; break;
|
||||
case POPT_BUILDROOT:
|
||||
|
@ -213,22 +219,50 @@ static void buildArgCallback(poptContext con, enum poptCallbackReason reason,
|
|||
}
|
||||
data->buildRootOverride = strdup(arg);
|
||||
break;
|
||||
case POPT_BUILDARCH:
|
||||
fprintf(stderr, _("--buildarch has been obsoleted. Use the --target option instead.\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
break;
|
||||
case POPT_BUILDOS:
|
||||
fprintf(stderr, _("--buildos has been obsoleted. Use the --target option instead.\n"));
|
||||
exit(EXIT_FAILURE);
|
||||
break;
|
||||
case POPT_TARGETPLATFORM:
|
||||
if (data->targets) {
|
||||
int len = strlen(data->targets) + strlen(arg) + 2;
|
||||
data->targets = realloc(data->targets, len);
|
||||
strcat(data->targets, ",");
|
||||
} else {
|
||||
data->targets = malloc(strlen(arg) + 1);
|
||||
data->targets[0] = '\0';
|
||||
}
|
||||
strcat(data->targets, arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct poptOption rpmBuildPoptTable[] = {
|
||||
{ NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA,
|
||||
buildArgCallback, 0, NULL, NULL },
|
||||
{ "buildarch", '\0', POPT_ARG_STRING, 0, POPT_BUILDARCH,
|
||||
N_("override build architecture"), "ARCH" },
|
||||
{ "buildos", '\0', POPT_ARG_STRING, 0, POPT_BUILDOS,
|
||||
N_("override build operating system"), "OS" },
|
||||
{ "buildroot", '\0', POPT_ARG_STRING, 0, POPT_BUILDROOT,
|
||||
N_("override build root"), "DIRECTORY" },
|
||||
{ "clean", '\0', 0, 0, POPT_RMBUILD,
|
||||
N_("remove build tree when done"), NULL},
|
||||
{ "nobuild", '\0', 0, &noBuild, POPT_NOBUILD,
|
||||
N_("do not execute any stages of the build"), NULL },
|
||||
{ "nolang", '\0', 0, &noLang, POPT_NOLANG,
|
||||
N_("do not accept I18N msgstr's from specfile"), NULL},
|
||||
{ "rmsource", '\0', 0, 0, POPT_RMSOURCE,
|
||||
N_("remove sources and specfile when done"), NULL},
|
||||
{ "short-circuit", '\0', 0, 0, POPT_SHORTCIRCUIT,
|
||||
N_("skip straight to specified stage (only for c,i)"), NULL },
|
||||
{ "target", '\0', POPT_ARG_STRING, 0, POPT_TARGETPLATFORM,
|
||||
N_("override target platform"), "CPU-VENDOR-OS" },
|
||||
{ "usecatalog", '\0', 0, &useCatalog, POPT_USECATALOG,
|
||||
N_("lookup I18N strings in specfile catalog"), NULL},
|
||||
{ 0, 0, 0, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
7
build.h
7
build.h
|
@ -10,14 +10,17 @@ extern struct poptOption rpmBuildPoptTable[];
|
|||
struct rpmBuildArguments {
|
||||
int buildAmount;
|
||||
char *buildRootOverride;
|
||||
char *targets;
|
||||
int useCatalog;
|
||||
int noLang;
|
||||
int noBuild;
|
||||
int shortCircuit;
|
||||
char buildChar;
|
||||
};
|
||||
|
||||
int build(char *arg, int buildAmount, char *passPhrase,
|
||||
char *buildRoot, int fromTarball, int test, char *cookie,
|
||||
char * rcfile, char * arch, char * os,
|
||||
char * buildplatforms, int force);
|
||||
char * rcfile, char * buildplatforms, int force);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ int main(int argc, char ** argv) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
rpmReadConfigFiles(NULL, NULL, NULL, 0, NULL);
|
||||
rpmReadConfigFiles(NULL, NULL);
|
||||
|
||||
printf(_("rpmconvert 1.0 - converting database in /var/lib/rpm\n"));
|
||||
convertDB();
|
||||
|
|
|
@ -88,7 +88,7 @@ sortMacroTable(MacroContext *mc)
|
|||
compareMacroName);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
dumpMacroTable(MacroContext *mc)
|
||||
{
|
||||
int i;
|
||||
|
|
17
lib/rpmlib.h
17
lib/rpmlib.h
|
@ -242,11 +242,11 @@ extern const struct headerSprintfExtension rpmHeaderFormats[];
|
|||
#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_ARCH 44 -- No longer used */
|
||||
/* #define RPMVAR_OS 45 -- No longer used */
|
||||
/* #define RPMVAR_BUILDPLATFORM 46 -- No longer used */
|
||||
/* #define RPMVAR_BUILDARCH 47 -- No longer used */
|
||||
/* #define RPMVAR_BUILDOS 48 -- No longer used */
|
||||
#define RPMVAR_MACROFILES 49
|
||||
|
||||
#define RPMVAR_NUM 50 /* number of RPMVAR entries */
|
||||
|
@ -263,11 +263,8 @@ void rpmSetVar(int var, char *val);
|
|||
#define RPM_MACHTABLE_BUILDOS 3
|
||||
#define RPM_MACHTABLE_COUNT 4 /* number of arch/os tables */
|
||||
|
||||
/* rpmReadConfigFiles() is for backwards compatibility only! It won't
|
||||
work if building is true! */
|
||||
int rpmReadConfigFiles(char * file, char * arch, char * os, int building,
|
||||
char * buildplatform);
|
||||
int rpmReadRC(char * file);
|
||||
int rpmReadConfigFiles(const char * file, const char * target);
|
||||
int rpmReadRC(const char * file);
|
||||
void rpmGetArchInfo(/*@out@*/char ** name, /*@out@*/int * num);
|
||||
void rpmGetOsInfo(/*@out@*/char ** name, /*@out@*/int * num);
|
||||
int rpmMachineScore(int type, char * name);
|
||||
|
|
|
@ -46,6 +46,8 @@ extern "C" {
|
|||
|
||||
int isCompressed(char *file, int *compressed);
|
||||
|
||||
void dumpMacroTable __P((MacroContext *mc));
|
||||
|
||||
void initMacros __P((MacroContext *mc, const char *macrofile));
|
||||
void freeMacros __P((MacroContext *mc));
|
||||
|
||||
|
|
272
lib/rpmrc.c
272
lib/rpmrc.c
|
@ -11,9 +11,9 @@
|
|||
|
||||
#include "misc.h"
|
||||
|
||||
static char *usrlibrpmrc = LIBRPMRC_FILENAME;
|
||||
static char *etcrpmrc = "/etc/rpmrc";
|
||||
static char *macrofiles = MACROFILES;
|
||||
static const char *usrlibrpmrc = LIBRPMRC_FILENAME;
|
||||
static const char *etcrpmrc = "/etc/rpmrc";
|
||||
static const char *macrofiles = MACROFILES;
|
||||
|
||||
struct MacroContext globalMacroContext;
|
||||
|
||||
|
@ -90,11 +90,7 @@ static struct tableType tables[RPM_MACHTABLE_COUNT] = {
|
|||
/* The order of the flags is archSpecific, required, macroize, localize */
|
||||
|
||||
static struct rpmOption optionTable[] = {
|
||||
{ "arch", RPMVAR_ARCH, 0, 1, 1, 2 },
|
||||
{ "builddir", RPMVAR_BUILDDIR, 0, 0, 1, 2 },
|
||||
{ "buildarch", RPMVAR_BUILDARCH, 0, 1, 1, 0 },
|
||||
{ "buildos", RPMVAR_BUILDOS, 0, 1, 1, 0 },
|
||||
{ "buildplatform", RPMVAR_BUILDPLATFORM, 0, 1, 1, 2 },
|
||||
{ "buildroot", RPMVAR_BUILDROOT, 0, 0, 1, 0 },
|
||||
{ "buildshell", RPMVAR_BUILDSHELL, 0, 0, 1, 0 },
|
||||
{ "bzip2bin", RPMVAR_BZIP2BIN, 0, 1, 1, 2 },
|
||||
|
@ -113,7 +109,6 @@ static struct rpmOption optionTable[] = {
|
|||
{ "messagelevel", RPMVAR_MESSAGELEVEL, 0, 0, 1, 0 },
|
||||
{ "netsharedpath", RPMVAR_NETSHAREDPATH, 0, 0, 1, 0 },
|
||||
{ "optflags", RPMVAR_OPTFLAGS, 1, 0, 1, 0 },
|
||||
{ "os", RPMVAR_OS, 0, 1, 1, 2 },
|
||||
{ "packager", RPMVAR_PACKAGER, 0, 0, 1, 0 },
|
||||
{ "pgp_name", RPMVAR_PGP_NAME, 0, 0, 1, 0 },
|
||||
{ "pgp_path", RPMVAR_PGP_PATH, 0, 0, 1, 0 },
|
||||
|
@ -121,8 +116,6 @@ static struct rpmOption optionTable[] = {
|
|||
{ "require_distribution", RPMVAR_REQUIREDISTRIBUTION, 0, 0, 1, 0 },
|
||||
{ "require_icon", RPMVAR_REQUIREICON, 0, 0, 1, 0 },
|
||||
{ "require_vendor", RPMVAR_REQUIREVENDOR, 0, 0, 1, 0 },
|
||||
/* root is obsolete - use buildroot instead */
|
||||
/* { "root", RPMVAR_ROOT, 0, 0, 1, 0 }, */
|
||||
{ "rpmdir", RPMVAR_RPMDIR, 0, 0, 1, 1 },
|
||||
{ "rpmfilename", RPMVAR_RPMFILENAME, 0, 1, 1, 2 },
|
||||
#if defined(RPMVAR_SETENV)
|
||||
|
@ -149,12 +142,12 @@ static struct rpmvarValue values[RPMVAR_NUM];
|
|||
|
||||
/* prototypes */
|
||||
static void defaultMachine(char ** arch, char ** os);
|
||||
static int doReadRC(FD_t fd, char * filename);
|
||||
static int doReadRC(FD_t fd, const char * filename);
|
||||
static int optionCompare(const void * a, const void * b);
|
||||
static int addCanon(struct canonEntry **table, int *tableLen, char *line,
|
||||
char *fn, int lineNum);
|
||||
const char *fn, int lineNum);
|
||||
static int addDefault(struct defaultEntry **table, int *tableLen, char *line,
|
||||
char *fn, int lineNum);
|
||||
const char *fn, int lineNum);
|
||||
static void freeRpmVar(struct rpmvarValue * orig);
|
||||
static void rpmSetVarArch(int var, char * val, char * arch);
|
||||
static struct canonEntry *lookupInCanonTable(char *name,
|
||||
|
@ -168,7 +161,7 @@ static void setPathDefault(int var, char * macroname, char * subdir);
|
|||
static void rebuildCompatTables(int type, char * name);
|
||||
|
||||
/* compatiblity tables */
|
||||
static int machCompatCacheAdd(char * name, char * fn, int linenum,
|
||||
static int machCompatCacheAdd(char * name, const char * fn, int linenum,
|
||||
struct machCache * cache);
|
||||
static struct machCacheEntry * machCacheFindEntry(struct machCache * cache,
|
||||
char * key);
|
||||
|
@ -189,12 +182,12 @@ static int optionCompare(const void * a, const void * b) {
|
|||
((struct rpmOption *) b)->name);
|
||||
}
|
||||
|
||||
static void rpmRebuildPlatformVars(char ** buildplatform, char **canonarch,
|
||||
char **canonos);
|
||||
static void rpmRebuildTargetVars(const char ** canontarget);
|
||||
|
||||
|
||||
static struct machCacheEntry * machCacheFindEntry(struct machCache * cache,
|
||||
char * key) {
|
||||
char * key)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cache->size; i++)
|
||||
|
@ -203,8 +196,9 @@ static struct machCacheEntry * machCacheFindEntry(struct machCache * cache,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int machCompatCacheAdd(char * name, char * fn, int linenum,
|
||||
struct machCache * cache) {
|
||||
static int machCompatCacheAdd(char * name, const char * fn, int linenum,
|
||||
struct machCache * cache)
|
||||
{
|
||||
char * chptr, * equivs;
|
||||
int delEntry = 0;
|
||||
int i;
|
||||
|
@ -252,27 +246,26 @@ static int machCompatCacheAdd(char * name, char * fn, int linenum,
|
|||
|
||||
if (delEntry) return 0;
|
||||
|
||||
chptr = strtok(equivs, " ");
|
||||
while (chptr) {
|
||||
if (strlen(chptr)) { /* does strtok() return "" ever?? */
|
||||
if (entry->count)
|
||||
entry->equivs = realloc(entry->equivs, sizeof(*entry->equivs)
|
||||
while ((chptr = strtok(equivs, " ")) != NULL) {
|
||||
equivs = NULL;
|
||||
if (chptr[0] == '\0') /* does strtok() return "" ever?? */
|
||||
continue;
|
||||
if (entry->count)
|
||||
entry->equivs = realloc(entry->equivs, sizeof(*entry->equivs)
|
||||
* (entry->count + 1));
|
||||
else
|
||||
entry->equivs = malloc(sizeof(*entry->equivs));
|
||||
else
|
||||
entry->equivs = malloc(sizeof(*entry->equivs));
|
||||
|
||||
entry->equivs[entry->count] = strdup(chptr);
|
||||
entry->count++;
|
||||
}
|
||||
|
||||
chptr = strtok(NULL, " ");
|
||||
entry->equivs[entry->count] = strdup(chptr);
|
||||
entry->count++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct machEquivInfo * machEquivSearch(
|
||||
struct machEquivTable * table, char * name) {
|
||||
struct machEquivTable * table, char * name)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
|
@ -291,7 +284,8 @@ static struct machEquivInfo * machEquivSearch(
|
|||
}
|
||||
|
||||
static void machAddEquiv(struct machEquivTable * table, char * name,
|
||||
int distance) {
|
||||
int distance)
|
||||
{
|
||||
struct machEquivInfo * equiv;
|
||||
|
||||
equiv = machEquivSearch(table, name);
|
||||
|
@ -310,7 +304,8 @@ static void machAddEquiv(struct machEquivTable * table, char * name,
|
|||
static void machCacheEntryVisit(struct machCache * cache,
|
||||
struct machEquivTable * table,
|
||||
char * name,
|
||||
int distance) {
|
||||
int distance)
|
||||
{
|
||||
struct machCacheEntry * entry;
|
||||
int i;
|
||||
|
||||
|
@ -330,7 +325,8 @@ static void machCacheEntryVisit(struct machCache * cache,
|
|||
|
||||
static void machFindEquivs(struct machCache * cache,
|
||||
struct machEquivTable * table,
|
||||
char * key) {
|
||||
char * key)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cache->size; i++)
|
||||
|
@ -346,7 +342,8 @@ static void machFindEquivs(struct machCache * cache,
|
|||
}
|
||||
|
||||
static int addCanon(struct canonEntry **table, int *tableLen, char *line,
|
||||
char *fn, int lineNum) {
|
||||
const char *fn, int lineNum)
|
||||
{
|
||||
struct canonEntry *t;
|
||||
char *s, *s1;
|
||||
|
||||
|
@ -392,7 +389,8 @@ static int addCanon(struct canonEntry **table, int *tableLen, char *line,
|
|||
}
|
||||
|
||||
static int addDefault(struct defaultEntry **table, int *tableLen, char *line,
|
||||
char *fn, int lineNum) {
|
||||
const char *fn, int lineNum)
|
||||
{
|
||||
struct defaultEntry *t;
|
||||
|
||||
if (! *tableLen) {
|
||||
|
@ -448,42 +446,24 @@ static char *lookupInDefaultTable(char *name, struct defaultEntry *table,
|
|||
return name;
|
||||
}
|
||||
|
||||
int rpmReadConfigFiles(char * file, char * arch, char * os, int building,
|
||||
char * buildplatform)
|
||||
int rpmReadConfigFiles(const char * file, const char * target)
|
||||
{
|
||||
|
||||
char * canonarch, * canonos;
|
||||
rpmSetMachine(NULL, NULL);
|
||||
|
||||
rpmSetMachine(arch, os);
|
||||
if (!buildplatform)
|
||||
rpmRebuildPlatformVars(&buildplatform, &canonarch, &canonos);
|
||||
else
|
||||
addMacro(&globalMacroContext, "_buildplatform_preset", NULL,
|
||||
buildplatform, RMIL_RPMRC);
|
||||
|
||||
/*
|
||||
addMacro(&globalMacroContext, "buildplatform", NULL, buildplatform,
|
||||
RMIL_RPMRC);
|
||||
*/
|
||||
if (target == NULL) {
|
||||
rpmRebuildTargetVars(&target);
|
||||
} else {
|
||||
addMacro(&globalMacroContext, "_target", NULL, target, RMIL_RPMRC);
|
||||
}
|
||||
|
||||
if (rpmReadRC(file)) return -1;
|
||||
|
||||
rpmRebuildPlatformVars(&buildplatform, &canonarch, &canonos);
|
||||
rpmRebuildTargetVars(&target);
|
||||
|
||||
/* This is where we finally set the arch and os absolutely */
|
||||
|
||||
/* rpmSetMachine(canonarch, canonos); */
|
||||
|
||||
|
||||
{ char *buildarch;
|
||||
char *buildos;
|
||||
|
||||
/* XXX getMacroBody() may be nuked -- (see below) */
|
||||
/* XXX the macro names buildarch/buildos don't exist */
|
||||
buildarch = (char *) getMacroBody(&globalMacroContext, "buildarch");
|
||||
buildos = (char *) getMacroBody(&globalMacroContext, "buildos");
|
||||
|
||||
rpmSetMachine(buildarch, buildos);
|
||||
{ const char *cpu = getMacroBody(&globalMacroContext, "_target_cpu");
|
||||
const char *os = getMacroBody(&globalMacroContext, "_target_os");
|
||||
rpmSetMachine(cpu, os);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -528,9 +508,9 @@ static void setDefaults(void) {
|
|||
rpmSetVar(RPMVAR_BUILDSHELL, "/bin/sh");
|
||||
}
|
||||
|
||||
int rpmReadRC(char * file) {
|
||||
int rpmReadRC(const char * file) {
|
||||
FD_t fd;
|
||||
char * fn;
|
||||
const char * fn;
|
||||
char * home;
|
||||
int rc = 0;
|
||||
static int first = 1;
|
||||
|
@ -551,26 +531,22 @@ int rpmReadRC(char * file) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (file)
|
||||
fn = file;
|
||||
else
|
||||
fn = etcrpmrc;
|
||||
|
||||
fn = (file != NULL ? file : etcrpmrc);
|
||||
fd = fdOpen(fn, O_RDONLY, 0);
|
||||
if (fdFileno(fd) >= 0) {
|
||||
rc = doReadRC(fd, fn);
|
||||
fdClose(fd);
|
||||
if (rc) return rc;
|
||||
} else if (file) {
|
||||
} else if (file != NULL) {
|
||||
rpmError(RPMERR_RPMRC, _("Unable to open %s for reading: %s."), file,
|
||||
strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!file) {
|
||||
if (file == NULL) {
|
||||
home = getenv("HOME");
|
||||
if (home) {
|
||||
fn = alloca(strlen(home) + 8);
|
||||
if (home != NULL) {
|
||||
char *fn = alloca(strlen(home) + 8);
|
||||
strcpy(fn, home);
|
||||
strcat(fn, "/.rpmrc");
|
||||
fd = fdOpen(fn, O_RDONLY, 0);
|
||||
|
@ -596,7 +572,7 @@ int rpmReadRC(char * file) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int doReadRC(FD_t fd, char * filename) {
|
||||
static int doReadRC(FD_t fd, const char * filename) {
|
||||
char buf[BUFSIZ];
|
||||
char * start, * chptr, * next, * rest;
|
||||
int linenum = 0;
|
||||
|
@ -713,7 +689,7 @@ static int doReadRC(FD_t fd, char * filename) {
|
|||
case RPMVAR_INCLUDE:
|
||||
{ FD_t fdinc;
|
||||
|
||||
rpmRebuildPlatformVars(NULL,NULL,NULL);
|
||||
rpmRebuildTargetVars(NULL);
|
||||
|
||||
strcpy(buf, start);
|
||||
if (expandMacros(NULL, &globalMacroContext, buf, sizeof(buf))) {
|
||||
|
@ -891,11 +867,10 @@ static void defaultMachine(char ** arch, char ** os) {
|
|||
/* wrong, just for now, find out how to look for i586 later*/
|
||||
strcpy(un.machine,"i486");
|
||||
}
|
||||
#endif
|
||||
#endif /* __linux__ */
|
||||
|
||||
/* get rid of the hyphens in the sysname */
|
||||
chptr = un.machine;
|
||||
while (*chptr++)
|
||||
for (chptr = un.machine; *chptr; chptr++)
|
||||
if (*chptr == '/') *chptr = '-';
|
||||
|
||||
# if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL)
|
||||
|
@ -946,7 +921,7 @@ static void defaultMachine(char ** arch, char ** os) {
|
|||
strcpy(un.machine, "hppa2.0");
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
# endif /* hpux */
|
||||
|
||||
/* the uname() result goes through the arch_canon table */
|
||||
canon = lookupInCanonTable(un.machine,
|
||||
|
@ -960,6 +935,7 @@ static void defaultMachine(char ** arch, char ** os) {
|
|||
tables[RPM_MACHTABLE_INSTOS].canonsLength);
|
||||
if (canon)
|
||||
strcpy(un.sysname, canon->short_name);
|
||||
gotDefaults = 1;
|
||||
}
|
||||
|
||||
if (arch) *arch = un.machine;
|
||||
|
@ -1105,30 +1081,30 @@ void rpmGetMachine(char **arch, char **os)
|
|||
}
|
||||
|
||||
void rpmSetMachine(char * arch, char * os) {
|
||||
int transOs = os == NULL;
|
||||
int transArch = arch == NULL;
|
||||
char * realArch, * realOs;
|
||||
char * host_cpu, * host_os;
|
||||
|
||||
defaultMachine(&realArch, &realOs);
|
||||
defaultMachine(&host_cpu, &host_os);
|
||||
|
||||
if (!arch)
|
||||
arch = realArch;
|
||||
if (!os)
|
||||
os = realOs;
|
||||
|
||||
if (transArch && tables[currTables[ARCH]].hasTranslate)
|
||||
arch = lookupInDefaultTable(arch,
|
||||
if (arch == NULL) {
|
||||
arch = host_cpu;
|
||||
if (tables[currTables[ARCH]].hasTranslate)
|
||||
arch = lookupInDefaultTable(arch,
|
||||
tables[currTables[ARCH]].defaults,
|
||||
tables[currTables[ARCH]].defaultsLength);
|
||||
if (transOs && tables[currTables[OS]].hasTranslate)
|
||||
os = lookupInDefaultTable(os,
|
||||
}
|
||||
|
||||
if (os == NULL) {
|
||||
os = host_os;
|
||||
if (tables[currTables[OS]].hasTranslate)
|
||||
os = lookupInDefaultTable(os,
|
||||
tables[currTables[OS]].defaults,
|
||||
tables[currTables[OS]].defaultsLength);
|
||||
}
|
||||
|
||||
if (!current[ARCH] || strcmp(arch, current[ARCH])) {
|
||||
if (current[ARCH]) free(current[ARCH]);
|
||||
current[ARCH] = strdup(arch);
|
||||
rebuildCompatTables(ARCH, realArch);
|
||||
rebuildCompatTables(ARCH, host_cpu);
|
||||
}
|
||||
|
||||
if (!current[OS] || strcmp(os, current[OS])) {
|
||||
|
@ -1144,7 +1120,7 @@ void rpmSetMachine(char * arch, char * os) {
|
|||
*/
|
||||
if (!strcmp(current[OS], "linux"))
|
||||
*current[OS]= 'L';
|
||||
rebuildCompatTables(OS, realOs);
|
||||
rebuildCompatTables(OS, host_os);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1187,17 +1163,12 @@ void rpmGetOsInfo(char ** name, int * num) {
|
|||
getMachineInfo(OS, name, num);
|
||||
}
|
||||
|
||||
void rpmRebuildPlatformVars(char ** buildplatform, char **canonarch,
|
||||
char **canonos) {
|
||||
void rpmRebuildTargetVars(const char ** canontarget)
|
||||
{
|
||||
|
||||
/* If buildplatform == NULL, don't return anything */
|
||||
|
||||
|
||||
char * b = NULL, * ca = NULL, * co = NULL;
|
||||
char * presetbuildplatform = NULL;
|
||||
char * ct = NULL, * ca = NULL, * co = NULL;
|
||||
const char * target = NULL;
|
||||
int x;
|
||||
/*
|
||||
*/
|
||||
|
||||
/*
|
||||
* XXX getMacroBody() may be nuked -- I originally added it for tdyas and it's
|
||||
|
@ -1206,34 +1177,38 @@ void rpmRebuildPlatformVars(char ** buildplatform, char **canonarch,
|
|||
*
|
||||
* You can, however, always do
|
||||
* char buf[BUFSIZ];
|
||||
* strcpy(buf, "%_buildplatform_preset")
|
||||
* expandMacros(NULL, &globalMacroContext, buf, sizeof(buf))) {
|
||||
* presetbuildplatform = strdup(buf);
|
||||
* strcpy(buf, "%_target")
|
||||
* expandMacros(NULL, &globalMacroContext, buf, sizeof(buf)))
|
||||
* target = strdup(buf);
|
||||
*
|
||||
*/
|
||||
presetbuildplatform= (char *) getMacroBody(&globalMacroContext,
|
||||
"_buildplatform_preset");
|
||||
if ((target = getMacroBody(&globalMacroContext, "_target")) != NULL)
|
||||
target = strdup(target);
|
||||
|
||||
/* Rebuild the compat table to recalculate the
|
||||
current buildarch. */
|
||||
current target arch. */
|
||||
|
||||
rpmSetMachine(NULL, NULL);
|
||||
rpmSetTables(RPM_MACHTABLE_INSTARCH, RPM_MACHTABLE_INSTOS);
|
||||
rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
|
||||
rpmSetMachine(NULL, NULL);
|
||||
rpmSetTables(RPM_MACHTABLE_INSTARCH, RPM_MACHTABLE_INSTOS);
|
||||
rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
|
||||
|
||||
rpmGetArchInfo(&ca,NULL);
|
||||
rpmGetOsInfo(&co,NULL);
|
||||
rpmGetArchInfo(&ca,NULL);
|
||||
rpmGetOsInfo(&co,NULL);
|
||||
|
||||
if (!ca) defaultMachine(&ca,NULL);
|
||||
if (!co) defaultMachine(NULL,&co);
|
||||
if (ca == NULL) defaultMachine(&ca, NULL);
|
||||
if (co == NULL) defaultMachine(NULL, &co);
|
||||
|
||||
for (x = 0; ca[x]; x++)
|
||||
ca[x] = tolower(ca[x]);
|
||||
for (x = 0; co[x]; x++)
|
||||
co[x] = tolower(co[x]);
|
||||
for (x = 0; ca[x]; x++)
|
||||
ca[x] = tolower(ca[x]);
|
||||
for (x = 0; co[x]; x++)
|
||||
co[x] = tolower(co[x]);
|
||||
|
||||
b = malloc(strlen(co)+strlen(ca)+2);
|
||||
sprintf(b,"%s-%s",ca,co);
|
||||
if (target) {
|
||||
ct = target;
|
||||
} else {
|
||||
ct = malloc(strlen(co)+strlen(ca)+2);
|
||||
sprintf(ct, "%s-%s", ca, co);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX All this macro pokery/jiggery could be achieved (I think)
|
||||
|
@ -1241,41 +1216,23 @@ void rpmRebuildPlatformVars(char ** buildplatform, char **canonarch,
|
|||
* initMacros(&globalMacroContext, PER-PLATFORM-MACRO-FILE-NAMES);
|
||||
* (I haven't looked at the code :-)
|
||||
*
|
||||
* In fact, if you want to get really sophisticatedf, you could encapsulate
|
||||
* In fact, if you want to get really sophisticated, you could encapsulate
|
||||
* within per-platform MacroContexts (but I'm not quite ready for that yet).
|
||||
*/
|
||||
delMacro(&globalMacroContext, "buildplatform");
|
||||
|
||||
if (!presetbuildplatform) {
|
||||
addMacro(&globalMacroContext, "buildplatform", NULL, b,
|
||||
RMIL_RPMRC);
|
||||
} else {
|
||||
addMacro(&globalMacroContext, "buildplatform", NULL,
|
||||
presetbuildplatform, RMIL_RPMRC);
|
||||
}
|
||||
delMacro(&globalMacroContext, "arch");
|
||||
addMacro(&globalMacroContext, "arch", NULL, ca,
|
||||
RMIL_RPMRC);
|
||||
delMacro(&globalMacroContext, "os");
|
||||
addMacro(&globalMacroContext, "os", NULL, co,
|
||||
RMIL_RPMRC);
|
||||
|
||||
if (buildplatform) {
|
||||
if (presetbuildplatform)
|
||||
*buildplatform = presetbuildplatform;
|
||||
else
|
||||
*buildplatform = b;
|
||||
}
|
||||
if (canonarch) *canonarch = ca;
|
||||
if (canonos) *canonos = co;
|
||||
delMacro(&globalMacroContext, "_target");
|
||||
addMacro(&globalMacroContext, "_target", NULL, ct, 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);
|
||||
|
||||
if (canontarget)
|
||||
*canontarget = ct;
|
||||
}
|
||||
|
||||
int rpmShowRC(FILE *f)
|
||||
{
|
||||
struct rpmOption *opt;
|
||||
int count = 0;
|
||||
char *s;
|
||||
int i;
|
||||
struct machEquivTable * equivTable;
|
||||
|
||||
|
@ -1316,14 +1273,13 @@ int rpmShowRC(FILE *f)
|
|||
fprintf(f, "\n");
|
||||
|
||||
fprintf(f, "\nRPMRC VALUES:\n");
|
||||
opt = optionTable;
|
||||
while (count < optionTableSize) {
|
||||
s = rpmGetVar(opt->var);
|
||||
for (i = 0, opt = optionTable; i < optionTableSize; i++, opt++) {
|
||||
char *s = rpmGetVar(opt->var);
|
||||
if (s != NULL || rpmGetVerbosity() < RPMMESS_NORMAL)
|
||||
fprintf(f, "%-21s : %s\n", opt->name, s ? s : "(not set)");
|
||||
opt++;
|
||||
count++;
|
||||
}
|
||||
|
||||
dumpMacroTable(&globalMacroContext);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
11
macros.in
11
macros.in
|
@ -61,8 +61,8 @@
|
|||
RPM_SOURCE_DIR=\"%{_sourcedir}\"\
|
||||
RPM_BUILD_DIR=\"%{_builddir}\"\
|
||||
RPM_OPT_FLAGS=\"%{optflags}\"\
|
||||
RPM_ARCH=\"%{arch}\"\
|
||||
RPM_OS=\"%{os}\"\
|
||||
RPM_ARCH=\"%{_target_cpu}\"\
|
||||
RPM_OS=\"%{_target_os}\"\
|
||||
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
|
||||
RPM_DOC_DIR=\"%{_docdir}\"\
|
||||
export RPM_DOC_DIR\
|
||||
|
@ -78,6 +78,7 @@
|
|||
# ---- configure macros.
|
||||
# Macro(s) similar to those used by configure.
|
||||
#
|
||||
%_prefix @prefix@
|
||||
%_build @build@
|
||||
%_build_alias @build_alias@
|
||||
%_build_cpu @build_cpu@
|
||||
|
@ -88,4 +89,8 @@
|
|||
%_host_cpu @host_cpu@
|
||||
%_host_vendor @host_vendor@
|
||||
%_host_os @host_os@
|
||||
%_prefix @prefix@
|
||||
%_target @target@
|
||||
%_target_alias @target_alias@
|
||||
%_target_cpu @target_cpu@
|
||||
%_target_vendor @target_vendor@
|
||||
%_target_os @target_os@
|
||||
|
|
571
po/rpm.pot
571
po/rpm.pot
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 1998-11-30 18:28-0500\n"
|
||||
"POT-Creation-Date: 1998-12-01 16:02-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"
|
||||
|
|
4
rpm-qo.c
4
rpm-qo.c
|
@ -131,9 +131,7 @@ int main(int argc, char ** argv) {
|
|||
char * specFile;
|
||||
char *passPhrase = "";
|
||||
char *buildRootOverride = NULL;
|
||||
char *arch = NULL;
|
||||
char * ftpProxy = NULL, * ftpPort = NULL;
|
||||
char *os = NULL;
|
||||
char * smallArgv[2] = { NULL, NULL };
|
||||
char ** currarg;
|
||||
int ec = 0;
|
||||
|
@ -175,7 +173,7 @@ int main(int argc, char ** argv) {
|
|||
textdomain(NLSPACKAGE);
|
||||
|
||||
/* reading this early makes it easy to override */
|
||||
if (rpmReadConfigFiles(rcfile, arch, os, building))
|
||||
if (rpmReadConfigFiles(rcfile, NULL))
|
||||
exit(EXIT_FAILURE);
|
||||
if (showrc) {
|
||||
rpmShowRC(stdout);
|
||||
|
|
154
rpm.c
154
rpm.c
|
@ -13,17 +13,12 @@
|
|||
#define GETOPT_RECOMPILE 1004
|
||||
#define GETOPT_ADDSIGN 1005
|
||||
#define GETOPT_RESIGN 1006
|
||||
#define GETOPT_BUILDROOT 1007
|
||||
#define GETOPT_DBPATH 1010
|
||||
#define GETOPT_TIMECHECK 1012
|
||||
#define GETOPT_REBUILDDB 1013
|
||||
#define GETOPT_INSTALL 1014
|
||||
#define GETOPT_RMSOURCE 1015
|
||||
#define GETOPT_RELOCATE 1016
|
||||
#define GETOPT_SHOWRC 1018
|
||||
#define GETOPT_BUILDPLATFORM 1019
|
||||
#define GETOPT_BUILDARCH 1020
|
||||
#define GETOPT_BUILDOS 1021
|
||||
|
||||
char * version = VERSION;
|
||||
|
||||
|
@ -35,11 +30,7 @@ enum modes { MODE_QUERY, MODE_INSTALL, MODE_UNINSTALL, MODE_VERIFY,
|
|||
/* the flags for the various options */
|
||||
static int allFiles;
|
||||
static int allMatches;
|
||||
static char * arch;
|
||||
static int badReloc;
|
||||
#if XXX
|
||||
static int clean;
|
||||
#endif
|
||||
static int excldocs;
|
||||
static int force;
|
||||
static char * ftpPort;
|
||||
|
@ -58,7 +49,6 @@ static int noOrder;
|
|||
static int noPgp;
|
||||
static int noScripts;
|
||||
static int noTriggers;
|
||||
static char * os;
|
||||
static int oldPackage;
|
||||
static int showPercents;
|
||||
static char * pipeOutput;
|
||||
|
@ -69,7 +59,6 @@ static char * rcfile;
|
|||
static int replaceFiles;
|
||||
static int replacePackages;
|
||||
static char * rootdir;
|
||||
static int shortCircuit;
|
||||
static int showrc;
|
||||
static int signIt;
|
||||
static int test;
|
||||
|
@ -88,14 +77,7 @@ static struct poptOption optionsTable[] = {
|
|||
{ "allmatches", '\0', 0, &allMatches, 0, NULL, NULL},
|
||||
{ "badreloc", '\0', 0, &badReloc, 0, NULL, NULL},
|
||||
{ "build", 'b', POPT_ARG_STRING, 0, 'b', NULL, NULL},
|
||||
{ "buildarch", '\0', POPT_ARG_STRING, &arch, GETOPT_BUILDARCH, NULL, NULL},
|
||||
{ "buildos", '\0', POPT_ARG_STRING, &os, GETOPT_BUILDOS, NULL, NULL},
|
||||
{ "buildplatform", '\0', POPT_ARG_STRING, 0, GETOPT_BUILDPLATFORM, NULL, NULL},
|
||||
{ "buildroot", '\0', POPT_ARG_STRING, 0, GETOPT_BUILDROOT, NULL, NULL},
|
||||
{ "checksig", 'K', 0, 0, 'K', NULL, NULL},
|
||||
#if XXX
|
||||
{ "clean", '\0', 0, &clean, 0, NULL, NULL},
|
||||
#endif
|
||||
{ "dbpath", '\0', POPT_ARG_STRING, 0, GETOPT_DBPATH, NULL, NULL},
|
||||
{ "erase", 'e', 0, 0, 'e', NULL, NULL},
|
||||
{ "excludedocs", '\0', 0, &excldocs, 0, NULL, NULL},
|
||||
|
@ -134,11 +116,7 @@ static struct poptOption optionsTable[] = {
|
|||
{ "replacefiles", '\0', 0, &replaceFiles, 0, NULL, NULL},
|
||||
{ "replacepkgs", '\0', 0, &replacePackages, 0, NULL, NULL},
|
||||
{ "resign", '\0', 0, 0, GETOPT_RESIGN, NULL, NULL},
|
||||
#if XXX
|
||||
{ "rmsource", '\0', 0, 0, GETOPT_RMSOURCE, NULL, NULL},
|
||||
#endif
|
||||
{ "root", 'r', POPT_ARG_STRING, &rootdir, 0, NULL, NULL},
|
||||
{ "short-circuit", '\0', 0, &shortCircuit, 0, NULL, NULL},
|
||||
{ "showrc", '\0', 0, &showrc, GETOPT_SHOWRC, NULL, NULL},
|
||||
{ "sign", '\0', 0, &signIt, 0, NULL, NULL},
|
||||
{ "tarball", 't', POPT_ARG_STRING, 0, 't', NULL, NULL},
|
||||
|
@ -222,8 +200,8 @@ static void printUsage(void) {
|
|||
puts(_(" [--dbpath <dir>] [--nodeps] [--allmatches]"));
|
||||
puts(_(" [--justdb] [--notriggers] rpackage1 ... packageN"));
|
||||
puts(_(" rpm {-b|t}[plciba] [-v] [--short-circuit] [--clean] [--rcfile <file>]"));
|
||||
puts(_(" [--sign] [--test] [--timecheck <s>] ]"));
|
||||
puts(_(" [--buildplatform=platform1[,platform2...]]"));
|
||||
puts(_(" [--sign] [--nobuild] [--timecheck <s>] ]"));
|
||||
puts(_(" [--target=platform1[,platform2...]]"));
|
||||
puts(_(" [--rmsource] specfile"));
|
||||
puts(_(" rpm {--rmsource} [--rcfile <file>] [-v] specfile"));
|
||||
puts(_(" rpm {--rebuild} [--rcfile <file>] [-v] source1.rpm ... sourceN.rpm"));
|
||||
|
@ -455,9 +433,9 @@ static void printHelp(void) {
|
|||
_("generate PGP signature"));
|
||||
printHelpLine(_(" --buildroot <dir> "),
|
||||
_("use <dir> as the build root"));
|
||||
printHelpLine(_(" --platform=<platform>+"),
|
||||
_("build the packages for the platform1...platformN build targets."));
|
||||
printHelpLine( " --test ",
|
||||
printHelpLine(_(" --target=<platform>+"),
|
||||
_("build the packages for the build targets platform1...platformN."));
|
||||
printHelpLine( " --nobuild ",
|
||||
_("do not execute any stages"));
|
||||
printHelpLine(_(" --timecheck <secs> "),
|
||||
_("set the time check to <secs> seconds (0 disables)"));
|
||||
|
@ -497,15 +475,10 @@ int main(int argc, char ** argv) {
|
|||
enum verifysources verifySource = VERIFY_PACKAGE;
|
||||
int arg;
|
||||
int installFlags = 0, uninstallFlags = 0, interfaceFlags = 0;
|
||||
int buildAmount = 0;
|
||||
int gotDbpath = 0, building = 0, verifyFlags;
|
||||
#if XXX
|
||||
int rmsource = 0;
|
||||
#endif
|
||||
int gotDbpath = 0, verifyFlags;
|
||||
int checksigFlags = 0;
|
||||
unsigned long int timeCheck = 0L;
|
||||
int addSign = NEW_SIGNATURE;
|
||||
char buildChar = ' ';
|
||||
char * specFile;
|
||||
char * tce;
|
||||
char * passPhrase = "";
|
||||
|
@ -522,16 +495,11 @@ int main(int argc, char ** argv) {
|
|||
int p[2];
|
||||
struct rpmRelocation * relocations = NULL;
|
||||
int numRelocations = 0;
|
||||
char * buildplatforms = NULL;
|
||||
|
||||
/* set the defaults for the various command line options */
|
||||
allFiles = 0;
|
||||
allMatches = 0;
|
||||
arch = NULL;
|
||||
badReloc = 0;
|
||||
#if XXX
|
||||
clean = 0;
|
||||
#endif
|
||||
excldocs = 0;
|
||||
force = 0;
|
||||
ftpProxy = NULL;
|
||||
|
@ -551,7 +519,6 @@ int main(int argc, char ** argv) {
|
|||
noScripts = 0;
|
||||
noTriggers = 0;
|
||||
oldPackage = 0;
|
||||
os = NULL;
|
||||
showPercents = 0;
|
||||
pipeOutput = NULL;
|
||||
prefix = NULL;
|
||||
|
@ -560,7 +527,6 @@ int main(int argc, char ** argv) {
|
|||
replaceFiles = 0;
|
||||
replacePackages = 0;
|
||||
rootdir = "/";
|
||||
shortCircuit = 0;
|
||||
showrc = 0;
|
||||
signIt = 0;
|
||||
test = 0;
|
||||
|
@ -578,49 +544,28 @@ int main(int argc, char ** argv) {
|
|||
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. */
|
||||
/* We need to handle that before dealing with the rest of the arguments. */
|
||||
optCon = poptGetContext("rpm", argc, argv, optionsTable, 0);
|
||||
poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
|
||||
poptReadDefaultConfig(optCon, 1);
|
||||
poptSetExecPath(optCon, RPMCONFIGDIR, 1);
|
||||
|
||||
while ((arg = poptGetNextOpt(optCon)) > 0) {
|
||||
optArg = poptGetOptArg(optCon);
|
||||
/* reading rcfile early makes it easy to override */
|
||||
/* XXX only --rcfile (and --showrc) need this pre-parse */
|
||||
|
||||
while ((arg = poptGetNextOpt(optCon)) > 0) {
|
||||
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");
|
||||
exit(EXIT_FAILURE);
|
||||
break;
|
||||
case GETOPT_BUILDOS:
|
||||
fprintf(stderr, "--buildos has been obsoleted. Use the --buildplatform option\n");
|
||||
fprintf(stderr, "with a platform specific rpmrc file with a Buildos: tag set\n");
|
||||
exit(EXIT_FAILURE);
|
||||
break;
|
||||
case 'b':
|
||||
case 't':
|
||||
case GETOPT_REBUILD:
|
||||
case GETOPT_RECOMPILE:
|
||||
case GETOPT_SHOWRC: /* showrc set as side effect */
|
||||
#if XXX
|
||||
case GETOPT_RMSOURCE:
|
||||
#endif
|
||||
building = 1;
|
||||
/* fall thru */
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* reading this early makes it easy to override */
|
||||
if (rpmReadConfigFiles(rcfile, arch, os, building, NULL))
|
||||
if (rpmReadConfigFiles(rcfile, NULL))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
if (showrc) {
|
||||
rpmShowRC(stdout);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -633,7 +578,9 @@ int main(int argc, char ** argv) {
|
|||
if (queryArgs.queryFormat) free(queryArgs.queryFormat);
|
||||
memset(&queryArgs, 0, sizeof(queryArgs));
|
||||
if (buildArgs.buildRootOverride) free(buildArgs.buildRootOverride);
|
||||
if (buildArgs.targets) free(buildArgs.targets);
|
||||
memset(&buildArgs, 0, sizeof(buildArgs));
|
||||
buildArgs.buildChar = ' ';
|
||||
|
||||
while ((arg = poptGetNextOpt(optCon)) > 0) {
|
||||
optArg = poptGetOptArg(optCon);
|
||||
|
@ -691,8 +638,8 @@ int main(int argc, char ** argv) {
|
|||
if (strlen(optArg) > 1)
|
||||
argerror(errString);
|
||||
|
||||
buildChar = optArg[0];
|
||||
switch (buildChar) {
|
||||
buildArgs.buildChar = optArg[0];
|
||||
switch (buildArgs.buildChar) {
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'i':
|
||||
|
@ -875,12 +822,8 @@ int main(int argc, char ** argv) {
|
|||
relocations[numRelocations++].newPath = errString;
|
||||
break;
|
||||
|
||||
case GETOPT_BUILDPLATFORM:
|
||||
buildplatforms = optArg;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, _("Internal error in argument processing :-(\n"));
|
||||
fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
@ -1053,16 +996,16 @@ int main(int argc, char ** argv) {
|
|||
|
||||
if (bigMode != MODE_BUILD && bigMode != MODE_TARBUILD && rmsource)
|
||||
argerror(_("--rmsource may only be used with -b and -t"));
|
||||
#endif
|
||||
|
||||
if (bigMode != MODE_BUILD && bigMode != MODE_TARBUILD && shortCircuit)
|
||||
if (bigMode != MODE_BUILD && bigMode != MODE_TARBUILD && buildArgs.shortCircuit)
|
||||
argerror(_("--short-circuit may only be used during package building"));
|
||||
|
||||
if (shortCircuit && (buildChar != 'c') && (buildChar != 'i')
|
||||
&& (buildChar != 's')) {
|
||||
if (buildArgs.shortCircuit && (buildArgs.buildChar != 'c') && (buildArgs.buildChar != 'i')
|
||||
&& (buildArgs.buildChar != 's')) {
|
||||
argerror(_("--short-circuit may only be used with -bc, -bi, -bs, -tc "
|
||||
"-ti, or -ts"));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (oldPackage && !(installFlags & RPMINSTALL_UPGRADE))
|
||||
argerror(_("--oldpackage may only be used during upgrades"));
|
||||
|
@ -1171,20 +1114,20 @@ int main(int argc, char ** argv) {
|
|||
if (!poptPeekArg(optCon))
|
||||
argerror(_("no packages files given for rebuild"));
|
||||
|
||||
buildAmount = RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL;
|
||||
buildArgs.buildAmount = RPMBUILD_PREP | RPMBUILD_BUILD | RPMBUILD_INSTALL;
|
||||
if (bigMode == MODE_REBUILD) {
|
||||
buildAmount |= RPMBUILD_PACKAGEBINARY;
|
||||
buildAmount |= RPMBUILD_RMSOURCE;
|
||||
buildAmount |= RPMBUILD_CLEAN;
|
||||
buildAmount |= RPMBUILD_RMBUILD;
|
||||
buildArgs.buildAmount |= RPMBUILD_PACKAGEBINARY;
|
||||
buildArgs.buildAmount |= RPMBUILD_RMSOURCE;
|
||||
buildArgs.buildAmount |= RPMBUILD_CLEAN;
|
||||
buildArgs.buildAmount |= RPMBUILD_RMBUILD;
|
||||
}
|
||||
|
||||
while ((pkg = poptGetArg(optCon))) {
|
||||
if (doSourceInstall("/", pkg, &specFile, &cookie))
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
if (build(specFile, buildAmount, passPhrase, buildArgs.buildRootOverride,
|
||||
0, test, cookie, rcfile, arch, os, buildplatforms, force)) {
|
||||
if (build(specFile, buildArgs.buildAmount, passPhrase, buildArgs.buildRootOverride,
|
||||
0, buildArgs.noBuild, cookie, rcfile, buildArgs.targets, force)) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
free(cookie);
|
||||
|
@ -1197,46 +1140,33 @@ int main(int argc, char ** argv) {
|
|||
if (rpmGetVerbosity() == RPMMESS_NORMAL)
|
||||
rpmSetVerbosity(RPMMESS_VERBOSE);
|
||||
|
||||
switch (buildChar) {
|
||||
switch (buildArgs.buildChar) {
|
||||
/* these fallthroughs are intentional */
|
||||
case 'a':
|
||||
buildAmount |= RPMBUILD_PACKAGESOURCE;
|
||||
buildArgs.buildAmount |= RPMBUILD_PACKAGESOURCE;
|
||||
case 'b':
|
||||
buildAmount |= RPMBUILD_PACKAGEBINARY;
|
||||
buildAmount |= RPMBUILD_CLEAN;
|
||||
buildArgs.buildAmount |= RPMBUILD_PACKAGEBINARY;
|
||||
buildArgs.buildAmount |= RPMBUILD_CLEAN;
|
||||
case 'i':
|
||||
buildAmount |= RPMBUILD_INSTALL;
|
||||
if ((buildChar == 'i') && shortCircuit)
|
||||
buildArgs.buildAmount |= RPMBUILD_INSTALL;
|
||||
if ((buildArgs.buildChar == 'i') && buildArgs.shortCircuit)
|
||||
break;
|
||||
case 'c':
|
||||
buildAmount |= RPMBUILD_BUILD;
|
||||
if ((buildChar == 'c') && shortCircuit)
|
||||
buildArgs.buildAmount |= RPMBUILD_BUILD;
|
||||
if ((buildArgs.buildChar == 'c') && buildArgs.shortCircuit)
|
||||
break;
|
||||
case 'p':
|
||||
buildAmount |= RPMBUILD_PREP;
|
||||
buildArgs.buildAmount |= RPMBUILD_PREP;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
buildAmount |= RPMBUILD_FILECHECK;
|
||||
buildArgs.buildAmount |= RPMBUILD_FILECHECK;
|
||||
break;
|
||||
case 's':
|
||||
buildAmount |= RPMBUILD_PACKAGESOURCE;
|
||||
buildArgs.buildAmount |= RPMBUILD_PACKAGESOURCE;
|
||||
break;
|
||||
}
|
||||
|
||||
#if XXX
|
||||
if (rmsource)
|
||||
buildAmount |= RPMBUILD_RMSOURCE;
|
||||
|
||||
if (clean)
|
||||
buildAmount |= RPMBUILD_RMBUILD;
|
||||
#else
|
||||
if (buildArgs.buildAmount) {
|
||||
buildAmount |=
|
||||
(buildArgs.buildAmount & (RPMBUILD_RMSOURCE|RPMBUILD_RMBUILD));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!poptPeekArg(optCon)) {
|
||||
if (bigMode == MODE_BUILD)
|
||||
argerror(_("no spec files given for build"));
|
||||
|
@ -1245,9 +1175,9 @@ int main(int argc, char ** argv) {
|
|||
}
|
||||
|
||||
while ((pkg = poptGetArg(optCon)))
|
||||
if (build(pkg, buildAmount, passPhrase, buildArgs.buildRootOverride,
|
||||
bigMode == MODE_TARBUILD, test, NULL,
|
||||
rcfile, arch, os, buildplatforms, force)) {
|
||||
if (build(pkg, buildArgs.buildAmount, passPhrase, buildArgs.buildRootOverride,
|
||||
bigMode == MODE_TARBUILD, buildArgs.noBuild, NULL,
|
||||
rcfile, buildArgs.targets, force)) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -88,7 +88,7 @@ sortMacroTable(MacroContext *mc)
|
|||
compareMacroName);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
dumpMacroTable(MacroContext *mc)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -46,6 +46,8 @@ extern "C" {
|
|||
|
||||
int isCompressed(char *file, int *compressed);
|
||||
|
||||
void dumpMacroTable __P((MacroContext *mc));
|
||||
|
||||
void initMacros __P((MacroContext *mc, const char *macrofile));
|
||||
void freeMacros __P((MacroContext *mc));
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
RPM_SOURCE_DIR=\"%{_sourcedir}\"\
|
||||
RPM_BUILD_DIR=\"%{_builddir}\"\
|
||||
RPM_OPT_FLAGS=\"%{optflags}\"\
|
||||
RPM_ARCH=\"%{arch}\"\
|
||||
RPM_OS=\"%{os}\"\
|
||||
RPM_ARCH=\"%{_target_cpu}\"\
|
||||
RPM_OS=\"%{_target_os}\"\
|
||||
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
|
||||
RPM_DOC_DIR=\"%{_docdir}\"\
|
||||
export RPM_DOC_DIR\
|
||||
|
@ -78,6 +78,7 @@
|
|||
# ---- configure macros.
|
||||
# Macro(s) similar to those used by configure.
|
||||
#
|
||||
%_prefix @prefix@
|
||||
%_build @build@
|
||||
%_build_alias @build_alias@
|
||||
%_build_cpu @build_cpu@
|
||||
|
@ -88,4 +89,8 @@
|
|||
%_host_cpu @host_cpu@
|
||||
%_host_vendor @host_vendor@
|
||||
%_host_os @host_os@
|
||||
%_prefix @prefix@
|
||||
%_target @target@
|
||||
%_target_alias @target_alias@
|
||||
%_target_cpu @target_cpu@
|
||||
%_target_vendor @target_vendor@
|
||||
%_target_os @target_os@
|
||||
|
|
|
@ -10,7 +10,7 @@ int main(int argc, char ** argv)
|
|||
int blockNum = 0;
|
||||
rpmdb db;
|
||||
|
||||
rpmReadConfigFiles(NULL, NULL, NULL, 0, NULL);
|
||||
rpmReadConfigFiles(NULL, NULL);
|
||||
|
||||
if (argc == 2) {
|
||||
dspBlockNum = atoi(argv[1]);
|
||||
|
|
Loading…
Reference in New Issue