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