RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/ CHANGES rpm/lib/ poptALL.c rpmrc.c rpm/scripts/ rt-rel...

From: Jeff Johnson <jbj@rpm5.org>
Date: Sun 17 Aug 2008 - 22:43:59 CEST
Message-Id: <20080817204359.3133D7009E@rpm5.org>
  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:   17-Aug-2008 22:43:59
  Branch: HEAD                             Handle: 2008081720435801

  Added files:
    rpm/scripts             rt-reloc-wrapper.sh
  Modified files:
    rpm                     CHANGES
    rpm/lib                 poptALL.c rpmrc.c

  Log:
    - WR: run-time discovered configuration goopiness, take 1.

  Summary:
    Revision    Changes     Path
    1.2522      +1  -0      rpm/CHANGES
    2.97        +58 -1      rpm/lib/poptALL.c
    2.244       +18 -3      rpm/lib/rpmrc.c
    1.2         +12 -0      rpm/scripts/rt-reloc-wrapper.sh
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2521 -r1.2522 CHANGES
  --- rpm/CHANGES	17 Aug 2008 19:02:05 -0000	1.2521
  +++ rpm/CHANGES	17 Aug 2008 20:43:58 -0000	1.2522
  @@ -1,5 +1,6 @@
   
   5.1.0 -> 5.2a0:
  +    - jbj: WR: run-time discovered configuration goopiness, take 1.
       - jbj: WR: rely on PATH to find pkg-config.
       - jbj: WR: don't spew error messages with internal lua shadow module.
       - jbj: WR: add shadow/chkconfig internal lua modules.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/poptALL.c
  ============================================================================
  $ cvs diff -u -r2.96 -r2.97 poptALL.c
  --- rpm/lib/poptALL.c	2 Aug 2008 17:56:46 -0000	2.96
  +++ rpm/lib/poptALL.c	17 Aug 2008 20:43:58 -0000	2.97
  @@ -6,6 +6,14 @@
   #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 <rpmiotypes.h>
   #include <fts.h>
  @@ -476,6 +484,37 @@
       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)
  @@ -516,9 +555,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
   
  @@ -580,10 +623,24 @@
       }
       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) {
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmrc.c
  ============================================================================
  $ cvs diff -u -r2.243 -r2.244 rpmrc.c
  --- rpm/lib/rpmrc.c	3 Aug 2008 19:59:09 -0000	2.243
  +++ rpm/lib/rpmrc.c	17 Aug 2008 20:43:58 -0000	2.244
  @@ -33,6 +33,7 @@
   
   /*@observer@*/ /*@unchecked@*/
   static const char * platform = SYSCONFIGDIR "/platform";
  +
   /*@only@*/ /*@relnull@*/ /*@unchecked@*/
   void * platpat = NULL;
   /*@unchecked@*/
  @@ -300,6 +301,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);
  @@ -529,6 +536,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;
  @@ -581,10 +593,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;
  @@ -604,9 +616,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;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/scripts/rt-reloc-wrapper.sh
  ============================================================================
  $ cvs diff -u -r0 -r1.2 rt-reloc-wrapper.sh
  --- /dev/null	2008-08-17 22:36:37 +0200
  +++ rt-reloc-wrapper.sh	2008-08-17 22:43:59 +0200
  @@ -0,0 +1,12 @@
  +#! /bin/sh
  +# Identify run path, and forward to ../lib_or_lib64/$0
  +
  +PROGNAME=$(basename $0)
  +DIR=$(cd $(dirname $0) ; pwd)
  +
  +export LD_LIBRARY_PATH=$DIR/../libMark64:$DIR/../lib:$DIR/../lib64
  +export RPM_USRLIBRPM=$DIR/../libMark64/rpm
  +export RPM_ETCRPM=$DIR/../etc/rpm
  +export RPM_LOCALEDIR=$DIR/../share/locale
  +
  +exec $DIR/../libMark64/rpm/$PROGNAME "$@"
  @@ .
Received on Sun Aug 17 22:43:59 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.