libzypp  15.28.6
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  if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.c_str(), 0 )) )
145  return s;
146  // here: no matching locale, so use default
147  s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
148  }
149  return s ? s : std::string();
150  }
151 
152  unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr ) const
153  {
154  NO_SOLVABLE_RETURN( 0 );
155  return ::solvable_lookup_num( _solvable, attr.id(), 0 );
156  }
157 
159  {
160  NO_SOLVABLE_RETURN( false );
161  return ::solvable_lookup_bool( _solvable, attr.id() );
162  }
163 
165  {
167  return ::solvable_lookup_id( _solvable, attr.id() );
168  }
169 
171  {
173  detail::IdType chksumtype = 0;
174  const char * s = ::solvable_lookup_checksum( _solvable, attr.id(), &chksumtype );
175  if ( ! s )
176  return CheckSum();
177  switch ( chksumtype )
178  {
179  case REPOKEY_TYPE_MD5: return CheckSum::md5( s );
180  case REPOKEY_TYPE_SHA1: return CheckSum::sha1( s );
181  case REPOKEY_TYPE_SHA224: return CheckSum::sha224( s );
182  case REPOKEY_TYPE_SHA256: return CheckSum::sha256( s );
183  case REPOKEY_TYPE_SHA384: return CheckSum::sha384( s );
184  case REPOKEY_TYPE_SHA512: return CheckSum::sha512( s );
185  }
186  return CheckSum( std::string(), s ); // try to autodetect
187  }
188 
190  namespace
191  {
192  inline Pathname lookupDatadirIn( Repository repor_r )
193  {
194  static const SolvAttr susetagsDatadir( "susetags:datadir" );
195  Pathname ret;
196  // First look for repo attribute "susetags:datadir". If not found,
197  // look into the solvables as Code11 libsolv placed it there.
198  LookupRepoAttr datadir( susetagsDatadir, repor_r );
199  if ( ! datadir.empty() )
200  ret = datadir.begin().asString();
201  else
202  {
203  LookupAttr datadir( susetagsDatadir, repor_r );
204  if ( ! datadir.empty() )
205  ret = datadir.begin().asString();
206  }
207  return ret;
208  }
209  } // namespace
211 
213  {
215  // medianumber and path
216  unsigned medianr;
217  const char * file = ::solvable_lookup_location( _solvable, &medianr );
218  if ( ! file )
219  return OnMediaLocation();
220  if ( ! medianr )
221  medianr = 1;
222 
223  OnMediaLocation ret;
224 
225  Pathname path;
226  switch ( repository().info().type().toEnum() )
227  {
229  {
230  path = lookupDatadirIn( repository() );
231  if ( ! path.empty() )
233  }
234  break;
235 
237  {
238  path = lookupDatadirIn( repository() );
239  if ( path.empty() )
240  path = "suse";
241  }
242  break;
243 
244  default:
245  break;
246  }
247  ret.setLocation ( path/file, medianr );
250  // Not needed/available for solvables?
251  //ret.setOpenSize ( ByteCount( lookupNumAttribute( SolvAttr::opensize ) ) );
252  //ret.setOpenChecksum( lookupCheckSumAttribute( SolvAttr::openchecksum ) );
253  return ret;
254  }
255 
256 
258  {
260  return IdString( _solvable->name );
261  }
262 
264  {
266  // detect srcpackages by 'arch'
267  switch ( _solvable->arch )
268  {
269  case ARCH_SRC:
270  case ARCH_NOSRC:
271  return ResKind::srcpackage;
272  break;
273  }
274 
275  // either explicitly prefixed...
276  const char * ident = IdString( _solvable->name ).c_str();
277  ResKind knownKind( ResKind::explicitBuiltin( ident ) );
278  if ( knownKind )
279  return knownKind;
280 
281  // ...or no ':' in package names (hopefully)...
282  const char * sep = ::strchr( ident, ':' );
283  if ( ! sep )
284  return ResKind::package;
285 
286  // ...or something unknown.
287  return ResKind( std::string( ident, sep-ident ) );
288  }
289 
290  bool Solvable::isKind( const ResKind & kind_r ) const
291  {
292  NO_SOLVABLE_RETURN( false );
293 
294  // detect srcpackages by 'arch'
295  switch ( _solvable->arch )
296  {
297  case ARCH_SRC:
298  case ARCH_NOSRC:
299  return( kind_r == ResKind::srcpackage );
300  break;
301  }
302 
303  // no ':' in package names (hopefully)
304  const char * ident = IdString( _solvable->name ).c_str();
305  if ( kind_r == ResKind::package )
306  {
307  return( ::strchr( ident, ':' ) == 0 );
308  }
309 
310  // look for a 'kind:' prefix
311  const char * kind = kind_r.c_str();
312  unsigned ksize = ::strlen( kind );
313  return( ::strncmp( ident, kind, ksize ) == 0
314  && ident[ksize] == ':' );
315  }
316 
317  std::string Solvable::name() const
318  {
319  NO_SOLVABLE_RETURN( std::string() );
320  const char * ident = IdString( _solvable->name ).c_str();
321  const char * sep = ::strchr( ident, ':' );
322  return( sep ? sep+1 : ident );
323  }
324 
326  {
328  return Edition( _solvable->evr );
329  }
330 
332  {
333  NO_SOLVABLE_RETURN( Arch_noarch ); //ArchId() );
334  switch ( _solvable->arch )
335  {
336  case ARCH_SRC:
337  case ARCH_NOSRC:
338  return Arch_noarch; //ArchId( ARCH_NOARCH );
339  break;
340  }
341  return Arch( IdString(_solvable->arch).asString() );
342  //return ArchId( _solvable->arch );
343  }
344 
346  {
348  return IdString( _solvable->vendor );
349  }
350 
352  {
354  return Repository( _solvable->repo );
355  }
356 
358  { return repository().info(); }
359 
360 
361  bool Solvable::isSystem() const
362  {
364  return myPool().isSystemRepo( _solvable->repo );
365  }
366 
368  {
369  return isSystem() && myPool().isOnSystemByUser( ident() );
370  }
371 
373  {
374  NO_SOLVABLE_RETURN( false );
375  return myPool().isMultiversion( *this );
376  }
377 
379  {
382  }
383 
385  {
388  }
389 
390  std::string Solvable::asString() const
391  {
392  NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
393  return str::form( "%s-%s.%s",
394  IdString( _solvable->name ).c_str(),
395  IdString( _solvable->evr ).c_str(),
396  IdString( _solvable->arch ).c_str() );
397  }
398 
399  std::string Solvable::asUserString() const\
400  {
401  NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
402  return str::form( "%s-%s.%s (%s)",
403  IdString( _solvable->name ).c_str(),
404  IdString( _solvable->evr ).c_str(),
405  IdString( _solvable->arch ).c_str(),
406  repository().asUserString().c_str() );
407  }
408 
409  bool Solvable::identical( const Solvable & rhs ) const
410  {
411  NO_SOLVABLE_RETURN( ! rhs.get() );
412  detail::CSolvable * rhssolvable( rhs.get() );
413  return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
414  }
415 
417  namespace
418  {
419  inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
420  {
421  return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
422  }
423  } // namespace
425 
427  {
429  return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
430  }
432  {
434  return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
435  }
437  {
439  return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
440  }
442  {
444  return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
445  }
447  {
449  return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
450  }
452  {
454  return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
455  }
457  {
459  return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
460  }
462  {
464  return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
465  }
467  {
469  // prerequires are a subset of requires
470  ::Offset offs = _solvable->requires;
471  return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker )
472  : Capabilities();
473  }
474 
475  CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
476  {
478  CapabilitySet ret;
479  Capabilities caps( provides() );
480  for_( it, caps.begin(), caps.end() )
481  {
482  CapDetail caprep( it->detail() );
483  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
484  ret.insert( *it );
485  }
486  return ret;
487  }
488 
489  CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
490  {
492  CapabilitySet ret;
493  Capabilities caps( provides() );
494  for_( it, caps.begin(), caps.end() )
495  {
496  CapDetail caprep( it->detail() );
497  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
498  {
499  std::string value( caprep.name().c_str()+namespace_r.size()+1 );
500  value[value.size()-1] = '\0'; // erase the trailing ')'
501  ret.insert( Capability( value, caprep.op(), caprep.ed() ) );
502  }
503  }
504  return ret;
505  }
506 
508  namespace
509  {
514  int invokeOnEachSupportedLocale( Capability cap_r, function<bool (const Locale &)> fnc_r )
515  {
516  CapDetail detail( cap_r );
517  if ( detail.kind() == CapDetail::EXPRESSION )
518  {
519  switch ( detail.capRel() )
520  {
521  case CapDetail::CAP_AND:
522  case CapDetail::CAP_OR:
523  // expand
524  {
525  int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
526  if ( res < 0 )
527  return res; // negative on abort.
528  int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
529  if ( res2 < 0 )
530  return -res + res2; // negative on abort.
531  return res + res2;
532  }
533  break;
534 
536  if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
537  {
538  return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort.
539  }
540  break;
541 
542  case CapDetail::REL_NONE:
543  case CapDetail::CAP_WITH:
544  case CapDetail::CAP_ARCH:
545  break; // unwanted
546  }
547  }
548  return 0;
549  }
550 
555  inline int invokeOnEachSupportedLocale( Capabilities cap_r, function<bool (Locale)> fnc_r )
556  {
557  int cnt = 0;
558  for_( cit, cap_r.begin(), cap_r.end() )
559  {
560  int res = invokeOnEachSupportedLocale( *cit, fnc_r );
561  if ( res < 0 )
562  return -cnt + res; // negative on abort.
563  cnt += res;
564  }
565  return cnt;
566  }
568 
569  // Functor returning false if a Locale is in the set.
570  struct NoMatchIn
571  {
572  NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {}
573 
574  bool operator()( const Locale & locale_r ) const
575  {
576  return _locales.find( locale_r ) == _locales.end();
577  }
578 
580  };
581  } // namespace
583 
585  {
586  // false_c stops on 1st Locale.
587  return invokeOnEachSupportedLocale( supplements(), functor::false_c() ) < 0;
588  }
589 
590  bool Solvable::supportsLocale( const Locale & locale_r ) const
591  {
592  // not_equal_to stops on == Locale.
593  return invokeOnEachSupportedLocale( supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
594  }
595 
596  bool Solvable::supportsLocale( const LocaleSet & locales_r ) const
597  {
598  if ( locales_r.empty() )
599  return false;
600  // NoMatchIn stops if Locale is included.
601  return invokeOnEachSupportedLocale( supplements(), NoMatchIn(locales_r) ) < 0;
602  }
603 
605  { return supportsLocale( myPool().getRequestedLocales() ); }
606 
608  {
609  LocaleSet ret;
610  invokeOnEachSupportedLocale( supplements(), functor::collector( std::inserter( ret, ret.begin() ) ) );
611  return ret;
612  }
613 
615  {
618  }
619 
620  unsigned Solvable::mediaNr() const
621  {
622  NO_SOLVABLE_RETURN( 0U );
624  }
625 
627  {
630  }
631 
633  {
636  }
637 
638  std::string Solvable::distribution() const
639  {
640  NO_SOLVABLE_RETURN( std::string() );
642  }
643 
644  std::string Solvable::summary( const Locale & lang_r ) const
645  {
646  NO_SOLVABLE_RETURN( std::string() );
647  return lookupStrAttribute( SolvAttr::summary, lang_r );
648  }
649 
650  std::string Solvable::description( const Locale & lang_r ) const
651  {
652  NO_SOLVABLE_RETURN( std::string() );
653  return lookupStrAttribute( SolvAttr::description, lang_r );
654  }
655 
656  std::string Solvable::insnotify( const Locale & lang_r ) const
657  {
658  NO_SOLVABLE_RETURN( std::string() );
659  return lookupStrAttribute( SolvAttr::insnotify, lang_r );
660  }
661 
662  std::string Solvable::delnotify( const Locale & lang_r ) const
663  {
664  NO_SOLVABLE_RETURN( std::string() );
665  return lookupStrAttribute( SolvAttr::delnotify, lang_r );
666  }
667 
668  std::string Solvable::licenseToConfirm( const Locale & lang_r ) const
669  {
670  NO_SOLVABLE_RETURN( std::string() );
671  std::string ret = lookupStrAttribute( SolvAttr::eula, lang_r );
672  if ( ret.empty() && isKind<Product>() )
673  {
674  const RepoInfo & ri( repoInfo() );
675  if ( ri.needToAcceptLicense() || ! ui::Selectable::get( *this )->hasInstalledObj() )
676  ret = ri.getLicense( lang_r ); // bnc#908976: suppress informal license upon update
677  }
678  return ret;
679  }
680 
682  {
683  NO_SOLVABLE_RETURN( false );
684  return ( isKind<Product>() ? repoInfo().needToAcceptLicense() : true );
685  }
686 
687 
688  std::ostream & operator<<( std::ostream & str, const Solvable & obj )
689  {
690  if ( ! obj )
691  return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" );
692 
693  return str << "(" << obj.id() << ")"
694  << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
695  << '-' << obj.edition() << '.' << obj.arch() << "("
696  << obj.repository().alias() << ")";
697  }
698 
699  std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
700  {
701  str << obj;
702  if ( obj )
703  {
704 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
705  OUTS(PROVIDES);
706  OUTS(PREREQUIRES);
707  OUTS(REQUIRES);
708  OUTS(CONFLICTS);
709  OUTS(OBSOLETES);
710  OUTS(RECOMMENDS);
711  OUTS(SUGGESTS);
712  OUTS(ENHANCES);
713  OUTS(SUPPLEMENTS);
714 #undef OUTS
715  }
716  return str;
717  }
718 
719  std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
720  {
721  xmlout::Node guard( str, "solvable" );
722 
723  dumpAsXmlOn( *guard, obj.kind() );
724  *xmlout::Node( *guard, "name" ) << obj.name();
725  dumpAsXmlOn( *guard, obj.edition() );
726  dumpAsXmlOn( *guard, obj.arch() );
727  dumpAsXmlOn( *guard, obj.repository() );
728  return str;
729  }
730 
731  } // namespace sat
733 } // namespace zypp
Repository repository() const
The Repository this Solvable belongs to.
Definition: Solvable.cc:351
bool needToAcceptLicense() const
True except for well known exceptions (i.e show license but no need to accept it).
Definition: Solvable.cc:681
RepoInfo info() const
Return any associated RepoInfo.
Definition: Repository.cc:273
Interface to gettext.
int IdType
Generic Id type.
Definition: PoolMember.h:130
A Solvable object within the sat Pool.
Definition: Solvable.h:53
Arch arch() const
The architecture.
Definition: Solvable.cc:331
Capabilities recommends() const
Definition: Solvable.cc:446
detail::CSolvable * get() const
Expert backdoor.
Definition: Solvable.cc:102
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides 'namespace([value])[ op edition]' of this Solvable.
Definition: Solvable.cc:475
Container of Capability (currently read only).
Definition: Capabilities.h:35
Date buildtime() const
The items build time.
Definition: Solvable.cc:378
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:257
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:579
#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:590
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:105
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition: Solvable.cc:584
Capabilities supplements() const
Definition: Solvable.cc:461
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
std::string asString() const
String representation "ident-edition.arch" or "noSolvable".
Definition: Solvable.cc:390
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition: Solvable.cc:361
std::ostream & operator<<(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:688
bool isKind() const
Definition: Solvable.h:94
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:151
Capabilities suggests() const
Definition: Solvable.cc:451
ByteCount downloadSize() const
Download size.
Definition: Solvable.cc:632
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:468
What is known about a repository.
Definition: RepoInfo.h:72
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:656
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:172
CapabilitySet valuesOfNamespace(const std::string &namespace_r) const
Return 'value[ op edition]' for namespaced provides 'namespace(value)[ op edition]'.
Definition: Solvable.cc:489
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
Definition: String.cc:36
std::string asUserString() const
String representation "ident-edition.arch(repo)" or "noSolvable".
Definition: Solvable.cc:399
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:668
Capabilities provides() const
Definition: Solvable.cc:426
static const Solvable noSolvable
Represents no Solvable.
Definition: Solvable.h:71
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:164
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:317
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:357
Solvable attribute keys.
Definition: SolvAttr.h:40
bool needToAcceptLicense() const
Whether the repo license has to be accepted, e.g.
Definition: RepoInfo.cc:576
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Definition: Solvable.cc:212
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:170
unsigned mediaNr() const
Media number the solvable is located on (0 if no media access required).
Definition: Solvable.cc:620
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:650
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:604
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition: Solvable.cc:158
bool isOnSystemByUser(IdString ident_r) const
Definition: PoolImpl.h:302
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
Definition: Solvable.cc:367
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:152
LocaleSet getSupportedLocales() const
Return the supported locales.
Definition: Solvable.cc:607
Date installtime() const
The items install time (false if not installed).
Definition: Solvable.cc:384
bool identical(const Solvable &rhs) const
Test whether two Solvables have the same content.
Definition: Solvable.cc:409
std::ostream & dumpOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:699
OnMediaLocation & setChecksum(const CheckSum &val_r)
Set the files checksum.
static const SolvAttr checksum
Definition: SolvAttr.h:86
static PoolImpl & myPool()
Definition: PoolImpl.cc:167
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:112
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:456
'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:165
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:345
ResKind kind() const
The Solvables ResKind.
Definition: Solvable.cc:263
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:109
Solvable()
Default ctor creates noSolvable.
Definition: Solvable.h:60
Capabilities conflicts() const
Definition: Solvable.cc:436
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:372
static const Repository noRepository
Represents no Repository.
Definition: Repository.h:62
std::string getLicense(const Locale &lang_r=Locale()) const
Return the best license for the current (or a specified) locale.
Definition: RepoInfo.cc:608
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:719
Capabilities prerequires() const
Definition: Solvable.cc:466
A sat capability.
Definition: Capability.h:59
std::string summary(const Locale &lang_r=Locale()) const
Short (singleline) text describing the solvable (opt.
Definition: Solvable.cc:644
bool isSystemRepo(CRepo *repo_r) const
Definition: PoolImpl.h:97
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:662
static const IdType noId(0)
ByteCount installSize() const
Installed (unpacked) size.
Definition: Solvable.cc:626
static CheckSum sha384(const std::string &checksum)
Definition: CheckSum.h:80
Capabilities requires() const
Definition: Solvable.cc:431
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:614
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:374
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:290
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:638
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1036
const_iterator begin() const
Iterator pointing to the first Capability.
Definition: Capabilities.h:162
std::unordered_set< Locale > LocaleSet
Definition: Locale.h:27
Edition edition() const
The edition (version-release).
Definition: Solvable.cc:325
OnMediaLocation & setLocation(const Pathname &val_r, unsigned mediaNumber_r=1)
Set filename and media number (defaults to 1).
Capabilities obsoletes() const
Definition: Solvable.cc:441
bool isMultiversion(const Solvable &solv_r) const
Definition: PoolImpl.cc:599
static const SolvAttr medianr
Definition: SolvAttr.h:88