28 #include <zypp-core/OnMediaLocation> 63 _name =
IdString( ::strchr( _ident.c_str(),
':' )+1 );
87 , _kind(
std::move( kind_r ))
92 , _kind(
std::move( kind_r ))
113 #define NO_SOLVABLE_RETURN( VAL ) \ 114 detail::CSolvable * _solvable( get() ); \ 115 if ( ! _solvable ) return VAL 126 if ( nextS && nextS->repo == _solvable->repo )
137 const char * s = ::solvable_lookup_str( _solvable,
attr.id() );
138 return s ? s : std::string();
147 s = ::solvable_lookup_str_poollang( _solvable,
attr.id() );
153 if ( (s = ::solvable_lookup_str_lang( _solvable,
attr.id(), l.c_str(), 0 )) )
157 s = ::solvable_lookup_str_lang( _solvable,
attr.id(), 0, 0 );
159 return s ? s : std::string();
165 return ::solvable_lookup_num( _solvable,
attr.id(), 0 );
171 return ::solvable_lookup_num( _solvable,
attr.id(), notfound_r );
177 return ::solvable_lookup_bool( _solvable,
attr.id() );
183 return ::solvable_lookup_id( _solvable,
attr.id() );
190 const char * s = ::solvable_lookup_checksum( _solvable,
attr.id(), &chksumtype );
193 switch ( chksumtype )
202 return CheckSum( std::string(), s );
210 static const SolvAttr susetagsDatadir(
"susetags:datadir" );
215 if ( ! datadir.empty() )
216 ret = datadir.begin().asString();
219 LookupAttr datadir( susetagsDatadir, repor_r );
220 if ( ! datadir.empty() )
221 ret = datadir.begin().asString();
232 unsigned medianr = 0;
233 const char * file = ::solvable_lookup_location( _solvable, &medianr );
242 switch (
repository().info().type().toEnum() )
247 if ( ! path.
empty() )
283 switch ( _solvable->arch )
298 const char * sep = ::strchr(
ident,
':' );
311 switch ( _solvable->arch )
323 return( ::strchr(
ident,
':' ) == 0 );
328 unsigned ksize = ::strlen(
kind );
329 return( ::strncmp(
ident,
kind, ksize ) == 0
330 &&
ident[ksize] ==
':' );
337 const char * sep = ::strchr(
ident,
':' );
338 return( sep ? sep+1 :
ident );
344 return Edition( _solvable->evr );
350 switch ( _solvable->arch )
364 return IdString( _solvable->vendor );
411 if ( isKind<Package>() )
413 if ( isKind<Patch>() )
475 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
491 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_provides );
496 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_requires );
501 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_conflicts );
506 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_obsoletes );
511 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_recommends );
516 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_suggests );
521 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_enhances );
526 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_supplements );
532 ::Offset offs = _solvable->dep_requires;
537 #if __cplusplus < 202002L 538 #define DECLARE_CAP_FWD(_Fnc_Name) \ 539 Capabilities Solvable::_Fnc_Name() const \ 540 { return dep_##_Fnc_Name(); } 551 #undef DECLARE_CAP_FWD 562 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
576 if (
str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) ==
'(' )
578 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
579 value[value.size()-1] =
'\0';
580 ret.insert(
Capability( value, caprep.op(), caprep.ed() ) );
589 int res = solvable_matchessolvable(
get(),
attr.id(),
static_cast<Id
>( solv.
id() ), capQueue, 0 );
592 if ( capQueue.
size() )
593 std::for_each( capQueue.
begin(), capQueue.
end(), [ &caps ](
auto cap ){ caps.insert(
Capability(cap) );});
595 return std::make_pair( res == 1, std::move(caps) );
605 int invokeOnEachSupportedLocale(
Capability cap_r,
const function<
bool (
const Locale &)>& fnc_r )
610 switch ( detail.capRel() )
616 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
619 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
627 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
629 return ( !fnc_r || fnc_r(
Locale(
IdString(detail.rhs().id()) ) ) ) ? 1 : -1;
644 inline int invokeOnEachSupportedLocale( Capabilities cap_r,
const function<
bool (Locale)>& fnc_r )
647 for_( cit, cap_r.begin(), cap_r.end() )
649 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
663 bool operator()(
const Locale & locale_r )
const 682 return invokeOnEachSupportedLocale(
dep_supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
687 if ( locales_r.empty() )
690 return invokeOnEachSupportedLocale(
dep_supplements(), NoMatchIn(locales_r) ) < 0;
713 unsigned medianr = 0U;
714 const char * file = ::solvable_lookup_location( _solvable, &medianr );
717 else if ( ! medianr )
768 if ( ret.empty() && isKind<Product>() )
771 std::string riname(
name() );
784 if ( isKind<Product>() )
787 std::string riname(
name() );
800 return str << (obj.
isSystem() ?
"systemSolvable" :
"noSolvable" );
802 return str <<
"(" << obj.
id() <<
")" 804 <<
'-' << obj.
edition() <<
'.' << obj.
arch() <<
"(" 813 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X] std::ostream & dumpAsXmlOn(std::ostream &str, const FileConflicts &obj)
relates: FileConflicts XML output
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
Capabilities provides() const ZYPP_DEPRECATED
std::string name() const
The name (without any ResKind prefix).
std::ostream & operator<<(std::ostream &str, const FileConflicts &obj)
relates: FileConflicts Stream output
Capabilities dep_supplements() const
Capabilities suggests() const ZYPP_DEPRECATED
bool hasLicense() const
Whether there is a license associated with the repo.
Capabilities dep_obsoletes() const
static const IdString ptfMasterToken
Indicator provides ptf()
A Solvable object within the sat Pool.
IdString vendor() const
The vendor.
IdType id() const
Expert backdoor.
RepoInfo repoInfo() const
The repositories RepoInfo.
ResKind kind() const
The Solvables ResKind.
Container of Capability (currently read only).
static const ResKind package
const LocaleSet & _locales
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects...
Helper providing more detailed information about a Capability.
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Capabilities dep_requires() const
LocaleSet getSupportedLocales() const
Return the supported locales.
const_iterator end() const
Iterator pointing behind the last Capability.
static ResKind explicitBuiltin(const char *str_r)
Return the builtin kind if str_r explicitly prefixed.
static const IdString patternToken
Indicator provides pattern()
Store and operate with byte count.
Capabilities dep_recommends() const
detail::IdType lookupIdAttribute(const SolvAttr &attr) const
returns the id attribute value for attr or detail::noId if it does not exists.
Lightweight attribute value lookup.
Capabilities requires() const ZYPP_DEPRECATED
static const SolvAttr installtime
RAII writing a nodes start/end tag.
std::unordered_set< Locale > LocaleSet
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
#define NO_SOLVABLE_RETURN(VAL)
bool isBlacklisted() const
Whether this solvable is blacklisted (retracted,ptf,...).
bool isOnSystemByAuto(IdString ident_r) const
Capabilities dep_prerequires() const
String related utilities and Regular expression matching.
Collector< TOutputIterator > collector(TOutputIterator iter_r)
relates: Collector Convenience constructor.
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Capabilities supplements() const ZYPP_DEPRECATED
int IdType
Generic Id type.
What is known about a repository.
static const ResKind srcpackage
std::string delnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for uninstall (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]
ByteCount downloadSize() const
Download size.
bool isPtfMaster(const Solvable &solv_r) const
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
bool isPtfPackage() const
Subset of isPtf (provides ptfPackageToken).
static const SolvAttr insnotify
static CheckSum md5(const std::string &checksum)
static const Solvable noSolvable
Represents no Solvable.
static const IdString productToken
Indicator provides product()
Capabilities dep_suggests() const
const_iterator begin() const
bool isSystemRepo(CRepo *repo_r) const
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
False false_c()
Convenience function for creating a False.
bool empty() const
Test for an empty path.
std::string distribution() const
The distribution string.
static const IdString ptfPackageToken
Indicator provides ptf-package()
Repository repository() const
The Repository this Solvable belongs to.
::s_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
bool onSystemByAuto() const
Whether this is known to be automatically installed (as dependency of a user request package)...
Capabilities obsoletes() const ZYPP_DEPRECATED
const_iterator begin() const
Iterator pointing to the first Capability.
Store and operate on date (time_t).
bool identIsAutoInstalled() const
Whether an installed solvable with the same ident is flagged as AutoInstalled.
Edition edition() const
The edition (version-release).
Lightweight repository attribute value lookup.
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable.
static constexpr NoThrowType noThrow
Indicator argument for non-trowing ctor.
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
ByteCount installSize() const
Installed (unpacked) size.
static CheckSum sha224(const std::string &checksum)
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
bool isNeedreboot(const Solvable &solv_r) const
Whether solv_r matches the spec.
unsigned long long lookupNumAttribute(const SolvAttr &attr) const
returns the numeric attribute value for attr or 0 if it does not exists.
RepoInfo info() const
Return any associated RepoInfo.
CheckSum lookupCheckSumAttribute(const SolvAttr &attr) const
returns the CheckSum attribute value for attr or an empty CheckSum if ir does not exist...
Capabilities dep_conflicts() const
Arch arch() const
The architecture.
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Capabilities dep_provides() const
static const SolvAttr updateStatus
CpeId cpeId() const
The solvables CpeId if available.
static const SolvAttr checksum
static PoolImpl & myPool()
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
static const SolvAttr downloadsize
Capabilities enhances() const ZYPP_DEPRECATED
const char * c_str() const
Conversion to const char *
std::string asUserString() const
User string: label (alias or name)
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
static CheckSum sha256(const std::string &checksum)
static const SolvAttr delnotify
bool isMultiversion(const Solvable &solv_r) const
'Language[_Country]' codes.
static const SolvAttr installsize
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
std::unordered_set< Capability > CapabilitySet
detail::CSolvable * get() const
Expert backdoor.
Libsolv Id queue wrapper.
std::string lookupStrAttribute(const SolvAttr &attr) const
returns the string attribute value for attr or an empty string if it does not exists.
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
static const SolvAttr buildtime
std::string alias() const
Short unique string to identify a repo.
bool isOnSystemByUser(IdString ident_r) const
bool isRetracted(const Solvable &solv_r) const
Solvable()
Default ctor creates noSolvable.
Capabilities dep_enhances() const
bool supportsRequestedLocales() const
Whether this Solvable supports at least one requested locale.
bool isNeedreboot() const
Whether this solvable triggers the reboot-needed hint if installed/updated.
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
static const SolvAttr cpeid
#define DECLARE_CAP_FWD(_Fnc_Name)
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
static const Repository noRepository
Represents no Repository.
bool isPtfPackage(const Solvable &solv_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).
static const SolvAttr description
std::ostream & dumpOn(std::ostream &str, const LocaleSupport &obj)
relates: LocaleSupport More verbose stream output including dependencies
static const IdType noId(0)
Capabilities conflicts() const ZYPP_DEPRECATED
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
static CheckSum sha384(const std::string &checksum)
CSolvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
std::pair< bool, CapabilitySet > matchesSolvable(const SolvAttr &attr, const sat::Solvable &solv) const
static const SolvAttr eula
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
static CheckSum sha1(const std::string &checksum)
static const SolvAttr summary
static const IdString retractedToken
Indicator provides retracted-patch-package()
std::string asString() const
Conversion to std::string
static const SolvAttr distribution
static CheckSum sha512(const std::string &checksum)
Capabilities recommends() const ZYPP_DEPRECATED
Easy-to use interface to the ZYPP dependency resolver.
bool supportsLocales() const
Whether this Solvable claims to support locales.
Date buildtime() const
The items build time.
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
bool isPtf() const
Whether this solvable belongs to a PTF (provides ptfMasterToken or ptfPackageToken).
const_iterator end() const
const char * c_str() const
IdString ident() const
The identifier.
Date installtime() const
The items install time (false if not installed).
Capabilities prerequires() const ZYPP_DEPRECATED
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
bool isRetracted() const
Whether this solvable is retracted (provides retractedToken).