libzypp  16.22.5
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::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  { return isPtf() || isRetracted(); }
396 
398  {
399  NO_SOLVABLE_RETURN( false );
400  if ( isKind<Package>() )
401  return myPool().isRetracted( *this );
402  if ( isKind<Patch>() )
403  return lookupStrAttribute( SolvAttr::updateStatus ) == "retracted";
404  return false;
405  }
406 
407  bool Solvable::isPtf() const
408  { return isPtfPackage() || isPtfMaster(); }
409 
411  {
412  NO_SOLVABLE_RETURN( false );
413  return myPool().isPtfMaster( *this );
414  }
415 
417  {
418  NO_SOLVABLE_RETURN( false );
419  return myPool().isPtfPackage( *this );
420  }
421 
423  {
424  NO_SOLVABLE_RETURN( false );
425  return myPool().isMultiversion( *this );
426  }
427 
429  {
432  }
433 
435  {
438  }
439 
440  std::string Solvable::asString() const
441  {
442  NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
443  return str::form( "%s-%s.%s",
444  IdString( _solvable->name ).c_str(),
445  IdString( _solvable->evr ).c_str(),
446  IdString( _solvable->arch ).c_str() );
447  }
448 
449  std::string Solvable::asUserString() const\
450  {
451  NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
452  return str::form( "%s-%s.%s (%s)",
453  IdString( _solvable->name ).c_str(),
454  IdString( _solvable->evr ).c_str(),
455  IdString( _solvable->arch ).c_str(),
456  repository().asUserString().c_str() );
457  }
458 
459  bool Solvable::identical( const Solvable & rhs ) const
460  {
461  NO_SOLVABLE_RETURN( ! rhs.get() );
462  detail::CSolvable * rhssolvable( rhs.get() );
463  return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
464  }
465 
467  namespace
468  {
469  inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
470  {
471  return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
472  }
473  } // namespace
475 
477  {
479  return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
480  }
482  {
484  return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
485  }
487  {
489  return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
490  }
492  {
494  return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
495  }
497  {
499  return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
500  }
502  {
504  return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
505  }
507  {
509  return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
510  }
512  {
514  return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
515  }
517  {
519  // prerequires are a subset of requires
520  ::Offset offs = _solvable->requires;
521  return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker )
522  : Capabilities();
523  }
524 
525  CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
526  {
528  CapabilitySet ret;
529  Capabilities caps( provides() );
530  for_( it, caps.begin(), caps.end() )
531  {
532  CapDetail caprep( it->detail() );
533  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
534  ret.insert( *it );
535  }
536  return ret;
537  }
538 
539  CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
540  {
542  CapabilitySet ret;
543  Capabilities caps( provides() );
544  for_( it, caps.begin(), caps.end() )
545  {
546  CapDetail caprep( it->detail() );
547  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
548  {
549  std::string value( caprep.name().c_str()+namespace_r.size()+1 );
550  value[value.size()-1] = '\0'; // erase the trailing ')'
551  ret.insert( Capability( value, caprep.op(), caprep.ed() ) );
552  }
553  }
554  return ret;
555  }
556 
558  namespace
559  {
564  int invokeOnEachSupportedLocale( Capability cap_r, function<bool (const Locale &)> fnc_r )
565  {
566  CapDetail detail( cap_r );
567  if ( detail.kind() == CapDetail::EXPRESSION )
568  {
569  switch ( detail.capRel() )
570  {
571  case CapDetail::CAP_AND:
572  case CapDetail::CAP_OR:
573  // expand
574  {
575  int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
576  if ( res < 0 )
577  return res; // negative on abort.
578  int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
579  if ( res2 < 0 )
580  return -res + res2; // negative on abort.
581  return res + res2;
582  }
583  break;
584 
586  if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
587  {
588  return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort.
589  }
590  break;
591 
592  case CapDetail::REL_NONE:
593  case CapDetail::CAP_WITH:
594  case CapDetail::CAP_ARCH:
595  break; // unwanted
596  }
597  }
598  return 0;
599  }
600 
605  inline int invokeOnEachSupportedLocale( Capabilities cap_r, function<bool (Locale)> fnc_r )
606  {
607  int cnt = 0;
608  for_( cit, cap_r.begin(), cap_r.end() )
609  {
610  int res = invokeOnEachSupportedLocale( *cit, fnc_r );
611  if ( res < 0 )
612  return -cnt + res; // negative on abort.
613  cnt += res;
614  }
615  return cnt;
616  }
618 
619  // Functor returning false if a Locale is in the set.
620  struct NoMatchIn
621  {
622  NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {}
623 
624  bool operator()( const Locale & locale_r ) const
625  {
626  return _locales.find( locale_r ) == _locales.end();
627  }
628 
630  };
631  } // namespace
633 
635  {
636  // false_c stops on 1st Locale.
637  return invokeOnEachSupportedLocale( supplements(), functor::false_c() ) < 0;
638  }
639 
640  bool Solvable::supportsLocale( const Locale & locale_r ) const
641  {
642  // not_equal_to stops on == Locale.
643  return invokeOnEachSupportedLocale( supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
644  }
645 
646  bool Solvable::supportsLocale( const LocaleSet & locales_r ) const
647  {
648  if ( locales_r.empty() )
649  return false;
650  // NoMatchIn stops if Locale is included.
651  return invokeOnEachSupportedLocale( supplements(), NoMatchIn(locales_r) ) < 0;
652  }
653 
655  { return supportsLocale( myPool().getRequestedLocales() ); }
656 
658  {
659  LocaleSet ret;
660  invokeOnEachSupportedLocale( supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
661  return ret;
662  }
663 
665  {
668  }
669 
670  unsigned Solvable::mediaNr() const
671  {
672  NO_SOLVABLE_RETURN( 0U );
674  }
675 
677  {
680  }
681 
683  {
686  }
687 
688  std::string Solvable::distribution() const
689  {
690  NO_SOLVABLE_RETURN( std::string() );
692  }
693 
694  std::string Solvable::summary( const Locale & lang_r ) const
695  {
696  NO_SOLVABLE_RETURN( std::string() );
697  return lookupStrAttribute( SolvAttr::summary, lang_r );
698  }
699 
700  std::string Solvable::description( const Locale & lang_r ) const
701  {
702  NO_SOLVABLE_RETURN( std::string() );
703  return lookupStrAttribute( SolvAttr::description, lang_r );
704  }
705 
706  std::string Solvable::insnotify( const Locale & lang_r ) const
707  {
708  NO_SOLVABLE_RETURN( std::string() );
709  return lookupStrAttribute( SolvAttr::insnotify, lang_r );
710  }
711 
712  std::string Solvable::delnotify( const Locale & lang_r ) const
713  {
714  NO_SOLVABLE_RETURN( std::string() );
715  return lookupStrAttribute( SolvAttr::delnotify, lang_r );
716  }
717 
718  std::string Solvable::licenseToConfirm( const Locale & lang_r ) const
719  {
720  NO_SOLVABLE_RETURN( std::string() );
721  std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
722  if ( ret.empty() && isKind<Product>() )
723  {
724  const RepoInfo & ri( repoInfo() );
725  std::string riname( name() ); // "license-"+name with fallback "license"
726  if ( ! ri.hasLicense( riname ) )
727  riname.clear();
728 
729  if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
730  ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
731  }
732  return ret;
733  }
734 
736  {
737  NO_SOLVABLE_RETURN( false );
738  if ( isKind<Product>() )
739  {
740  const RepoInfo & ri( repoInfo() );
741  std::string riname( name() ); // "license-"+name with fallback "license"
742  if ( ! ri.hasLicense( riname ) )
743  riname.clear();
744 
745  return ri.needToAcceptLicense( riname );
746  }
747  return true;
748  }
749 
750 
751  std::ostream & operator<<( std::ostream & str, const Solvable & obj )
752  {
753  if ( ! obj )
754  return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" );
755 
756  return str << "(" << obj.id() << ")"
757  << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
758  << '-' << obj.edition() << '.' << obj.arch() << "("
759  << obj.repository().alias() << ")";
760  }
761 
762  std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
763  {
764  str << obj;
765  if ( obj )
766  {
767 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
768  OUTS(PROVIDES);
769  OUTS(PREREQUIRES);
770  OUTS(REQUIRES);
771  OUTS(CONFLICTS);
772  OUTS(OBSOLETES);
773  OUTS(RECOMMENDS);
774  OUTS(SUGGESTS);
775  OUTS(ENHANCES);
776  OUTS(SUPPLEMENTS);
777 #undef OUTS
778  }
779  return str;
780  }
781 
782  std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
783  {
784  xmlout::Node guard( str, "solvable" );
785 
786  dumpAsXmlOn( *guard, obj.kind() );
787  *xmlout::Node( *guard, "name" ) << obj.name();
788  dumpAsXmlOn( *guard, obj.edition() );
789  dumpAsXmlOn( *guard, obj.arch() );
790  dumpAsXmlOn( *guard, obj.repository() );
791  return str;
792  }
793 
794  } // namespace sat
796 } // namespace zypp
Repository repository() const
The Repository this Solvable belongs to.
Definition: Solvable.cc:363
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
Definition: Solvable.cc:735
bool isPtfPackage() const
Subset of isPtf (provides ptfPackageToken).
Definition: Solvable.cc:416
bool isPtf() const
Whether this solvable belongs to a PTF (provides ptfMasterToken or ptfPackageToken).
Definition: Solvable.cc:407
RepoInfo info() const
Return any associated RepoInfo.
Definition: Repository.cc:273
Interface to gettext.
bool isPtfMaster(const Solvable &solv_r) const
Definition: PoolImpl.h:317
int IdType
Generic Id type.
Definition: PoolMember.h:130
static const IdString ptfMasterToken
Indicator provides ptf()
Definition: Solvable.h:59
A Solvable object within the sat Pool.
Definition: Solvable.h:53
Arch arch() const
The architecture.
Definition: Solvable.cc:343
Capabilities recommends() const
Definition: Solvable.cc:496
detail::CSolvable * get() const
Expert backdoor.
Definition: Solvable.cc:106
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable.
Definition: Solvable.cc:525
Container of Capability (currently read only).
Definition: Capabilities.h:35
Date buildtime() const
The items build time.
Definition: Solvable.cc:428
static const ResKind package
Definition: ResKind.h:40
std::string alias() const
Short unique string to identify a repo.
Definition: Repository.cc:59
IdString ident() const
The identifier.
Definition: Solvable.cc:269
IdType id() const
Definition: IdStringType.h:108
Describes a path on a certain media amongs as the information required to download it...
const LocaleSet & _locales
Definition: Solvable.cc:629
#define OUTS(X)
Helper providing more detailed information about a Capability.
Definition: Capability.h:298
Architecture.
Definition: Arch.h:36
static ResKind explicitBuiltin(const char *str_r)
Return the builtin kind if str_r explicitly prefixed.
Definition: ResKind.cc:46
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Definition: Solvable.cc:640
Store and operate with byte count.
Definition: ByteCount.h:30
Lightweight attribute value lookup.
Definition: LookupAttr.h:107
static const SolvAttr installtime
Definition: SolvAttr.h:76
RAII writing a nodes start/end tag.
Definition: Xml.h:84
sat::SolvAttr attr
Definition: PoolQuery.cc:314
#define NO_SOLVABLE_RETURN(VAL)
Definition: Solvable.cc:109
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition: Solvable.cc:634
Capabilities supplements() const
Definition: Solvable.cc:511
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
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition: Solvable.cc:440
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition: Solvable.cc:373
std::ostream & operator<<(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:751
bool isKind() const
Definition: Solvable.h:98
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:151
Capabilities suggests() const
Definition: Solvable.cc:501
ByteCount downloadSize() const
Download size.
Definition: Solvable.cc:682
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:517
What is known about a repository.
Definition: RepoInfo.h:71
static const ResKind srcpackage
Definition: ResKind.h:44
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
Definition: Solvable.cc:706
Access to the sat-pools string space.
Definition: IdString.h:41
Common Platform Enumearation (2.3) See http://cpe.mitre.org/ for more information on the Common Platf...
Definition: CpeId.h:31
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
::_Solvable CSolvable
Wrapped libsolv C data type exposed as backdoor.
Definition: PoolMember.h:89
CSolvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
Definition: PoolImpl.h:175
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
Definition: Solvable.cc:539
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:36
bool identIsAutoInstalled() const
Whether an installed solvable with the same ident is flagged as AutoInstalled.
Definition: Solvable.h:138
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
Definition: Solvable.cc:449
static const SolvAttr insnotify
Definition: SolvAttr.h:73
static CheckSum md5(const std::string &checksum)
Definition: CheckSum.h:75
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
Definition: Solvable.cc:718
Capabilities provides() const
Definition: Solvable.cc:476
static const Solvable noSolvable
Represents no Solvable.
Definition: Solvable.h:75
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::string asString() const
Conversion to std::string
Definition: IdString.h:91
std::string asUserString() const
User string: label (alias or name)
Definition: Repository.h:93
OnMediaLocation & setDownloadSize(const ByteCount &val_r)
Set the files size.
False false_c()
Convenience function for creating a False.
Definition: Functional.h:265
std::string name() const
The name (without any ResKind prefix).
Definition: Solvable.cc:329
static const IdString ptfPackageToken
Indicator provides ptf-package()
Definition: Solvable.h:60
Store and operate on date (time_t).
Definition: Date.h:32
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
Definition: Locale.cc:208
RepoInfo repoInfo() const
The repositories RepoInfo.
Definition: Solvable.cc:369
Solvable attribute keys.
Definition: SolvAttr.h:40
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:629
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Definition: Solvable.cc:224
Lightweight repository attribute value lookup.
Definition: LookupAttr.h:257
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
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Definition: Solvable.cc:670
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
Definition: String.h:90
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
Definition: Solvable.cc:700
static CheckSum sha224(const std::string &checksum)
Definition: CheckSum.h:78
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
bool supportsRequestedLocales() const
Whether this Solvable supports at least one requested locale.
Definition: Solvable.cc:654
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition: Solvable.cc:170
bool isOnSystemByUser(IdString ident_r) const
Definition: PoolImpl.h:305
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
Definition: Solvable.cc:379
bool isPtfMaster() const
Subset of isPtf (provides ptfMasterToken).
Definition: Solvable.cc:410
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
LocaleSet getSupportedLocales() const
Return the supported locales.
Definition: Solvable.cc:657
Date installtime() const
The items install time (false if not installed).
Definition: Solvable.cc:434
bool isPtfPackage(const Solvable &solv_r) const
Definition: PoolImpl.h:319
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
Definition: Solvable.cc:459
bool isBlacklisted() const
Whether this solvable is blacklisted (retracted,ptf,...).
Definition: Solvable.cc:394
std::ostream & dumpOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:762
static const SolvAttr updateStatus
Definition: SolvAttr.h:115
OnMediaLocation & setChecksum(const CheckSum &val_r)
Set the files checksum.
static const SolvAttr checksum
Definition: SolvAttr.h:86
static PoolImpl & myPool()
Definition: PoolImpl.cc:172
static const SolvAttr downloadsize
Definition: SolvAttr.h:79
const char * c_str() const
Conversion to const char *
Definition: IdString.cc:50
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
Definition: Solvable.cc:116
static CheckSum sha256(const std::string &checksum)
Definition: CheckSum.h:79
static const SolvAttr delnotify
Definition: SolvAttr.h:74
Capabilities enhances() const
Definition: Solvable.cc:506
'Language[_Country]' codes.
Definition: Locale.h:49
static const SolvAttr installsize
Definition: SolvAttr.h:78
const_iterator end() const
Iterator pointing behind the last Capability.
Definition: Capabilities.h:169
static constexpr NoThrowType noThrow
Indicator argument for non-trowing ctor.
Definition: CpeId.h:62
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
IdString vendor() const
The vendor.
Definition: Solvable.cc:357
ResKind kind() const
The Solvables ResKind.
Definition: Solvable.cc:275
const char * c_str() const
Definition: IdStringType.h:105
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Definition: Selectable.cc:28
static const SolvAttr buildtime
Definition: SolvAttr.h:77
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Definition: Solvable.cc:113
Solvable()
Default ctor creates noSolvable.
Definition: Solvable.h:64
Capabilities conflicts() const
Definition: Solvable.cc:486
static const SolvAttr cpeid
Definition: SolvAttr.h:81
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
Definition: Solvable.cc:422
bool isRetracted() const
Whether this solvable is retracted (provides retractedToken).
Definition: Solvable.cc:397
static const Repository noRepository
Represents no Repository.
Definition: Repository.h:62
bool isRetracted(const Solvable &solv_r) const
Definition: PoolImpl.h:315
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:664
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:782
Capabilities prerequires() const
Definition: Solvable.cc:516
A sat capability.
Definition: Capability.h:59
bool isOnSystemByAuto(IdString ident_r) const
Definition: PoolImpl.h:308
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:622
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
Definition: Solvable.cc:694
bool isSystemRepo(CRepo *repo_r) const
Definition: PoolImpl.h:100
static const SolvAttr description
Definition: SolvAttr.h:72
std::string delnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for uninstall (opt.
Definition: Solvable.cc:712
static const IdType noId(0)
ByteCount installSize() const
Installed (unpacked) size.
Definition: Solvable.cc:676
static CheckSum sha384(const std::string &checksum)
Definition: CheckSum.h:80
Capabilities requires() const
Definition: Solvable.cc:481
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
static const SolvAttr eula
Definition: SolvAttr.h:75
CpeId cpeId() const
The solvables CpeId if available.
Definition: Solvable.cc:664
static CheckSum sha1(const std::string &checksum)
Definition: CheckSum.h:77
static const SolvAttr summary
Definition: SolvAttr.h:71
IdType id() const
Expert backdoor.
Definition: Solvable.h:423
static const IdString retractedToken
Indicator provides retracted-patch-package()
Definition: Solvable.h:58
static const SolvAttr distribution
Definition: SolvAttr.h:92
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition: Solvable.cc:302
static CheckSum sha512(const std::string &checksum)
Definition: CheckSum.h:81
Resolvable kinds.
Definition: ResKind.h:32
std::string distribution() const
The distribution string.
Definition: Solvable.cc:688
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1037
const_iterator begin() const
Iterator pointing to the first Capability.
Definition: Capabilities.h:166
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
Edition edition() const
The edition (version-release).
Definition: Solvable.cc:337
bool onSystemByAuto() const
Whether this is known to be automatically installed (as dependency of a user request package)...
Definition: Solvable.cc:384
OnMediaLocation & setLocation(const Pathname &val_r, unsigned mediaNumber_r=1)
Set filename and media number (defaults to 1).
Capabilities obsoletes() const
Definition: Solvable.cc:491
bool isMultiversion(const Solvable &solv_r) const
Definition: PoolImpl.cc:622
static const SolvAttr medianr
Definition: SolvAttr.h:88