41 void _doSplit( IdString & _ident, ResKind & _kind, IdString & _name )
55 _ident = IdString(
str::form(
"%s:%s", _kind.c_str(), _ident.c_str() ) );
60 _name = IdString( ::strchr( _ident.c_str(),
':' )+1 );
71 { _doSplit( _ident, _kind, _name ); }
75 { _doSplit( _ident, _kind, _name ); }
79 { _doSplit( _ident, _kind, _name ); }
84 { _doSplit( _ident, _kind, _name ); }
89 { _doSplit( _ident, _kind, _name ); }
96 const char * sep = ::strchr( ident_r,
':' );
101 if ( sep-ident_r >= 4 )
103 switch ( ident_r[3] )
105 #define OUTS(K,S) if ( !::strncmp( ident_r, ResKind::K.c_str(), S ) && ident_r[S] == ':' ) ret = ResKind::K
107 case 'c':
OUTS( patch, 5 );
break;
108 case 'd':
OUTS( product, 7 );
break;
109 case 'k':
OUTS( package, 7 );
break;
110 case 'p':
OUTS( srcpackage, 10 );
break;
111 case 't':
OUTS( pattern, 7 );
break;
127 #define NO_SOLVABLE_RETURN( VAL ) \
128 ::_Solvable * _solvable( get() ); \
129 if ( ! _solvable ) return VAL
139 ::_Solvable * nextS(
myPool().getSolvable( next ) );
140 if ( nextS && nextS->repo == _solvable->repo )
174 const char * s = ::solvable_lookup_str( _solvable, attr.
id() );
175 return s ? s : std::string();
184 s = ::solvable_lookup_str_poollang( _solvable, attr.
id() );
189 if ( (s = ::solvable_lookup_str_lang( _solvable, attr.
id(), l.code().c_str(), 0 )) )
192 s = ::solvable_lookup_str_lang( _solvable, attr.
id(), 0, 0 );
194 return s ? s : std::string();
200 return ::solvable_lookup_num( _solvable, attr.
id(), 0 );
206 return ::solvable_lookup_bool( _solvable, attr.
id() );
212 return ::solvable_lookup_id( _solvable, attr.
id() );
219 const char * s = ::solvable_lookup_checksum( _solvable, attr.
id(), &chksumtype );
222 switch ( chksumtype )
228 return CheckSum( std::string(), s );
234 inline Pathname lookupDatadirIn(
Repository repor_r )
236 static const sat::SolvAttr susetagsDatadir(
"susetags:datadir" );
241 if ( ! datadir.empty() )
242 ret = datadir.begin().asString();
246 if ( ! datadir.empty() )
247 ret = datadir.begin().asString();
259 const char * file = ::solvable_lookup_location( _solvable, &medianr );
268 switch (
repository().info().type().toEnum() )
273 if ( ! path.empty() )
302 switch ( _solvable->arch )
311 const char * sep = ::strchr( ident,
':' );
318 if ( sep-ident >= 4 )
322 #define OUTS(K,S) if ( !::strncmp( ident, ResKind::K.c_str(), S ) ) return ResKind::K
324 case 'c':
OUTS( patch, 5 );
break;
325 case 'd':
OUTS( product, 7 );
break;
326 case 'k':
OUTS( package, 7 );
break;
327 case 'p':
OUTS( srcpackage, 10 );
break;
328 case 't':
OUTS( pattern, 7 );
break;
334 return ResKind( std::string( ident, sep-ident ) );
342 switch ( _solvable->arch )
354 return( ::strchr( ident,
':' ) == 0 );
359 unsigned ksize = ::strlen( kind );
360 return( ::strncmp( ident, kind, ksize ) == 0
361 && ident[ksize] ==
':' );
368 const char * sep = ::strchr( ident,
':' );
369 return( sep ? sep+1 : ident );
375 return Edition( _solvable->evr );
381 switch ( _solvable->arch )
400 return IdString( _solvable->vendor );
422 return offs_r ?
Capabilities( idarraydata_r + offs_r ) : Capabilities();
427 return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
432 return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
437 return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
442 return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
447 return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
452 return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
457 return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
462 return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
468 ::Offset offs = _solvable->requires;
481 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
495 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
497 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
498 value[value.size()-1] =
'\0';
499 ret.insert(
Capability( value, caprep.op(), caprep.ed() ) );
528 ::_Solvable * rhssolvable( rhs.
get() );
529 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
539 int invokeOnEachSupportedLocale(
Capability cap_r,
function<
bool (
const Locale &)> fnc_r )
544 switch ( detail.capRel() )
550 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
553 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
561 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
563 return ( !fnc_r || fnc_r(
Locale(
IdString(detail.rhs().id()) ) ) ) ? 1 : -1;
580 inline int invokeOnEachSupportedLocale( Capabilities cap_r,
function<
bool (
const Locale &)> fnc_r )
583 for_( cit, cap_r.begin(), cap_r.end() )
585 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
599 bool operator()(
const Locale & locale_r )
const
618 return invokeOnEachSupportedLocale(
supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
623 if ( locales_r.empty() )
626 return invokeOnEachSupportedLocale(
supplements(), NoMatchIn(locales_r) ) < 0;
635 functor::Collector( std::inserter( locales_r, locales_r.begin() ) ) );
646 return str << (obj.
isSystem() ?
"systemSolvable" :
"noSolvable" );
648 return str <<
"(" << obj.
id() <<
")"
650 <<
'-' << obj.
edition() <<
'.' << obj.
arch() <<
"("
664 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
Repository repository() const
The Repository this Solvable belongs to.
static const Locale noCode
No or empty code.
RepoInfo info() const
Return any associated RepoInfo.
bool isSystemRepo(::_Repo *repo_r) const
int IdType
Generic Id type.
A Solvable object within the sat Pool.
Capabilities recommends() const
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable.
Container of Capability (currently read only).
static const ResKind package
std::string alias() const
Short unique string to identify a repo.
IdString ident() const
The identifier.
const LocaleSet & _locales
Enumeration class of dependency types.
Helper providing more detailed information about a Capability.
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Store and operate with byte count.
Lightweight attribute value lookup.
RAII writing a nodes start/end tag.
#define NO_SOLVABLE_RETURN(VAL)
bool supportsLocales() const
Whether this Solvable claims to support locales.
Capabilities supplements() const
std::string lookupStrAttribute(const SolvAttr &attr) const
returns the string attribute value for attr or an empty string if it does not exists.
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
bool isSystem() const
Return whether this Solvable belongs to the system repo.
static ResKind explicitKind(IdString ident_r)
Return an idents explicit kind prefix, or ResKind() if none.
std::ostream & operator<<(std::ostream &str, const Solvable &obj)
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Capabilities suggests() const
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects...
::_Solvable * get() const
Expert backdoor.
static const ResKind srcpackage
Access to the sat-pools string space.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Edition represents [epoch:]version[-release]
const Arch Arch_noarch(_noarch())
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
std::tr1::unordered_set< Capability > CapabilitySet
static CheckSum md5(const std::string &checksum)
Capabilities _getCapabilities(detail::IdType *idarraydata_r,::Offset offs_r)
Capabilities provides() const
static const Solvable noSolvable
Represents no Solvable.
detail::IdType lookupIdAttribute(const SolvAttr &attr) const
returns the id attribute value for attr or detail::noId if it does not exists.
std::string asString() const
Conversion to std::string
std::string asUserString() const
User string.
False false_c()
Convenience function for creating a False.
Locale fallback() const
Return a fallback locale for this locale, when giving up, returns empty Locale()
bool isMultiversion(IdString ident_r) const
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Lightweight repository attribute value lookup.
CheckSum lookupCheckSumAttribute(const SolvAttr &attr) const
returns the CheckSum attribute value for attr or an empty CheckSum if ir does not exist...
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
bool supportsRequestedLocales() const
Whether this Solvable supports at least one requested locale.
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
bool isOnSystemByUser(IdString ident_r) const
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
unsigned long long lookupNumAttribute(const SolvAttr &attr) const
returns the numeric attribute value for attr or 0 if it does not exists.
LocaleSet getSupportedLocales() const
std::tr1::unordered_set< Locale > LocaleSet
std::ostream & dumpOn(std::ostream &str, const Solvable &obj)
static const SolvAttr checksum
static PoolImpl & myPool()
static const SolvAttr downloadsize
const char * c_str() const
Conversion to const char *
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
static CheckSum sha256(const std::string &checksum)
Capabilities enhances() const
std::string form(const char *format,...)
Printf style construction of std::string.
const_iterator end() const
Iterator pointing behind the last Capability.
const char * c_str() const
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Solvable()
Default ctor creates noSolvable.
Capabilities conflicts() const
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
static const Repository noRepository
Represents no Repository.
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj)
Capabilities prerequires() const
static const IdType noId(0)
::_Solvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
Capabilities operator[](Dep which_r) const
Capabilities requires() const
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
for_use_in_switch inSwitch() const
Enumarator provided for use in switch statement.
static CheckSum sha1(const std::string &checksum)
IdType id() const
Expert backdoor.
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
const_iterator begin() const
Iterator pointing to the first Capability.
Capabilities obsoletes() const
bool identical(Solvable rhs) const
Test whether two Solvables have the same content.