libzypp  17.35.15
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 
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 
33 using std::endl;
34 
36 namespace 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  {
161  NO_SOLVABLE_RETURN( 0 );
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 
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 
374  bool Solvable::isSystem() const
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 
390  bool Solvable::identIsAutoInstalled( const IdString & ident_r )
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 
438  {
441  }
442 
444  {
447  }
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->provides );
489  }
491  {
493  return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
494  }
496  {
498  return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
499  }
501  {
503  return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
504  }
506  {
508  return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
509  }
511  {
513  return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
514  }
516  {
518  return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
519  }
521  {
523  return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
524  }
526  {
528  // prerequires are a subset of requires
529  ::Offset offs = _solvable->requires;
530  return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker )
531  : Capabilities();
532  }
533 
534  CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
535  {
537  CapabilitySet ret;
538  Capabilities caps( provides() );
539  for_( it, caps.begin(), caps.end() )
540  {
541  CapDetail caprep( it->detail() );
542  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
543  ret.insert( *it );
544  }
545  return ret;
546  }
547 
548  CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
549  {
551  CapabilitySet ret;
552  Capabilities caps( provides() );
553  for_( it, caps.begin(), caps.end() )
554  {
555  CapDetail caprep( it->detail() );
556  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
557  {
558  std::string value( caprep.name().c_str()+namespace_r.size()+1 );
559  value[value.size()-1] = '\0'; // erase the trailing ')'
560  ret.insert( Capability( value, caprep.op(), caprep.ed() ) );
561  }
562  }
563  return ret;
564  }
565 
566  std::pair<bool, CapabilitySet> Solvable::matchesSolvable(const SolvAttr &attr, const Solvable &solv) const
567  {
568  sat::Queue capQueue;
569  int res = solvable_matchessolvable( get(), attr.id(), static_cast<Id>( solv.id() ), capQueue, 0 );
570 
571  CapabilitySet caps;
572  if ( capQueue.size() )
573  std::for_each( capQueue.begin(), capQueue.end(), [ &caps ]( auto cap ){ caps.insert( Capability(cap) );});
574 
575  return std::make_pair( res == 1, std::move(caps) );
576  }
577 
579  namespace
580  {
585  int invokeOnEachSupportedLocale( Capability cap_r, const function<bool (const Locale &)>& fnc_r )
586  {
587  CapDetail detail( cap_r );
588  if ( detail.kind() == CapDetail::EXPRESSION )
589  {
590  switch ( detail.capRel() )
591  {
592  case CapDetail::CAP_AND:
593  case CapDetail::CAP_OR:
594  // expand
595  {
596  int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
597  if ( res < 0 )
598  return res; // negative on abort.
599  int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
600  if ( res2 < 0 )
601  return -res + res2; // negative on abort.
602  return res + res2;
603  }
604  break;
605 
607  if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
608  {
609  return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort.
610  }
611  break;
612 
613  default:
614  break; // unwanted
615  }
616  }
617  return 0;
618  }
619 
624  inline int invokeOnEachSupportedLocale( Capabilities cap_r, const function<bool (Locale)>& fnc_r )
625  {
626  int cnt = 0;
627  for_( cit, cap_r.begin(), cap_r.end() )
628  {
629  int res = invokeOnEachSupportedLocale( *cit, fnc_r );
630  if ( res < 0 )
631  return -cnt + res; // negative on abort.
632  cnt += res;
633  }
634  return cnt;
635  }
637 
638  // Functor returning false if a Locale is in the set.
639  struct NoMatchIn
640  {
641  NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {}
642 
643  bool operator()( const Locale & locale_r ) const
644  {
645  return _locales.find( locale_r ) == _locales.end();
646  }
647 
649  };
650  } // namespace
652 
654  {
655  // false_c stops on 1st Locale.
656  return invokeOnEachSupportedLocale( supplements(), functor::false_c() ) < 0;
657  }
658 
659  bool Solvable::supportsLocale( const Locale & locale_r ) const
660  {
661  // not_equal_to stops on == Locale.
662  return invokeOnEachSupportedLocale( supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
663  }
664 
665  bool Solvable::supportsLocale( const LocaleSet & locales_r ) const
666  {
667  if ( locales_r.empty() )
668  return false;
669  // NoMatchIn stops if Locale is included.
670  return invokeOnEachSupportedLocale( supplements(), NoMatchIn(locales_r) ) < 0;
671  }
672 
674  { return supportsLocale( myPool().getRequestedLocales() ); }
675 
677  {
678  LocaleSet ret;
679  invokeOnEachSupportedLocale( supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
680  return ret;
681  }
682 
684  {
687  }
688 
689  unsigned Solvable::mediaNr() const
690  {
691  NO_SOLVABLE_RETURN( 0U );
692  // medianumber and path
693  unsigned medianr = 0U;
694  const char * file = ::solvable_lookup_location( _solvable, &medianr );
695  if ( ! file )
696  medianr = 0U;
697  else if ( ! medianr )
698  medianr = 1U;
699  return medianr;
700  }
701 
703  {
706  }
707 
709  {
712  }
713 
714  std::string Solvable::distribution() const
715  {
716  NO_SOLVABLE_RETURN( std::string() );
718  }
719 
720  std::string Solvable::summary( const Locale & lang_r ) const
721  {
722  NO_SOLVABLE_RETURN( std::string() );
723  return lookupStrAttribute( SolvAttr::summary, lang_r );
724  }
725 
726  std::string Solvable::description( const Locale & lang_r ) const
727  {
728  NO_SOLVABLE_RETURN( std::string() );
729  return lookupStrAttribute( SolvAttr::description, lang_r );
730  }
731 
732  std::string Solvable::insnotify( const Locale & lang_r ) const
733  {
734  NO_SOLVABLE_RETURN( std::string() );
735  return lookupStrAttribute( SolvAttr::insnotify, lang_r );
736  }
737 
738  std::string Solvable::delnotify( const Locale & lang_r ) const
739  {
740  NO_SOLVABLE_RETURN( std::string() );
741  return lookupStrAttribute( SolvAttr::delnotify, lang_r );
742  }
743 
744  std::string Solvable::licenseToConfirm( const Locale & lang_r ) const
745  {
746  NO_SOLVABLE_RETURN( std::string() );
747  std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
748  if ( ret.empty() && isKind<Product>() )
749  {
750  const RepoInfo & ri( repoInfo() );
751  std::string riname( name() ); // "license-"+name with fallback "license"
752  if ( ! ri.hasLicense( riname ) )
753  riname.clear();
754 
755  if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
756  ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
757  }
758  return ret;
759  }
760 
762  {
763  NO_SOLVABLE_RETURN( false );
764  if ( isKind<Product>() )
765  {
766  const RepoInfo & ri( repoInfo() );
767  std::string riname( name() ); // "license-"+name with fallback "license"
768  if ( ! ri.hasLicense( riname ) )
769  riname.clear();
770 
771  return ri.needToAcceptLicense( riname );
772  }
773  return true;
774  }
775 
776 
777  std::ostream & operator<<( std::ostream & str, const Solvable & obj )
778  {
779  if ( ! obj )
780  return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" );
781 
782  return str << "(" << obj.id() << ")"
783  << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
784  << '-' << obj.edition() << '.' << obj.arch() << "("
785  << obj.repository().alias() << ")";
786  }
787 
788  std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
789  {
790  str << obj;
791  if ( obj )
792  {
793 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
794  OUTS(PROVIDES);
795  OUTS(PREREQUIRES);
796  OUTS(REQUIRES);
797  OUTS(CONFLICTS);
798  OUTS(OBSOLETES);
799  OUTS(RECOMMENDS);
800  OUTS(SUGGESTS);
801  OUTS(ENHANCES);
802  OUTS(SUPPLEMENTS);
803 #undef OUTS
804  }
805  return str;
806  }
807 
808  std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
809  {
810  xmlout::Node guard( str, "solvable" );
811 
812  dumpAsXmlOn( *guard, obj.kind() );
813  *xmlout::Node( *guard, "name" ) << obj.name();
814  dumpAsXmlOn( *guard, obj.edition() );
815  dumpAsXmlOn( *guard, obj.arch() );
816  dumpAsXmlOn( *guard, obj.repository() );
817  return str;
818  }
819 
820  } // namespace sat
822 } // namespace zypp
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
Definition: Solvable.cc:726
std::string name() const
The name (without any ResKind prefix).
Definition: Solvable.cc:330
Interface to gettext.
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:676
static const IdString ptfMasterToken
Indicator provides ptf()
Definition: Solvable.h:59
A Solvable object within the sat Pool.
Definition: Solvable.h:53
IdString vendor() const
The vendor.
Definition: Solvable.cc:358
IdType id() const
Expert backdoor.
Definition: Solvable.h:433
Capabilities provides() const
Definition: Solvable.cc:485
RepoInfo repoInfo() const
The repositories RepoInfo.
Definition: Solvable.cc:370
ResKind kind() const
The Solvables ResKind.
Definition: Solvable.cc:276
Container of Capability (currently read only).
Definition: Capabilities.h:35
static const ResKind package
Definition: ResKind.h:40
Describes a resource file located on a medium.
const LocaleSet & _locales
Definition: Solvable.cc:648
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:571
#define OUTS(X)
Helper providing more detailed information about a Capability.
Definition: Capability.h:309
std::ostream & dumpOn(std::ostream &str, const Solvable &obj) ZYPP_API
Definition: Solvable.cc:788
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Definition: Solvable.cc:225
Architecture.
Definition: Arch.h:36
LocaleSet getSupportedLocales() const
Return the supported locales.
Definition: Solvable.cc:676
Capabilities recommends() const
Definition: Solvable.cc:505
const_iterator end() const
Iterator pointing behind the last Capability.
Definition: Capabilities.h:172
static ResKind explicitBuiltin(const char *str_r)
Return the builtin kind if str_r explicitly prefixed.
Definition: ResKind.cc:46
Store and operate with byte count.
Definition: ByteCount.h:31
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
Lightweight attribute value lookup.
Definition: LookupAttr.h:109
static const SolvAttr installtime
Definition: SolvAttr.h:83
RAII writing a nodes start/end tag.
Definition: Xml.h:84
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:29
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
Definition: Locale.cc:208
sat::SolvAttr attr
Definition: PoolQuery.cc:312
#define NO_SOLVABLE_RETURN(VAL)
Definition: Solvable.cc:110
bool isBlacklisted() const
Whether this solvable is blacklisted (retracted,ptf,...).
Definition: Solvable.cc:402
bool isOnSystemByAuto(IdString ident_r) const
Definition: PoolImpl.h:320
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
String related utilities and Regular expression matching.
Capabilities supplements() const
Definition: Solvable.cc:520
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition: Solvable.cc:303
OnMediaLocation & setChecksum(CheckSum val_r)
Set the checksum.
Definition: Arch.h:363
int IdType
Generic Id type.
Definition: PoolMember.h:104
What is known about a repository.
Definition: RepoInfo.h:71
static const ResKind srcpackage
Definition: ResKind.h:44
std::string delnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for uninstall (opt.
Definition: Solvable.cc:738
Access to the sat-pools string space.
Definition: IdString.h:43
Common Platform Enumearation (2.3) See http://cpe.mitre.org/ for more information on the Common Platf...
Definition: CpeId.h:32
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
ByteCount downloadSize() const
Download size.
Definition: Solvable.cc:708
bool isPtfMaster(const Solvable &solv_r) const
Definition: PoolImpl.h:344
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:37
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
Definition: Solvable.cc:468
bool isPtfPackage() const
Subset of isPtf (provides ptfPackageToken).
Definition: Solvable.cc:424
static const SolvAttr insnotify
Definition: SolvAttr.h:80
static CheckSum md5(const std::string &checksum)
Definition: CheckSum.h:73
static const Solvable noSolvable
Represents no Solvable.
Definition: Solvable.h:80
const_iterator begin() const
Definition: Queue.cc:52
bool isSystemRepo(CRepo *repo_r) const
Definition: PoolImpl.h:101
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return &#39;value[ op edition]&#39; for namespaced provides &#39;namespace(value)[ op edition]&#39;.
Definition: Solvable.cc:548
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
Definition: Solvable.cc:117
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
Definition: Solvable.cc:458
False false_c()
Convenience function for creating a False.
Definition: Functional.h:104
bool empty() const
Test for an empty path.
Definition: Pathname.h:116
std::string distribution() const
The distribution string.
Definition: Solvable.cc:714
static const IdString ptfPackageToken
Indicator provides ptf-package()
Definition: Solvable.h:60
Repository repository() const
The Repository this Solvable belongs to.
Definition: Solvable.cc:364
::s_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:64
bool onSystemByAuto() const
Whether this is known to be automatically installed (as dependency of a user request package)...
Definition: Solvable.cc:385
const_iterator begin() const
Iterator pointing to the first Capability.
Definition: Capabilities.h:169
bool isKind() const
Definition: Solvable.h:103
Store and operate on date (time_t).
Definition: Date.h:32
bool identIsAutoInstalled() const
Whether an installed solvable with the same ident is flagged as AutoInstalled.
Definition: Solvable.h:143
Solvable attribute keys.
Definition: SolvAttr.h:40
Capabilities enhances() const
Definition: Solvable.cc:515
Edition edition() const
The edition (version-release).
Definition: Solvable.cc:338
Lightweight repository attribute value lookup.
Definition: LookupAttr.h:264
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides &#39;namespace([value])[ op edition]&#39; of this Solvable.
Definition: Solvable.cc:534
static constexpr NoThrowType noThrow
Indicator argument for non-trowing ctor.
Definition: CpeId.h:63
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
Definition: String.h:90
ByteCount installSize() const
Installed (unpacked) size.
Definition: Solvable.cc:702
static CheckSum sha224(const std::string &checksum)
Definition: CheckSum.h:76
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
bool isNeedreboot(const Solvable &solv_r) const
Whether solv_r matches the spec.
Definition: PoolImpl.h:335
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
RepoInfo info() const
Return any associated RepoInfo.
Definition: Repository.cc:274
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
Arch arch() const
The architecture.
Definition: Solvable.cc:344
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:718
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Definition: Solvable.cc:689
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition: Solvable.cc:449
static const SolvAttr updateStatus
Definition: SolvAttr.h:122
CpeId cpeId() const
The solvables CpeId if available.
Definition: Solvable.cc:683
static const SolvAttr checksum
Definition: SolvAttr.h:93
static PoolImpl & myPool()
Definition: PoolImpl.cc:184
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
Definition: Solvable.cc:431
static const SolvAttr downloadsize
Definition: SolvAttr.h:86
OnMediaLocation & setLocation(Pathname filename_r, unsigned medianr_r=1)
Set filename_r and medianr_r (defaults to 1).
Capabilities requires() const
Definition: Solvable.cc:490
const char * c_str() const
Conversion to const char *
Definition: IdString.cc:50
std::string asUserString() const
User string: label (alias or name)
Definition: Repository.h:98
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
size_type size() const
Definition: Queue.cc:49
static CheckSum sha256(const std::string &checksum)
Definition: CheckSum.h:77
static const SolvAttr delnotify
Definition: SolvAttr.h:81
std::ostream & operator<<(std::ostream &str, const Solvable &obj) ZYPP_API
Definition: Solvable.cc:777
bool isMultiversion(const Solvable &solv_r) const
Definition: PoolImpl.cc:650
&#39;Language[_Country]&#39; codes.
Definition: Locale.h:50
static const SolvAttr installsize
Definition: SolvAttr.h:85
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Definition: Solvable.cc:659
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:35
detail::CSolvable * get() const
Expert backdoor.
Definition: Solvable.cc:107
Libsolv Id queue wrapper.
Definition: Queue.h:35
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
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Definition: Selectable.cc:29
static const SolvAttr buildtime
Definition: SolvAttr.h:84
std::string alias() const
Short unique string to identify a repo.
Definition: Repository.cc:60
bool isOnSystemByUser(IdString ident_r) const
Definition: PoolImpl.h:317
bool isRetracted(const Solvable &solv_r) const
Definition: PoolImpl.h:342
Solvable()
Default ctor creates noSolvable.
Definition: Solvable.h:64
bool supportsRequestedLocales() const
Whether this Solvable supports at least one requested locale.
Definition: Solvable.cc:673
bool isNeedreboot() const
Whether this solvable triggers the reboot-needed hint if installed/updated.
Definition: Solvable.cc:395
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:683
static const SolvAttr cpeid
Definition: SolvAttr.h:88
OnMediaLocation & setDownloadSize(ByteCount val_r)
Set the downloadSize.
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
Definition: Solvable.cc:732
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
Definition: Solvable.cc:720
static const Repository noRepository
Represents no Repository.
Definition: Repository.h:67
bool isPtfPackage(const Solvable &solv_r) const
Definition: PoolImpl.h:346
Capabilities conflicts() const
Definition: Solvable.cc:495
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
Definition: Solvable.cc:380
A sat capability.
Definition: Capability.h:62
bool isPtfMaster() const
Subset of isPtf (provides ptfMasterToken).
Definition: Solvable.cc:418
static const SolvAttr description
Definition: SolvAttr.h:79
Capabilities prerequires() const
Definition: Solvable.cc:525
static const IdType noId(0)
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
Definition: Solvable.cc:761
static CheckSum sha384(const std::string &checksum)
Definition: CheckSum.h:78
CSolvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
Definition: PoolImpl.h:182
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
std::pair< bool, CapabilitySet > matchesSolvable(const SolvAttr &attr, const sat::Solvable &solv) const
Definition: Solvable.cc:566
static const SolvAttr eula
Definition: SolvAttr.h:82
unsigned int SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:125
static CheckSum sha1(const std::string &checksum)
Definition: CheckSum.h:75
static const SolvAttr summary
Definition: SolvAttr.h:78
Capabilities obsoletes() const
Definition: Solvable.cc:500
static const IdString retractedToken
Indicator provides retracted-patch-package()
Definition: Solvable.h:58
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj) ZYPP_API
Definition: Solvable.cc:808
std::string asString() const
Conversion to std::string
Definition: IdString.h:99
static const SolvAttr distribution
Definition: SolvAttr.h:99
static CheckSum sha512(const std::string &checksum)
Definition: CheckSum.h:79
Resolvable kinds.
Definition: ResKind.h:32
Easy-to use interface to the ZYPP dependency resolver.
Definition: Application.cc:19
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition: Solvable.cc:653
Date buildtime() const
The items build time.
Definition: Solvable.cc:437
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
Definition: Solvable.cc:744
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1027
zypp::IdString IdString
Definition: idstring.h:16
bool isPtf() const
Whether this solvable belongs to a PTF (provides ptfMasterToken or ptfPackageToken).
Definition: Solvable.cc:415
const_iterator end() const
Definition: Queue.cc:55
const char * c_str() const
Definition: IdStringType.h:107
Capabilities suggests() const
Definition: Solvable.cc:510
IdString ident() const
The identifier.
Definition: Solvable.cc:270
Date installtime() const
The items install time (false if not installed).
Definition: Solvable.cc:443
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition: Solvable.cc:171
bool isRetracted() const
Whether this solvable is retracted (provides retractedToken).
Definition: Solvable.cc:405