libzypp 17.38.3
Solvable.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13
18#include <zypp/base/Collector.h>
19#include <zypp-core/base/Xml.h>
20
22#include <zypp/sat/Solvable.h>
23#include <zypp/sat/Pool.h>
24#include <zypp/sat/LookupAttr.h>
25
26#include <zypp/Repository.h>
27#include <utility>
28#include <zypp-core/OnMediaLocation>
29#include <zypp/ZConfig.h>
30
31#include <zypp/ui/Selectable.h>
32
33using std::endl;
34
36namespace zypp
37{
39 namespace sat
40 {
42 namespace
43 {
44 void _doSplit( IdString & _ident, ResKind & _kind, IdString & _name )
45 {
46 if ( ! _ident )
47 return;
48
49 ResKind explicitKind = ResKind::explicitBuiltin( _ident.c_str() );
50 // NOTE: kind package and srcpackage do not have namespaced ident!
51 if ( ! explicitKind )
52 {
53 _name = _ident;
54 // No kind defaults to package
55 if ( !_kind )
56 _kind = ResKind::package;
57 else if ( ! ( _kind == ResKind::package || _kind == ResKind::srcpackage ) )
58 _ident = IdString( str::form( "%s:%s", _kind.c_str(), _ident.c_str() ) );
59 }
60 else
61 {
62 // strip kind spec from name
63 _name = IdString( ::strchr( _ident.c_str(), ':' )+1 );
64 _kind = explicitKind;
65 if ( _kind == ResKind::package || _kind == ResKind::srcpackage )
66 _ident = _name;
67 }
68 return;
69 }
70 } // namespace
72
74 : _ident( ident_r )
75 { _doSplit( _ident, _kind, _name ); }
76
77 Solvable::SplitIdent::SplitIdent( const char * ident_r )
78 : _ident( ident_r )
79 { _doSplit( _ident, _kind, _name ); }
80
81 Solvable::SplitIdent::SplitIdent( const std::string & ident_r )
82 : _ident( ident_r )
83 { _doSplit( _ident, _kind, _name ); }
84
86 : _ident( name_r )
87 , _kind(std::move( kind_r ))
88 { _doSplit( _ident, _kind, _name ); }
89
91 : _ident( name_r )
92 , _kind(std::move( kind_r ))
93 { _doSplit( _ident, _kind, _name ); }
94
96 // class Solvable
98
100
101 const IdString Solvable::patternToken { "pattern()" };
102 const IdString Solvable::productToken { "product()" };
103
104 const IdString Solvable::retractedToken { "retracted-patch-package()" };
105 const IdString Solvable::ptfMasterToken { "ptf()" };
106 const IdString Solvable::ptfPackageToken { "ptf-package()" };
107
109
111 { return myPool().getSolvable( _id ); }
112
113#define NO_SOLVABLE_RETURN( VAL ) \
114 detail::CSolvable * _solvable( get() ); \
115 if ( ! _solvable ) return VAL
116
118 { return Solvable( myPool().getNextId( _id ) ); }
119
121 {
123 for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next )
124 {
125 detail::CSolvable * nextS( myPool().getSolvable( next ) );
126 if ( nextS && nextS->repo == _solvable->repo )
127 {
128 return Solvable( next );
129 }
130 }
131 return noSolvable;
132 }
133
134 std::string Solvable::lookupStrAttribute( const SolvAttr & attr ) const
135 {
136 NO_SOLVABLE_RETURN( std::string() );
137 const char * s = ::solvable_lookup_str( _solvable, attr.id() );
138 return s ? s : std::string();
139 }
140
141 std::string Solvable::lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const
142 {
143 NO_SOLVABLE_RETURN( std::string() );
144 const char * s = 0;
145 if ( !lang_r )
146 {
147 s = ::solvable_lookup_str_poollang( _solvable, attr.id() );
148 }
149 else
150 {
151 for ( Locale l( lang_r ); l; l = l.fallback() )
152 {
153 if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.c_str(), 0 )) )
154 return s;
155 }
156 // here: no matching locale, so use default
157 s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
158 }
159 return s ? s : std::string();
160 }
161
162 unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr ) const
163 {
165 return ::solvable_lookup_num( _solvable, attr.id(), 0 );
166 }
167
168 unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr, unsigned long long notfound_r ) const
169 {
170 NO_SOLVABLE_RETURN( notfound_r );
171 return ::solvable_lookup_num( _solvable, attr.id(), notfound_r );
172 }
173
174 bool Solvable::lookupBoolAttribute( const SolvAttr & attr ) const
175 {
176 NO_SOLVABLE_RETURN( false );
177 return ::solvable_lookup_bool( _solvable, attr.id() );
178 }
179
181 {
183 return ::solvable_lookup_id( _solvable, attr.id() );
184 }
185
187 {
189 detail::IdType chksumtype = 0;
190 const char * s = ::solvable_lookup_checksum( _solvable, attr.id(), &chksumtype );
191 if ( ! s )
192 return CheckSum();
193 switch ( chksumtype )
194 {
195 case REPOKEY_TYPE_MD5: return CheckSum::md5( s );
196 case REPOKEY_TYPE_SHA1: return CheckSum::sha1( s );
197 case REPOKEY_TYPE_SHA224: return CheckSum::sha224( s );
198 case REPOKEY_TYPE_SHA256: return CheckSum::sha256( s );
199 case REPOKEY_TYPE_SHA384: return CheckSum::sha384( s );
200 case REPOKEY_TYPE_SHA512: return CheckSum::sha512( s );
201 }
202 return CheckSum( std::string(), s ); // try to autodetect
203 }
204
206 namespace
207 {
208 inline Pathname lookupDatadirIn( Repository repor_r )
209 {
210 static const SolvAttr susetagsDatadir( "susetags:datadir" );
211 Pathname ret;
212 // First look for repo attribute "susetags:datadir". If not found,
213 // look into the solvables as Code11 libsolv placed it there.
214 LookupRepoAttr datadir( susetagsDatadir, repor_r );
215 if ( ! datadir.empty() )
216 ret = datadir.begin().asString();
217 else
218 {
219 LookupAttr datadir( susetagsDatadir, repor_r );
220 if ( ! datadir.empty() )
221 ret = datadir.begin().asString();
222 }
223 return ret;
224 }
225 } // namespace
227
229 {
231 // medianumber and path
232 unsigned medianr = 0;
233 const char * file = ::solvable_lookup_location( _solvable, &medianr );
234 if ( ! file )
235 return OnMediaLocation();
236 if ( ! medianr )
237 medianr = 1;
238
239 OnMediaLocation ret;
240
241 Pathname path;
242 switch ( repository().info().type().toEnum() )
243 {
245 {
246 path = lookupDatadirIn( repository() );
247 if ( ! path.empty() )
249 }
250 break;
251
253 {
254 path = lookupDatadirIn( repository() );
255 if ( path.empty() )
256 path = "suse";
257 }
258 break;
259
260 default:
261 break;
262 }
263 ret.setLocation ( path/file, medianr );
266 // Not needed/available for solvables?
267 //ret.setOpenSize ( ByteCount( lookupNumAttribute( SolvAttr::opensize ) ) );
268 //ret.setOpenChecksum( lookupCheckSumAttribute( SolvAttr::openchecksum ) );
269 return ret;
270 }
271
272
274 {
276 return IdString( _solvable->name );
277 }
278
280 {
282 // detect srcpackages by 'arch'
283 switch ( _solvable->arch )
284 {
285 case ARCH_SRC:
286 case ARCH_NOSRC:
287 return ResKind::srcpackage;
288 break;
289 }
290
291 // either explicitly prefixed...
292 const char * ident = IdString( _solvable->name ).c_str();
293 ResKind knownKind( ResKind::explicitBuiltin( ident ) );
294 if ( knownKind )
295 return knownKind;
296
297 // ...or no ':' in package names (hopefully)...
298 const char * sep = ::strchr( ident, ':' );
299 if ( ! sep )
300 return ResKind::package;
301
302 // ...or something unknown.
303 return ResKind( std::string( ident, sep-ident ) );
304 }
305
306 bool Solvable::isKind( const ResKind & kind_r ) const
307 {
308 NO_SOLVABLE_RETURN( false );
309
310 // detect srcpackages by 'arch'
311 switch ( _solvable->arch )
312 {
313 case ARCH_SRC:
314 case ARCH_NOSRC:
315 return( kind_r == ResKind::srcpackage );
316 break;
317 }
318
319 // no ':' in package names (hopefully)
320 const char * ident = IdString( _solvable->name ).c_str();
321 if ( kind_r == ResKind::package )
322 {
323 return( ::strchr( ident, ':' ) == 0 );
324 }
325
326 // look for a 'kind:' prefix
327 const char * kind = kind_r.c_str();
328 unsigned ksize = ::strlen( kind );
329 return( ::strncmp( ident, kind, ksize ) == 0
330 && ident[ksize] == ':' );
331 }
332
333 std::string Solvable::name() const
334 {
335 NO_SOLVABLE_RETURN( std::string() );
336 const char * ident = IdString( _solvable->name ).c_str();
337 const char * sep = ::strchr( ident, ':' );
338 return( sep ? sep+1 : ident );
339 }
340
342 {
344 return Edition( _solvable->evr );
345 }
346
348 {
349 NO_SOLVABLE_RETURN( Arch_noarch ); //ArchId() );
350 switch ( _solvable->arch )
351 {
352 case ARCH_SRC:
353 case ARCH_NOSRC:
354 return Arch_noarch; //ArchId( ARCH_NOARCH );
355 break;
356 }
357 return Arch( IdString(_solvable->arch).asString() );
358 //return ArchId( _solvable->arch );
359 }
360
362 {
364 return IdString( _solvable->vendor );
365 }
366
368 {
370 return Repository( _solvable->repo );
371 }
372
374 { return repository().info(); }
375
376
378 {
380 return myPool().isSystemRepo( _solvable->repo );
381 }
382
384 {
385 return isSystem() && myPool().isOnSystemByUser( ident() );
386 }
387
389 {
390 return isSystem() && myPool().isOnSystemByAuto( ident() );
391 }
392
394 {
395 return myPool().isOnSystemByAuto( ident_r );
396 }
397
399 {
400 NO_SOLVABLE_RETURN( false );
401 return myPool().isNeedreboot( *this );
402 }
403
404 // TODO: Optimize
406 { return isPtf() || isRetracted(); }
407
409 {
410 NO_SOLVABLE_RETURN( false );
411 if ( isKind<Package>() )
412 return myPool().isRetracted( *this );
413 if ( isKind<Patch>() )
414 return lookupStrAttribute( SolvAttr::updateStatus ) == "retracted";
415 return false;
416 }
417
418 bool Solvable::isPtf() const
419 { return isPtfPackage() || isPtfMaster(); }
420
422 {
423 NO_SOLVABLE_RETURN( false );
424 return myPool().isPtfMaster( *this );
425 }
426
428 {
429 NO_SOLVABLE_RETURN( false );
430 return myPool().isPtfPackage( *this );
431 }
432
433
435 {
436 NO_SOLVABLE_RETURN( false );
437 return myPool().isMultiversion( *this );
438 }
439
445
451
452 std::string Solvable::asString() const
453 {
454 NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
455 return str::form( "%s-%s.%s",
456 IdString( _solvable->name ).c_str(),
457 IdString( _solvable->evr ).c_str(),
458 IdString( _solvable->arch ).c_str() );
459 }
460
461 std::string Solvable::asUserString() const\
462 {
463 NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
464 return str::form( "%s-%s.%s (%s)",
465 IdString( _solvable->name ).c_str(),
466 IdString( _solvable->evr ).c_str(),
467 IdString( _solvable->arch ).c_str(),
468 repository().asUserString().c_str() );
469 }
470
471 bool Solvable::identical( const Solvable & rhs ) const
472 {
473 NO_SOLVABLE_RETURN( ! rhs.get() );
474 detail::CSolvable * rhssolvable( rhs.get() );
475 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
476 }
477
479 namespace
480 {
481 inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
482 {
483 return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
484 }
485 } // namespace
487
489 {
491 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_provides );
492 }
494 {
496 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_requires );
497 }
499 {
501 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_conflicts );
502 }
504 {
506 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_obsoletes );
507 }
509 {
511 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_recommends );
512 }
514 {
516 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_suggests );
517 }
519 {
521 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_enhances );
522 }
524 {
526 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_supplements );
527 }
529 {
531 // prerequires are a subset of requires
532 ::Offset offs = _solvable->dep_requires;
533 return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker )
534 : Capabilities();
535 }
536
537#if __cplusplus < 202002L
538#define DECLARE_CAP_FWD(_Fnc_Name) \
539 Capabilities Solvable::_Fnc_Name() const \
540 { return dep_##_Fnc_Name(); }
541
543 DECLARE_CAP_FWD(requires)
551#undef DECLARE_CAP_FWD
552#endif
553
554 CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
555 {
557 CapabilitySet ret;
558 Capabilities caps( dep_provides() );
559 for_( it, caps.begin(), caps.end() )
560 {
561 CapDetail caprep( it->detail() );
562 if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
563 ret.insert( *it );
564 }
565 return ret;
566 }
567
568 CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
569 {
571 CapabilitySet ret;
572 Capabilities caps( dep_provides() );
573 for_( it, caps.begin(), caps.end() )
574 {
575 CapDetail caprep( it->detail() );
576 if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
577 {
578 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
579 value[value.size()-1] = '\0'; // erase the trailing ')'
580 ret.insert( Capability( value, caprep.op(), caprep.ed() ) );
581 }
582 }
583 return ret;
584 }
585
586 std::pair<bool, CapabilitySet> Solvable::matchesSolvable(const SolvAttr &attr, const Solvable &solv) const
587 {
588 sat::Queue capQueue;
589 int res = solvable_matchessolvable( get(), attr.id(), static_cast<Id>( solv.id() ), capQueue, 0 );
590
591 CapabilitySet caps;
592 if ( capQueue.size() )
593 std::for_each( capQueue.begin(), capQueue.end(), [ &caps ]( auto cap ){ caps.insert( Capability(cap) );});
594
595 return std::make_pair( res == 1, std::move(caps) );
596 }
597
599 namespace
600 {
605 int invokeOnEachSupportedLocale( Capability cap_r, const function<bool (const Locale &)>& fnc_r )
606 {
607 CapDetail detail( cap_r );
608 if ( detail.kind() == CapDetail::EXPRESSION )
609 {
610 switch ( detail.capRel() )
611 {
614 // expand
615 {
616 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
617 if ( res < 0 )
618 return res; // negative on abort.
619 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
620 if ( res2 < 0 )
621 return -res + res2; // negative on abort.
622 return res + res2;
623 }
624 break;
625
627 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
628 {
629 return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort.
630 }
631 break;
632
633 default:
634 break; // unwanted
635 }
636 }
637 return 0;
638 }
639
644 inline int invokeOnEachSupportedLocale( Capabilities cap_r, const function<bool (Locale)>& fnc_r )
645 {
646 int cnt = 0;
647 for_( cit, cap_r.begin(), cap_r.end() )
648 {
649 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
650 if ( res < 0 )
651 return -cnt + res; // negative on abort.
652 cnt += res;
653 }
654 return cnt;
655 }
657
658 // Functor returning false if a Locale is in the set.
659 struct NoMatchIn
660 {
661 NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {}
662
663 bool operator()( const Locale & locale_r ) const
664 {
665 return _locales.find( locale_r ) == _locales.end();
666 }
667
668 const LocaleSet & _locales;
669 };
670 } // namespace
672
674 {
675 // false_c stops on 1st Locale.
676 return invokeOnEachSupportedLocale( dep_supplements(), functor::false_c() ) < 0;
677 }
678
679 bool Solvable::supportsLocale( const Locale & locale_r ) const
680 {
681 // not_equal_to stops on == Locale.
682 return invokeOnEachSupportedLocale( dep_supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
683 }
684
685 bool Solvable::supportsLocale( const LocaleSet & locales_r ) const
686 {
687 if ( locales_r.empty() )
688 return false;
689 // NoMatchIn stops if Locale is included.
690 return invokeOnEachSupportedLocale( dep_supplements(), NoMatchIn(locales_r) ) < 0;
691 }
692
694 { return supportsLocale( myPool().getRequestedLocales() ); }
695
697 {
698 LocaleSet ret;
699 invokeOnEachSupportedLocale( dep_supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
700 return ret;
701 }
702
708
709 unsigned Solvable::mediaNr() const
710 {
711 NO_SOLVABLE_RETURN( 0U );
712 // medianumber and path
713 unsigned medianr = 0U;
714 const char * file = ::solvable_lookup_location( _solvable, &medianr );
715 if ( ! file )
716 medianr = 0U;
717 else if ( ! medianr )
718 medianr = 1U;
719 return medianr;
720 }
721
727
733
734 std::string Solvable::distribution() const
735 {
736 NO_SOLVABLE_RETURN( std::string() );
738 }
739
740 std::string Solvable::summary( const Locale & lang_r ) const
741 {
742 NO_SOLVABLE_RETURN( std::string() );
743 return lookupStrAttribute( SolvAttr::summary, lang_r );
744 }
745
746 std::string Solvable::description( const Locale & lang_r ) const
747 {
748 NO_SOLVABLE_RETURN( std::string() );
750 }
751
752 std::string Solvable::insnotify( const Locale & lang_r ) const
753 {
754 NO_SOLVABLE_RETURN( std::string() );
755 return lookupStrAttribute( SolvAttr::insnotify, lang_r );
756 }
757
758 std::string Solvable::delnotify( const Locale & lang_r ) const
759 {
760 NO_SOLVABLE_RETURN( std::string() );
761 return lookupStrAttribute( SolvAttr::delnotify, lang_r );
762 }
763
764 std::string Solvable::licenseToConfirm( const Locale & lang_r ) const
765 {
766 NO_SOLVABLE_RETURN( std::string() );
767 std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
768 if ( ret.empty() && isKind<Product>() )
769 {
770 const RepoInfo & ri( repoInfo() );
771 std::string riname( name() ); // "license-"+name with fallback "license"
772 if ( ! ri.hasLicense( riname ) )
773 riname.clear();
774
775 if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
776 ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
777 }
778 return ret;
779 }
780
782 {
783 NO_SOLVABLE_RETURN( false );
784 if ( isKind<Product>() )
785 {
786 const RepoInfo & ri( repoInfo() );
787 std::string riname( name() ); // "license-"+name with fallback "license"
788 if ( ! ri.hasLicense( riname ) )
789 riname.clear();
790
791 return ri.needToAcceptLicense( riname );
792 }
793 return true;
794 }
795
796
797 std::ostream & operator<<( std::ostream & str, const Solvable & obj )
798 {
799 if ( ! obj )
800 return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" );
801
802 return str << "(" << obj.id() << ")"
803 << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
804 << '-' << obj.edition() << '.' << obj.arch() << "("
805 << obj.repository().alias() << ")";
806 }
807
808 std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
809 {
810 str << obj;
811 if ( obj )
812 {
813#define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
814 OUTS(PROVIDES);
815 OUTS(PREREQUIRES);
816 OUTS(REQUIRES);
817 OUTS(CONFLICTS);
818 OUTS(OBSOLETES);
819 OUTS(RECOMMENDS);
820 OUTS(SUGGESTS);
821 OUTS(ENHANCES);
822 OUTS(SUPPLEMENTS);
823#undef OUTS
824 }
825 return str;
826 }
827
828 std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
829 {
830 xmlout::Node guard( str, "solvable" );
831
832 dumpAsXmlOn( *guard, obj.kind() );
833 *xmlout::Node( *guard, "name" ) << obj.name();
834 dumpAsXmlOn( *guard, obj.edition() );
835 dumpAsXmlOn( *guard, obj.arch() );
836 dumpAsXmlOn( *guard, obj.repository() );
837 return str;
838 }
839
840 } // namespace sat
842} // namespace zypp
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
#define DECLARE_CAP_FWD(_Fnc_Name)
Definition Solvable.cc:538
#define NO_SOLVABLE_RETURN(VAL)
Definition Solvable.cc:113
#define OUTS(V)
Architecture.
Definition Arch.h:37
bool operator()(const zypp::Arch &lhs, const zypp::Arch &rhs) const
Default order for std::container based Arch::compare.
Definition Arch.h:370
Store and operate with byte count.
Definition ByteCount.h:32
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition String.h:92
Helper providing more detailed information about a Capability.
Definition Capability.h:365
IdString name() const
Definition Capability.h:418
Edition ed() const
Definition Capability.h:420
Rel op() const
Definition Capability.h:419
Container of Capability (currently read only).
const_iterator begin() const
Iterator pointing to the first Capability.
const_iterator end() const
Iterator pointing behind the last Capability.
A sat capability.
Definition Capability.h:63
static CheckSum md5(const std::string &checksum)
Definition CheckSum.h:73
static CheckSum sha384(const std::string &checksum)
Definition CheckSum.h:78
static CheckSum sha1(const std::string &checksum)
Definition CheckSum.h:75
static CheckSum sha512(const std::string &checksum)
Definition CheckSum.h:79
static CheckSum sha256(const std::string &checksum)
Definition CheckSum.h:77
static CheckSum sha224(const std::string &checksum)
Definition CheckSum.h:76
Common Platform Enumearation (2.3) See http://cpe.mitre.org/ for more information on the Common Platf...
Definition CpeId.h:33
static constexpr NoThrowType noThrow
Indicator argument for non-trowing ctor.
Definition CpeId.h:63
Store and operate on date (time_t).
Definition Date.h:33
Edition represents [epoch:]version[-release].
Definition Edition.h:61
const char * c_str() const
IdType id() const
Access to the sat-pools string space.
Definition IdString.h:44
const char * c_str() const
Conversion to const char *.
Definition IdString.cc:50
std::string asString() const
Conversion to std::string.
Definition IdString.h:99
'Language[_Country]' codes.
Definition Locale.h:51
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
Definition Locale.cc:208
Describes a resource file located on a medium.
OnMediaLocation & setDownloadSize(ByteCount val_r)
Set the downloadSize.
OnMediaLocation & setChecksum(CheckSum val_r)
Set the checksum.
OnMediaLocation & setLocation(Pathname filename_r, unsigned medianr_r=1)
Set filename_r and medianr_r (defaults to 1).
What is known about a repository.
Definition RepoInfo.h:72
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition RepoInfo.cc:913
void setProbedType(const repo::RepoType &t) const
This allows to adjust the RepoType lazy, from NONE to some probed value, even for const objects.
Definition RepoInfo.cc:749
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition RepoInfo.cc:878
bool hasLicense() const
Whether there is a license associated with the repo.
Definition RepoInfo.cc:871
static const Repository noRepository
Represents no Repository.
Definition Repository.h:67
std::string alias() const
Short unique string to identify a repo.
Definition Repository.cc:60
RepoInfo info() const
Return any associated RepoInfo.
Resolvable kinds.
Definition ResKind.h:33
static const ResKind srcpackage
Definition ResKind.h:44
static ResKind explicitBuiltin(const char *str_r)
Return the builtin kind if str_r explicitly prefixed.
Definition ResKind.cc:46
static const ResKind package
Definition ResKind.h:40
const std::string & asString() const
String representation.
Definition Pathname.h:94
bool empty() const
Test for an empty path.
Definition Pathname.h:117
Lightweight attribute value lookup.
Definition LookupAttr.h:110
Lightweight repository attribute value lookup.
Definition LookupAttr.h:265
Libsolv Id queue wrapper.
Definition Queue.h:36
size_type size() const
Definition Queue.cc:49
const_iterator end() const
Definition Queue.cc:55
const_iterator begin() const
Definition Queue.cc:52
Solvable attribute keys.
Definition SolvAttr.h:41
static const SolvAttr cpeid
Definition SolvAttr.h:100
static const SolvAttr buildtime
Definition SolvAttr.h:96
static const SolvAttr distribution
Definition SolvAttr.h:111
static const SolvAttr description
Definition SolvAttr.h:91
static const SolvAttr delnotify
Definition SolvAttr.h:93
static const SolvAttr installsize
Definition SolvAttr.h:97
static const SolvAttr downloadsize
Definition SolvAttr.h:98
static const SolvAttr insnotify
Definition SolvAttr.h:92
static const SolvAttr summary
Definition SolvAttr.h:90
static const SolvAttr checksum
Definition SolvAttr.h:105
static const SolvAttr updateStatus
Definition SolvAttr.h:134
static const SolvAttr installtime
Definition SolvAttr.h:95
static const SolvAttr eula
Definition SolvAttr.h:94
IdType id() const
Expert backdoor.
Definition Solvable.h:464
bool isPtfPackage() const
Subset of isPtf (provides ptfPackageToken).
Definition Solvable.cc:427
bool isNeedreboot() const
Whether this solvable triggers the reboot-needed hint if installed/updated.
Definition Solvable.cc:398
Capabilities supplements() const ZYPP_DEPRECATED
bool identIsAutoInstalled() const
Whether an installed solvable with the same ident is flagged as AutoInstalled.
Definition Solvable.h:146
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Definition Solvable.cc:228
Capabilities dep_suggests() const
Definition Solvable.cc:513
static const IdString patternToken
Indicator provides pattern().
Definition Solvable.h:58
Capabilities dep_conflicts() const
Definition Solvable.cc:498
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition Solvable.cc:174
std::ostream & operator<<(std::ostream &str, const Solvable &obj) ZYPP_API
Stream output.
Definition Solvable.cc:797
IdString vendor() const
The vendor.
Definition Solvable.cc:361
Capabilities recommends() const ZYPP_DEPRECATED
ByteCount installSize() const
Installed (unpacked) size.
Definition Solvable.cc:722
Date buildtime() const
The items build time.
Definition Solvable.cc:440
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
Definition Solvable.cc:781
std::ostream & dumpOn(std::ostream &str, const Solvable &obj) ZYPP_API
More verbose stream output including dependencies.
Definition Solvable.cc:808
ResKind kind() const
The Solvables ResKind.
Definition Solvable.cc:279
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable.
Definition Solvable.cc:554
static const Solvable noSolvable
Represents no Solvable.
Definition Solvable.h:83
Capabilities dep_supplements() const
Definition Solvable.cc:523
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition Solvable.cc:452
Capabilities suggests() const ZYPP_DEPRECATED
std::string distribution() const
The distribution string.
Definition Solvable.cc:734
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Definition Solvable.cc:709
bool isBlacklisted() const
Whether this solvable is blacklisted (retracted,ptf,...).
Definition Solvable.cc:405
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
Capabilities dep_enhances() const
Definition Solvable.cc:518
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
Capabilities dep_recommends() const
Definition Solvable.cc:508
Capabilities conflicts() const ZYPP_DEPRECATED
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
Definition Solvable.cc:434
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj) ZYPP_API
XML output.
Definition Solvable.cc:828
CpeId cpeId() const
The solvables CpeId if available.
Definition Solvable.cc:703
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
Definition Solvable.cc:120
Date installtime() const
The items install time (false if not installed).
Definition Solvable.cc:446
Edition edition() const
The edition (version-release).
Definition Solvable.cc:341
static const IdString ptfMasterToken
Indicator provides ptf().
Definition Solvable.h:62
bool isPtfMaster() const
Subset of isPtf (provides ptfMasterToken).
Definition Solvable.cc:421
Solvable()
Default ctor creates noSolvable.
Definition Solvable.h:67
Capabilities dep_obsoletes() const
Definition Solvable.cc:503
LocaleSet getSupportedLocales() const
Return the supported locales.
Definition Solvable.cc:696
bool supportsRequestedLocales() const
Whether this Solvable supports at least one requested locale.
Definition Solvable.cc:693
detail::CSolvable * get() const
Expert backdoor.
Definition Solvable.cc:110
Arch arch() const
The architecture.
Definition Solvable.cc:347
static const IdString ptfPackageToken
Indicator provides ptf-package().
Definition Solvable.h:63
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition Solvable.cc:377
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Definition Solvable.cc:117
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
Definition Solvable.cc:764
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition Solvable.cc:673
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
Definition Solvable.cc:461
static const IdString retractedToken
Indicator provides retracted-patch-package().
Definition Solvable.h:61
Capabilities obsoletes() const ZYPP_DEPRECATED
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
Definition Solvable.cc:740
Capabilities dep_prerequires() const
Definition Solvable.cc:528
Capabilities dep_provides() const
Definition Solvable.cc:488
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
std::pair< bool, CapabilitySet > matchesSolvable(const SolvAttr &attr, const sat::Solvable &solv) const
Definition Solvable.cc:586
std::string name() const
The name (without any ResKind prefix).
Definition Solvable.cc:333
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Definition Solvable.cc:679
Capabilities dep_requires() const
Definition Solvable.cc:493
ByteCount downloadSize() const
Download size.
Definition Solvable.cc:728
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition Solvable.cc:306
bool onSystemByAuto() const
Whether this is known to be automatically installed (as dependency of a user request package).
Definition Solvable.cc:388
std::string delnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for uninstall (opt.
Definition Solvable.cc:758
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
Definition Solvable.cc:568
IdString ident() const
The identifier.
Definition Solvable.cc:273
static const IdString productToken
Indicator provides product().
Definition Solvable.h:59
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
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
Definition Solvable.cc:746
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
Definition Solvable.cc:383
Capabilities provides() const ZYPP_DEPRECATED
RepoInfo repoInfo() const
The repositories RepoInfo.
Definition Solvable.cc:373
Capabilities enhances() const ZYPP_DEPRECATED
Capabilities prerequires() const ZYPP_DEPRECATED
Repository repository() const
The Repository this Solvable belongs to.
Definition Solvable.cc:367
bool isPtf() const
Whether this solvable belongs to a PTF (provides ptfMasterToken or ptfPackageToken).
Definition Solvable.cc:418
bool isRetracted() const
Whether this solvable is retracted (provides retractedToken).
Definition Solvable.cc:408
bool isKind() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Solvable.h:106
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
Definition Solvable.cc:752
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
Definition Solvable.cc:471
bool isPtfMaster(const Solvable &solv_r) const
Definition PoolImpl.h:344
bool isSystemRepo(CRepo *repo_r) const
Definition PoolImpl.h:101
bool isPtfPackage(const Solvable &solv_r) const
Definition PoolImpl.h:346
bool isNeedreboot(const Solvable &solv_r) const
Whether solv_r matches the spec.
Definition PoolImpl.h:335
bool isOnSystemByAuto(IdString ident_r) const
Definition PoolImpl.h:320
bool isRetracted(const Solvable &solv_r) const
Definition PoolImpl.h:342
CSolvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
Definition PoolImpl.h:182
bool isMultiversion(const Solvable &solv_r) const
Definition PoolImpl.cc:651
bool isOnSystemByUser(IdString ident_r) const
Definition PoolImpl.h:317
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Definition Selectable.cc:29
Definition ansi.h:855
String related utilities and Regular expression matching.
False false_c()
Convenience function for creating a False.
Definition Functional.h:104
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition PoolMember.h:125
static const IdType noId(0)
int IdType
Generic Id type.
Definition PoolMember.h:104
::s_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
Definition PoolMember.h:64
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
Libsolv interface
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition String.h:1097
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition String.cc:39
Easy-to use interface to the ZYPP dependency resolver.
std::unordered_set< Locale > LocaleSet
Definition Locale.h:29
std::unordered_set< Capability > CapabilitySet
Definition Capability.h:35
zypp::IdString IdString
Definition idstring.h:16
Collector< TOutputIterator > collector(TOutputIterator iter_r)
Convenience constructor.
Definition Collector.h:55
static PoolImpl & myPool()
Definition PoolImpl.cc:185
RAII writing a nodes start/end tag.
Definition Xml.h:85