diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-11-22 18:08:40 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-11-22 18:08:40 +0200 |
commit | 43b08986a8aa0464566716f6fe0d510e96cd77bf (patch) | |
tree | a8252ad0d7d188057f6fc3491a83ee947a6907ae | |
parent | da83a562e1fd81402a39b7c3edfdc413fa860d8c (diff) | |
download | rpm-43b08986a8aa0464566716f6fe0d510e96cd77bf.tar.gz rpm-43b08986a8aa0464566716f6fe0d510e96cd77bf.tar.bz2 rpm-43b08986a8aa0464566716f6fe0d510e96cd77bf.zip |
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?
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/poptALL.c | 9 | ||||
-rw-r--r-- | rpmqv.c | 9 | ||||
-rw-r--r-- | 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 <rpm/rpmgi.h> #include <rpm/rpmlog.h> #include <rpm/rpmstring.h> +#include <rpm/rpmfileutil.h> #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) { @@ -15,6 +15,7 @@ const char *__progname; #include <rpm/rpmlib.h> /* RPMSIGTAG, rpmReadPackageFile .. */ #include <rpm/rpmbuild.h> #include <rpm/rpmlog.h> +#include <rpm/rpmfileutil.h> #include <rpm/rpmdb.h> #include <rpm/rpmps.h> @@ -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 |