libzypp 17.37.17
Solvable.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#include <iostream>
13
14#include <zypp/base/Logger.h>
15#include <zypp/base/Gettext.h>
16#include <zypp/base/Exception.h>
18#include <zypp/base/Collector.h>
19#include <zypp/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::retractedToken { "retracted-patch-package()" };
102 const IdString Solvable::ptfMasterToken { "ptf()" };
103 const IdString Solvable::ptfPackageToken { "ptf-package()" };
104
106
108 { return myPool().getSolvable( _id ); }
109
110#define NO_SOLVABLE_RETURN( VAL ) \
111 detail::CSolvable * _solvable( get() ); \
112 if ( ! _solvable ) return VAL
113
115 { return Solvable( myPool().getNextId( _id ) ); }
116
118 {
120 for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next )
121 {
122 detail::CSolvable * nextS( myPool().getSolvable( next ) );
123 if ( nextS && nextS->repo == _solvable->repo )
124 {
125 return Solvable( next );
126 }
127 }
128 return noSolvable;
129 }
130
131 std::string Solvable::lookupStrAttribute( const SolvAttr & attr ) const
132 {
133 NO_SOLVABLE_RETURN( std::string() );
134 const char * s = ::solvable_lookup_str( _solvable, attr.id() );
135 return s ? s : std::string();
136 }
137
138 std::string Solvable::lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const
139 {
140 NO_SOLVABLE_RETURN( std::string() );
141 const char * s = 0;
142 if ( !lang_r )
143 {
144 s = ::solvable_lookup_str_poollang( _solvable, attr.id() );
145 }
146 else
147 {
148 for ( Locale l( lang_r ); l; l = l.fallback() )
149 {
150 if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.c_str(), 0 )) )
151 return s;
152 }
153 // here: no matching locale, so use default
154 s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
155 }
156 return s ? s : std::string();
157 }
158
159 unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr ) const
160 {
162 return ::solvable_lookup_num( _solvable, attr.id(), 0 );
163 }
164
165 unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr, unsigned long long notfound_r ) const
166 {
167 NO_SOLVABLE_RETURN( notfound_r );
168 return ::solvable_lookup_num( _solvable, attr.id(), notfound_r );
169 }
170
171 bool Solvable::lookupBoolAttribute( const SolvAttr & attr ) const
172 {
173 NO_SOLVABLE_RETURN( false );
174 return ::solvable_lookup_bool( _solvable, attr.id() );
175 }
176
178 {
180 return ::solvable_lookup_id( _solvable, attr.id() );
181 }
182
184 {
186 detail::IdType chksumtype = 0;
187 const char * s = ::solvable_lookup_checksum( _solvable, attr.id(), &chksumtype );
188 if ( ! s )
189 return CheckSum();
190 switch ( chksumtype )
191 {
192 case REPOKEY_TYPE_MD5: return CheckSum::md5( s );
193 case REPOKEY_TYPE_SHA1: return CheckSum::sha1( s );
194 case REPOKEY_TYPE_SHA224: return CheckSum::sha224( s );
195 case REPOKEY_TYPE_SHA256: return CheckSum::sha256( s );
196 case REPOKEY_TYPE_SHA384: return CheckSum::sha384( s );
197 case REPOKEY_TYPE_SHA512: return CheckSum::sha512( s );
198 }
199 return CheckSum( std::string(), s ); // try to autodetect
200 }
201
203 namespace
204 {
205 inline Pathname lookupDatadirIn( Repository repor_r )
206 {
207 static const SolvAttr susetagsDatadir( "susetags:datadir" );
208 Pathname ret;
209 // First look for repo attribute "susetags:datadir". If not found,
210 // look into the solvables as Code11 libsolv placed it there.
211 LookupRepoAttr datadir( susetagsDatadir, repor_r );
212 if ( ! datadir.empty() )
213 ret = datadir.begin().asString();
214 else
215 {
216 LookupAttr datadir( susetagsDatadir, repor_r );
217 if ( ! datadir.empty() )
218 ret = datadir.begin().asString();
219 }
220 return ret;
221 }
222 } // namespace
224
226 {
228 // medianumber and path
229 unsigned medianr = 0;
230 const char * file = ::solvable_lookup_location( _solvable, &medianr );
231 if ( ! file )
232 return OnMediaLocation();
233 if ( ! medianr )
234 medianr = 1;
235
236 OnMediaLocation ret;
237
238 Pathname path;
239 switch ( repository().info().type().toEnum() )
240 {
242 {
243 path = lookupDatadirIn( repository() );
244 if ( ! path.empty() )
246 }
247 break;
248
250 {
251 path = lookupDatadirIn( repository() );
252 if ( path.empty() )
253 path = "suse";
254 }
255 break;
256
257 default:
258 break;
259 }
260 ret.setLocation ( path/file, medianr );
263 // Not needed/available for solvables?
264 //ret.setOpenSize ( ByteCount( lookupNumAttribute( SolvAttr::opensize ) ) );
265 //ret.setOpenChecksum( lookupCheckSumAttribute( SolvAttr::openchecksum ) );
266 return ret;
267 }
268
269
271 {
273 return IdString( _solvable->name );
274 }
275
277 {
279 // detect srcpackages by 'arch'
280 switch ( _solvable->arch )
281 {
282 case ARCH_SRC:
283 case ARCH_NOSRC:
284 return ResKind::srcpackage;
285 break;
286 }
287
288 // either explicitly prefixed...
289 const char * ident = IdString( _solvable->name ).c_str();
290 ResKind knownKind( ResKind::explicitBuiltin( ident ) );
291 if ( knownKind )
292 return knownKind;
293
294 // ...or no ':' in package names (hopefully)...
295 const char * sep = ::strchr( ident, ':' );
296 if ( ! sep )
297 return ResKind::package;
298
299 // ...or something unknown.
300 return ResKind( std::string( ident, sep-ident ) );
301 }
302
303 bool Solvable::isKind( const ResKind & kind_r ) const
304 {
305 NO_SOLVABLE_RETURN( false );
306
307 // detect srcpackages by 'arch'
308 switch ( _solvable->arch )
309 {
310 case ARCH_SRC:
311 case ARCH_NOSRC:
312 return( kind_r == ResKind::srcpackage );
313 break;
314 }
315
316 // no ':' in package names (hopefully)
317 const char * ident = IdString( _solvable->name ).c_str();
318 if ( kind_r == ResKind::package )
319 {
320 return( ::strchr( ident, ':' ) == 0 );
321 }
322
323 // look for a 'kind:' prefix
324 const char * kind = kind_r.c_str();
325 unsigned ksize = ::strlen( kind );
326 return( ::strncmp( ident, kind, ksize ) == 0
327 && ident[ksize] == ':' );
328 }
329
330 std::string Solvable::name() const
331 {
332 NO_SOLVABLE_RETURN( std::string() );
333 const char * ident = IdString( _solvable->name ).c_str();
334 const char * sep = ::strchr( ident, ':' );
335 return( sep ? sep+1 : ident );
336 }
337
339 {
341 return Edition( _solvable->evr );
342 }
343
345 {
346 NO_SOLVABLE_RETURN( Arch_noarch ); //ArchId() );
347 switch ( _solvable->arch )
348 {
349 case ARCH_SRC:
350 case ARCH_NOSRC:
351 return Arch_noarch; //ArchId( ARCH_NOARCH );
352 break;
353 }
354 return Arch( IdString(_solvable->arch).asString() );
355 //return ArchId( _solvable->arch );
356 }
357
359 {
361 return IdString( _solvable->vendor );
362 }
363
365 {
367 return Repository( _solvable->repo );
368 }
369
371 { return repository().info(); }
372
373
375 {
377 return myPool().isSystemRepo( _solvable->repo );
378 }
379
381 {
382 return isSystem() && myPool().isOnSystemByUser( ident() );
383 }
384
386 {
387 return isSystem() && myPool().isOnSystemByAuto( ident() );
388 }
389
391 {
392 return myPool().isOnSystemByAuto( ident_r );
393 }
394
396 {
397 NO_SOLVABLE_RETURN( false );
398 return myPool().isNeedreboot( *this );
399 }
400
401 // TODO: Optimize
403 { return isPtf() || isRetracted(); }
404
406 {
407 NO_SOLVABLE_RETURN( false );
408 if ( isKind<Package>() )
409 return myPool().isRetracted( *this );
410 if ( isKind<Patch>() )
411 return lookupStrAttribute( SolvAttr::updateStatus ) == "retracted";
412 return false;
413 }
414
415 bool Solvable::isPtf() const
416 { return isPtfPackage() || isPtfMaster(); }
417
419 {
420 NO_SOLVABLE_RETURN( false );
421 return myPool().isPtfMaster( *this );
422 }
423
425 {
426 NO_SOLVABLE_RETURN( false );
427 return myPool().isPtfPackage( *this );
428 }
429
430
432 {
433 NO_SOLVABLE_RETURN( false );
434 return myPool().isMultiversion( *this );
435 }
436
442
448
449 std::string Solvable::asString() const
450 {
451 NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
452 return str::form( "%s-%s.%s",
453 IdString( _solvable->name ).c_str(),
454 IdString( _solvable->evr ).c_str(),
455 IdString( _solvable->arch ).c_str() );
456 }
457
458 std::string Solvable::asUserString() const\
459 {
460 NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
461 return str::form( "%s-%s.%s (%s)",
462 IdString( _solvable->name ).c_str(),
463 IdString( _solvable->evr ).c_str(),
464 IdString( _solvable->arch ).c_str(),
465 repository().asUserString().c_str() );
466 }
467
468 bool Solvable::identical( const Solvable & rhs ) const
469 {
470 NO_SOLVABLE_RETURN( ! rhs.get() );
471 detail::CSolvable * rhssolvable( rhs.get() );
472 return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
473 }
474
476 namespace
477 {
478 inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
479 {
480 return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
481 }
482 } // namespace
484
486 {
488 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_provides );
489 }
491 {
493 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_requires );
494 }
496 {
498 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_conflicts );
499 }
501 {
503 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_obsoletes );
504 }
506 {
508 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_recommends );
509 }
511 {
513 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_suggests );
514 }
516 {
518 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_enhances );
519 }
521 {
523 return _getCapabilities( _solvable->repo->idarraydata, _solvable->dep_supplements );
524 }
526 {
528 // prerequires are a subset of requires
529 ::Offset offs = _solvable->dep_requires;
530 return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker )
531 : Capabilities();
532 }
533
534#if __cplusplus < 202002L
535#define DECLARE_CAP_FWD(_Fnc_Name) \
536 Capabilities Solvable::_Fnc_Name() const \
537 { return dep_##_Fnc_Name(); }
538
540 DECLARE_CAP_FWD(requires)
548#undef DECLARE_CAP_FWD
549#endif
550
551 CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
552 {
554 CapabilitySet ret;
555 Capabilities caps( dep_provides() );
556 for_( it, caps.begin(), caps.end() )
557 {
558 CapDetail caprep( it->detail() );
559 if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
560 ret.insert( *it );
561 }
562 return ret;
563 }
564
565 CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
566 {
568 CapabilitySet ret;
569 Capabilities caps( dep_provides() );
570 for_( it, caps.begin(), caps.end() )
571 {
572 CapDetail caprep( it->detail() );
573 if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
574 {
575 std::string value( caprep.name().c_str()+namespace_r.size()+1 );
576 value[value.size()-1] = '\0'; // erase the trailing ')'
577 ret.insert( Capability( value, caprep.op(), caprep.ed() ) );
578 }
579 }
580 return ret;
581 }
582
583 std::pair<bool, CapabilitySet> Solvable::matchesSolvable(const SolvAttr &attr, const Solvable &solv) const
584 {
585 sat::Queue capQueue;
586 int res = solvable_matchessolvable( get(), attr.id(), static_cast<Id>( solv.id() ), capQueue, 0 );
587
588 CapabilitySet caps;
589 if ( capQueue.size() )
590 std::for_each( capQueue.begin(), capQueue.end(), [ &caps ]( auto cap ){ caps.insert( Capability(cap) );});
591
592 return std::make_pair( res == 1, std::move(caps) );
593 }
594
596 namespace
597 {
602 int invokeOnEachSupportedLocale( Capability cap_r, const function<bool (const Locale &)>& fnc_r )
603 {
604 CapDetail detail( cap_r );
605 if ( detail.kind() == CapDetail::EXPRESSION )
606 {
607 switch ( detail.capRel() )
608 {
611 // expand
612 {
613 int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
614 if ( res < 0 )
615 return res; // negative on abort.
616 int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
617 if ( res2 < 0 )
618 return -res + res2; // negative on abort.
619 return res + res2;
620 }
621 break;
622
624 if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
625 {
626 return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort.
627 }
628 break;
629
630 default:
631 break; // unwanted
632 }
633 }
634 return 0;
635 }
636
641 inline int invokeOnEachSupportedLocale( Capabilities cap_r, const function<bool (Locale)>& fnc_r )
642 {
643 int cnt = 0;
644 for_( cit, cap_r.begin(), cap_r.end() )
645 {
646 int res = invokeOnEachSupportedLocale( *cit, fnc_r );
647 if ( res < 0 )
648 return -cnt + res; // negative on abort.
649 cnt += res;
650 }
651 return cnt;
652 }
654
655 // Functor returning false if a Locale is in the set.
656 struct NoMatchIn
657 {
658 NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {}
659
660 bool operator()( const Locale & locale_r ) const
661 {
662 return _locales.find( locale_r ) == _locales.end();
663 }
664
665 const LocaleSet & _locales;
666 };
667 } // namespace
669
671 {
672 // false_c stops on 1st Locale.
673 return invokeOnEachSupportedLocale( dep_supplements(), functor::false_c() ) < 0;
674 }
675
676 bool Solvable::supportsLocale( const Locale & locale_r ) const
677 {
678 // not_equal_to stops on == Locale.
679 return invokeOnEachSupportedLocale( dep_supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
680 }
681
682 bool Solvable::supportsLocale( const LocaleSet & locales_r ) const
683 {
684 if ( locales_r.empty() )
685 return false;
686 // NoMatchIn stops if Locale is included.
687 return invokeOnEachSupportedLocale( dep_supplements(), NoMatchIn(locales_r) ) < 0;
688 }
689
691 { return supportsLocale( myPool().getRequestedLocales() ); }
692
694 {
695 LocaleSet ret;
696 invokeOnEachSupportedLocale( dep_supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
697 return ret;
698 }
699
705
706 unsigned Solvable::mediaNr() const
707 {
708 NO_SOLVABLE_RETURN( 0U );
709 // medianumber and path
710 unsigned medianr = 0U;
711 const char * file = ::solvable_lookup_location( _solvable, &medianr );
712 if ( ! file )
713 medianr = 0U;
714 else if ( ! medianr )
715 medianr = 1U;
716 return medianr;
717 }
718
724
730
731 std::string Solvable::distribution() const
732 {
733 NO_SOLVABLE_RETURN( std::string() );
735 }
736
737 std::string Solvable::summary( const Locale & lang_r ) const
738 {
739 NO_SOLVABLE_RETURN( std::string() );
740 return lookupStrAttribute( SolvAttr::summary, lang_r );
741 }
742
743 std::string Solvable::description( const Locale & lang_r ) const
744 {
745 NO_SOLVABLE_RETURN( std::string() );
747 }
748
749 std::string Solvable::insnotify( const Locale & lang_r ) const
750 {
751 NO_SOLVABLE_RETURN( std::string() );
752 return lookupStrAttribute( SolvAttr::insnotify, lang_r );
753 }
754
755 std::string Solvable::delnotify( const Locale & lang_r ) const
756 {
757 NO_SOLVABLE_RETURN( std::string() );
758 return lookupStrAttribute( SolvAttr::delnotify, lang_r );
759 }
760
761 std::string Solvable::licenseToConfirm( const Locale & lang_r ) const
762 {
763 NO_SOLVABLE_RETURN( std::string() );
764 std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
765 if ( ret.empty() && isKind<Product>() )
766 {
767 const RepoInfo & ri( repoInfo() );
768 std::string riname( name() ); // "license-"+name with fallback "license"
769 if ( ! ri.hasLicense( riname ) )
770 riname.clear();
771
772 if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
773 ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
774 }
775 return ret;
776 }
777
779 {
780 NO_SOLVABLE_RETURN( false );
781 if ( isKind<Product>() )
782 {
783 const RepoInfo & ri( repoInfo() );
784 std::string riname( name() ); // "license-"+name with fallback "license"
785 if ( ! ri.hasLicense( riname ) )
786 riname.clear();
787
788 return ri.needToAcceptLicense( riname );
789 }
790 return true;
791 }
792
793
794 std::ostream & operator<<( std::ostream & str, const Solvable & obj )
795 {
796 if ( ! obj )
797 return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" );
798
799 return str << "(" << obj.id() << ")"
800 << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
801 << '-' << obj.edition() << '.' << obj.arch() << "("
802 << obj.repository().alias() << ")";
803 }
804
805 std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
806 {
807 str << obj;
808 if ( obj )
809 {
810#define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
811 OUTS(PROVIDES);
812 OUTS(PREREQUIRES);
813 OUTS(REQUIRES);
814 OUTS(CONFLICTS);
815 OUTS(OBSOLETES);
816 OUTS(RECOMMENDS);
817 OUTS(SUGGESTS);
818 OUTS(ENHANCES);
819 OUTS(SUPPLEMENTS);
820#undef OUTS
821 }
822 return str;
823 }
824
825 std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
826 {
827 xmlout::Node guard( str, "solvable" );
828
829 dumpAsXmlOn( *guard, obj.kind() );
830 *xmlout::Node( *guard, "name" ) << obj.name();
831 dumpAsXmlOn( *guard, obj.edition() );
832 dumpAsXmlOn( *guard, obj.arch() );
833 dumpAsXmlOn( *guard, obj.repository() );
834 return str;
835 }
836
837 } // namespace sat
839} // namespace zypp
#define DECLARE_CAP_FWD(_Fnc_Name)
Definition Solvable.cc:535
#define NO_SOLVABLE_RETURN(VAL)
Definition Solvable.cc:110
#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:310
IdString name() const
Definition Capability.h:363
Edition ed() const
Definition Capability.h:365
Rel op() const
Definition Capability.h:364
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:874
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:713
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition RepoInfo.cc:839
bool hasLicense() const
Whether there is a license associated with the repo.
Definition RepoInfo.cc:832
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:93
bool empty() const
Test for an empty path.
Definition Pathname.h:116
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:445
bool isPtfPackage() const
Subset of isPtf (provides ptfPackageToken).
Definition Solvable.cc:424
bool isNeedreboot() const
Whether this solvable triggers the reboot-needed hint if installed/updated.
Definition Solvable.cc:395
Capabilities supplements() const ZYPP_DEPRECATED
bool identIsAutoInstalled() const
Whether an installed solvable with the same ident is flagged as AutoInstalled.
Definition Solvable.h:143
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Definition Solvable.cc:225
Capabilities dep_suggests() const
Definition Solvable.cc:510
Capabilities dep_conflicts() const
Definition Solvable.cc:495
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition Solvable.cc:171
std::ostream & operator<<(std::ostream &str, const Solvable &obj) ZYPP_API
Stream output.
Definition Solvable.cc:794
IdString vendor() const
The vendor.
Definition Solvable.cc:358
Capabilities recommends() const ZYPP_DEPRECATED
ByteCount installSize() const
Installed (unpacked) size.
Definition Solvable.cc:719
Date buildtime() const
The items build time.
Definition Solvable.cc:437
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
Definition Solvable.cc:778
std::ostream & dumpOn(std::ostream &str, const Solvable &obj) ZYPP_API
More verbose stream output including dependencies.
Definition Solvable.cc:805
ResKind kind() const
The Solvables ResKind.
Definition Solvable.cc:276
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable.
Definition Solvable.cc:551
static const Solvable noSolvable
Represents no Solvable.
Definition Solvable.h:80
Capabilities dep_supplements() const
Definition Solvable.cc:520
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition Solvable.cc:449
Capabilities suggests() const ZYPP_DEPRECATED
std::string distribution() const
The distribution string.
Definition Solvable.cc:731
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Definition Solvable.cc:706
bool isBlacklisted() const
Whether this solvable is blacklisted (retracted,ptf,...).
Definition Solvable.cc:402
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:159
Capabilities dep_enhances() const
Definition Solvable.cc:515
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:131
Capabilities dep_recommends() const
Definition Solvable.cc:505
Capabilities conflicts() const ZYPP_DEPRECATED
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
Definition Solvable.cc:431
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj) ZYPP_API
XML output.
Definition Solvable.cc:825
CpeId cpeId() const
The solvables CpeId if available.
Definition Solvable.cc:700
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
Definition Solvable.cc:117
Date installtime() const
The items install time (false if not installed).
Definition Solvable.cc:443
Edition edition() const
The edition (version-release).
Definition Solvable.cc:338
static const IdString ptfMasterToken
Indicator provides ptf()
Definition Solvable.h:59
bool isPtfMaster() const
Subset of isPtf (provides ptfMasterToken).
Definition Solvable.cc:418
Solvable()
Default ctor creates noSolvable.
Definition Solvable.h:64
Capabilities dep_obsoletes() const
Definition Solvable.cc:500
LocaleSet getSupportedLocales() const
Return the supported locales.
Definition Solvable.cc:693
bool supportsRequestedLocales() const
Whether this Solvable supports at least one requested locale.
Definition Solvable.cc:690
detail::CSolvable * get() const
Expert backdoor.
Definition Solvable.cc:107
Arch arch() const
The architecture.
Definition Solvable.cc:344
static const IdString ptfPackageToken
Indicator provides ptf-package()
Definition Solvable.h:60
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition Solvable.cc:374
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Definition Solvable.cc:114
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
Definition Solvable.cc:761
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition Solvable.cc:670
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
Definition Solvable.cc:458
static const IdString retractedToken
Indicator provides retracted-patch-package()
Definition Solvable.h:58
Capabilities obsoletes() const ZYPP_DEPRECATED
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
Definition Solvable.cc:737
Capabilities dep_prerequires() const
Definition Solvable.cc:525
Capabilities dep_provides() const
Definition Solvable.cc:485
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:177
std::pair< bool, CapabilitySet > matchesSolvable(const SolvAttr &attr, const sat::Solvable &solv) const
Definition Solvable.cc:583
std::string name() const
The name (without any ResKind prefix).
Definition Solvable.cc:330
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Definition Solvable.cc:676
Capabilities dep_requires() const
Definition Solvable.cc:490
ByteCount downloadSize() const
Download size.
Definition Solvable.cc:725
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition Solvable.cc:303
bool onSystemByAuto() const
Whether this is known to be automatically installed (as dependency of a user request package).
Definition Solvable.cc:385
std::string delnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for uninstall (opt.
Definition Solvable.cc:755
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
Definition Solvable.cc:565
IdString ident() const
The identifier.
Definition Solvable.cc:270
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:183
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
Definition Solvable.cc:743
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
Definition Solvable.cc:380
Capabilities provides() const ZYPP_DEPRECATED
RepoInfo repoInfo() const
The repositories RepoInfo.
Definition Solvable.cc:370
Capabilities enhances() const ZYPP_DEPRECATED
Capabilities prerequires() const ZYPP_DEPRECATED
Repository repository() const
The Repository this Solvable belongs to.
Definition Solvable.cc:364
bool isPtf() const
Whether this solvable belongs to a PTF (provides ptfMasterToken or ptfPackageToken).
Definition Solvable.cc:415
bool isRetracted() const
Whether this solvable is retracted (provides retractedToken).
Definition Solvable.cc:405
bool isKind() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Solvable.h:103
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
Definition Solvable.cc:749
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
Definition Solvable.cc:468
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 Arch.h:364
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
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition Easy.h:27
Interface to gettext.