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 ::_Solvable * _solvable( get() ); \
102 if ( ! _solvable ) return VAL
112 ::_Solvable * nextS(
myPool().getSolvable( next ) );
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 )
201 return CheckSum( std::string(), s );
207 inline Pathname lookupDatadirIn(
Repository repor_r )
209 static const sat::SolvAttr susetagsDatadir(
"susetags:datadir" );
214 if ( ! datadir.empty() )
215 ret = datadir.begin().asString();
219 if ( ! datadir.empty() )
220 ret = datadir.begin().asString();
232 const char * file = ::solvable_lookup_location( _solvable, &medianr );
241 switch (
repository().info().type().toEnum() )
246 if ( ! path.empty() )
275 switch ( _solvable->arch )
290 const char * sep = ::strchr( ident,
':' );
295 return ResKind( std::string( ident, sep-ident ) );
303 switch ( _solvable->arch )
315 return( ::strchr( ident,
':' ) == 0 );
320 unsigned ksize = ::strlen( kind );
321 return( ::strncmp( ident, kind, ksize ) == 0
322 && ident[ksize] ==
':' );
329 const char * sep = ::strchr( ident,
':' );
330 return( sep ? sep+1 : ident );
336 return Edition( _solvable->evr );
342 switch ( _solvable->arch )
361 return IdString( _solvable->vendor );
383 return offs_r ?
Capabilities( idarraydata_r + offs_r ) : Capabilities();
388 return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
393 return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
398 return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
403 return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
408 return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
413 return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
418 return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
423 return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
429 ::Offset offs = _solvable->requires;
442 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
456 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
458 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
459 value[value.size()-1] =
'\0';
460 ret.insert(
Capability( value, caprep.op(), caprep.ed() ) );
489 ::_Solvable * rhssolvable( rhs.
get() );
490 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
500 int invokeOnEachSupportedLocale(
Capability cap_r,
function<
bool (
const Locale &)> fnc_r )
505 switch ( detail.capRel() )
511 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
514 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
522 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
524 return ( !fnc_r || fnc_r(
Locale(
IdString(detail.rhs().id()) ) ) ) ? 1 : -1;
541 inline int invokeOnEachSupportedLocale( Capabilities cap_r,
function<
bool (
const Locale &)> fnc_r )
544 for_( cit, cap_r.begin(), cap_r.end() )
546 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
560 bool operator()(
const Locale & locale_r )
const
579 return invokeOnEachSupportedLocale(
supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
584 if ( locales_r.empty() )
587 return invokeOnEachSupportedLocale(
supplements(), NoMatchIn(locales_r) ) < 0;
596 functor::Collector( std::inserter( locales_r, locales_r.begin() ) ) );
607 return str << (obj.
isSystem() ?
"systemSolvable" :
"noSolvable" );
609 return str <<
"(" << obj.
id() <<
")"
611 <<
'-' << obj.
edition() <<
'.' << obj.
arch() <<
"("
625 #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.
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)
String related utilities and Regular expression matching.
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]
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 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
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.
Easy-to use interface to the ZYPP dependency resolver.
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.