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 ); }
100 #define NO_SOLVABLE_RETURN( VAL ) \
101 detail::CSolvable * _solvable( get() ); \
102 if ( ! _solvable ) return VAL
113 if ( nextS && nextS->repo == _solvable->repo )
147 const char * s = ::solvable_lookup_str( _solvable, attr.
id() );
148 return s ? s : std::string();
157 s = ::solvable_lookup_str_poollang( _solvable, attr.
id() );
162 if ( (s = ::solvable_lookup_str_lang( _solvable, attr.
id(), l.code().c_str(), 0 )) )
165 s = ::solvable_lookup_str_lang( _solvable, attr.
id(), 0, 0 );
167 return s ? s : std::string();
173 return ::solvable_lookup_num( _solvable, attr.
id(), 0 );
179 return ::solvable_lookup_bool( _solvable, attr.
id() );
185 return ::solvable_lookup_id( _solvable, attr.
id() );
192 const char * s = ::solvable_lookup_checksum( _solvable, attr.
id(), &chksumtype );
195 switch ( chksumtype )
204 return CheckSum( std::string(), s );
210 inline Pathname lookupDatadirIn(
Repository repor_r )
212 static const sat::SolvAttr susetagsDatadir(
"susetags:datadir" );
217 if ( ! datadir.empty() )
218 ret = datadir.begin().asString();
222 if ( ! datadir.empty() )
223 ret = datadir.begin().asString();
235 const char * file = ::solvable_lookup_location( _solvable, &medianr );
244 switch (
repository().info().type().toEnum() )
249 if ( ! path.empty() )
278 switch ( _solvable->arch )
293 const char * sep = ::strchr( ident,
':' );
298 return ResKind( std::string( ident, sep-ident ) );
306 switch ( _solvable->arch )
318 return( ::strchr( ident,
':' ) == 0 );
323 unsigned ksize = ::strlen( kind );
324 return( ::strncmp( ident, kind, ksize ) == 0
325 && ident[ksize] ==
':' );
332 const char * sep = ::strchr( ident,
':' );
333 return( sep ? sep+1 : ident );
339 return Edition( _solvable->evr );
345 switch ( _solvable->arch )
364 return IdString( _solvable->vendor );
386 return offs_r ?
Capabilities( idarraydata_r + offs_r ) : Capabilities();
391 return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
396 return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
401 return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
406 return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
411 return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
416 return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
421 return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
426 return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
432 ::Offset offs = _solvable->requires;
445 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
459 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
461 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
462 value[value.size()-1] =
'\0';
463 ret.insert(
Capability( value, caprep.op(), caprep.ed() ) );
493 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
503 int invokeOnEachSupportedLocale(
Capability cap_r,
function<
bool (
const Locale &)> fnc_r )
508 switch ( detail.capRel() )
514 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
517 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
525 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
527 return ( !fnc_r || fnc_r(
Locale(
IdString(detail.rhs().id()) ) ) ) ? 1 : -1;
544 inline int invokeOnEachSupportedLocale( Capabilities cap_r,
function<
bool (
const Locale &)> fnc_r )
547 for_( cit, cap_r.begin(), cap_r.end() )
549 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
563 bool operator()(
const Locale & locale_r )
const
582 return invokeOnEachSupportedLocale(
supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
587 if ( locales_r.empty() )
590 return invokeOnEachSupportedLocale(
supplements(), NoMatchIn(locales_r) ) < 0;
599 functor::Collector( std::inserter( locales_r, locales_r.begin() ) ) );
610 return str << (obj.
isSystem() ?
"systemSolvable" :
"noSolvable" );
612 return str <<
"(" << obj.
id() <<
")"
614 <<
'-' << obj.
edition() <<
'.' << obj.
arch() <<
"("
628 #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.
int IdType
Generic Id type.
A Solvable object within the sat Pool.
Capabilities recommends() const
detail::CSolvable * get() const
Expert backdoor.
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.
static ResKind explicitBuiltin(const char *str_r)
Return the builtin kind if str_r explicitly prefixed.
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.
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...
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]
::_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
CSolvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
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: label (alias or name)
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 CheckSum sha224(const std::string &checksum)
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
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
bool isSystemRepo(CRepo *repo_r) const
static const IdType noId(0)
static CheckSum sha384(const std::string &checksum)
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.
static CheckSum sha512(const std::string &checksum)
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.