libzypp  17.1.1
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 
101 
103  { return myPool().getSolvable( _id ); }
104 
105 #define NO_SOLVABLE_RETURN( VAL ) \
106  detail::CSolvable * _solvable( get() ); \
107  if ( ! _solvable ) return VAL
108 
110  { return Solvable( myPool().getNextId( _id ) ); }
111 
113  {
115  for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next )
116  {
117  detail::CSolvable * nextS( myPool().getSolvable( next ) );
118  if ( nextS && nextS->repo == _solvable->repo )
119  {
120  return Solvable( next );
121  }
122  }
123  return noSolvable;
124  }
125 
126  std::string Solvable::lookupStrAttribute( const SolvAttr & attr ) const
127  {
128  NO_SOLVABLE_RETURN( std::string() );
129  const char * s = ::solvable_lookup_str( _solvable, attr.id() );
130  return s ? s : std::string();
131  }
132 
133  std::string Solvable::lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const
134  {
135  NO_SOLVABLE_RETURN( std::string() );
136  const char * s = 0;
137  if ( !lang_r )
138  {
139  s = ::solvable_lookup_str_poollang( _solvable, attr.id() );
140  }
141  else
142  {
143  for ( Locale l( lang_r ); l; l = l.fallback() )
144  {
145  if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.c_str(), 0 )) )
146  return s;
147  }
148  // here: no matching locale, so use default
149  s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
150  }
151  return s ? s : std::string();
152  }
153 
154  unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr ) const
155  {
156  NO_SOLVABLE_RETURN( 0 );
157  return ::solvable_lookup_num( _solvable, attr.id(), 0 );
158  }
159 
160  unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr, unsigned long long notfound_r ) const
161  {
162  NO_SOLVABLE_RETURN( notfound_r );
163  return ::solvable_lookup_num( _solvable, attr.id(), notfound_r );
164  }
165 
167  {
168  NO_SOLVABLE_RETURN( false );
169  return ::solvable_lookup_bool( _solvable, attr.id() );
170  }
171 
173  {
175  return ::solvable_lookup_id( _solvable, attr.id() );
176  }
177 
179  {
181  detail::IdType chksumtype = 0;
182  const char * s = ::solvable_lookup_checksum( _solvable, attr.id(), &chksumtype );
183  if ( ! s )
184  return CheckSum();
185  switch ( chksumtype )
186  {
187  case REPOKEY_TYPE_MD5: return CheckSum::md5( s );
188  case REPOKEY_TYPE_SHA1: return CheckSum::sha1( s );
189  case REPOKEY_TYPE_SHA224: return CheckSum::sha224( s );
190  case REPOKEY_TYPE_SHA256: return CheckSum::sha256( s );
191  case REPOKEY_TYPE_SHA384: return CheckSum::sha384( s );
192  case REPOKEY_TYPE_SHA512: return CheckSum::sha512( s );
193  }
194  return CheckSum( std::string(), s ); // try to autodetect
195  }
196 
198  namespace
199  {
200  inline Pathname lookupDatadirIn( Repository repor_r )
201  {
202  static const SolvAttr susetagsDatadir( "susetags:datadir" );
203  Pathname ret;
204  // First look for repo attribute "susetags:datadir". If not found,
205  // look into the solvables as Code11 libsolv placed it there.
206  LookupRepoAttr datadir( susetagsDatadir, repor_r );
207  if ( ! datadir.empty() )
208  ret = datadir.begin().asString();
209  else
210  {
211  LookupAttr datadir( susetagsDatadir, repor_r );
212  if ( ! datadir.empty() )
213  ret = datadir.begin().asString();
214  }
215  return ret;
216  }
217  } // namespace
219 
221  {
223  // medianumber and path
224  unsigned medianr;
225  const char * file = ::solvable_lookup_location( _solvable, &medianr );
226  if ( ! file )
227  return OnMediaLocation();
228  if ( ! medianr )
229  medianr = 1;
230 
231  OnMediaLocation ret;
232 
233  Pathname path;
234  switch ( repository().info().type().toEnum() )
235  {
237  {
238  path = lookupDatadirIn( repository() );
239  if ( ! path.empty() )
241  }
242  break;
243 
245  {
246  path = lookupDatadirIn( repository() );
247  if ( path.empty() )
248  path = "suse";
249  }
250  break;
251 
252  default:
253  break;
254  }
255  ret.setLocation ( path/file, medianr );
258  // Not needed/available for solvables?
259  //ret.setOpenSize ( ByteCount( lookupNumAttribute( SolvAttr::opensize ) ) );
260  //ret.setOpenChecksum( lookupCheckSumAttribute( SolvAttr::openchecksum ) );
261  return ret;
262  }
263 
264 
266  {
268  return IdString( _solvable->name );
269  }
270 
272  {
274  // detect srcpackages by 'arch'
275  switch ( _solvable->arch )
276  {
277  case ARCH_SRC:
278  case ARCH_NOSRC:
279  return ResKind::srcpackage;
280  break;
281  }
282 
283  // either explicitly prefixed...
284  const char * ident = IdString( _solvable->name ).c_str();
285  ResKind knownKind( ResKind::explicitBuiltin( ident ) );
286  if ( knownKind )
287  return knownKind;
288 
289  // ...or no ':' in package names (hopefully)...
290  const char * sep = ::strchr( ident, ':' );
291  if ( ! sep )
292  return ResKind::package;
293 
294  // ...or something unknown.
295  return ResKind( std::string( ident, sep-ident ) );
296  }
297 
298  bool Solvable::isKind( const ResKind & kind_r ) const
299  {
300  NO_SOLVABLE_RETURN( false );
301 
302  // detect srcpackages by 'arch'
303  switch ( _solvable->arch )
304  {
305  case ARCH_SRC:
306  case ARCH_NOSRC:
307  return( kind_r == ResKind::srcpackage );
308  break;
309  }
310 
311  // no ':' in package names (hopefully)
312  const char * ident = IdString( _solvable->name ).c_str();
313  if ( kind_r == ResKind::package )
314  {
315  return( ::strchr( ident, ':' ) == 0 );
316  }
317 
318  // look for a 'kind:' prefix
319  const char * kind = kind_r.c_str();
320  unsigned ksize = ::strlen( kind );
321  return( ::strncmp( ident, kind, ksize ) == 0
322  && ident[ksize] == ':' );
323  }
324 
325  std::string Solvable::name() const
326  {
327  NO_SOLVABLE_RETURN( std::string() );
328  const char * ident = IdString( _solvable->name ).c_str();
329  const char * sep = ::strchr( ident, ':' );
330  return( sep ? sep+1 : ident );
331  }
332 
334  {
336  return Edition( _solvable->evr );
337  }
338 
340  {
341  NO_SOLVABLE_RETURN( Arch_noarch ); //ArchId() );
342  switch ( _solvable->arch )
343  {
344  case ARCH_SRC:
345  case ARCH_NOSRC:
346  return Arch_noarch; //ArchId( ARCH_NOARCH );
347  break;
348  }
349  return Arch( IdString(_solvable->arch).asString() );
350  //return ArchId( _solvable->arch );
351  }
352 
354  {
356  return IdString( _solvable->vendor );
357  }
358 
360  {
362  return Repository( _solvable->repo );
363  }
364 
366  { return repository().info(); }
367 
368 
369  bool Solvable::isSystem() const
370  {
372  return myPool().isSystemRepo( _solvable->repo );
373  }
374 
376  {
377  return isSystem() && myPool().isOnSystemByUser( ident() );
378  }
379 
381  {
382  return isSystem() && myPool().isOnSystemByAuto( ident() );
383  }
384 
385  bool Solvable::identIsAutoInstalled( const IdString & ident_r )
386  {
387  return myPool().isOnSystemByAuto( ident_r );
388  }
389 
391  {
392  NO_SOLVABLE_RETURN( false );
393  return myPool().isMultiversion( *this );
394  }
395 
397  {
400  }
401 
403  {
406  }
407 
408  std::string Solvable::asString() const
409  {
410  NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
411  return str::form( "%s-%s.%s",
412  IdString( _solvable->name ).c_str(),
413  IdString( _solvable->evr ).c_str(),
414  IdString( _solvable->arch ).c_str() );
415  }
416 
417  std::string Solvable::asUserString() const\
418  {
419  NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
420  return str::form( "%s-%s.%s (%s)",
421  IdString( _solvable->name ).c_str(),
422  IdString( _solvable->evr ).c_str(),
423  IdString( _solvable->arch ).c_str(),
424  repository().asUserString().c_str() );
425  }
426 
427  bool Solvable::identical( const Solvable & rhs ) const
428  {
429  NO_SOLVABLE_RETURN( ! rhs.get() );
430  detail::CSolvable * rhssolvable( rhs.get() );
431  return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
432  }
433 
435  namespace
436  {
437  inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
438  {
439  return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
440  }
441  } // namespace
443 
445  {
447  return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
448  }
450  {
452  return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
453  }
455  {
457  return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
458  }
460  {
462  return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
463  }
465  {
467  return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
468  }
470  {
472  return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
473  }
475  {
477  return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
478  }
480  {
482  return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
483  }
485  {
487  // prerequires are a subset of requires
488  ::Offset offs = _solvable->requires;
489  return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker )
490  : Capabilities();
491  }
492 
493  CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
494  {
496  CapabilitySet ret;
497  Capabilities caps( provides() );
498  for_( it, caps.begin(), caps.end() )
499  {
500  CapDetail caprep( it->detail() );
501  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
502  ret.insert( *it );
503  }
504  return ret;
505  }
506 
507  CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
508  {
510  CapabilitySet ret;
511  Capabilities caps( provides() );
512  for_( it, caps.begin(), caps.end() )
513  {
514  CapDetail caprep( it->detail() );
515  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
516  {
517  std::string value( caprep.name().c_str()+namespace_r.size()+1 );
518  value[value.size()-1] = '\0'; // erase the trailing ')'
519  ret.insert( Capability( value, caprep.op(), caprep.ed() ) );
520  }
521  }
522  return ret;
523  }
524 
526  namespace
527  {
532  int invokeOnEachSupportedLocale( Capability cap_r, function<bool (const Locale &)> fnc_r )
533  {
534  CapDetail detail( cap_r );
535  if ( detail.kind() == CapDetail::EXPRESSION )
536  {
537  switch ( detail.capRel() )
538  {
539  case CapDetail::CAP_AND:
540  case CapDetail::CAP_OR:
541  // expand
542  {
543  int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
544  if ( res < 0 )
545  return res; // negative on abort.
546  int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
547  if ( res2 < 0 )
548  return -res + res2; // negative on abort.
549  return res + res2;
550  }
551  break;
552 
554  if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
555  {
556  return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort.
557  }
558  break;
559 
560  case CapDetail::REL_NONE:
561  case CapDetail::CAP_WITH:
562  case CapDetail::CAP_ARCH:
563  break; // unwanted
564  }
565  }
566  return 0;
567  }
568 
573  inline int invokeOnEachSupportedLocale( Capabilities cap_r, function<bool (Locale)> fnc_r )
574  {
575  int cnt = 0;
576  for_( cit, cap_r.begin(), cap_r.end() )
577  {
578  int res = invokeOnEachSupportedLocale( *cit, fnc_r );
579  if ( res < 0 )
580  return -cnt + res; // negative on abort.
581  cnt += res;
582  }
583  return cnt;
584  }
586 
587  // Functor returning false if a Locale is in the set.
588  struct NoMatchIn
589  {
590  NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {}
591 
592  bool operator()( const Locale & locale_r ) const
593  {
594  return _locales.find( locale_r ) == _locales.end();
595  }
596 
598  };
599  } // namespace
601 
603  {
604  // false_c stops on 1st Locale.
605  return invokeOnEachSupportedLocale( supplements(), functor::false_c() ) < 0;
606  }
607 
608  bool Solvable::supportsLocale( const Locale & locale_r ) const
609  {
610  // not_equal_to stops on == Locale.
611  return invokeOnEachSupportedLocale( supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
612  }
613 
614  bool Solvable::supportsLocale( const LocaleSet & locales_r ) const
615  {
616  if ( locales_r.empty() )
617  return false;
618  // NoMatchIn stops if Locale is included.
619  return invokeOnEachSupportedLocale( supplements(), NoMatchIn(locales_r) ) < 0;
620  }
621 
623  { return supportsLocale( myPool().getRequestedLocales() ); }
624 
626  {
627  LocaleSet ret;
628  invokeOnEachSupportedLocale( supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
629  return ret;
630  }
631 
633  {
636  }
637 
638  unsigned Solvable::mediaNr() const
639  {
640  NO_SOLVABLE_RETURN( 0U );
641  // medianumber and path
642  unsigned medianr = 0U;
643  const char * file = ::solvable_lookup_location( _solvable, &medianr );
644  if ( ! file )
645  medianr = 0U;
646  else if ( ! medianr )
647  medianr = 1U;
648  return medianr;
649  }
650 
652  {
655  }
656 
658  {
661  }
662 
663  std::string Solvable::distribution() const
664  {
665  NO_SOLVABLE_RETURN( std::string() );
667  }
668 
669  std::string Solvable::summary( const Locale & lang_r ) const
670  {
671  NO_SOLVABLE_RETURN( std::string() );
672  return lookupStrAttribute( SolvAttr::summary, lang_r );
673  }
674 
675  std::string Solvable::description( const Locale & lang_r ) const
676  {
677  NO_SOLVABLE_RETURN( std::string() );
678  return lookupStrAttribute( SolvAttr::description, lang_r );
679  }
680 
681  std::string Solvable::insnotify( const Locale & lang_r ) const
682  {
683  NO_SOLVABLE_RETURN( std::string() );
684  return lookupStrAttribute( SolvAttr::insnotify, lang_r );
685  }
686 
687  std::string Solvable::delnotify( const Locale & lang_r ) const
688  {
689  NO_SOLVABLE_RETURN( std::string() );
690  return lookupStrAttribute( SolvAttr::delnotify, lang_r );
691  }
692 
693  std::string Solvable::licenseToConfirm( const Locale & lang_r ) const
694  {
695  NO_SOLVABLE_RETURN( std::string() );
696  std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
697  if ( ret.empty() && isKind<Product>() )
698  {
699  const RepoInfo & ri( repoInfo() );
700  std::string riname( name() ); // "license-"+name with fallback "license"
701  if ( ! ri.hasLicense( riname ) )
702  riname.clear();
703 
704  if ( ri.needToAcceptLicense( riname ) || ! ui::Selectable::get( *this )->hasInstalledObj() )
705  ret = ri.getLicense( riname, lang_r ); // bnc#908976: suppress informal license upon update
706  }
707  return ret;
708  }
709 
711  {
712  NO_SOLVABLE_RETURN( false );
713  if ( isKind<Product>() )
714  {
715  const RepoInfo & ri( repoInfo() );
716  std::string riname( name() ); // "license-"+name with fallback "license"
717  if ( ! ri.hasLicense( riname ) )
718  riname.clear();
719 
720  return ri.needToAcceptLicense( riname );
721  }
722  return true;
723  }
724 
725 
726  std::ostream & operator<<( std::ostream & str, const Solvable & obj )
727  {
728  if ( ! obj )
729  return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" );
730 
731  return str << "(" << obj.id() << ")"
732  << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
733  << '-' << obj.edition() << '.' << obj.arch() << "("
734  << obj.repository().alias() << ")";
735  }
736 
737  std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
738  {
739  str << obj;
740  if ( obj )
741  {
742 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
743  OUTS(PROVIDES);
744  OUTS(PREREQUIRES);
745  OUTS(REQUIRES);
746  OUTS(CONFLICTS);
747  OUTS(OBSOLETES);
748  OUTS(RECOMMENDS);
749  OUTS(SUGGESTS);
750  OUTS(ENHANCES);
751  OUTS(SUPPLEMENTS);
752 #undef OUTS
753  }
754  return str;
755  }
756 
757  std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
758  {
759  xmlout::Node guard( str, "solvable" );
760 
761  dumpAsXmlOn( *guard, obj.kind() );
762  *xmlout::Node( *guard, "name" ) << obj.name();
763  dumpAsXmlOn( *guard, obj.edition() );
764  dumpAsXmlOn( *guard, obj.arch() );
765  dumpAsXmlOn( *guard, obj.repository() );
766  return str;
767  }
768 
769  } // namespace sat
771 } // namespace zypp
std::string description(const Locale &lang_r=Locale()) const
Long (multiline) text describing the solvable (opt.
Definition: Solvable.cc:675
std::string name() const
The name (without any ResKind prefix).
Definition: Solvable.cc:325
Interface to gettext.
bool hasLicense() const
Whether there is a license associated with the repo.
Definition: RepoInfo.cc:621
CapRel capRel() const
Definition: Capability.h:353
int IdType
Generic Id type.
Definition: PoolMember.h:104
A Solvable object within the sat Pool.
Definition: Solvable.h:53
IdString vendor() const
The vendor.
Definition: Solvable.cc:353
IdType id() const
Expert backdoor.
Definition: Solvable.h:385
Capability lhs() const
Definition: Capability.h:352
Capabilities provides() const
Definition: Solvable.cc:444
RepoInfo repoInfo() const
The repositories RepoInfo.
Definition: Solvable.cc:365
IdType id() const
Definition: IdStringType.h:108
ResKind kind() const
The Solvables ResKind.
Definition: Solvable.cc:271
Container of Capability (currently read only).
Definition: Capabilities.h:35
static const ResKind package
Definition: ResKind.h:40
Describes a path on a certain media amongs as the information required to download it...
const LocaleSet & _locales
Definition: Solvable.cc:597
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:516
#define OUTS(X)
Helper providing more detailed information about a Capability.
Definition: Capability.h:298
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Definition: Solvable.cc:220
Architecture.
Definition: Arch.h:36
LocaleSet getSupportedLocales() const
Return the supported locales.
Definition: Solvable.cc:625
Capabilities recommends() const
Definition: Solvable.cc:464
const_iterator end() const
Iterator pointing behind the last Capability.
Definition: Capabilities.h:169
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:30
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:172
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
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:314
#define NO_SOLVABLE_RETURN(VAL)
Definition: Solvable.cc:105
bool isOnSystemByAuto(IdString ident_r) const
Definition: PoolImpl.h:307
std::ostream & operator<<(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:726
String related utilities and Regular expression matching.
Capabilities supplements() const
Definition: Solvable.cc:479
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:125
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition: Solvable.cc:298
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:687
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:64
ByteCount downloadSize() const
Download size.
Definition: Solvable.cc:657
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:36
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
Definition: Solvable.cc:427
static const SolvAttr insnotify
Definition: SolvAttr.h:73
static CheckSum md5(const std::string &checksum)
Definition: CheckSum.h:75
static const Solvable noSolvable
Represents no Solvable.
Definition: Solvable.h:71
sat::detail::IdType id() const
Expert backdoor.
Definition: Capability.h:253
bool isSystemRepo(CRepo *repo_r) const
Definition: PoolImpl.h:99
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:507
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
Definition: Solvable.cc:112
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
Definition: Solvable.cc:417
OnMediaLocation & setDownloadSize(const ByteCount &val_r)
Set the files size.
False false_c()
Convenience function for creating a False.
Definition: Functional.h:265
bool empty() const
Test for an empty path.
Definition: Pathname.h:113
std::string distribution() const
The distribution string.
Definition: Solvable.cc:663
Repository repository() const
The Repository this Solvable belongs to.
Definition: Solvable.cc:359
bool onSystemByAuto() const
Whether this is known to be automatically installed (as dependency of a user request package)...
Definition: Solvable.cc:380
const_iterator begin() const
Iterator pointing to the first Capability.
Definition: Capabilities.h:166
bool isKind() const
Definition: Solvable.h:94
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:134
Solvable attribute keys.
Definition: SolvAttr.h:40
Capabilities enhances() const
Definition: Solvable.cc:474
Edition edition() const
The edition (version-release).
Definition: Solvable.cc:333
Lightweight repository attribute value lookup.
Definition: LookupAttr.h:257
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides &#39;namespace([value])[ op edition]&#39; of this Solvable.
Definition: Solvable.cc:493
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:651
static CheckSum sha224(const std::string &checksum)
Definition: CheckSum.h:78
static const SolvableIdType systemSolvableId(1)
Id to denote the usually hidden Solvable::systemSolvable.
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:154
RepoInfo info() const
Return any associated RepoInfo.
Definition: Repository.cc:273
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:178
Arch arch() const
The architecture.
Definition: Solvable.cc:339
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:662
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Definition: Solvable.cc:638
std::ostream & dumpOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:737
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition: Solvable.cc:408
OnMediaLocation & setChecksum(const CheckSum &val_r)
Set the files checksum.
CpeId cpeId() const
The solvables CpeId if available.
Definition: Solvable.cc:632
static const SolvAttr checksum
Definition: SolvAttr.h:86
static PoolImpl & myPool()
Definition: PoolImpl.cc:172
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
Definition: Solvable.cc:390
static const SolvAttr downloadsize
Definition: SolvAttr.h:79
Capabilities requires() const
Definition: Solvable.cc:449
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:93
Kind kind() const
Definition: Capability.h:334
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition: Solvable.cc:369
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Definition: Solvable.cc:109
static CheckSum sha256(const std::string &checksum)
Definition: CheckSum.h:79
static const SolvAttr delnotify
Definition: SolvAttr.h:74
bool isMultiversion(const Solvable &solv_r) const
Definition: PoolImpl.cc:604
&#39;Language[_Country]&#39; codes.
Definition: Locale.h:49
static const SolvAttr installsize
Definition: SolvAttr.h:78
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Definition: Solvable.cc:608
detail::CSolvable * get() const
Expert backdoor.
Definition: Solvable.cc:102
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:126
static constexpr NoThrowType noThrow
Indicator argument for non-trowing ctor.
Definition: CpeId.h:62
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
static Ptr get(const pool::ByIdent &ident_r)
Get the Selctable.
Definition: Selectable.cc:28
static const SolvAttr buildtime
Definition: SolvAttr.h:77
std::string alias() const
Short unique string to identify a repo.
Definition: Repository.cc:59
bool isOnSystemByUser(IdString ident_r) const
Definition: PoolImpl.h:304
Solvable()
Default ctor creates noSolvable.
Definition: Solvable.h:60
bool supportsRequestedLocales() const
Whether this Solvable supports at least one requested locale.
Definition: Solvable.cc:622
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:628
static const SolvAttr cpeid
Definition: SolvAttr.h:81
std::string insnotify(const Locale &lang_r=Locale()) const
UI hint text when selecting the solvable for install (opt.
Definition: Solvable.cc:681
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
Definition: Solvable.cc:669
static const Repository noRepository
Represents no Repository.
Definition: Repository.h:62
Capabilities conflicts() const
Definition: Solvable.cc:454
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:757
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
Definition: Solvable.cc:375
A sat capability.
Definition: Capability.h:59
static const SolvAttr description
Definition: SolvAttr.h:72
Capabilities prerequires() const
Definition: Solvable.cc:484
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:710
static CheckSum sha384(const std::string &checksum)
Definition: CheckSum.h:80
CSolvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
Definition: PoolImpl.h:174
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
static const SolvAttr eula
Definition: SolvAttr.h:75
static CheckSum sha1(const std::string &checksum)
Definition: CheckSum.h:77
static const SolvAttr summary
Definition: SolvAttr.h:71
Capabilities obsoletes() const
Definition: Solvable.cc:459
std::string asString() const
Conversion to std::string
Definition: IdString.h:91
static const SolvAttr distribution
Definition: SolvAttr.h:92
std::string asString() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: LookupAttr.cc:613
Capability rhs() const
Definition: Capability.h:354
static CheckSum sha512(const std::string &checksum)
Definition: CheckSum.h:81
Resolvable kinds.
Definition: ResKind.h:32
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition: Solvable.cc:602
Date buildtime() const
The items build time.
Definition: Solvable.cc:396
std::string licenseToConfirm(const Locale &lang_r=Locale()) const
License or agreement to accept before installing the solvable (opt.
Definition: Solvable.cc:693
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1028
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
const char * c_str() const
Definition: IdStringType.h:105
Capabilities suggests() const
Definition: Solvable.cc:469
IdString ident() const
The identifier.
Definition: Solvable.cc:265
Date installtime() const
The items install time (false if not installed).
Definition: Solvable.cc:402
bool empty() const
Whether the query is empty.
Definition: LookupAttr.cc:242
iterator begin() const
Iterator to the begin of query results.
Definition: LookupAttr.cc:236
OnMediaLocation & setLocation(const Pathname &val_r, unsigned mediaNumber_r=1)
Set filename and media number (defaults to 1).
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition: Solvable.cc:166