libzypp: zypp/ng/sat/solvable.cc Source File

libzypp 17.38.14

solvable.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13
14#include "solvable.h"
15#include "solvableident.h"
16
17#include <zypp-core/base/Logger.h>
18#include <zypp-core/base/Gettext.h>
19#include <zypp-core/base/Exception.h>
20#include <zypp-core/base/Xml.h>
21#include <zypp-core/ByteCount.h>
22#include <zypp-core/CheckSum.h>
23#include <zypp-core/Date.h>
24
25
26#include <zypp-core/base/Functional.h>
27
28#include "pool.h"
29#include <zypp-core/ng/base/precondition.h>
30#include <zypp-core/ng/base/ranges.h>
31#include <zypp/ng/sat/stringpool.h>
32#include <zypp/ng/sat/queue.h>
33
34using std::endl;
35
37namespace zyppng
38{
40 namespace sat
41 {
42 namespace detail {
43 template<> Pool & poolFromType( Solvable & s )
44 {
45 const auto id = s.id();
46 ZYPP_PRECONDITION( id != detail::noSolvableId );
47 CPool * cp = StringPool::instance().getPool();
48 ZYPP_PRECONDITION( cp->solvables[id].repo, "Solvable has no repo — already freed?" );
49 ZYPP_PRECONDITION( cp->appdata );
50 return *static_cast<Pool *>( cp->appdata );
51 }
52 template<> const Pool & poolFromType( const Solvable & s )
53 {
54 const auto id = s.id();
55 ZYPP_PRECONDITION( id != detail::noSolvableId );
56 CPool * cp = StringPool::instance().getPool();
57 ZYPP_PRECONDITION( cp->solvables[id].repo, "Solvable has no repo — already freed?" );
58 ZYPP_PRECONDITION( cp->appdata );
59 return *static_cast<const Pool *>( cp->appdata );
60 }
61 }
63 // class Solvable
65
66 const Solvable Solvable::noSolvable;
67
68 const IdString Solvable::patternToken { "pattern()" };
69 const IdString Solvable::productToken { "product()" };
70
71 const IdString Solvable::retractedToken { "retracted-patch-package()" };
72 const IdString Solvable::ptfMasterToken { "ptf()" };
73 const IdString Solvable::ptfPackageToken { "ptf-package()" };
74
76
77 detail::CSolvable * Solvable::get() const
78 {
79 if ( _id == detail::noSolvableId )
80 return nullptr;
81 return pool().getSolvable( _id );
82 }
83
84#define NO_SOLVABLE_RETURN( VAL ) \
85 detail::CSolvable * _solvable( get() ); \
86 if ( ! _solvable ) return VAL
87
88 Solvable Solvable::nextInPool() const
89 {
90 NO_SOLVABLE_RETURN( noSolvable );
91 return Solvable( pool().getNextId( _id ) );
92 }
93
94 Solvable Solvable::nextInRepo() const
95 {
96 NO_SOLVABLE_RETURN( noSolvable );
97 for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next )
98 {
99 detail::CSolvable * nextS( pool().getSolvable( next ) );
100 if ( nextS && nextS->repo == _solvable->repo )
101 {
102 return Solvable( next );
103 }
104 }
105 return noSolvable;
106 }
107
108 std::string Solvable::lookupStrAttribute( const SolvAttr & attr ) const
109 {
110 NO_SOLVABLE_RETURN( std::string() );
111 const char * s = ::solvable_lookup_str( _solvable, attr.id() );
112 return s ? s : std::string();
113 }
114
115 std::string Solvable::lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const
116 {
117 NO_SOLVABLE_RETURN( std::string() );
118 const char * s = 0;
119 if ( !lang_r )
120 {
121 s = ::solvable_lookup_str_poollang( _solvable, attr.id() );
122 }
123 else
124 {
125 for ( Locale l( lang_r ); l; l = l.fallback() )
126 {
127 if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.c_str(), 0 )) )
128 return s;
129 }
130 // here: no matching locale, so use default
131 s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
132 }
133 return s ? s : std::string();
134 }
135
136 unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr ) const
137 {
138 NO_SOLVABLE_RETURN( 0 );
139 return ::solvable_lookup_num( _solvable, attr.id(), 0 );
140 }
141
142 unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr, unsigned long long notfound_r ) const
143 {
144 NO_SOLVABLE_RETURN( notfound_r );
145 return ::solvable_lookup_num( _solvable, attr.id(), notfound_r );
146 }
147
148 bool Solvable::lookupBoolAttribute( const SolvAttr & attr ) const
149 {
150 NO_SOLVABLE_RETURN( false );
151 return ::solvable_lookup_bool( _solvable, attr.id() );
152 }
153
154 detail::IdType Solvable::lookupIdAttribute( const SolvAttr & attr ) const
155 {
156 NO_SOLVABLE_RETURN( detail::noId );
157 return ::solvable_lookup_id( _solvable, attr.id() );
158 }
159
160 zypp::CheckSum Solvable::lookupCheckSumAttribute( const SolvAttr & attr ) const
161 {
162 NO_SOLVABLE_RETURN( zypp::CheckSum() );
163 detail::IdType chksumtype = 0;
164 const char * s = ::solvable_lookup_checksum( _solvable, attr.id(), &chksumtype );
165 if ( ! s )
166 return zypp::CheckSum();
167 switch ( chksumtype )
168 {
169 case REPOKEY_TYPE_MD5: return zypp::CheckSum::md5( s );
170 case REPOKEY_TYPE_SHA1: return zypp::CheckSum::sha1( s );
171 case REPOKEY_TYPE_SHA224: return zypp::CheckSum::sha224( s );
172 case REPOKEY_TYPE_SHA256: return zypp::CheckSum::sha256( s );
173 case REPOKEY_TYPE_SHA384: return zypp::CheckSum::sha384( s );
174 case REPOKEY_TYPE_SHA512: return zypp::CheckSum::sha512( s );
175 }
176 return zypp::CheckSum( std::string(), s ); // try to autodetect
177 }
178
179 IdString Solvable::ident() const
180 {
181 NO_SOLVABLE_RETURN( IdString() );
182 return IdString( _solvable->name );
183 }
184
185 ResKind Solvable::kind() const
186 {
187 NO_SOLVABLE_RETURN( ResKind() );
188 // detect srcpackages by 'arch'
189 switch ( _solvable->arch )
190 {
191 case ARCH_SRC:
192 case ARCH_NOSRC:
193 return ResKind::srcpackage;
194 break;
195 }
196
197 // either explicitly prefixed...
198 const char * ident = IdString( _solvable->name ).c_str();
199 ResKind knownKind( ResKind::explicitBuiltin( ident ) );
200 if ( knownKind )
201 return knownKind;
202
203 // ...or no ':' in package names (hopefully)...
204 const char * sep = ::strchr( ident, ':' );
205 if ( ! sep )
206 return ResKind::package;
207
208 // ...or something unknown.
209 return ResKind( std::string( ident, sep-ident ) );
210 }
211
212 bool Solvable::isKind( const ResKind & kind_r ) const
213 {
214 NO_SOLVABLE_RETURN( false );
215
216 // detect srcpackages by 'arch'
217 switch ( _solvable->arch )
218 {
219 case ARCH_SRC:
220 case ARCH_NOSRC:
221 return( kind_r == ResKind::srcpackage );
222 break;
223 }
224
225 // no ':' in package names (hopefully)
226 const char * ident = IdString( _solvable->name ).c_str();
227 if ( kind_r == ResKind::package )
228 {
229 return( ::strchr( ident, ':' ) == 0 );
230 }
231
232 // look for a 'kind:' prefix
233 const char * kind = kind_r.c_str();
234 unsigned ksize = ::strlen( kind );
235 return( ::strncmp( ident, kind, ksize ) == 0
236 && ident[ksize] == ':' );
237 }
238
239 std::string Solvable::name() const
240 {
241 NO_SOLVABLE_RETURN( std::string() );
242 const char * ident = IdString( _solvable->name ).c_str();
243 const char * sep = ::strchr( ident, ':' );
244 return( sep ? sep+1 : ident );
245 }
246
247 Edition Solvable::edition() const
248 {
249 NO_SOLVABLE_RETURN( Edition() );
250 return Edition( _solvable->evr );
251 }
252
253 Arch Solvable::arch() const
254 {
255 NO_SOLVABLE_RETURN( Arch_noarch ); //ArchId() );
256 switch ( _solvable->arch )
257 {
258 case ARCH_SRC:
259 case ARCH_NOSRC:
260 return Arch_noarch; //ArchId( ARCH_NOARCH );
261 break;
262 }
263 return Arch( IdString(_solvable->arch).asString() );
264 //return ArchId( _solvable->arch );
265 }
266
267 IdString Solvable::vendor() const
268 {
269 NO_SOLVABLE_RETURN( IdString() );
270 return IdString( _solvable->vendor );
271 }
272
273 detail::RepoIdType Solvable::repository() const
274 {
275 NO_SOLVABLE_RETURN( detail::noRepoId );
276 return _solvable->repo;
277 }
278
279 bool Solvable::isSystem() const
280 {
281 NO_SOLVABLE_RETURN( _id == detail::systemSolvableId );
282 return pool().isSystemRepo( _solvable->repo );
283 }
284
285 zypp::Date Solvable::buildtime() const
286 {
287 NO_SOLVABLE_RETURN( zypp::Date() );
288 return zypp::Date( lookupNumAttribute( SolvAttr::buildtime ) );
289 }
290
291 zypp::Date Solvable::installtime() const
292 {
293 NO_SOLVABLE_RETURN( zypp::Date() );
294 return zypp::Date( lookupNumAttribute( SolvAttr::installtime ) );
295 }
296
297#if 0
298 std::string Solvable::asString() const
299 {
300 NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
301 return str::form( "%s-%s.%s",
302 IdString( _solvable->name ).c_str(),
303 IdString( _solvable->evr ).c_str(),
304 IdString( _solvable->arch ).c_str() );
305 }
306
307 std::string Solvable::asUserString() const\
308 {
309 NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
310 return str::form( "%s-%s.%s (%s)",
311 IdString( _solvable->name ).c_str(),
312 IdString( _solvable->evr ).c_str(),
313 IdString( _solvable->arch ).c_str(),
314 repository().asUserString().c_str() );
315 }
316#endif
317
318 bool Solvable::identical( const Solvable & rhs ) const
319 {
320 NO_SOLVABLE_RETURN( ! rhs.get() );
321 detail::CSolvable * rhssolvable( rhs.get() );
322 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
323 }
324
326 namespace
327 {
328 inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
329 {
330 return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
331 }
332 } // namespace
334
335 Capabilities Solvable::dep_provides() const
336 {
337 NO_SOLVABLE_RETURN( Capabilities() );
338 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_provides );
339 }
340 Capabilities Solvable::dep_requires() const
341 {
342 NO_SOLVABLE_RETURN( Capabilities() );
343 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_requires );
344 }
345 Capabilities Solvable::dep_conflicts() const
346 {
347 NO_SOLVABLE_RETURN( Capabilities() );
348 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_conflicts );
349 }
350 Capabilities Solvable::dep_obsoletes() const
351 {
352 NO_SOLVABLE_RETURN( Capabilities() );
353 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_obsoletes );
354 }
355 Capabilities Solvable::dep_recommends() const
356 {
357 NO_SOLVABLE_RETURN( Capabilities() );
358 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_recommends );
359 }
360 Capabilities Solvable::dep_suggests() const
361 {
362 NO_SOLVABLE_RETURN( Capabilities() );
363 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_suggests );
364 }
365 Capabilities Solvable::dep_enhances() const
366 {
367 NO_SOLVABLE_RETURN( Capabilities() );
368 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_enhances );
369 }
370 Capabilities Solvable::dep_supplements() const
371 {
372 NO_SOLVABLE_RETURN( Capabilities() );
373 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_supplements );
374 }
375 Capabilities Solvable::dep_prerequires() const
376 {
377 NO_SOLVABLE_RETURN( Capabilities() );
378 // prerequires are a subset of requires
379 ::Offset offs = _solvable->dep_requires;
380 return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker )
381 : Capabilities();
382 }
383
384 CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
385 {
386 NO_SOLVABLE_RETURN( CapabilitySet() );
387
388 const auto &providesPredicate = []( std::string_view namespace_r ) {
389 return [namespace_r]( const Capability &ca ){
390 CapDetail caprep( ca.detail() );
391 return ( zypp::str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' );
392 };
393 };
394
395 return dep_provides()
396 | ranges::views::filter( providesPredicate(namespace_r) )
397 | ranges::to<CapabilitySet>();
398 }
399
400 CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
401 {
402 NO_SOLVABLE_RETURN( CapabilitySet() );
403 const auto ns_size = namespace_r.size();
404 return dep_provides()
405 | ranges::views::transform( [] ( const Capability & ca ) {
406 return CapDetail( ca.detail() );
407 })
408 | ranges::views::filter( [&namespace_r, ns_size]( const CapDetail & cd ) {
409 const char * name = cd.name().c_str();
410 return zypp::str::hasPrefix( name, namespace_r ) && name[ns_size] == '(';
411 })
412 | ranges::views::transform( [ns_size]( const CapDetail & caprep ) {
413 std::string_view full( caprep.name().c_str() );
414 full.remove_prefix( ns_size + 1 ); // strip "namespace("
415 full.remove_suffix( 1 ); // strip trailing ")"
416 return Capability( std::string(full), caprep.op(), caprep.ed() );
417 })
418 | ranges::to<CapabilitySet>();
419 }
420
421 std::pair<bool, CapabilitySet> Solvable::matchesSolvable(const SolvAttr &attr, const Solvable &solv) const
422 {
423 sat::Queue capQueue;
424 int res = solvable_matchessolvable( get(), attr.id(), static_cast<Id>( solv.id() ), capQueue, 0 );
425
426 CapabilitySet caps;
427 if ( capQueue.size() )
428 ranges::for_each( capQueue, [&caps]( auto cap ){ caps.insert( Capability(cap) ); });
429
430 return std::make_pair( res == 1, std::move(caps) );
431 }
432
434 namespace
435 {
440 int invokeOnEachSupportedLocale( Capability cap_r, const std::function<bool (const Locale &)>& fnc_r )
441 {
442 CapDetail detail( cap_r );
443 if ( detail.kind() == CapDetail::EXPRESSION )
444 {
445 switch ( detail.capRel() )
446 {
447 case CapDetail::CAP_AND:
448 case CapDetail::CAP_OR:
449 // expand
450 {
451 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
452 if ( res < 0 )
453 return res; // negative on abort.
454 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
455 if ( res2 < 0 )
456 return -res + res2; // negative on abort.
457 return res + res2;
458 }
459 break;
460
461 case CapDetail::CAP_NAMESPACE:
462 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
463 {
464 return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort.
465 }
466 break;
467
468 default:
469 break; // unwanted
470 }
471 }
472 return 0;
473 }
474
479 inline int invokeOnEachSupportedLocale( Capabilities cap_r, const std::function<bool (const Locale &)>& fnc_r )
480 {
481 int cnt = 0;
482 for ( const Capability & cap : cap_r )
483 {
484 int res = invokeOnEachSupportedLocale( cap, fnc_r );
485 if ( res < 0 )
486 return -cnt + res; // negative on abort.
487 cnt += res;
488 }
489 return cnt;
490 }
492
493 // Functor returning false if a Locale is in the set.
494 struct NoMatchIn
495 {
496 NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {}
497
498 bool operator()( const Locale & locale_r ) const
499 {
500 return _locales.find( locale_r ) == _locales.end();
501 }
502
503 const LocaleSet & _locales;
504 };
505 } // namespace
507
508 bool Solvable::supportsLocales() const
509 {
510 // false_c stops on 1st Locale.
511 return invokeOnEachSupportedLocale( dep_supplements(), zypp::functor::false_c() ) < 0;
512 }
513
514 bool Solvable::supportsLocale( const Locale & locale_r ) const
515 {
516 // not_equal_to stops on == Locale.
517 return invokeOnEachSupportedLocale( dep_supplements(), [&]( const Locale & locale ){ return std::not_equal_to<Locale>()( locale, locale_r ); } ) < 0;
518 }
519
520 bool Solvable::supportsLocale( const LocaleSet & locales_r ) const
521 {
522 if ( locales_r.empty() )
523 return false;
524 // NoMatchIn stops if Locale is included.
525 return invokeOnEachSupportedLocale( dep_supplements(), NoMatchIn(locales_r) ) < 0;
526 }
527
528 LocaleSet Solvable::getSupportedLocales() const
529 {
530 LocaleSet ret;
531 invokeOnEachSupportedLocale( dep_supplements(), [&](const Locale & l){
532 ret.insert ( l );
533 return true;
534 } );
535 return ret;
536 }
537
538 CpeId Solvable::cpeId() const
539 {
540 NO_SOLVABLE_RETURN( CpeId() );
541 return CpeId( lookupStrAttribute( SolvAttr::cpeid ), CpeId::noThrow );
542 }
543
544 unsigned Solvable::mediaNr() const
545 {
546 NO_SOLVABLE_RETURN( 0U );
547 // medianumber and path
548 unsigned medianr = 0U;
549 const char * file = ::solvable_lookup_location( _solvable, &medianr );
550 if ( ! file )
551 medianr = 0U;
552 else if ( ! medianr )
553 medianr = 1U;
554 return medianr;
555 }
556
557 zypp::ByteCount Solvable::installSize() const
558 {
559 NO_SOLVABLE_RETURN( zypp::ByteCount() );
560 return zypp::ByteCount( lookupNumAttribute( SolvAttr::installsize ) );
561 }
562
563 zypp::ByteCount Solvable::downloadSize() const
564 {
565 NO_SOLVABLE_RETURN( zypp::ByteCount() );
566 return zypp::ByteCount( lookupNumAttribute( SolvAttr::downloadsize ) );
567 }
568
569 std::string Solvable::distribution() const
570 {
571 NO_SOLVABLE_RETURN( std::string() );
572 return lookupStrAttribute( SolvAttr::distribution );
573 }
574
575 std::string Solvable::summary( const Locale & lang_r ) const
576 {
577 NO_SOLVABLE_RETURN( std::string() );
578 return lookupStrAttribute( SolvAttr::summary, lang_r );
579 }
580
581 std::string Solvable::description( const Locale & lang_r ) const
582 {
583 NO_SOLVABLE_RETURN( std::string() );
584 return lookupStrAttribute( SolvAttr::description, lang_r );
585 }
586
587 std::string Solvable::insnotify( const Locale & lang_r ) const
588 {
589 NO_SOLVABLE_RETURN( std::string() );
590 return lookupStrAttribute( SolvAttr::insnotify, lang_r );
591 }
592
593 std::string Solvable::delnotify( const Locale & lang_r ) const
594 {
595 NO_SOLVABLE_RETURN( std::string() );
596 return lookupStrAttribute( SolvAttr::delnotify, lang_r );
597 }
598
599
600#if 0
601 std::string Solvable::licenseToConfirm( const Locale & lang_r ) const
602 {
603 NO_SOLVABLE_RETURN( std::string() );
604 std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
605 if ( ret.empty() && isKind<Product>() )
606 {
607 const RepoInfo & ri( repoInfo() );
608 std::string riname( name() ); // "license-"+name with fallback "license"
609 if ( ! ri.hasLicense( riname ) )
610 riname.clear();
611
612 if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
613 ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
614 }
615 return ret;
616 }
617
618 bool Solvable::needToAcceptLicense() const
619 {
620 NO_SOLVABLE_RETURN( false );
621 if ( isKind<Product>() )
622 {
623 const RepoInfo & ri( repoInfo() );
624 std::string riname( name() ); // "license-"+name with fallback "license"
625 if ( ! ri.hasLicense( riname ) )
626 riname.clear();
627
628 return ri.needToAcceptLicense( riname );
629 }
630 return true;
631 }
632 std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
633 {
634 str << obj;
635 if ( obj )
636 {
637#define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
638 OUTS(PROVIDES);
639 OUTS(PREREQUIRES);
640 OUTS(REQUIRES);
641 OUTS(CONFLICTS);
642 OUTS(OBSOLETES);
643 OUTS(RECOMMENDS);
644 OUTS(SUGGESTS);
645 OUTS(ENHANCES);
646 OUTS(SUPPLEMENTS);
647#undef OUTS
648 }
649 return str;
650 }
651
652 std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
653 {
654 xmlout::Node guard( str, "solvable" );
655
656 dumpAsXmlOn( *guard, obj.kind() );
657 *xmlout::Node( *guard, "name" ) << obj.name();
658 dumpAsXmlOn( *guard, obj.edition() );
659 dumpAsXmlOn( *guard, obj.arch() );
660 dumpAsXmlOn( *guard, obj.repository() );
661 return str;
662 }
663#endif
664
665 } // namespace sat
667} // namespace zypp
ByteCount.h
Date.h
OUTS
#define OUTS(VAL)
Exception.h
Functional.h
Gettext.h
Logger.h
NO_SOLVABLE_RETURN
#define NO_SOLVABLE_RETURN(VAL)
Definition Solvable.cc:113
Xml.h
zypp::Arch
Architecture.
Definition Arch.h:37
zypp::ByteCount
Store and operate with byte count.
Definition ByteCount.h:32
zypp::CapDetail::CAP_NAMESPACE
@ CAP_NAMESPACE
Definition Capability.h:392
zypp::CheckSum
Definition CheckSum.h:34
zypp::CheckSum::md5
static CheckSum md5(const std::string &checksum)
Definition CheckSum.h:73
zypp::CheckSum::sha384
static CheckSum sha384(const std::string &checksum)
Definition CheckSum.h:78
zypp::CheckSum::sha1
static CheckSum sha1(const std::string &checksum)
Definition CheckSum.h:75
zypp::CheckSum::sha512
static CheckSum sha512(const std::string &checksum)
Definition CheckSum.h:79
zypp::CheckSum::sha256
static CheckSum sha256(const std::string &checksum)
Definition CheckSum.h:77
zypp::CheckSum::sha224
static CheckSum sha224(const std::string &checksum)
Definition CheckSum.h:76
zypp::CpeId
Common Platform Enumearation (2.3) See http://cpe.mitre.org/ for more information on the Common Platf...
Definition CpeId.h:33
zypp::Date
Store and operate on date (time_t).
Definition Date.h:33
zypp::Edition
Edition represents [epoch:]version[-release].
Definition Edition.h:60
zypp::IdString
Access to the sat-pools string space.
Definition IdString.h:55
zypp::IdString::c_str
const char * c_str() const
Conversion to const char *.
Definition IdString.cc:51
zypp::IdString::asString
std::string asString() const
Conversion to std::string.
Definition IdString.h:110
zypp::Locale
'Language[_Country]' codes.
Definition Locale.h:51
zypp::Locale::fallback
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
Definition Locale.cc:211
zypp::RepoInfo
What is known about a repository.
Definition RepoInfo.h:72
zypp::ResKind
Resolvable kinds.
Definition ResKind.h:33
zypp::sat::SolvAttr
Solvable attribute keys.
Definition SolvAttr.h:41
zypp::sat::Solvable::dep_suggests
Capabilities dep_suggests() const
Definition Solvable.cc:513
zypp::sat::Solvable::patternToken
static const IdString patternToken
Indicator provides pattern().
Definition Solvable.h:58
zypp::sat::Solvable::dep_conflicts
Capabilities dep_conflicts() const
Definition Solvable.cc:498
zypp::sat::Solvable::lookupBoolAttribute
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition Solvable.cc:174
zypp::sat::Solvable::vendor
IdString vendor() const
The vendor.
Definition Solvable.cc:361
zypp::sat::Solvable::installSize
ByteCount installSize() const
Installed (unpacked) size.
Definition Solvable.cc:722
zypp::sat::Solvable::buildtime
Date buildtime() const
The items build time.
Definition Solvable.cc:440
zypp::sat::Solvable::needToAcceptLicense
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
Definition Solvable.cc:781
zypp::sat::Solvable::kind
ResKind kind() const
The Solvables ResKind.
Definition Solvable.cc:279
zypp::sat::Solvable::providesNamespace
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable.
Definition Solvable.cc:554
zypp::sat::Solvable::noSolvable
static const Solvable noSolvable
Represents no Solvable.
Definition Solvable.h:83
zypp::sat::Solvable::dep_supplements
Capabilities dep_supplements() const
Definition Solvable.cc:523
zypp::sat::Solvable::asString
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition Solvable.cc:452
zypp::sat::Solvable::distribution
std::string distribution() const
The distribution string.
Definition Solvable.cc:734
zypp::sat::Solvable::mediaNr
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Definition Solvable.cc:709
zypp::sat::Solvable::lookupNumAttribute
unsigned long long lookupNumAttribute(const SolvAttr &attr) const
returns the numeric attribute value for attr or 0 if it does not exists.
Definition Solvable.cc:162
zypp::sat::Solvable::dep_enhances
Capabilities dep_enhances() const
Definition Solvable.cc:518
zypp::sat::Solvable::lookupStrAttribute
std::string lookupStrAttribute(const SolvAttr &attr) const
returns the string attribute value for attr or an empty string if it does not exists.
Definition Solvable.cc:134
zypp::sat::Solvable::dep_recommends
Capabilities dep_recommends() const
Definition Solvable.cc:508
zypp::sat::Solvable::cpeId
CpeId cpeId() const
The solvables CpeId if available.
Definition Solvable.cc:703
zypp::sat::Solvable::nextInRepo
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
Definition Solvable.cc:120
zypp::sat::Solvable::installtime
Date installtime() const
The items install time (false if not installed).
Definition Solvable.cc:446
zypp::sat::Solvable::edition
Edition edition() const
The edition (version-release).
Definition Solvable.cc:341
zypp::sat::Solvable::dep_obsoletes
Capabilities dep_obsoletes() const
Definition Solvable.cc:503
zypp::sat::Solvable::getSupportedLocales
LocaleSet getSupportedLocales() const
Return the supported locales.
Definition Solvable.cc:696
zypp::sat::Solvable::get
detail::CSolvable * get() const
Expert backdoor.
Definition Solvable.cc:110
zypp::sat::Solvable::arch
Arch arch() const
The architecture.
Definition Solvable.cc:347
zypp::sat::Solvable::isSystem
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition Solvable.cc:377
zypp::sat::Solvable::nextInPool
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Definition Solvable.cc:117
zypp::sat::Solvable::licenseToConfirm
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
Definition Solvable.cc:764
zypp::sat::Solvable::supportsLocales
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition Solvable.cc:673
zypp::sat::Solvable::asUserString
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
Definition Solvable.cc:461
zypp::sat::Solvable::summary
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
Definition Solvable.cc:740
zypp::sat::Solvable::dep_prerequires
Capabilities dep_prerequires() const
Definition Solvable.cc:528
zypp::sat::Solvable::dep_provides
Capabilities dep_provides() const
Definition Solvable.cc:488
zypp::sat::Solvable::lookupIdAttribute
detail::IdType lookupIdAttribute(const SolvAttr &attr) const
returns the id attribute value for attr or detail::noId if it does not exists.
Definition Solvable.cc:180
zypp::sat::Solvable::matchesSolvable
std::pair< bool, CapabilitySet > matchesSolvable(const SolvAttr &attr, const sat::Solvable &solv) const
Definition Solvable.cc:586
zypp::sat::Solvable::name
std::string name() const
The name (without any ResKind prefix).
Definition Solvable.cc:333
zypp::sat::Solvable::supportsLocale
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Definition Solvable.cc:679
zypp::sat::Solvable::dep_requires
Capabilities dep_requires() const
Definition Solvable.cc:493
zypp::sat::Solvable::downloadSize
ByteCount downloadSize() const
Download size.
Definition Solvable.cc:728
zypp::sat::Solvable::delnotify
std::string delnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for uninstall (opt.
Definition Solvable.cc:758
zypp::sat::Solvable::valuesOfNamespace
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
Definition Solvable.cc:568
zypp::sat::Solvable::ident
IdString ident() const
The identifier.
Definition Solvable.cc:273
zypp::sat::Solvable::productToken
static const IdString productToken
Indicator provides product().
Definition Solvable.h:59
zypp::sat::Solvable::lookupCheckSumAttribute
CheckSum lookupCheckSumAttribute(const SolvAttr &attr) const
returns the CheckSum attribute value for attr or an empty CheckSum if ir does not exist.
Definition Solvable.cc:186
zypp::sat::Solvable::description
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
Definition Solvable.cc:746
zypp::sat::Solvable::repository
Repository repository() const
The Repository this Solvable belongs to.
Definition Solvable.cc:367
zypp::sat::Solvable::isKind
bool isKind() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Solvable.h:106
zypp::sat::Solvable::insnotify
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
Definition Solvable.cc:752
zypp::sat::Solvable::identical
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
Definition Solvable.cc:471
zypp::ui::Selectable::get
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Definition Selectable.cc:29
zyppng::CpeId::noThrow
static constexpr NoThrowType noThrow
Indicator argument for non-trowing ctor.
Definition CpeId.h:63
zyppng::IdStringType::c_str
const char * c_str() const
Definition IdStringType.h:115
zyppng::IdStringType::id
IdType id() const
Definition IdStringType.h:123
zyppng::ResKind::srcpackage
static const ResKind srcpackage
Definition ResKind.h:44
zyppng::ResKind::explicitBuiltin
static ResKind explicitBuiltin(const char *str_r)
Return the builtin kind if str_r explicitly prefixed.
Definition ResKind.cc:46
zyppng::ResKind::package
static const ResKind package
Definition ResKind.h:40
zyppng::sat::CapDetail
Helper providing more detailed information about a Capability.
Definition capability.h:339
zyppng::sat::CapDetail::EXPRESSION
@ EXPRESSION
Definition capability.h:346
zyppng::sat::CapDetail::ed
Edition ed() const
Definition capability.h:394
zyppng::sat::CapDetail::name
IdString name() const
Definition capability.h:392
zyppng::sat::CapDetail::CAP_OR
@ CAP_OR
or
Definition capability.h:356
zyppng::sat::CapDetail::CAP_AND
@ CAP_AND
and
Definition capability.h:355
zyppng::sat::CapDetail::op
Rel op() const
Definition capability.h:393
zyppng::sat::Capabilities
Container of Capability (currently read only).
Definition capabilities.h:33
zyppng::sat::Capability
A sat capability.
Definition capability.h:74
zyppng::sat::Capability::detail
CapDetail detail() const
Helper providing more detailed information about a Capability.
Definition capability.h:414
zyppng::sat::PoolMember< Solvable >::pool
Pool & pool()
Definition poolmember.h:30
zyppng::sat::Pool
Orchestrator for a libsolv pool instance.
Definition pool.h:37
zyppng::sat::Pool::getSolvable
detail::CSolvable * getSolvable(detail::SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
Definition pool.h:227
zyppng::sat::Pool::isSystemRepo
bool isSystemRepo(detail::CRepo *repo_r) const
Definition pool.h:132
zyppng::sat::Queue
Libsolv Id queue wrapper.
Definition queue.h:37
zyppng::sat::Queue::size
size_type size() const
Definition queue.cc:56
zyppng::sat::SolvAttr::cpeid
static const SolvAttr cpeid
Definition SolvAttr.h:100
zyppng::sat::SolvAttr::buildtime
static const SolvAttr buildtime
Definition SolvAttr.h:96
zyppng::sat::SolvAttr::distribution
static const SolvAttr distribution
Definition SolvAttr.h:111
zyppng::sat::SolvAttr::description
static const SolvAttr description
Definition SolvAttr.h:91
zyppng::sat::SolvAttr::delnotify
static const SolvAttr delnotify
Definition SolvAttr.h:93
zyppng::sat::SolvAttr::installsize
static const SolvAttr installsize
Definition SolvAttr.h:97
zyppng::sat::SolvAttr::downloadsize
static const SolvAttr downloadsize
Definition SolvAttr.h:98
zyppng::sat::SolvAttr::insnotify
static const SolvAttr insnotify
Definition SolvAttr.h:92
zyppng::sat::SolvAttr::summary
static const SolvAttr summary
Definition SolvAttr.h:90
zyppng::sat::SolvAttr::installtime
static const SolvAttr installtime
Definition SolvAttr.h:95
zyppng::sat::SolvAttr::eula
static const SolvAttr eula
Definition SolvAttr.h:94
zyppng::sat::Solvable
A Solvable object within the sat Pool.
Definition solvable.h:66
zyppng::sat::Solvable::lookupStrAttribute
std::string lookupStrAttribute(const SolvAttr &attr) const
returns the string attribute value for attr or an empty string if it does not exists.
Definition solvable.cc:108
zyppng::sat::Solvable::ptfPackageToken
static const IdString ptfPackageToken
Indicator provides ptf-package().
Definition solvable.h:75
zyppng::sat::Solvable::get
detail::CSolvable * get() const
Expert backdoor.
Definition solvable.cc:77
zyppng::sat::Solvable::_id
IdType _id
Definition solvable.h:345
zyppng::sat::Solvable::Solvable
Solvable()
Default ctor creates noSolvable.
Definition solvable.h:79
zyppng::sat::Solvable::name
std::string name() const
The name (without any ResKind prefix).
Definition solvable.cc:239
zyppng::sat::Solvable::kind
ResKind kind() const
The Solvables ResKind.
Definition solvable.cc:185
zyppng::sat::Solvable::isKind
bool isKind() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition solvable.h:118
zyppng::sat::Solvable::retractedToken
static const IdString retractedToken
Indicator provides retracted-patch-package().
Definition solvable.h:73
zyppng::sat::Solvable::dep_supplements
Capabilities dep_supplements() const
Definition solvable.cc:370
zyppng::sat::Solvable::ident
IdString ident() const
The identifier.
Definition solvable.cc:179
zyppng::sat::Solvable::lookupNumAttribute
unsigned long long lookupNumAttribute(const SolvAttr &attr) const
returns the numeric attribute value for attr or 0 if it does not exists.
Definition solvable.cc:136
zyppng::sat::Solvable::id
IdType id() const
Expert backdoor.
Definition solvable.h:342
zyppng::sat::Solvable::dep_provides
Capabilities dep_provides() const
Definition solvable.cc:335
zyppng::sat::Solvable::noSolvable
static const Solvable noSolvable
Represents no Solvable.
Definition solvable.h:95
zyppng::sat::Solvable::repository
detail::RepoIdType repository() const
The repo id this Solvable belongs to.
Definition solvable.cc:273
zyppng::sat::Solvable::ptfMasterToken
static const IdString ptfMasterToken
Indicator provides ptf().
Definition solvable.h:74
zyppng::sat::StringPool::getPool
detail::CPool * getPool() const
Explicit accessor for the raw sat-pool.
Definition stringpool.h:60
zyppng::sat::StringPool::instance
static StringPool & instance()
Access the global StringPool instance.
Definition stringpool.cc:18
zypp::functor::false_c
False false_c()
Convenience function for creating a False.
Definition Functional.h:104
zypp::sat::dumpAsXmlOn
std::ostream & dumpAsXmlOn(std::ostream &str, const FileConflicts &obj)
relates: FileConflicts XML output
Definition FileConflicts.cc:132
zypp::sat::dumpOn
std::ostream & dumpOn(std::ostream &str, const LocaleSupport &obj)
relates: LocaleSupport More verbose stream output including dependencies
Definition LocaleSupport.cc:41
zypp::str::hasPrefix
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition String.h:1097
zypp::LocaleSet
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
zypp::asUserString
std::string asUserString(VendorSupportOption opt)
converts the support option to a name intended to be printed to the user.
Definition VendorSupportOptions.cc:9
zyppng::detail
Definition reporthelper.h:31
zyppng::ranges::to
to_fn< Container > to()
Definition ranges.h:138
zyppng::ranges::to
Container to(Range &&range)
Convert any range into a Container.
Definition ranges.h:109
zyppng::sat::detail
CLASS NAME : detail::DIWrap.
Definition cap2str.cc:14
zyppng::sat::detail::CSolvable
zypp::sat::detail::CSolvable CSolvable
Definition poolconstants.h:39
zyppng::sat::detail::solvablePrereqMarker
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
zyppng::sat::detail::RepoIdType
zypp::sat::detail::RepoIdType RepoIdType
Definition poolconstants.h:45
zyppng::sat::detail::CPool
zypp::sat::detail::CPool CPool
Definition poolconstants.h:36
zyppng::sat::detail::poolFromType
Pool & poolFromType(T &)
zyppng::sat::detail::SolvableIdType
zypp::sat::detail::SolvableIdType SolvableIdType
Definition poolconstants.h:44
zyppng::sat::detail::noId
static const IdType noId(0)
zyppng::sat::detail::noSolvableId
static const SolvableIdType noSolvableId(0)
Id to denote Solvable::noSolvable.
zyppng::sat::detail::noRepoId
static const RepoIdType noRepoId(0)
Id to denote Repo::noRepository.
zyppng::sat::detail::IdType
zypp::sat::detail::IdType IdType
Definition poolconstants.h:43
zyppng::sat::detail::systemSolvableId
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
zyppng::sat
This file contains private API, this might break at any time between releases.
Definition capabilities.h:22
zyppng::sat::isKind
bool isKind(const Solvable &solvable_r)
relates: Solvable Test whether a Solvable is of a certain Kind.
Definition solvable.h:363
zyppng::sat::CapabilitySet
std::unordered_set< Capability > CapabilitySet
Definition capability.h:35
zyppng
Definition MediaNetworkRequestExecutor.h:16
zyppng::IdString
zypp::IdString IdString
Definition idstring.h:16
zyppng::RepoInfo
zypp::RepoInfo RepoInfo
Definition repomanager.h:38
pool.h
precondition.h
Always-on precondition checking for NG code.
ZYPP_PRECONDITION
#define ZYPP_PRECONDITION(EXPR,...)
Always-on precondition check — fires in debug AND release builds.
Definition precondition.h:42
ranges.h
Namespace routing for C++20 ranges and C++23 ranges::to<T>() backport.
queue.h
solvable.h
solvableident.h
stringpool.h
CheckSum.h