From 43b08986a8aa0464566716f6fe0d510e96cd77bf Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Sat, 22 Nov 2008 18:08:40 +0200 Subject: Use rpmConfigDir() for finding our popt alias file - this allows popt aliases to be reliably available in tests - why do we have the popt initialization done twice? --- Makefile.am | 2 +- lib/Makefile.am | 2 +- lib/poptALL.c | 9 +++++++-- rpmqv.c | 9 +++++++-- tests/atlocal.in | 3 +++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index b509b6082..cd7a70c9e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/misc AM_CPPFLAGS += @WITH_LIBELF_INCLUDE@ AM_CPPFLAGS += -DLOCALEDIR="\"$(localedir)\"" AM_CPPFLAGS += -DRPMCONFIGDIR="\"@RPMCONFIGDIR@\"" -AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"@RPMCONFIGDIR@/rpmpopt-${VERSION}\"" +AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"rpmpopt-${VERSION}\"" pkginclude_HEADERS = nodist_pkginclude_HEADERS = diff --git a/lib/Makefile.am b/lib/Makefile.am index dbd204bd4..025452d3d 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -11,7 +11,7 @@ AM_CPPFLAGS += -DLOCALEDIR="\"$(localedir)\"" AM_CPPFLAGS += -DSYSCONFDIR="\"$(sysconfdir)\"" AM_CPPFLAGS += -DLOCALSTATEDIR="\"$(localstatedir)\"" AM_CPPFLAGS += -DRPMCONFIGDIR="\"@RPMCONFIGDIR@\"" -AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"@RPMCONFIGDIR@/rpmpopt-${VERSION}\"" +AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"rpmpopt-${VERSION}\"" check_PROGRAMS = CLEANFILES = diff --git a/lib/poptALL.c b/lib/poptALL.c index 4bce0e046..ca5d8b24d 100644 --- a/lib/poptALL.c +++ b/lib/poptALL.c @@ -11,6 +11,7 @@ const char *__progname; #include #include #include +#include #include "debug.h" @@ -337,11 +338,15 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable) } optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0); - (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME); + { + char *poptfile = rpmGenPath(rpmConfigDir(), LIBRPMALIAS_FILENAME, NULL); + (void) poptReadConfigFile(optCon, poptfile); + free(poptfile); + } #if RPM_USES_POPTREADDEFAULTCONFIG (void) poptReadDefaultConfig(optCon, 1); #endif - poptSetExecPath(optCon, RPMCONFIGDIR, 1); + poptSetExecPath(optCon, rpmConfigDir(), 1); /* Process all options, whine if unknown. */ while ((rc = poptGetNextOpt(optCon)) > 0) { diff --git a/rpmqv.c b/rpmqv.c index a9ec0743e..cd8f2ee4f 100644 --- a/rpmqv.c +++ b/rpmqv.c @@ -15,6 +15,7 @@ const char *__progname; #include /* RPMSIGTAG, rpmReadPackageFile .. */ #include #include +#include #include #include @@ -261,11 +262,15 @@ int main(int argc, char *argv[]) /* We need to handle that before dealing with the rest of the arguments. */ /* XXX popt argv definition should be fixed instead of casting... */ optCon = poptGetContext(poptCtx, argc, (const char **)argv, optionsTable, 0); - (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME); + { + char *poptfile = rpmGenPath(rpmConfigDir(), LIBRPMALIAS_FILENAME, NULL); + (void) poptReadConfigFile(optCon, poptfile); + free(poptfile); + } #if RPM_USES_POPTREADDEFAULTCONFIG (void) poptReadDefaultConfig(optCon, 1); #endif - poptSetExecPath(optCon, RPMCONFIGDIR, 1); + poptSetExecPath(optCon, rpmConfigDir(), 1); while ((arg = poptGetNextOpt(optCon)) > 0) { optArg = poptGetOptArg(optCon); diff --git a/tests/atlocal.in b/tests/atlocal.in index b392e8c7c..64c116c27 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -6,6 +6,9 @@ export PATH RPMTEST="${abs_builddir}/testing" RPMDATA="${abs_srcdir}/data/" +RPM_CONFIGDIR="${RPMTEST}/@RPMCONFIGDIR@" +export RPM_CONFIGDIR + # Popt looks into $HOME HOME="${RPMTEST}" export HOME -- cgit v1.2.3