Force "rpm" popt context for everything but build

- we want the same set of aliases to be seen no matter what name we're
  invoked with, except for build which has it's own set of aliases
- this has a nice little side-effect of permitting popt aliases to work
  from source tree on non-static builds despite libtool calling executables
  lt-something instead of their real names
This commit is contained in:
Panu Matilainen 2008-06-25 09:33:50 +03:00
parent 7a02b41365
commit 997f5a24c5
1 changed files with 9 additions and 2 deletions

11
rpmqv.c
View File

@ -188,7 +188,7 @@ int main(int argc, char *argv[])
int arg; int arg;
const char * optArg; const char *optArg, *poptCtx;
pid_t pipeChild = 0; pid_t pipeChild = 0;
poptContext optCon; poptContext optCon;
int ec = 0; int ec = 0;
@ -250,10 +250,17 @@ int main(int argc, char *argv[])
rpmSetVerbosity(RPMLOG_NOTICE); /* XXX silly use by showrc */ rpmSetVerbosity(RPMLOG_NOTICE); /* XXX silly use by showrc */
/* Only build has it's own set of aliases, everything else uses rpm */
#ifdef IAM_RPMBT
poptCtx = "rpmbuild";
#else
poptCtx = "rpm";
#endif
/* Make a first pass through the arguments, looking for --rcfile */ /* Make a first pass through the arguments, looking for --rcfile */
/* 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. */
/* XXX popt argv definition should be fixed instead of casting... */ /* XXX popt argv definition should be fixed instead of casting... */
optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0); optCon = poptGetContext(poptCtx, argc, (const char **)argv, optionsTable, 0);
(void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME); (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
#if RPM_USES_POPTREADDEFAULTCONFIG #if RPM_USES_POPTREADDEFAULTCONFIG
(void) poptReadDefaultConfig(optCon, 1); (void) poptReadDefaultConfig(optCon, 1);