libzypp  17.23.8
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 <zypp/OnMediaLocation.h>
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::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  {
159  NO_SOLVABLE_RETURN( 0 );
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 
372  bool Solvable::isSystem() const
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 
388  bool Solvable::identIsAutoInstalled( const IdString & ident_r )
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>() )
403  return provides().contains( Capability( retractedToken.id() ) );
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 
442  std::string Solvable::asUserString() const\
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  }
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  {
576  case CapDetail::CAP_AND:
577  case CapDetail::CAP_OR:
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 
597  case CapDetail::REL_NONE:
598  case CapDetail::CAP_WITH:
599  case CapDetail::CAP_ARCH:
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() );
715  return lookupStrAttribute( SolvAttr::description, lang_r );
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
zypp::sat::Solvable::installtime
Date installtime() const
The items install time (false if not installed).
Definition: Solvable.cc:427
Xml.h
zypp::xmlout::Node
RAII writing a nodes start/end tag.
Definition: Xml.h:84
zypp::sat::Solvable::isRetracted
bool isRetracted() const
Whether this solvable is retracted (provides retractedToken).
Definition: Solvable.cc:399
zypp::sat::detail::PoolImpl::isOnSystemByUser
bool isOnSystemByUser(IdString ident_r) const
Definition: PoolImpl.h:305
zypp::sat::Solvable::lookupBoolAttribute
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition: Solvable.cc:169
zypp::sat::detail::systemSolvableId
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
zypp::sat::Solvable
A Solvable object within the sat Pool.
Definition: Solvable.h:53
zypp::sat::Solvable::description
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
Definition: Solvable.cc:712
zypp::sat::Solvable::lookupLocation
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Definition: Solvable.cc:223
zypp::sat::Solvable::id
IdType id() const
Expert backdoor.
Definition: Solvable.h:399
zypp::sat::detail::solvablePrereqMarker
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
zypp::Repository::alias
std::string alias() const
Short unique string to identify a repo.
Definition: Repository.cc:59
zypp::CheckSum::sha256
static CheckSum sha256(const std::string &checksum)
Definition: CheckSum.h:77
zypp::sat::SolvAttr::installtime
static const SolvAttr installtime
Definition: SolvAttr.h:76
zypp::sat::Solvable::kind
ResKind kind() const
The Solvables ResKind.
Definition: Solvable.cc:274
NO_SOLVABLE_RETURN
#define NO_SOLVABLE_RETURN(VAL)
Definition: Solvable.cc:108
zypp::CapDetail::REL_NONE
Definition: Capability.h:314
zypp::sat::Solvable::provides
Capabilities provides() const
Definition: Solvable.cc:469
zypp::sat::Solvable::repoInfo
RepoInfo repoInfo() const
The repositories RepoInfo.
Definition: Solvable.cc:368
zypp::CheckSum
Definition: CheckSum.h:33
zypp::IdString::c_str
const char * c_str() const
Conversion to const char *
Definition: IdString.cc:50
zypp::RepoInfo
What is known about a repository.
Definition: RepoInfo.h:71
zypp::sat::Solvable::ptfToken
static const IdString ptfToken
Indicator provides ptf()
Definition: Solvable.h:59
zypp::sat::detail::noId
static const IdType noId(0)
zypp::sat::Solvable::operator<<
std::ostream & operator<<(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:763
zypp::sat::Solvable::isKind
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition: Solvable.cc:301
zypp::Capabilities::begin
const_iterator begin() const
Iterator pointing to the first Capability.
Definition: Capabilities.h:169
zypp::sat::Solvable::supplements
Capabilities supplements() const
Definition: Solvable.cc:504
zypp::Repository::asUserString
std::string asUserString() const
User string: label (alias or name)
Definition: Repository.h:93
ZConfig.h
zypp::sat::Solvable::lookupIdAttribute
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
zypp::sat::Solvable::getSupportedLocales
LocaleSet getSupportedLocales() const
Return the supported locales.
Definition: Solvable.cc:662
zypp::sat::Solvable::recommends
Capabilities recommends() const
Definition: Solvable.cc:489
attr
sat::SolvAttr attr
Definition: PoolQuery.cc:311
zypp::Edition
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
zypp::sat::Solvable::downloadSize
ByteCount downloadSize() const
Download size.
Definition: Solvable.cc:694
zypp::ResKind::package
static const ResKind package
Definition: ResKind.h:40
zypp::OnMediaLocation
Describes a resource file located on a medium.
Definition: OnMediaLocation.h:38
zypp::sat::detail::PoolMember::myPool
static PoolImpl & myPool()
Definition: PoolImpl.cc:176
zypp::repo::RepoType::NONE_e
Definition: RepoType.h:36
zypp::sat::Queue::begin
const_iterator begin() const
Definition: Queue.cc:52
zypp::OnMediaLocation::setChecksum
OnMediaLocation & setChecksum(CheckSum val_r)
Set the checksum.
Definition: OnMediaLocation.cc:121
zypp::sat::Solvable::delnotify
std::string delnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for uninstall (opt.
Definition: Solvable.cc:724
zypp::CheckSum::sha384
static CheckSum sha384(const std::string &checksum)
Definition: CheckSum.h:78
zypp::Arch
Architecture.
Definition: Arch.h:36
zypp::sat::Solvable::repository
Repository repository() const
The Repository this Solvable belongs to.
Definition: Solvable.cc:362
zypp::sat::Solvable::identical
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
Definition: Solvable.cc:452
zypp::sat::SolvAttr::insnotify
static const SolvAttr insnotify
Definition: SolvAttr.h:73
zypp::sat::Solvable::distribution
std::string distribution() const
The distribution string.
Definition: Solvable.cc:700
zypp::sat::Solvable::enhances
Capabilities enhances() const
Definition: Solvable.cc:499
zypp::ByteCount
Store and operate with byte count.
Definition: ByteCount.h:30
zypp::CapDetail::CAP_WITH
Definition: Capability.h:317
zypp::sat::Solvable::SplitIdent::_name
IdString _name
Definition: Solvable.h:332
OnMediaLocation.h
zypp::IdString::asString
std::string asString() const
Conversion to std::string
Definition: IdString.h:91
zypp::sat::Solvable::noSolvable
static const Solvable noSolvable
Represents no Solvable.
Definition: Solvable.h:74
zypp::CheckSum::sha1
static CheckSum sha1(const std::string &checksum)
Definition: CheckSum.h:75
zypp::sat::Solvable::_id
IdType _id
Definition: Solvable.h:402
zypp::CapDetail::CAP_OR
Definition: Capability.h:316
zypp::IdString
Access to the sat-pools string space.
Definition: IdString.h:41
zypp::CpeId
Common Platform Enumearation (2.3) See http://cpe.mitre.org/ for more information on the Common Platf...
Definition: CpeId.h:31
zypp::CheckSum::sha512
static CheckSum sha512(const std::string &checksum)
Definition: CheckSum.h:79
zypp::sat::Solvable::installSize
ByteCount installSize() const
Installed (unpacked) size.
Definition: Solvable.cc:688
zypp::sat::Solvable::nextInRepo
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
Definition: Solvable.cc:115
Exception.h
zypp::CapabilitySet
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
zypp::sat::detail::PoolImpl::isNeedreboot
bool isNeedreboot(const Solvable &solv_r) const
Whether solv_r matches the spec.
Definition: PoolImpl.h:323
zypp::sat::Solvable::lookupNumAttribute
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
zypp::sat::Solvable::valuesOfNamespace
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
Definition: Solvable.cc:532
zypp::sat::Solvable::onSystemByAuto
bool onSystemByAuto() const
Whether this is known to be automatically installed (as dependency of a user request package).
Definition: Solvable.cc:383
zypp::sat::Solvable::asUserString
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
Definition: Solvable.cc:442
zypp::sat::detail::SolvableIdType
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:125
zypp::sat::detail::PoolImpl::getSolvable
CSolvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
Definition: PoolImpl.h:175
zypp::sat::Solvable::identIsAutoInstalled
bool identIsAutoInstalled() const
Whether an installed solvable with the same ident is flagged as AutoInstalled.
Definition: Solvable.h:137
zypp::sat::SolvAttr
Solvable attribute keys.
Definition: SolvAttr.h:40
zypp::sat::Solvable::SplitIdent::SplitIdent
SplitIdent()
Definition: Solvable.h:318
PoolImpl.h
zypp::sat::Solvable::arch
Arch arch() const
The architecture.
Definition: Solvable.cc:342
zypp::sat::Solvable::isKind
bool isKind() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: Solvable.h:97
zypp::repo::RepoType::YAST2_e
Definition: RepoType.h:38
zypp::sat::Solvable::edition
Edition edition() const
The edition (version-release).
Definition: Solvable.cc:336
zypp::sat::Solvable::lookupCheckSumAttribute
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
Logger.h
zypp::sat::Solvable::dumpOn
std::ostream & dumpOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:774
zypp::sat::SolvAttr::updateStatus
static const SolvAttr updateStatus
Definition: SolvAttr.h:115
Functional.h
zypp::sat::Solvable::providesNamespace
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable.
Definition: Solvable.cc:518
zypp::Capabilities::end
const_iterator end() const
Iterator pointing behind the last Capability.
Definition: Capabilities.h:172
OUTS
#define OUTS(X)
zypp::sat::Solvable::mediaNr
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Definition: Solvable.cc:675
zypp::sat::Solvable::multiversionInstall
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
Definition: Solvable.cc:415
zypp::sat::Solvable::asString
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition: Solvable.cc:433
zypp::sat::detail::IdType
int IdType
Generic Id type.
Definition: PoolMember.h:104
zypp::sat::Solvable::requires
Capabilities requires() const
Definition: Solvable.cc:474
zypp::str::form
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:35
zypp::sat::SolvAttr::downloadsize
static const SolvAttr downloadsize
Definition: SolvAttr.h:79
zypp::CapDetail::CAP_NAMESPACE
Definition: Capability.h:318
zypp::sat::Solvable::nextInPool
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Definition: Solvable.cc:112
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::Locale::fallback
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
Definition: Locale.cc:208
zypp::sat::SolvAttr::delnotify
static const SolvAttr delnotify
Definition: SolvAttr.h:74
zypp::RepoInfo::hasLicense
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:732
Pool.h
zypp::sat::Queue::size
size_type size() const
Definition: Queue.cc:49
zypp::Capabilities::contains
bool contains(const Capability &lhs) const
Return whether the set contains lhs (the Id)
Definition: Capabilities.h:175
zypp::C_Str
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string.
Definition: String.h:90
zypp::sat::Queue
Libsolv Id queue wrapper.
Definition: Queue.h:34
zypp::sat::SolvAttr::installsize
static const SolvAttr installsize
Definition: SolvAttr.h:78
zypp::sat::LookupRepoAttr
Lightweight repository attribute value lookup.
Definition: LookupAttr.h:257
zypp::sat::Solvable::lookupStrAttribute
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
Selectable.h
zypp::sat::Solvable::get
detail::CSolvable * get() const
Expert backdoor.
Definition: Solvable.cc:105
LookupAttr.h
zypp::OnMediaLocation::setLocation
OnMediaLocation & setLocation(Pathname filename_r, unsigned medianr_r=1)
Set filename_r and medianr_r (defaults to 1).
Definition: OnMediaLocation.cc:91
zypp::IdString::id
IdType id() const
Expert backdoor.
Definition: IdString.h:115
zypp::sat::Solvable::cpeId
CpeId cpeId() const
The solvables CpeId if available.
Definition: Solvable.cc:669
zypp::sat::Solvable::supportsRequestedLocales
bool supportsRequestedLocales() const
Whether this Solvable supports at least one requested locale.
Definition: Solvable.cc:659
zypp::sat::SolvAttr::checksum
static const SolvAttr checksum
Definition: SolvAttr.h:86
zypp::sat::Solvable::isNeedreboot
bool isNeedreboot() const
Whether this solvable triggers the reboot-needed hint if installed/updated.
Definition: Solvable.cc:393
zypp::RepoInfo::setProbedType
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:627
zypp::sat::SolvAttr::buildtime
static const SolvAttr buildtime
Definition: SolvAttr.h:77
zypp::sat::Solvable::isSystem
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition: Solvable.cc:372
zypp::sat::Solvable::summary
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
Definition: Solvable.cc:706
_locales
const LocaleSet & _locales
Definition: Solvable.cc:634
zypp::CapDetail::CAP_ARCH
Definition: Capability.h:319
zypp::Repository::noRepository
static const Repository noRepository
Represents no Repository.
Definition: Repository.h:62
zypp::sat::Solvable::SplitIdent::_ident
IdString _ident
Definition: Solvable.h:330
zypp::sat::Solvable::insnotify
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
Definition: Solvable.cc:718
zypp::OnMediaLocation::setDownloadSize
OnMediaLocation & setDownloadSize(ByteCount val_r)
Set the downloadSize.
Definition: OnMediaLocation.cc:115
zypp::sat::Solvable::dumpAsXmlOn
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:794
zypp::sat::detail::CSolvable
::s_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:64
zypp::sat::Solvable::supportsLocale
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Definition: Solvable.cc:645
Gettext.h
zypp::sat::SolvAttr::description
static const SolvAttr description
Definition: SolvAttr.h:72
zypp::Capability
A sat capability.
Definition: Capability.h:59
zypp::ResKind::srcpackage
static const ResKind srcpackage
Definition: ResKind.h:44
zypp::sat::detail::PoolImpl::isSystemRepo
bool isSystemRepo(CRepo *repo_r) const
Definition: PoolImpl.h:100
zypp::sat::detail::PoolImpl::isMultiversion
bool isMultiversion(const Solvable &solv_r) const
Definition: PoolImpl.cc:617
Collector.h
zypp::sat::Solvable::SplitIdent::_kind
ResKind _kind
Definition: Solvable.h:331
zypp::Date
Store and operate on date (time_t).
Definition: Date.h:32
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
zypp::sat::SolvAttr::cpeid
static const SolvAttr cpeid
Definition: SolvAttr.h:81
zypp::sat::Solvable::Solvable
Solvable()
Default ctor creates noSolvable.
Definition: Solvable.h:63
zypp::sat::Solvable::conflicts
Capabilities conflicts() const
Definition: Solvable.cc:479
zypp::filesystem::Pathname::empty
bool empty() const
Test for an empty path.
Definition: Pathname.h:114
zypp::functor::false_c
False false_c()
Convenience function for creating a False.
Definition: Functional.h:265
zypp::LocaleSet
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
zypp::CheckSum::md5
static CheckSum md5(const std::string &checksum)
Definition: CheckSum.h:73
zypp::ui::Selectable::get
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Definition: Selectable.cc:28
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
zypp::sat::Solvable::obsoletes
Capabilities obsoletes() const
Definition: Solvable.cc:484
zypp::sat::Solvable::onSystemByUser
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
Definition: Solvable.cc:378
zypp::sat::SolvAttr::distribution
static const SolvAttr distribution
Definition: SolvAttr.h:92
zypp::sat::Solvable::prerequires
Capabilities prerequires() const
Definition: Solvable.cc:509
Repository.h
zypp::sat::Solvable::needToAcceptLicense
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
Definition: Solvable.cc:747
zypp::RepoInfo::needToAcceptLicense
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:739
Solvable.h
zypp::sat::Solvable::buildtime
Date buildtime() const
The items build time.
Definition: Solvable.cc:421
zypp::sat::Solvable::licenseToConfirm
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
Definition: Solvable.cc:730
zypp::sat::SolvAttr::eula
static const SolvAttr eula
Definition: SolvAttr.h:75
zypp::sat::Solvable::isPtf
bool isPtf() const
Whether this solvable is a PTF (provides ptfToken).
Definition: Solvable.cc:409
str
String related utilities and Regular expression matching.
zypp::Repository::info
RepoInfo info() const
Return any associated RepoInfo.
Definition: Repository.cc:273
zypp::IdStringType::c_str
const char * c_str() const
Definition: IdStringType.h:105
zypp::sat::Solvable::supportsLocales
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition: Solvable.cc:639
zypp::CpeId::noThrow
static constexpr NoThrowType noThrow
Indicator argument for non-trowing ctor.
Definition: CpeId.h:62
zypp::sat::SolvAttr::summary
static const SolvAttr summary
Definition: SolvAttr.h:71
zypp::str::hasPrefix
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1023
zypp::sat::Solvable::matchesSolvable
std::pair< bool, CapabilitySet > matchesSolvable(const SolvAttr &attr, const sat::Solvable &solv) const
Definition: Solvable.cc:550
zypp::sat::Queue::end
const_iterator end() const
Definition: Queue.cc:55
zypp::sat::Solvable::retractedToken
static const IdString retractedToken
Indicator provides retracted-patch-package()
Definition: Solvable.h:58
zypp::CheckSum::sha224
static CheckSum sha224(const std::string &checksum)
Definition: CheckSum.h:76
zypp::Repository
Definition: Repository.h:39
zypp::Locale
'Language[_Country]' codes.
Definition: Locale.h:49
zypp::sat::Solvable::name
std::string name() const
The name (without any ResKind prefix).
Definition: Solvable.cc:328
zypp::ResKind
Resolvable kinds. A lowercased string and used as identification. Comparison against string values is...
Definition: ResKind.h:32
zypp::Capabilities
Container of Capability (currently read only).
Definition: Capabilities.h:35
zypp::sat::LookupAttr
Lightweight attribute value lookup.
Definition: LookupAttr.h:107
zypp::CapDetail::CAP_AND
Definition: Capability.h:315
zypp::ResKind::explicitBuiltin
static ResKind explicitBuiltin(const char *str_r)
Return the builtin kind if str_r explicitly prefixed.
Definition: ResKind.cc:46
zypp::sat::Solvable::vendor
IdString vendor() const
The vendor.
Definition: Solvable.cc:356
zypp::CapDetail
Helper providing more detailed information about a Capability.
Definition: Capability.h:298
zypp::RepoInfo::getLicense
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:774
zypp::sat::Solvable::suggests
Capabilities suggests() const
Definition: Solvable.cc:494
zypp::sat::detail::PoolImpl::isOnSystemByAuto
bool isOnSystemByAuto(IdString ident_r) const
Definition: PoolImpl.h:308
zypp::sat::Solvable::ident
IdString ident() const
The identifier.
Definition: Solvable.cc:268
zypp::CapDetail::EXPRESSION
Definition: Capability.h:306