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