RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: jbj@rpm5.org
Module: rpm Date: 19-Aug-2008 17:21:53
Branch: rpm-5_1 Handle: 2008081915215201
Modified files: (Branch: rpm-5_1)
rpm CHANGES
rpm/lib poptALL.c rpmds.c rpmds.h rpmrc.c
Log:
- WR: run-time discovered configuration goopiness, take 1.
- display cpuinfo path with --showrc.
- display sysinfo path with --showrc.
Summary:
Revision Changes Path
1.2288.2.91 +3 -0 rpm/CHANGES
2.90.2.1 +83 -12 rpm/lib/poptALL.c
2.94.2.1 +1 -1 rpm/lib/rpmds.c
2.66.2.1 +5 -0 rpm/lib/rpmds.h
2.234.2.2 +21 -5 rpm/lib/rpmrc.c
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.2288.2.90 -r1.2288.2.91 CHANGES
--- rpm/CHANGES 18 Aug 2008 23:46:49 -0000 1.2288.2.90
+++ rpm/CHANGES 19 Aug 2008 15:21:52 -0000 1.2288.2.91
@@ -1,4 +1,7 @@
5.1.4 -> 5.1.5:
+ - jbj: WR: run-time discovered configuration goopiness, take 1.
+ - jbj: display cpuinfo path with --showrc.
+ - jbj: display sysinfo path with --showrc.
- jbj: remove internal zlib.
- jbj: WR: add %windriver target to devtool.conf.
- jbj: WR: eliminate most compiler warnings.
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/poptALL.c
============================================================================
$ cvs diff -u -r2.90 -r2.90.2.1 poptALL.c
--- rpm/lib/poptALL.c 2 Apr 2008 21:56:47 -0000 2.90
+++ rpm/lib/poptALL.c 19 Aug 2008 15:21:53 -0000 2.90.2.1
@@ -6,17 +6,30 @@
#include "system.h"
const char *__progname;
+#if defined(RPM_VENDOR_WINDRIVER)
+const char *__usrlibrpm = USRLIBRPM;
+const char *__etcrpm = SYSCONFIGDIR;
+#endif
+#if defined(ENABLE_NLS) && !defined(__LCLINT__)
+const char *__localedir = LOCALEDIR;
+#endif
+
#include <rpmio.h>
#include <fts.h>
#include <mire.h>
#include <poptIO.h>
#include <rpmcli.h>
-#include <fs.h> /* XXX rpmFreeFilesystems() */
+
#include <rpmns.h> /* XXX rpmnsClean() */
+#include <fs.h> /* XXX rpmFreeFilesystems() */
+
#include "debug.h"
+/*@unchecked@*/ /*@only@*/ /*@null@*/
+extern unsigned int * keyids;
+
#define POPT_SHOWVERSION -999
#define POPT_SHOWRC -998
#define POPT_QUERYTAGS -997
@@ -117,20 +130,22 @@
extern const char *rpmluaFiles;
#endif
+/*@-readonlytrans@*/ /* argv loading prevents observer, xstrdup needed. */
/*@unchecked@*/
static char *rpmpoptfiles = RPMPOPTFILES;
+/*@=readonlytrans@*/
/**
* Display rpm version.
*/
static void printVersion(FILE * fp)
- /*@globals rpmEVR, fileSystem @*/
- /*@modifies *fp, fileSystem @*/
+ /*@globals rpmEVR, fileSystem, internalState @*/
+ /*@modifies *fp, fileSystem, internalState @*/
{
fprintf(fp, _("%s (" RPM_NAME ") %s\n"), __progname, rpmEVR);
if (rpmIsVerbose())
- fprintf(fp, "rpmlib 0x%08x,0x%08x,0x%08x\n",
- rpmlibVersion(), rpmlibTimestamp(), rpmlibVendor());
+ fprintf(fp, "rpmlib 0x%08x,0x%08x,0x%08x\n", (unsigned)rpmlibVersion(),
+ (unsigned)rpmlibTimestamp(), (unsigned)rpmlibVendor());
}
void rpmcliConfigured(void)
@@ -161,9 +176,9 @@
/*@unused@*/ enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
/*@unused@*/ const void * data)
- /*@globals rpmcliTargets, rpmcliQueryFlags, rpmCLIMacroContext,
+ /*@globals pgpDigVSFlags, rpmcliTargets, rpmcliQueryFlags, rpmCLIMacroContext,
rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
- /*@modifies con, rpmcliTargets, rpmcliQueryFlags, rpmCLIMacroContext,
+ /*@modifies con, pgpDigVSFlags, rpmcliTargets, rpmcliQueryFlags, rpmCLIMacroContext,
rpmGlobalMacroContext, fileSystem, internalState @*/
{
@@ -214,7 +229,7 @@
size_t val_len;
val_len = strlen(val);
if (val[val_len - 1] == '\n')
- fwrite(val, val_len, 1, stdout);
+ val_len = fwrite(val, val_len, 1, stdout);
else
fprintf(stdout, "%s\n", val);
val = _free(val);
@@ -414,6 +429,8 @@
poptContext
rpmcliFini(poptContext optCon)
+ /*@globals keyids @*/
+ /*@modifies keyids @*/
{
/* XXX this should be done in the rpmioClean() wrapper. */
/* keeps memory leak checkers quiet */
@@ -454,13 +471,47 @@
return ret;
}
+#if defined(RPM_VENDOR_WINDRIVER)
+void setRuntimeRelocPaths(void)
+{
+ /*
+ * This is just an example of setting the values using env
+ * variables.... if they're not set, we make sure they get set
+ * for helper apps... We probably want to escape "%" in the path
+ * to avoid macro expansion.. someone might have a % in a path...
+ */
+
+ __usrlibrpm = getenv("RPM_USRLIBRPM");
+ __etcrpm = getenv("RPM_ETCRPM");
+ __localedir = getenv("RPM_LOCALEDIR");
+
+ if ( __usrlibrpm == NULL ) {
+ __usrlibrpm = USRLIBRPM ;
+ setenv("RPM_USRLIBRPM", USRLIBRPM, 0);
+ }
+
+ if ( __etcrpm == NULL ) {
+ __etcrpm = SYSCONFIGDIR ;
+ setenv("RPM_ETCRPM", SYSCONFIGDIR, 0);
+ }
+
+ if ( __localedir == NULL ) {
+ __localedir = LOCALEDIR ;
+ setenv("RPM_LOCALEDIR", LOCALEDIR, 0);
+ }
+}
+#endif
+
/*@-globstate@*/
poptContext
rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
+ /*@globals rpmpoptfiles @*/
+ /*@modifies rpmpoptfiles @*/
{
poptContext optCon;
char *path_buf, *path, *path_next;
int rc;
+ int xx;
int i;
#if defined(HAVE_MCHECK_H) && defined(HAVE_MTRACE)
@@ -491,9 +542,13 @@
#endif
}
+#if defined(RPM_VENDOR_WINDRIVER)
+ (void) setRuntimeRelocPaths();
+#endif
+
#if defined(ENABLE_NLS) && !defined(__LCLINT__)
(void) setlocale(LC_ALL, "" );
- (void) bindtextdomain(PACKAGE, LOCALEDIR);
+ (void) bindtextdomain(PACKAGE, __localedir);
(void) textdomain(PACKAGE);
#endif
@@ -523,7 +578,7 @@
path_buf = xstrdup(rpmpoptfiles);
for (path = path_buf; path != NULL && *path != '\0'; path = path_next) {
const char **av;
- int ac, i;
+ int ac;
/* locate start of next path element */
path_next = strchr(path, ':');
@@ -535,7 +590,7 @@
/* glob-expand the path element */
ac = 0;
av = NULL;
- if ((i = rpmGlob(path, &ac, &av)) != 0)
+ if ((xx = rpmGlob(path, &ac, &av)) != 0)
continue;
/* work-off each resulting file from the path element */
@@ -545,7 +600,7 @@
fn++;
if (!rpmSecuritySaneFile(fn)) {
rpmlog(RPMLOG_WARNING, "existing POPT configuration file \"%s\" considered INSECURE -- not loaded\n", fn);
- continue;
+ /*@innercontinue@*/ continue;
}
}
(void) poptReadConfigFile(optCon, fn);
@@ -555,15 +610,31 @@
}
path_buf = _free(path_buf);
+#if defined(RPM_VENDOR_WINDRIVER)
+ { char * poptAliasFn = rpmGetPath(__usrlibrpm, "/", VERSION, "/rpmpopt", NULL);
+ (void) poptReadConfigFile(optCon, poptAliasFn);
+ poptAliasFn = _free(poptAliasFn);
+ }
+#endif
+
/* read standard POPT configuration files */
(void) poptReadDefaultConfig(optCon, 1);
+#if defined(RPM_VENDOR_WINDRIVER)
+ { char * poptExecPath = rpmGetPath(__usrlibrpm, "/", VERSION, NULL);
+ poptSetExecPath(optCon, poptExecPath, 1);
+ poptExecPath = _free(poptExecPath);
+ }
+#else
poptSetExecPath(optCon, USRLIBRPM, 1);
+#endif
/* Process all options, whine if unknown. */
while ((rc = poptGetNextOpt(optCon)) > 0) {
const char * optArg = poptGetOptArg(optCon);
+/*@-dependenttrans -observertrans@*/ /* Avoid popt memory leaks. */
optArg = _free(optArg);
+/*@=dependenttrans =observertrans @*/
switch (rc) {
default:
/*@-nullpass@*/
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmds.c
============================================================================
$ cvs diff -u -r2.94 -r2.94.2.1 rpmds.c
--- rpm/lib/rpmds.c 14 Mar 2008 23:22:21 -0000 2.94
+++ rpm/lib/rpmds.c 19 Aug 2008 15:21:53 -0000 2.94.2.1
@@ -1245,7 +1245,7 @@
/**
*/
/*@unchecked@*/ /*@observer@*/ /*@owned@*/ /*@relnull@*/
-static const char * _cpuinfo_path = NULL;
+const char * _cpuinfo_path = NULL;
int rpmdsCpuinfo(rpmds *dsp, const char * fn)
/*@globals _cpuinfo_path, ctags @*/
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmds.h
============================================================================
$ cvs diff -u -r2.66 -r2.66.2.1 rpmds.h
--- rpm/lib/rpmds.h 9 Feb 2008 16:35:48 -0000 2.66
+++ rpm/lib/rpmds.h 19 Aug 2008 15:21:53 -0000 2.66.2.1
@@ -474,6 +474,11 @@
int rpmdsSearch(/*@null@*/ rpmds ds, /*@null@*/ rpmds ods)
/*@modifies ds, ods @*/;
+/**
+ */
+/*@unchecked@*/ /*@null@*/
+extern const char * _cpuinfo_path;
+
/** \ingroup rpmds
* Load /proc/cpuinfo provides into a dependency set.
* @retval *dsp (loaded) depedency set
@@ .
patch -p0 <<'@@ .'
Index: rpm/lib/rpmrc.c
============================================================================
$ cvs diff -u -r2.234.2.1 -r2.234.2.2 rpmrc.c
--- rpm/lib/rpmrc.c 6 Jun 2008 17:30:31 -0000 2.234.2.1
+++ rpm/lib/rpmrc.c 19 Aug 2008 15:21:53 -0000 2.234.2.2
@@ -278,6 +278,12 @@
/*@modifies rpmGlobalMacroContext, internalState @*/
{
+#if defined(RPM_VENDOR_WINDRIVER)
+ addMacro(NULL, "_usrlibrpm", NULL, __usrlibrpm, RMIL_DEFAULT);
+ addMacro(NULL, "_etcrpm", NULL, __etcrpm, RMIL_DEFAULT);
+ addMacro(NULL, "_vendor", NULL, "%{?_host_vendor}%{!?_host_vendor:" RPMCANONVENDOR "}", RMIL_DEFAULT);
+#endif
+
addMacro(NULL, "_usr", NULL, USRPREFIX, RMIL_DEFAULT);
addMacro(NULL, "_var", NULL, VARPREFIX, RMIL_DEFAULT);
addMacro(NULL, "_prefix", NULL, "%{_usr}", RMIL_DEFAULT);
@@ -510,6 +516,11 @@
int rc;
while (!gotDefaults) {
+#if defined(RPM_VENDOR_WINDRIVER)
+ const char * _platform = rpmGetPath(__etcrpm, "/platform", NULL);
+#else
+ const char * _platform = platform;
+#endif
CVOG_t cvog = NULL;
#if defined(RPM_VENDOR_OPENPKG) /* larger-utsname */
const char *cp;
@@ -562,10 +573,10 @@
/* allow the path to the "platforms" file be overridden under run-time */
cp = rpmExpand("%{?__platform}", NULL);
if (cp == NULL || cp[0] == '\0')
- cp = platform;
+ cp = _platform;
if (rpmPlatform(cp) == RPMRC_OK) {
#else
- if (rpmPlatform(platform) == RPMRC_OK) {
+ if (rpmPlatform(_platform) == RPMRC_OK) {
#endif
const char * s;
gotDefaults = 1;
@@ -585,9 +596,12 @@
#if defined(RPM_VENDOR_OPENPKG) /* explicit-platform */
/* cleanup after above processing */
- if (cp != NULL && cp != platform)
+ if (cp != NULL && cp != _platform)
cp = _free(cp);
#endif
+#if defined(RPM_VENDOR_WINDRIVER)
+ _platform = _free(_platform);
+#endif
if (configTarget && !parseCVOG(configTarget, &cvog) && cvog != NULL) {
gotDefaults = 1;
@@ -973,7 +987,8 @@
xx = rpmdsSysinfo(PRCO, NULL);
ds = rpmdsFromPRCO(PRCO, RPMTAG_PROVIDENAME);
if (ds != NULL) {
- fprintf(fp, _("Configured system provides (from /etc/rpm/sysinfo):\n"));
+ const char * fn = (_sysinfo_path ? _sysinfo_path : "/etc/rpm/sysinfo");
+ fprintf(fp, _("Configured system provides (from %s):\n"), fn);
ds = rpmdsInit(ds);
while (rpmdsNext(ds) >= 0) {
const char * DNEVR = rpmdsDNEVR(ds);
@@ -1000,8 +1015,9 @@
xx = rpmdsCpuinfo(&ds, NULL);
if (ds != NULL) {
+ const char * fn = (_cpuinfo_path ? _cpuinfo_path : "/proc/cpuinfo");
fprintf(fp,
- _("Features provided by current cpuinfo (from /proc/cpuinfo):\n"));
+ _("Features provided by current cpuinfo (from %s):\n"), fn);
ds = rpmdsInit(ds);
while (rpmdsNext(ds) >= 0) {
const char * DNEVR = rpmdsDNEVR(ds);
@@ .
Received on Tue Aug 19 17:21:53 2008