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 const char * file = ::solvable_lookup_location( _solvable, &medianr );
267 switch (
repository().info().type().toEnum() )
272 if ( ! path.empty() )
301 switch ( _solvable->arch )
310 const char * sep = ::strchr( ident,
':' );
317 if ( sep-ident >= 4 )
321 #define OUTS(K,S) if ( !::strncmp( ident, ResKind::K.c_str(), S ) ) return ResKind::K
323 case 'c':
OUTS( patch, 5 );
break;
324 case 'd':
OUTS( product, 7 );
break;
325 case 'k':
OUTS( package, 7 );
break;
326 case 'p':
OUTS( srcpackage, 10 );
break;
327 case 't':
OUTS( pattern, 7 );
break;
333 return ResKind( std::string( ident, sep-ident ) );
341 switch ( _solvable->arch )
353 return( ::strchr( ident,
':' ) == 0 );
358 unsigned ksize = ::strlen( kind );
359 return( ::strncmp( ident, kind, ksize ) == 0
360 && ident[ksize] ==
':' );
367 const char * sep = ::strchr( ident,
':' );
368 return( sep ? sep+1 : ident );
374 return Edition( _solvable->evr );
380 switch ( _solvable->arch )
399 return IdString( _solvable->vendor );
421 return offs_r ?
Capabilities( idarraydata_r + offs_r ) : Capabilities();
426 return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
431 return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
436 return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
441 return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
446 return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
451 return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
456 return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
461 return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
467 ::Offset offs = _solvable->requires;
480 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
494 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
496 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
497 value[value.size()-1] =
'\0';
498 ret.insert(
Capability( value, caprep.op(), caprep.ed() ) );
517 ::_Solvable * rhssolvable( rhs.
get() );
518 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
528 int invokeOnEachSupportedLocale(
Capability cap_r,
function<
bool (
const Locale &)> fnc_r )
533 switch ( detail.capRel() )
539 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
542 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
550 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
552 return ( !fnc_r || fnc_r(
Locale(
IdString(detail.rhs().id()) ) ) ) ? 1 : -1;
569 inline int invokeOnEachSupportedLocale( Capabilities cap_r,
function<
bool (
const Locale &)> fnc_r )
572 for_( cit, cap_r.begin(), cap_r.end() )
574 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
588 bool operator()(
const Locale & locale_r )
const
607 return invokeOnEachSupportedLocale(
supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
612 if ( locales_r.empty() )
615 return invokeOnEachSupportedLocale(
supplements(), NoMatchIn(locales_r) ) < 0;
624 functor::Collector( std::inserter( locales_r, locales_r.begin() ) ) );
635 return str << (obj.
isSystem() ?
"systemSolvable" :
"noSolvable" );
637 return str <<
"(" << obj.
id() <<
")"
639 <<
'-' << obj.
edition() <<
'.' << obj.
arch() <<
"("
653 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]