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