1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
15 #include "zypp/Arch.h"
19 ///////////////////////////////////////////////////////////////////
21 { /////////////////////////////////////////////////////////////////
23 /** Dumb Arch compat table
28 static set<string> _compatTable;
30 /** \return Whether \a lhs is compatible with \a rhs. */
31 static bool compatible( const zypp::Arch & lhs, const zypp::Arch & rhs )
33 if ( lhs == zypp::Arch_noarch )
36 if ( _compatTable.empty() )
39 #define DEF_COMPAT(L,R) _compatTable.insert( #L "|" #R )
40 DEF_COMPAT( noarch, i386 );
41 DEF_COMPAT( noarch, i486 );
42 DEF_COMPAT( i386, i486 );
43 DEF_COMPAT( noarch, i586 );
44 DEF_COMPAT( i386, i586 );
45 DEF_COMPAT( i486, i586 );
46 DEF_COMPAT( noarch, i686 );
47 DEF_COMPAT( i386, i686 );
48 DEF_COMPAT( i486, i686 );
49 DEF_COMPAT( i586, i686 );
50 DEF_COMPAT( noarch, athlon );
51 DEF_COMPAT( i386, athlon );
52 DEF_COMPAT( i486, athlon );
53 DEF_COMPAT( i586, athlon );
54 DEF_COMPAT( i686, athlon );
55 DEF_COMPAT( noarch, x86_64 );
56 DEF_COMPAT( i386, x86_64 );
57 DEF_COMPAT( i486, x86_64 );
58 DEF_COMPAT( i586, x86_64 );
59 DEF_COMPAT( i686, x86_64 );
60 DEF_COMPAT( athlon, x86_64 );
62 DEF_COMPAT( noarch, s390 );
63 DEF_COMPAT( noarch, s390x );
64 DEF_COMPAT( s390, s390x );
66 DEF_COMPAT( noarch, ppc );
67 DEF_COMPAT( noarch, ppc64 );
68 DEF_COMPAT( ppc, ppc64 );
70 DEF_COMPAT( noarch, ia64 );
74 return _compatTable.find( lhs.asString()+"|"+rhs.asString() )
75 != _compatTable.end();
79 set<string> CompatTable::_compatTable;
81 /////////////////////////////////////////////////////////////////
83 ///////////////////////////////////////////////////////////////////
85 ///////////////////////////////////////////////////////////////////
87 { /////////////////////////////////////////////////////////////////
89 ///////////////////////////////////////////////////////////////////
90 #define DEF_BUILTIN(A) const Arch Arch_##A( #A )
92 DEF_BUILTIN( noarch );
94 DEF_BUILTIN( x86_64 );
95 DEF_BUILTIN( athlon );
101 DEF_BUILTIN( s390x );
104 DEF_BUILTIN( ppc64 );
110 ///////////////////////////////////////////////////////////////////
112 ///////////////////////////////////////////////////////////////////
114 // METHOD NAME : Arch::Arch
115 // METHOD TYPE : Ctor
117 Arch::Arch( const std::string & rhs )
121 ///////////////////////////////////////////////////////////////////
123 // METHOD NAME : Arch::compatibleWith
124 // METHOD TYPE : bool
126 bool Arch::compatibleWith( const Arch & rhs ) const
128 return CompatTable::compatible( *this, rhs );
131 /////////////////////////////////////////////////////////////////
133 ///////////////////////////////////////////////////////////////////