43 void _doSplit( IdString & _ident, ResKind & _kind, IdString & _name )
57 _ident = IdString(
str::form(
"%s:%s", _kind.c_str(), _ident.c_str() ) );
62 _name = IdString( ::strchr( _ident.c_str(),
':' )+1 );
74 { _doSplit( _ident, _kind, _name ); }
78 { _doSplit( _ident, _kind, _name ); }
82 { _doSplit( _ident, _kind, _name ); }
87 { _doSplit( _ident, _kind, _name ); }
92 { _doSplit( _ident, _kind, _name ); }
109 #define NO_SOLVABLE_RETURN( VAL ) \
110 detail::CSolvable * _solvable( get() ); \
111 if ( ! _solvable ) return VAL
122 if ( nextS && nextS->repo == _solvable->repo )
133 const char * s = ::solvable_lookup_str( _solvable, attr.
id() );
134 return s ? s : std::string();
143 s = ::solvable_lookup_str_poollang( _solvable, attr.
id() );
149 if ( (s = ::solvable_lookup_str_lang( _solvable, attr.
id(), l.c_str(), 0 )) )
153 s = ::solvable_lookup_str_lang( _solvable, attr.
id(), 0, 0 );
155 return s ? s : std::string();
161 return ::solvable_lookup_num( _solvable, attr.
id(), 0 );
167 return ::solvable_lookup_num( _solvable, attr.
id(), notfound_r );
173 return ::solvable_lookup_bool( _solvable, attr.
id() );
179 return ::solvable_lookup_id( _solvable, attr.
id() );
186 const char * s = ::solvable_lookup_checksum( _solvable, attr.
id(), &chksumtype );
189 switch ( chksumtype )
198 return CheckSum( std::string(), s );
204 inline Pathname lookupDatadirIn(
Repository repor_r )
206 static const SolvAttr susetagsDatadir(
"susetags:datadir" );
211 if ( ! datadir.empty() )
212 ret = datadir.begin().asString();
215 LookupAttr datadir( susetagsDatadir, repor_r );
216 if ( ! datadir.empty() )
217 ret = datadir.begin().asString();
229 const char * file = ::solvable_lookup_location( _solvable, &medianr );
238 switch (
repository().info().type().toEnum() )
243 if ( ! path.empty() )
279 switch ( _solvable->arch )
294 const char * sep = ::strchr( ident,
':' );
299 return ResKind( std::string( ident, sep-ident ) );
307 switch ( _solvable->arch )
319 return( ::strchr( ident,
':' ) == 0 );
324 unsigned ksize = ::strlen( kind );
325 return( ::strncmp( ident, kind, ksize ) == 0
326 && ident[ksize] ==
':' );
333 const char * sep = ::strchr( ident,
':' );
334 return( sep ? sep+1 : ident );
340 return Edition( _solvable->evr );
346 switch ( _solvable->arch )
360 return IdString( _solvable->vendor );
400 if ( isKind<Package>() )
402 if ( isKind<Patch>() )
463 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
471 return offs_r ?
Capabilities( idarraydata_r + offs_r ) : Capabilities();
479 return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
484 return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
489 return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
494 return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
499 return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
504 return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
509 return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
514 return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
520 ::Offset offs = _solvable->requires;
533 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
547 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
549 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
550 value[value.size()-1] =
'\0';
551 ret.insert(
Capability( value, caprep.op(), caprep.ed() ) );
564 int invokeOnEachSupportedLocale(
Capability cap_r,
function<
bool (
const Locale &)> fnc_r )
569 switch ( detail.capRel() )
575 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
578 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
586 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
588 return ( !fnc_r || fnc_r(
Locale(
IdString(detail.rhs().id()) ) ) ) ? 1 : -1;
605 inline int invokeOnEachSupportedLocale( Capabilities cap_r,
function<
bool (Locale)> fnc_r )
608 for_( cit, cap_r.begin(), cap_r.end() )
610 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
624 bool operator()(
const Locale & locale_r )
const
643 return invokeOnEachSupportedLocale(
supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
648 if ( locales_r.empty() )
651 return invokeOnEachSupportedLocale(
supplements(), NoMatchIn(locales_r) ) < 0;
660 invokeOnEachSupportedLocale(
supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
722 if ( ret.empty() && isKind<Product>() )
725 std::string riname(
name() );
738 if ( isKind<Product>() )
741 std::string riname(
name() );
754 return str << (obj.
isSystem() ?
"systemSolvable" :
"noSolvable" );
756 return str <<
"(" << obj.
id() <<
")"
758 <<
'-' << obj.
edition() <<
'.' << obj.
arch() <<
"("
767 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
Repository repository() const
The Repository this Solvable belongs to.
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
bool isPtfPackage() const
Subset of isPtf (provides ptfPackageToken).
bool isPtf() const
Whether this solvable belongs to a PTF (provides ptfMasterToken or ptfPackageToken).
RepoInfo info() const
Return any associated RepoInfo.
bool isPtfMaster(const Solvable &solv_r) const
int IdType
Generic Id type.
static const IdString ptfMasterToken
Indicator provides ptf()
A Solvable object within the sat Pool.
Arch arch() const
The architecture.
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).
Date buildtime() const
The items build time.
static const ResKind package
std::string alias() const
Short unique string to identify a repo.
IdString ident() const
The identifier.
const LocaleSet & _locales
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.
static const SolvAttr installtime
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
ByteCount downloadSize() const
Download size.
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects...
What is known about a repository.
static const ResKind srcpackage
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
Access to the sat-pools string space.
Common Platform Enumearation (2.3) See http://cpe.mitre.org/ for more information on the Common Platf...
#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.
bool identIsAutoInstalled() const
Whether an installed solvable with the same ident is flagged as AutoInstalled.
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
static const SolvAttr insnotify
static CheckSum md5(const std::string &checksum)
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
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.
std::string name() const
The name (without any ResKind prefix).
static const IdString ptfPackageToken
Indicator provides ptf-package()
Store and operate on date (time_t).
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
RepoInfo repoInfo() const
The repositories RepoInfo.
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
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...
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
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.
bool isPtfMaster() const
Subset of isPtf (provides ptfMasterToken).
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
Return the supported locales.
Date installtime() const
The items install time (false if not installed).
bool isPtfPackage(const Solvable &solv_r) const
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
bool isBlacklisted() const
Whether this solvable is blacklisted (retracted,ptf,...).
std::ostream & dumpOn(std::ostream &str, const Solvable &obj)
static const SolvAttr updateStatus
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)
static const SolvAttr delnotify
Capabilities enhances() const
'Language[_Country]' codes.
static const SolvAttr installsize
const_iterator end() const
Iterator pointing behind the last Capability.
static constexpr NoThrowType noThrow
Indicator argument for non-trowing ctor.
std::unordered_set< Capability > CapabilitySet
IdString vendor() const
The vendor.
ResKind kind() const
The Solvables ResKind.
const char * c_str() const
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
static const SolvAttr buildtime
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Solvable()
Default ctor creates noSolvable.
Capabilities conflicts() const
static const SolvAttr cpeid
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
bool isRetracted() const
Whether this solvable is retracted (provides retractedToken).
static const Repository noRepository
Represents no Repository.
bool isRetracted(const Solvable &solv_r) const
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj)
Capabilities prerequires() const
bool isOnSystemByAuto(IdString ident_r) const
bool hasLicense() const
Whether there is a license associated with the repo.
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
bool isSystemRepo(CRepo *repo_r) const
static const SolvAttr description
std::string delnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for uninstall (opt.
static const IdType noId(0)
ByteCount installSize() const
Installed (unpacked) size.
static CheckSum sha384(const std::string &checksum)
Capabilities requires() const
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
static const SolvAttr eula
CpeId cpeId() const
The solvables CpeId if available.
static CheckSum sha1(const std::string &checksum)
static const SolvAttr summary
IdType id() const
Expert backdoor.
static const IdString retractedToken
Indicator provides retracted-patch-package()
static const SolvAttr distribution
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
static CheckSum sha512(const std::string &checksum)
std::string distribution() const
The distribution string.
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.
std::unordered_set< Locale > LocaleSet
Edition edition() const
The edition (version-release).
bool onSystemByAuto() const
Whether this is known to be automatically installed (as dependency of a user request package)...
Capabilities obsoletes() const
bool isMultiversion(const Solvable &solv_r) const
static const SolvAttr medianr