Lest it be forgotten:

You are trying to automate switching between different
platform compatibility patterns based on a luser
configuration chose for what they think their platform is.

The patterns being chosen should be in flat external files,
not compiled into lib/rpmrpc.c

And the choice should be done by using the elements
that compose %{_target_platfrom} aka CPU-VENDOR-OS-GNU
in a macro expanded include path encountered while
reading /etc/rpm/platform.

There's no need for -lcpuinfo baggage to do that
switch.

And the flaw is compiling the logic into lib/rpmrc.c,
not whether -lcpuinfo is used (or not). The choice
and logic could/should be done flexibly outside of rpm code.

73 de Jeff

On May 2, 2009, at 9:29 AM, Per Øyvind Karlsen wrote:

 RPM Package Manager, CVS Repository
 http://rpm5.org/cvs/
____________________________________________________________________________

 Server: rpm5.org                         Name:   Per Øyvind Karlsen
 Root:   /v/rpm/cvs                       Email:  pkarl...@rpm5.org
 Module: rpm                              Date:   02-May-2009 15:29:34
 Branch: HEAD                             Handle: 2009050213293301

 Modified files:
   rpm                     CHANGES configure.ac system.h
   rpm/lib                 rpmds.c rpmrc.c

 Log:
cpuinfo: allow to enable from configure again since it's usable now.
   (although still room for improvements...)

 Summary:
   Revision    Changes     Path
   1.2961      +2  -0      rpm/CHANGES
   2.371       +5  -5      rpm/configure.ac
   2.153       +2  -2      rpm/lib/rpmds.c
   2.273       +4  -4      rpm/lib/rpmrc.c
   2.116       +0  -9      rpm/system.h
____________________________________________________________________________

 patch -p0 <<'@@ .'
 Index: rpm/CHANGES
= = = = = = ======================================================================
 $ cvs diff -u -r1.2960 -r1.2961 CHANGES
 --- rpm/CHANGES        29 Apr 2009 23:53:32 -0000      1.2960
 +++ rpm/CHANGES        2 May 2009 13:29:33 -0000       1.2961
 @@ -1,5 +1,7 @@

  5.2a4 -> 5.2b1:
+ - proyvind: cpuinfo: allow to enable from configure again since it's usable
 +      now. (although still room for improvements...)
- jbj: ruby: stub-in the minimal necessary AutoFu to attempt ruby bindings.
      - jbj: add AutoFu to detect fallocate(2) and posix_fallocate(3).
      - jbj: js: add rpmMCExpand() for per-context macro expansion.
 @@ .
 patch -p0 <<'@@ .'
 Index: rpm/configure.ac
= = = = = = ======================================================================
 $ cvs diff -u -r2.370 -r2.371 configure.ac
 --- rpm/configure.ac   29 Apr 2009 23:53:32 -0000      2.370
 +++ rpm/configure.ac   2 May 2009 13:29:33 -0000       2.371
 @@ -1431,11 +1431,11 @@

  # later..
  dnl # CPUInfo
 -#RPM_CHECK_LIB(
 -#    [CPUInfo], [cpuinfo],
 -#    [cpuinfo], [cpuinfo_new], [cpuinfo.h],
 -#    [no,external:none], [],
 -#    [AC_MSG_WARN([CPUInfo support is under development])], [])
 +RPM_CHECK_LIB(
 +    [CPUInfo], [cpuinfo],
 +    [cpuinfo], [cpuinfo_new], [cpuinfo.h],
 +    [no,external:none], [],
 +    [AC_MSG_WARN([CPUInfo support is under development])], [])

  dnl ##
  dnl ## ==== INSTALLATION PARAMETERS ====
 @@ .
 patch -p0 <<'@@ .'
 Index: rpm/lib/rpmds.c
= = = = = = ======================================================================
 $ cvs diff -u -r2.152 -r2.153 rpmds.c
 --- rpm/lib/rpmds.c    17 Apr 2009 16:10:22 -0000      2.152
 +++ rpm/lib/rpmds.c    2 May 2009 13:29:34 -0000       2.153
 @@ -3,7 +3,7 @@
   */
  #include "system.h"

 -#if defined(SUPPORT_LIBCPUINFO)
 +#if defined(WITH_CPUINFO)
  #include <cpuinfo.h>
  #endif

 @@ -1192,7 +1192,7 @@
      ds = NULL;
  }

 -#if defined(SUPPORT_LIBCPUINFO)
 +#if defined(WITH_CPUINFO)
  int rpmdsCpuinfo(rpmds *dsp, const char * fn)
  {
      const char * NS = "cpuinfo";
 @@ .
 patch -p0 <<'@@ .'
 Index: rpm/lib/rpmrc.c
= = = = = = ======================================================================
 $ cvs diff -u -r2.272 -r2.273 rpmrc.c
 --- rpm/lib/rpmrc.c    6 Apr 2009 15:26:28 -0000       2.272
 +++ rpm/lib/rpmrc.c    2 May 2009 13:29:34 -0000       2.273
 @@ -502,7 +502,7 @@
  }
  /*...@=onlytrans@*/

 -#if defined(SUPPORT_LIBCPUINFO)
 +#if defined(WITH_CPUINFO)
static inline int rpmCpuinfoMatch(const char * feature, const char * EVR, rpmds cpuinfo)
  {
rpmds cpufeature = rpmdsSingle(RPMTAG_REQUIRENAME, feature, EVR, RPMSENSE_PROBE);
 @@ -712,7 +712,7 @@
        if (cp == NULL || cp[0] == '\0')
            cp = _platform;
        if (rpmPlatform(cp) == RPMRC_OK) {
 -#elif defined(SUPPORT_LIBCPUINFO)
 +#elif defined(WITH_CPUINFO)
if (rpmPlatform(_platform) == RPMRC_OK || rpmCpuinfo() == RPMRC_OK) {
  #else
        if (rpmPlatform(_platform) == RPMRC_OK) {
 @@ -853,7 +853,7 @@
        if (name) *name = canon->short_name;
      } else {
        if (num) *num = 255;
 -#if defined(SUPPORT_LIBCPUINFO)
 +#if defined(WITH_CPUINFO)
        if (name)
        {
            if(type == ARCH)
 @@ -1202,7 +1202,7 @@

        xx = rpmdsCpuinfo(&ds, NULL);
        if (ds != NULL) {
 -#if defined(SUPPORT_LIBCPUINFO)
 +#if defined(WITH_CPUINFO)
            const char * fn = "libcpuinfo";
  #else
const char * fn = (_cpuinfo_path ? _cpuinfo_path : "/proc/ cpuinfo");
 @@ .
 patch -p0 <<'@@ .'
 Index: rpm/system.h
= = = = = = ======================================================================
 $ cvs diff -u -r2.115 -r2.116 system.h
 --- rpm/system.h       7 Mar 2009 13:38:09 -0000       2.115
 +++ rpm/system.h       2 May 2009 13:29:33 -0000       2.116
 @@ -753,13 +753,4 @@
   */
  #undef        SUPPORT_AR_PAYLOADS

 -/**
- * Permit architecture detection through libcpuinfo. Disabled while under development.
 - */
 -#if defined(RPM_VENDOR_MANDRIVA)
 -#define       SUPPORT_LIBCPUINFO 1
 -#else
 -#undef        SUPPORT_LIBCPUINFO
 -#endif
 -
  #endif        /* H_SYSTEM */
 @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-...@rpm5.org

______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to