Upstream-Status: Inappropriate [distribution]

Disable all of the internal architectures

We disable all of the internal architectures and replace them with ones
generated by the libzypp recipe as specified in the oe-arch.h.

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>

diff -ur git.orig/tests/lib/TestSetup.h git/tests/lib/TestSetup.h
--- git.orig/tests/lib/TestSetup.h	2011-03-28 14:24:36.534800770 -0500
+++ git/tests/lib/TestSetup.h	2011-03-28 14:25:04.969912234 -0500
@@ -66,7 +66,7 @@
  *   // enabls loging fot the scope of this block:
  *   // base::LogControl::TmpLineWriter shutUp( new log::FileLineWriter( "/tmp/YLOG" ) );
  *
- *   TestSetup test( Arch_x86_64 );
+ *   TestSetup test( Arch_machine );
  *   // test.loadTarget(); // initialize and load target
  *   test.loadRepo( TESTS_SRC_DIR"/data/openSUSE-11.1" );
  *
@@ -313,7 +313,7 @@
      * a TestSetup system or a real system. The  provided repostitories are
      * loaded into the pool (without refresh).
     */
-    static void LoadSystemAt( const Pathname & sysRoot, const Arch & _testSetupArch_r = Arch_x86_64 )
+    static void LoadSystemAt( const Pathname & sysRoot, const Arch & _testSetupArch_r = Arch_machine )
     {
       if ( ! PathInfo( sysRoot ).isDir() )
         ZYPP_THROW( Exception("sysRoot argument needs to be a directory") );
diff -ur git.orig/tools/DumpSelectable.cc git/tools/DumpSelectable.cc
--- git.orig/tools/DumpSelectable.cc	2011-03-28 14:24:36.547876951 -0500
+++ git/tools/DumpSelectable.cc	2011-03-28 14:25:04.969912234 -0500
@@ -78,7 +78,7 @@
   else if ( TestSetup::isTestSetup( sysRoot ) )
   {
     message << str::form( "*** Load TestSetup from '%s'", sysRoot.c_str() ) << endl;
-    TestSetup test( sysRoot, Arch_x86_64 );
+    TestSetup test( sysRoot, Arch_machine );
     test.loadRepos();
   }
   else
diff -ur git.orig/tools/NameReqPrv.cc git/tools/NameReqPrv.cc
--- git.orig/tools/NameReqPrv.cc	2011-03-28 14:24:36.547876951 -0500
+++ git/tools/NameReqPrv.cc	2011-03-28 14:25:04.970849384 -0500
@@ -112,7 +112,7 @@
   else if ( TestSetup::isTestSetup( sysRoot ) )
   {
     message << str::form( "*** Load TestSetup from '%s'", sysRoot.c_str() ) << endl;
-    TestSetup test( sysRoot, Arch_x86_64 );
+    TestSetup test( sysRoot, Arch_machine );
     test.loadRepos();
     dumpRange( message, satpool.reposBegin(), satpool.reposEnd() ) << endl;
   }
diff -ur git.orig/tools/ToolScanRepos.cc git/tools/ToolScanRepos.cc
--- git.orig/tools/ToolScanRepos.cc	2011-03-28 14:24:36.547876951 -0500
+++ git/tools/ToolScanRepos.cc	2011-03-28 14:25:04.970849384 -0500
@@ -46,7 +46,7 @@
   ///////////////////////////////////////////////////////////////////
   Pathname mtmp( "/tmp" );
   Pathname mroot( mtmp/appname );
-  Arch     march( Arch_x86_64 );
+  Arch     march( Arch_machine );
   bool     oClearRoot = true;
 
   std::vector<std::string> urls;
@@ -83,7 +83,7 @@
       if ( *(argv[0]) ) // empty
         march = Arch( argv[0] );
       else
-        march = Arch_x86_64;
+        march = Arch_machine;
     }
    else
     {
@@ -131,4 +131,4 @@
 
   INT << "===[END]============================================" << endl << endl;
   return ret;
-}
\ No newline at end of file
+}
diff -ur git.orig/tools/zypp-list.cc git/tools/zypp-list.cc
--- git.orig/tools/zypp-list.cc	2011-03-28 14:24:36.547876951 -0500
+++ git/tools/zypp-list.cc	2011-03-28 14:25:04.971901224 -0500
@@ -56,7 +56,7 @@
   else if ( TestSetup::isTestSetup( sysRoot ) )
   {
     message << str::form( "*** Load TestSetup from '%s'", sysRoot.c_str() ) << endl;
-    TestSetup test( sysRoot, Arch_x86_64 );
+    TestSetup test( sysRoot, Arch_machine );
     test.loadRepos();
     dumpRange( message, satpool.reposBegin(), satpool.reposEnd() ) << endl;
   }
diff -ur git.orig/zypp/Arch.cc git/zypp/Arch.cc
--- git.orig/zypp/Arch.cc	2011-03-28 14:24:36.548877414 -0500
+++ git/zypp/Arch.cc	2011-03-28 14:31:13.943786442 -0500
@@ -153,53 +153,11 @@
     //       bit for each architecture.
     //
 #define DEF_BUILTIN(A) const IdString  _##A( #A );
+    DEF_BUILTIN( all );
+    DEF_BUILTIN( any );
     DEF_BUILTIN( noarch );
 
-    DEF_BUILTIN( i386 );
-    DEF_BUILTIN( i486 );
-    DEF_BUILTIN( i586 );
-    DEF_BUILTIN( i686 );
-    DEF_BUILTIN( athlon );
-    DEF_BUILTIN( x86_64 );
-
-    DEF_BUILTIN( pentium3 );
-    DEF_BUILTIN( pentium4 );
-
-    DEF_BUILTIN( s390 );
-    DEF_BUILTIN( s390x );
-
-    DEF_BUILTIN( ppc );
-    DEF_BUILTIN( ppc64 );
-
-    DEF_BUILTIN( ia64 );
-
-    DEF_BUILTIN( alphaev67 );
-    DEF_BUILTIN( alphaev6 );
-    DEF_BUILTIN( alphapca56 );
-    DEF_BUILTIN( alphaev56 );
-    DEF_BUILTIN( alphaev5 );
-    DEF_BUILTIN( alpha );
-
-    DEF_BUILTIN( sparc64v );
-    DEF_BUILTIN( sparcv9v );
-    DEF_BUILTIN( sparc64 );
-    DEF_BUILTIN( sparcv9 );
-    DEF_BUILTIN( sparcv8 );
-    DEF_BUILTIN( sparc );
-
-    DEF_BUILTIN( armv7l );
-    DEF_BUILTIN( armv6l );
-    DEF_BUILTIN( armv5tejl );
-    DEF_BUILTIN( armv5tel );
-    DEF_BUILTIN( armv5l );
-    DEF_BUILTIN( armv4tl );
-    DEF_BUILTIN( armv4l );
-    DEF_BUILTIN( armv3l );
-
-    DEF_BUILTIN( sh3 );
-
-    DEF_BUILTIN( sh4 );
-    DEF_BUILTIN( sh4a );
+#include "oe-arch.h"
 #undef DEF_BUILTIN
 
     ///////////////////////////////////////////////////////////////////
@@ -269,6 +227,8 @@
         // _noarch must have _idBit 0.
         // Other builtins have 1-bit set
         // and are initialized done on the fly.
+        _compatSet.insert( Arch::CompatEntry( _all, 0 ) );
+        _compatSet.insert( Arch::CompatEntry( _any, 0 ) );
         _compatSet.insert( Arch::CompatEntry( _noarch, 0 ) );
         ///////////////////////////////////////////////////////////////////
         // Define the CompatibleWith relation:
@@ -276,52 +236,9 @@
         // NOTE: Order of definition is significant! (Arch::compare)
 	//       - define compatible (less) architectures first!
         //
-        defCompatibleWith( _i386,	_noarch );
-        defCompatibleWith( _i486,	_noarch,_i386 );
-        defCompatibleWith( _i586,	_noarch,_i386,_i486 );
-        defCompatibleWith( _i686,	_noarch,_i386,_i486,_i586 );
-        defCompatibleWith( _athlon,	_noarch,_i386,_i486,_i586,_i686 );
-        defCompatibleWith( _x86_64,	_noarch,_i386,_i486,_i586,_i686,_athlon );
-
-        defCompatibleWith( _pentium3,	_noarch,_i386,_i486,_i586,_i686 );
-        defCompatibleWith( _pentium4,	_noarch,_i386,_i486,_i586,_i686,_pentium3 );
-
-        defCompatibleWith( _ia64,	_noarch,_i386,_i486,_i586,_i686 );
-        //
-        defCompatibleWith( _s390,	_noarch );
-        defCompatibleWith( _s390x,	_noarch,_s390 );
-        //
-        defCompatibleWith( _ppc,	_noarch );
-        defCompatibleWith( _ppc64,	_noarch,_ppc );
-        //
-        defCompatibleWith( _alpha,	_noarch );
-        defCompatibleWith( _alphaev5,	_noarch,_alpha );
-        defCompatibleWith( _alphaev56,	_noarch,_alpha,_alphaev5 );
-        defCompatibleWith( _alphapca56,	_noarch,_alpha,_alphaev5,_alphaev56 );
-        defCompatibleWith( _alphaev6,	_noarch,_alpha,_alphaev5,_alphaev56,_alphapca56 );
-        defCompatibleWith( _alphaev67,	_noarch,_alpha,_alphaev5,_alphaev56,_alphapca56,_alphaev6 );
-        //
-        defCompatibleWith( _sparc,	_noarch );
-        defCompatibleWith( _sparcv8,	_noarch,_sparc );
-        defCompatibleWith( _sparcv9,	_noarch,_sparc,_sparcv8 );
-	defCompatibleWith( _sparcv9v,	_noarch,_sparc,_sparcv8,_sparcv9 );
-	//
-        defCompatibleWith( _sparc64,	_noarch,_sparc,_sparcv8,_sparcv9 );
-	defCompatibleWith( _sparc64v,	_noarch,_sparc,_sparcv8,_sparcv9,_sparcv9v,_sparc64 );
-        //
-        defCompatibleWith( _armv3l,	_noarch );
-        defCompatibleWith( _armv4l,	_noarch,_armv3l );
-        defCompatibleWith( _armv4tl,	_noarch,_armv3l,_armv4l );
-        defCompatibleWith( _armv5l,	_noarch,_armv3l,_armv4l,_armv4tl );
-        defCompatibleWith( _armv5tel,	_noarch,_armv3l,_armv4l,_armv4tl,_armv5l );
-        defCompatibleWith( _armv5tejl,	_noarch,_armv3l,_armv4l,_armv4tl,_armv5l,_armv5tel );
-        defCompatibleWith( _armv6l,	_noarch,_armv3l,_armv4l,_armv4tl,_armv5l,_armv5tel,_armv5tejl );
-        defCompatibleWith( _armv7l,	_noarch,_armv3l,_armv4l,_armv4tl,_armv5l,_armv5tel,_armv5tejl,_armv6l );
-        //
-        defCompatibleWith( _sh3,	_noarch );
-        //
-        defCompatibleWith( _sh4,	_noarch );
-        defCompatibleWith( _sh4a,	_noarch,_sh4 );
+#define OE_DEF_COMPAT 1
+#include "oe-arch.h"
+#undef OE_DEF_COMPAT
         //
         ///////////////////////////////////////////////////////////////////
         // dumpOn( USR ) << endl;
@@ -388,53 +305,13 @@
   ///////////////////////////////////////////////////////////////////
 
   const Arch Arch_empty ( IdString::Empty );
+  const Arch Arch_all( _all );
+  const Arch Arch_any( _any );
   const Arch Arch_noarch( _noarch );
 
-  const Arch Arch_i386( _i386 );
-  const Arch Arch_i486( _i486 );
-  const Arch Arch_i586( _i586 );
-  const Arch Arch_i686( _i686 );
-  const Arch Arch_athlon( _athlon );
-  const Arch Arch_x86_64( _x86_64 );
-
-  const Arch Arch_pentium3( _pentium3 );
-  const Arch Arch_pentium4( _pentium4 );
-
-  const Arch Arch_s390( _s390 );
-  const Arch Arch_s390x( _s390x );
-
-  const Arch Arch_ppc( _ppc );
-  const Arch Arch_ppc64( _ppc64 );
-
-  const Arch Arch_ia64( _ia64 );
-
-  const Arch Arch_alphaev67( _alphaev67 );
-  const Arch Arch_alphaev6( _alphaev6 );
-  const Arch Arch_alphapca56( _alphapca56 );
-  const Arch Arch_alphaev56( _alphaev56 );
-  const Arch Arch_alphaev5( _alphaev5 );
-  const Arch Arch_alpha( _alpha );
-
-  const Arch Arch_sparc64v( _sparc64v );
-  const Arch Arch_sparc64( _sparc64 );
-  const Arch Arch_sparcv9v( _sparcv9v );
-  const Arch Arch_sparcv9( _sparcv9 );
-  const Arch Arch_sparcv8( _sparcv8 );
-  const Arch Arch_sparc( _sparc );
-
-  const Arch Arch_armv7l( _armv7l );
-  const Arch Arch_armv6l( _armv6l );
-  const Arch Arch_armv5tejl( _armv5tejl );
-  const Arch Arch_armv5tel( _armv5tel );
-  const Arch Arch_armv5l( _armv5l );
-  const Arch Arch_armv4tl( _armv4tl );
-  const Arch Arch_armv4l( _armv4l );
-  const Arch Arch_armv3l( _armv3l );
-
-  const Arch Arch_sh3( _sh3 );
-
-  const Arch Arch_sh4( _sh4 );
-  const Arch Arch_sh4a( _sh4a );
+#define OE_PROTO 1
+#include "oe-arch.h"
+#undef OE_PROTO
 
   ///////////////////////////////////////////////////////////////////
   //
@@ -504,26 +381,10 @@
   //
   Arch Arch::baseArch( ) const
   {
-    // check the multilib archs:
-    if (Arch_x86_64.compatibleWith(*this))
-    {
-      return Arch_x86_64;
-    }
-    if (Arch_sparc64v.compatibleWith(*this))
-    {
-      return Arch_sparc64v;
-    }
-    if (Arch_sparc64.compatibleWith(*this))
-    {
-      return Arch_sparc64;
-    }
-    if (Arch_ppc64.compatibleWith(*this))
-    {
-      return Arch_ppc64;
-    }
-    if (Arch_s390x.compatibleWith(*this))
+    // Check the multilib arch:
+    if (Arch_machine.compatibleWith(*this))
     {
-      return Arch_s390x;
+      return Arch_machine;
     }
     // Here: no multilib; return arch before noarch
     CompatSet cset( compatSet( *this ) );
diff -ur git.orig/zypp/Arch.h git/zypp/Arch.h
--- git.orig/zypp/Arch.h	2011-03-28 14:24:36.548877414 -0500
+++ git/zypp/Arch.h	2011-03-28 14:25:04.972801208 -0500
@@ -162,89 +162,13 @@
   extern const Arch Arch_empty;
 
   /** \relates Arch */
+  extern const Arch Arch_all;
+  extern const Arch Arch_any;
   extern const Arch Arch_noarch;
 
-  /** \relates Arch */
-  extern const Arch Arch_pentium4;
-  /** \relates Arch */
-  extern const Arch Arch_pentium3;
-
-  /** \relates Arch */
-  extern const Arch Arch_x86_64;
-  /** \relates Arch */
-  extern const Arch Arch_athlon;
-  /** \relates Arch */
-  extern const Arch Arch_i686;
-  /** \relates Arch */
-  extern const Arch Arch_i586;
-  /** \relates Arch */
-  extern const Arch Arch_i486;
-  /** \relates Arch */
-  extern const Arch Arch_i386;
-
-  /** \relates Arch */
-  extern const Arch Arch_s390x;
-  /** \relates Arch */
-  extern const Arch Arch_s390;
-
-  /** \relates Arch */
-  extern const Arch Arch_ppc64;
-  /** \relates Arch */
-  extern const Arch Arch_ppc;
-
-  /** \relates Arch */
-  extern const Arch Arch_ia64;
-
-  /** \relates Arch */
-  extern const Arch Arch_alphaev67;
-  /** \relates Arch */
-  extern const Arch Arch_alphaev6;
-  /** \relates Arch */
-  extern const Arch Arch_alphapca56;
-  /** \relates Arch */
-  extern const Arch Arch_alphaev56;
-  /** \relates Arch */
-  extern const Arch Arch_alphaev5;
-  /** \relates Arch */
-  extern const Arch Arch_alpha;
-
-   /** \relates Arch */
-  extern const Arch Arch_sparc64v;
-  /** \relates Arch */
-  extern const Arch Arch_sparc64;
-  /** \relates Arch */
-  extern const Arch Arch_sparcv9v;
-  /** \relates Arch */
-  extern const Arch Arch_sparcv9;
-  /** \relates Arch */
-  extern const Arch Arch_sparcv8;
-  /** \relates Arch */
-  extern const Arch Arch_sparc;
-
-  /** \relates Arch */
-  extern const Arch Arch_armv7l;
-  /** \relates Arch */
-  extern const Arch Arch_armv6l;
-  /** \relates Arch */
-  extern const Arch Arch_armv5tejl;
-  /** \relates Arch */
-  extern const Arch Arch_armv5tel;
-  /** \relates Arch */
-  extern const Arch Arch_armv5l;
-  /** \relates Arch */
-  extern const Arch Arch_armv4tl;
-  /** \relates Arch */
-  extern const Arch Arch_armv4l;
-  /** \relates Arch */
-  extern const Arch Arch_armv3l;
-
-   /** \relates Arch */
-  extern const Arch Arch_sh3;
-
-  /** \relates Arch */
-  extern const Arch Arch_sh4;
-  /** \relates Arch */
-  extern const Arch Arch_sh4a;
+#define OE_EXTERN_PROTO 1
+#include "oe-arch.h"
+#undef OE_EXTERN_PROTO
   //@}
 
   ///////////////////////////////////////////////////////////////////
diff -ur git.orig/zypp/CMakeLists.txt git/zypp/CMakeLists.txt
--- git.orig/zypp/CMakeLists.txt
+++ git/zypp/CMakeLists.txt
@@ -90,6 +90,7 @@ SET( zypp_EARLY_SRCS
 
 SET( zypp_HEADERS
   Arch.h
+  oe-arch.h
   AutoDispose.h
   Bit.h
   ByteCount.h
diff -ur git.orig/zypp/ZConfig.cc git/zypp/ZConfig.cc
--- git.orig/zypp/ZConfig.cc	2011-03-28 14:24:37.178989632 -0500
+++ git/zypp/ZConfig.cc	2011-03-28 14:25:04.973971936 -0500
@@ -48,77 +48,9 @@
     */
     Arch _autodetectSystemArchitecture()
     {
-      struct ::utsname buf;
-      if ( ::uname( &buf ) < 0 )
-      {
-        ERR << "Can't determine system architecture" << endl;
-        return Arch_noarch;
-      }
-
-      Arch architecture( buf.machine );
-      MIL << "Uname architecture is '" << buf.machine << "'" << endl;
+      /* Define the default architecture, ignore uname! */
+      Arch architecture( Arch_machine );
 
-      if ( architecture == Arch_i686 )
-      {
-	// some CPUs report i686 but dont implement cx8 and cmov
-	// check for both flags in /proc/cpuinfo and downgrade
-	// to i586 if either is missing (cf bug #18885)
-        std::ifstream cpuinfo( "/proc/cpuinfo" );
-        if ( cpuinfo )
-        {
-          for( iostr::EachLine in( cpuinfo ); in; in.next() )
-          {
-            if ( str::hasPrefix( *in, "flags" ) )
-            {
-              if (    in->find( "cx8" ) == std::string::npos
-                   || in->find( "cmov" ) == std::string::npos )
-              {
-                architecture = Arch_i586;
-                WAR << "CPU lacks 'cx8' or 'cmov': architecture downgraded to '" << architecture << "'" << endl;
-              }
-              break;
-            }
-          }
-        }
-        else
-        {
-          ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
-        }
-      }
-      else if ( architecture == Arch_sparc || architecture == Arch_sparc64 )
-      {
-	// Check for sun4[vum] to get the real arch. (bug #566291)
-	std::ifstream cpuinfo( "/proc/cpuinfo" );
-        if ( cpuinfo )
-        {
-          for( iostr::EachLine in( cpuinfo ); in; in.next() )
-          {
-            if ( str::hasPrefix( *in, "type" ) )
-            {
-              if ( in->find( "sun4v" ) != std::string::npos )
-              {
-                architecture = ( architecture == Arch_sparc64 ? Arch_sparc64v : Arch_sparcv9v );
-                WAR << "CPU has 'sun4v': architecture upgraded to '" << architecture << "'" << endl;
-              }
-              else if ( in->find( "sun4u" ) != std::string::npos )
-              {
-                architecture = ( architecture == Arch_sparc64 ? Arch_sparc64 : Arch_sparcv9 );
-                WAR << "CPU has 'sun4u': architecture upgraded to '" << architecture << "'" << endl;
-              }
-              else if ( in->find( "sun4m" ) != std::string::npos )
-              {
-                architecture = Arch_sparcv8;
-                WAR << "CPU has 'sun4m': architecture upgraded to '" << architecture << "'" << endl;
-              }
-              break;
-            }
-          }
-        }
-        else
-        {
-          ERR << "Cant open " << PathInfo("/proc/cpuinfo") << endl;
-        }
-      }
       return architecture;
     }
 
