40 void _doSplit( IdString & _ident, ResKind & _kind, IdString & _name )
54 _ident = IdString(
str::form(
"%s:%s", _kind.c_str(), _ident.c_str() ) );
59 _name = IdString( ::strchr( _ident.c_str(),
':' )+1 );
70 { _doSplit( _ident, _kind, _name ); }
74 { _doSplit( _ident, _kind, _name ); }
78 { _doSplit( _ident, _kind, _name ); }
83 { _doSplit( _ident, _kind, _name ); }
88 { _doSplit( _ident, _kind, _name ); }
95 const char * sep = ::strchr( ident_r,
':' );
100 if ( sep-ident_r >= 4 )
102 switch ( ident_r[3] )
104 #define OUTS(K,S) if ( !::strncmp( ident_r, ResKind::K.c_str(), S ) && ident_r[S] == ':' ) ret = ResKind::K
106 case 'c':
OUTS( patch, 5 );
break;
107 case 'd':
OUTS( product, 7 );
break;
108 case 'k':
OUTS( package, 7 );
break;
109 case 'p':
OUTS( srcpackage, 10 );
break;
110 case 't':
OUTS( pattern, 7 );
break;
126 #define NO_SOLVABLE_RETURN( VAL ) \
127 ::_Solvable * _solvable( get() ); \
128 if ( ! _solvable ) return VAL
138 ::_Solvable * nextS(
myPool().getSolvable( next ) );
139 if ( nextS && nextS->repo == _solvable->repo )
173 const char * s = ::solvable_lookup_str( _solvable, attr.
id() );
174 return s ? s : std::string();
183 s = ::solvable_lookup_str_poollang( _solvable, attr.
id() );
188 if ( (s = ::solvable_lookup_str_lang( _solvable, attr.
id(), l.code().c_str(), 0 )) )
191 s = ::solvable_lookup_str_lang( _solvable, attr.
id(), 0, 0 );
193 return s ? s : std::string();
199 return ::solvable_lookup_num( _solvable, attr.
id(), 0 );
205 return ::solvable_lookup_bool( _solvable, attr.
id() );
211 return ::solvable_lookup_id( _solvable, attr.
id() );
218 const char * s = ::solvable_lookup_checksum( _solvable, attr.
id(), &chksumtype );
221 switch ( chksumtype )
227 return CheckSum( std::string(), s );
233 inline Pathname lookupDatadirIn(
Repository repor_r )
235 static const sat::SolvAttr susetagsDatadir(
"susetags:datadir" );
240 if ( ! datadir.empty() )
241 ret = datadir.begin().asString();
245 if ( ! datadir.empty() )
246 ret = datadir.begin().asString();
258 char * file = ::solvable_get_location( _solvable, &medianr );
265 switch (
repository().info().type().toEnum() )
270 if ( ! path.empty() )
299 switch ( _solvable->arch )
308 const char * sep = ::strchr( ident,
':' );
315 if ( sep-ident >= 4 )
319 #define OUTS(K,S) if ( !::strncmp( ident, ResKind::K.c_str(), S ) ) return ResKind::K
321 case 'c':
OUTS( patch, 5 );
break;
322 case 'd':
OUTS( product, 7 );
break;
323 case 'k':
OUTS( package, 7 );
break;
324 case 'p':
OUTS( srcpackage, 10 );
break;
325 case 't':
OUTS( pattern, 7 );
break;
331 return ResKind( std::string( ident, sep-ident ) );
339 switch ( _solvable->arch )
351 return( ::strchr( ident,
':' ) == 0 );
356 unsigned ksize = ::strlen( kind );
357 return( ::strncmp( ident, kind, ksize ) == 0
358 && ident[ksize] ==
':' );
365 const char * sep = ::strchr( ident,
':' );
366 return( sep ? sep+1 : ident );
372 return Edition( _solvable->evr );
378 switch ( _solvable->arch )
397 return IdString( _solvable->vendor );
419 return offs_r ?
Capabilities( idarraydata_r + offs_r ) : Capabilities();
424 return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
429 return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
434 return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
439 return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
444 return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
449 return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
454 return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
459 return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
465 ::Offset offs = _solvable->requires;
478 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
492 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
494 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
495 value[value.size()-1] =
'\0';
496 ret.insert(
Capability( value, caprep.op(), caprep.ed() ) );
515 ::_Solvable * rhssolvable( rhs.
get() );
516 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
526 int invokeOnEachSupportedLocale(
Capability cap_r,
function<
bool (
const Locale &)> fnc_r )
531 switch ( detail.capRel() )
537 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
540 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
548 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
550 return ( !fnc_r || fnc_r(
Locale(
IdString(detail.rhs().id()) ) ) ) ? 1 : -1;
567 inline int invokeOnEachSupportedLocale( Capabilities cap_r,
function<
bool (
const Locale &)> fnc_r )
570 for_( cit, cap_r.begin(), cap_r.end() )
572 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
586 bool operator()(
const Locale & locale_r )
const
605 return invokeOnEachSupportedLocale(
supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
610 if ( locales_r.empty() )
613 return invokeOnEachSupportedLocale(
supplements(), NoMatchIn(locales_r) ) < 0;
622 functor::Collector( std::inserter( locales_r, locales_r.begin() ) ) );
633 return str << (obj.
isSystem() ?
"systemSolvable" :
"noSolvable" );
635 return str <<
"(" << obj.
id() <<
")"
637 <<
'-' << obj.
edition() <<
'.' << obj.
arch() <<
"("
651 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]