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