From 638fb7ba841441fd6624426997d4a644185f183d Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 15 Nov 2010 10:18:49 +0200 Subject: [PATCH] Make our popt exec path more useful, permit environment override - In 4.4.x days, we used to have bunch of helper binaries in /usr/lib/rpm executed through popt ping-pong, but there's nothing now that we'd want to execute through aliases. Instead use bindir for the default path, and additionally permit overriding through RPM_POPTEXEC_PATH environment variable (mostly probably useful for the testsuite) --- lib/Makefile.am | 1 + lib/poptALL.c | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index 1aeadb8..8a996d8 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -10,6 +10,7 @@ AM_CPPFLAGS += -DLOCALEDIR="\"$(localedir)\"" AM_CPPFLAGS += -DSYSCONFDIR="\"$(sysconfdir)\"" AM_CPPFLAGS += -DLOCALSTATEDIR="\"$(localstatedir)\"" AM_CPPFLAGS += -DLIBRPMALIAS_FILENAME="\"rpmpopt-${VERSION}\"" +AM_CPPFLAGS += -DLIBRPMALIAS_EXECPATH="\"$(bindir)\"" usrlibdir = $(libdir) diff --git a/lib/poptALL.c b/lib/poptALL.c index b073fc5..81ee27c 100644 --- a/lib/poptALL.c +++ b/lib/poptALL.c @@ -244,7 +244,7 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable) const char * optArg; poptContext optCon; int rc; - const char *ctx; + const char *ctx, *execPath; #if HAVE_MCHECK_H && HAVE_MTRACE mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */ @@ -282,7 +282,10 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable) free(poptfile); } (void) poptReadDefaultConfig(optCon, 1); - poptSetExecPath(optCon, rpmConfigDir(), 1); + + if ((execPath = getenv("RPM_POPTEXEC_PATH")) == NULL) + execPath = LIBRPMALIAS_EXECPATH; + poptSetExecPath(optCon, execPath, 1); /* Process all options, whine if unknown. */ while ((rc = poptGetNextOpt(optCon)) > 0) { -- 2.7.4