128 {
return ! ( lhs == rhs ); }
152 #define DEF_BUILTIN(A) \
153 namespace { static inline const IdString & _##A () { static IdString __str(#A); return __str; } } \
154 const Arch Arch_##A( _##A() )
238 typedef Arch::CompatEntry CompatEntry;
241 typedef std::unordered_set<CompatEntry> Set;
242 typedef Set::iterator iterator;
243 typedef Set::const_iterator const_iterator;
246 static ArchCompatSet & instance()
248 static ArchCompatSet _instance;
255 const Arch::CompatEntry & assertDef(
const std::string & archStr_r )
256 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r ) ).first; }
258 const Arch::CompatEntry & assertDef( IdString archStr_r )
259 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r ) ).first; }
261 const_iterator begin()
const
264 const_iterator end()
const
269 int operator()(
const CompatEntry & lhs,
const CompatEntry & rhs )
const
270 {
return lhs._idBit.value() < rhs._idBit.value(); }
273 std::ostream &
dumpOn( std::ostream & str )
const
275 str <<
"ArchCompatSet:";
277 ov.sort( DumpOnCompare() );
278 for_( it, ov.begin(), ov.end() )
280 str << endl <<
' ' << *it;
292 _compatSet.insert( Arch::CompatEntry( _noarch(), 0 ) );
299 defCompatibleWith( _i386(), _noarch() );
300 defCompatibleWith( _i486(), _noarch(),_i386() );
301 defCompatibleWith( _i586(), _noarch(),_i386(),_i486() );
302 defCompatibleWith( _i686(), _noarch(),_i386(),_i486(),_i586() );
303 defCompatibleWith( _athlon(), _noarch(),_i386(),_i486(),_i586(),_i686() );
304 defCompatibleWith( _x86_64(), _noarch(),_i386(),_i486(),_i586(),_i686(),_athlon() );
306 defCompatibleWith( _pentium3(), _noarch(),_i386(),_i486(),_i586(),_i686() );
307 defCompatibleWith( _pentium4(), _noarch(),_i386(),_i486(),_i586(),_i686(),_pentium3() );
309 defCompatibleWith( _ia64(), _noarch(),_i386(),_i486(),_i586(),_i686() );
311 defCompatibleWith( _s390(), _noarch() );
312 defCompatibleWith( _s390x(), _noarch(),_s390() );
314 defCompatibleWith( _ppc(), _noarch() );
315 defCompatibleWith( _ppc64(), _noarch(),_ppc() );
316 defCompatibleWith( _ppc64p7(), _noarch(),_ppc(),_ppc64() );
318 defCompatibleWith( _ppc64le(), _noarch() );
320 defCompatibleWith( _alpha(), _noarch() );
321 defCompatibleWith( _alphaev5(), _noarch(),_alpha() );
322 defCompatibleWith( _alphaev56(), _noarch(),_alpha(),_alphaev5() );
323 defCompatibleWith( _alphapca56(), _noarch(),_alpha(),_alphaev5(),_alphaev56() );
324 defCompatibleWith( _alphaev6(), _noarch(),_alpha(),_alphaev5(),_alphaev56(),_alphapca56() );
325 defCompatibleWith( _alphaev67(), _noarch(),_alpha(),_alphaev5(),_alphaev56(),_alphapca56(),_alphaev6() );
327 defCompatibleWith( _sparc(), _noarch() );
328 defCompatibleWith( _sparcv8(), _noarch(),_sparc() );
329 defCompatibleWith( _sparcv9(), _noarch(),_sparc(),_sparcv8() );
330 defCompatibleWith( _sparcv9v(), _noarch(),_sparc(),_sparcv8(),_sparcv9() );
332 defCompatibleWith( _sparc64(), _noarch(),_sparc(),_sparcv8(),_sparcv9() );
333 defCompatibleWith( _sparc64v(), _noarch(),_sparc(),_sparcv8(),_sparcv9(),_sparcv9v(),_sparc64() );
335 defCompatibleWith( _armv3l(), _noarch() );
336 defCompatibleWith( _armv4l(), _noarch(),_armv3l() );
337 defCompatibleWith( _armv4tl(), _noarch(),_armv3l(),_armv4l() );
338 defCompatibleWith( _armv5l(), _noarch(),_armv3l(),_armv4l(),_armv4tl() );
339 defCompatibleWith( _armv5tel(), _noarch(),_armv3l(),_armv4l(),_armv4tl(),_armv5l() );
340 defCompatibleWith( _armv5tejl(), _noarch(),_armv3l(),_armv4l(),_armv4tl(),_armv5l(),_armv5tel() );
341 defCompatibleWith( _armv6l(), _noarch(),_armv3l(),_armv4l(),_armv4tl(),_armv5l(),_armv5tel(),_armv5tejl() );
342 defCompatibleWith( _armv6hl(), _noarch() );
343 defCompatibleWith( _armv7l(), _noarch(),_armv3l(),_armv4l(),_armv4tl(),_armv5l(),_armv5tel(),_armv5tejl(),_armv6l() );
344 defCompatibleWith( _armv7hl(), _noarch(),_armv6hl() );
345 defCompatibleWith( _armv7nhl(), _noarch(),_armv7hl() );
346 defCompatibleWith( _armv7thl(), _noarch(),_armv7hl() );
347 defCompatibleWith( _armv7tnhl(), _noarch(),_armv7hl(),_armv7nhl(),_armv7thl() );
348 defCompatibleWith( _aarch64(), _noarch() );
350 defCompatibleWith( _sh3(), _noarch() );
352 defCompatibleWith( _sh4(), _noarch() );
353 defCompatibleWith( _sh4a(), _noarch(),_sh4() );
355 defCompatibleWith( _m68k(), _noarch() );
357 defCompatibleWith( _mips(), _noarch() );
358 defCompatibleWith( _mipsel(), _noarch() );
359 defCompatibleWith( _mips64(), _noarch() );
360 defCompatibleWith( _mips64el(), _noarch() );
378 ZYPP_THROW( Exception(
"Need more bits to encode architectures.") );
387 const CompatEntry & assertCompatSetEntry( IdString archStr_r )
388 {
return *
_compatSet.insert( Arch::CompatEntry( archStr_r, nextIdBit() ) ).first; }
392 void defCompatibleWith( IdString targetArch_r,
394 IdString arch1_r = IdString(),
395 IdString arch2_r = IdString(),
396 IdString arch3_r = IdString(),
397 IdString arch4_r = IdString(),
398 IdString arch5_r = IdString(),
399 IdString arch6_r = IdString(),
400 IdString arch7_r = IdString(),
401 IdString arch8_r = IdString(),
402 IdString arch9_r = IdString() )
404 const CompatEntry & target( assertCompatSetEntry( targetArch_r ) );
405 target.addCompatBit( assertCompatSetEntry( arch0_r )._idBit );
406 #define SETARG(N) if ( arch##N##_r.empty() ) return; target.addCompatBit( assertCompatSetEntry( arch##N##_r )._idBit )
435 : _entry( &ArchCompatSet::instance().assertDef( _noarch() ) )
439 : _entry( &ArchCompatSet::instance().assertDef(
IdString(id_r) ) )
443 : _entry( &ArchCompatSet::instance().assertDef( idstr_r ) )
447 : _entry( &ArchCompatSet::instance().assertDef( str_r ) )
451 : _entry( &ArchCompatSet::instance().assertDef( cstr_r ) )
520 if ( cset.size() > 2 )
522 return *(++cset.rbegin());
544 for ( ArchCompatSet::const_iterator it = ArchCompatSet::instance().begin();
545 it != ArchCompatSet::instance().end(); ++it )
547 if ( it->compatibleWith( *targetArch_r.
_entry ) )
549 ret.insert(
Arch(*it) );
bool compatibleWith(const Arch &targetArch_r) const
Compatibility relation.
int compare(const CompatEntry &rhs) const
compare by score, then archStr.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
const std::string & asString() const
IdType id() const
Expert backdoor.
std::set< Arch, CompareByGT< Arch > > CompatSet
Reversed arch order, best Arch first.
const Arch Arch_empty(IdString::Empty)
IdString idStr() const
String representation of Arch.
Access to the sat-pools string space.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
CompatEntry(const std::string &archStr_r, CompatBits::IntT idBit_r=1)
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
int compare(const Arch &rhs) const
Arch comparison.
const CompatEntry * _entry
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
static const IdString Empty
Empty string.
sat::detail::IdType IdType
std::ostream & operator<<(std::ostream &str, const Arch::CompatEntry &obj)
void addCompatBit(const CompatBits &idBit_r) const
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
static const unsigned size
bit::BitField< uint64_t > CompatBits
Bitfield for architecture IDs and compatBits relation.
std::string numstring(char n, int w=0)
static CompatSet compatSet(const Arch &targetArch_r)
Return a set of all Arch's compatibleWith a targetArch_r.
TInt value() const
Return the value.
bool operator!=(const Arch::CompatEntry &lhs, const Arch::CompatEntry &rhs)
Arch()
Default ctor Arc_noarch.
ZYPP_DEFINE_ID_HASHABLE(zypp::Arch::CompatEntry)
bool compatibleWith(const CompatEntry &targetEntry_r) const
Return whether this is compatible with targetEntry_r.
IdString::IdType id() const
bool isBuiltIn() const
Whether this is a buitin (or known) architecture.
bool operator==(const Arch::CompatEntry &lhs, const Arch::CompatEntry &rhs)
CompatEntry(IdString archStr_r, CompatBits::IntT idBit_r=1)
Holds an architecture ID and it's compatible relation.