libzypp  13.10.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 using std::endl;
31 
33 namespace zypp
34 {
35  namespace sat
37  {
38 
39  namespace
40  {
41  void _doSplit( IdString & _ident, ResKind & _kind, IdString & _name )
42  {
43  if ( ! _ident )
44  return;
45 
46  ResKind explicitKind = Solvable::SplitIdent::explicitKind( _ident.c_str() );
47  // NOTE: kind package and srcpackage do not have namespaced ident!
48  if ( ! explicitKind )
49  {
50  _name = _ident;
51  // No kind defaults to package
52  if ( !_kind )
53  _kind = ResKind::package;
54  if ( ! ( _kind == ResKind::package || _kind == ResKind::srcpackage ) )
55  _ident = IdString( str::form( "%s:%s", _kind.c_str(), _ident.c_str() ) );
56  }
57  else
58  {
59  // strip kind spec from name
60  _name = IdString( ::strchr( _ident.c_str(), ':' )+1 );
61  _kind = explicitKind;
62  if ( _kind == ResKind::package || _kind == ResKind::srcpackage )
63  _ident = _name;
64  }
65  return;
66  }
67  }
68 
70  : _ident( ident_r )
71  { _doSplit( _ident, _kind, _name ); }
72 
73  Solvable::SplitIdent::SplitIdent( const char * ident_r )
74  : _ident( ident_r )
75  { _doSplit( _ident, _kind, _name ); }
76 
77  Solvable::SplitIdent::SplitIdent( const std::string & ident_r )
78  : _ident( ident_r )
79  { _doSplit( _ident, _kind, _name ); }
80 
82  : _ident( name_r )
83  , _kind( kind_r )
84  { _doSplit( _ident, _kind, _name ); }
85 
87  : _ident( name_r )
88  , _kind( kind_r )
89  { _doSplit( _ident, _kind, _name ); }
90 
92  {
93  if ( ! ident_r )
94  return ResKind();
95 
96  const char * sep = ::strchr( ident_r, ':' );
97  if ( ! sep )
98  return ResKind();
99 
100  ResKind ret;
101  if ( sep-ident_r >= 4 )
102  {
103  switch ( ident_r[3] )
104  {
105  #define OUTS(K,S) if ( !::strncmp( ident_r, ResKind::K.c_str(), S ) && ident_r[S] == ':' ) ret = ResKind::K
106  // ----v
107  case 'c': OUTS( patch, 5 ); break;
108  case 'd': OUTS( product, 7 ); break;
109  case 'k': OUTS( package, 7 ); break;
110  case 'p': OUTS( srcpackage, 10 ); break;
111  case 't': OUTS( pattern, 7 ); break;
112  #undef OUTS
113  }
114  }
115  return ret;
116  }
117 
119 
121 
123 
124  ::_Solvable * Solvable::get() const
125  { return myPool().getSolvable( _id ); }
126 
127 #define NO_SOLVABLE_RETURN( VAL ) \
128  ::_Solvable * _solvable( get() ); \
129  if ( ! _solvable ) return VAL
130 
132  { return Solvable( myPool().getNextId( _id ) ); }
133 
135  {
137  for ( detail::SolvableIdType next = _id+1; next < unsigned(_solvable->repo->end); ++next )
138  {
139  ::_Solvable * nextS( myPool().getSolvable( next ) );
140  if ( nextS && nextS->repo == _solvable->repo )
141  {
142  return Solvable( next );
143  }
144  }
145  return noSolvable;
146  }
147 
149  {
151  return Repository( _solvable->repo );
152  }
153 
154  bool Solvable::isSystem() const
155  {
157  return myPool().isSystemRepo( _solvable->repo );
158  }
159 
161  {
162  return isSystem() && myPool().isOnSystemByUser( ident() );
163  }
164 
166  {
168  return IdString( _solvable->name );
169  }
170 
171  std::string Solvable::lookupStrAttribute( const SolvAttr & attr ) const
172  {
173  NO_SOLVABLE_RETURN( std::string() );
174  const char * s = ::solvable_lookup_str( _solvable, attr.id() );
175  return s ? s : std::string();
176  }
177 
178  std::string Solvable::lookupStrAttribute( const SolvAttr & attr, const Locale & lang_r ) const
179  {
180  NO_SOLVABLE_RETURN( std::string() );
181  const char * s = 0;
182  if ( lang_r == Locale::noCode )
183  {
184  s = ::solvable_lookup_str_poollang( _solvable, attr.id() );
185  }
186  else
187  {
188  for ( Locale l( lang_r ); l != Locale::noCode; l = l.fallback() )
189  if ( (s = ::solvable_lookup_str_lang( _solvable, attr.id(), l.code().c_str(), 0 )) )
190  return s;
191  // here: no matching locale, so use default
192  s = ::solvable_lookup_str_lang( _solvable, attr.id(), 0, 0 );
193  }
194  return s ? s : std::string();
195  }
196 
197  unsigned long long Solvable::lookupNumAttribute( const SolvAttr & attr ) const
198  {
199  NO_SOLVABLE_RETURN( 0 );
200  return ::solvable_lookup_num( _solvable, attr.id(), 0 );
201  }
202 
204  {
205  NO_SOLVABLE_RETURN( false );
206  return ::solvable_lookup_bool( _solvable, attr.id() );
207  }
208 
210  {
212  return ::solvable_lookup_id( _solvable, attr.id() );
213  }
214 
216  {
218  detail::IdType chksumtype = 0;
219  const char * s = ::solvable_lookup_checksum( _solvable, attr.id(), &chksumtype );
220  if ( ! s )
221  return CheckSum();
222  switch ( chksumtype )
223  {
224  case REPOKEY_TYPE_MD5: return CheckSum::md5( s );
225  case REPOKEY_TYPE_SHA1: return CheckSum::sha1( s );
226  case REPOKEY_TYPE_SHA256: return CheckSum::sha256( s );
227  }
228  return CheckSum( std::string(), s ); // try to autodetect
229  }
230 
232  namespace
233  {
234  inline Pathname lookupDatadirIn( Repository repor_r )
235  {
236  static const sat::SolvAttr susetagsDatadir( "susetags:datadir" );
237  Pathname ret;
238  // First look for repo attribute "susetags:datadir". If not found,
239  // look into the solvables as Code11 libsolv placed it there.
240  sat::LookupRepoAttr datadir( susetagsDatadir, repor_r );
241  if ( ! datadir.empty() )
242  ret = datadir.begin().asString();
243  else
244  {
245  sat::LookupAttr datadir( susetagsDatadir, repor_r );
246  if ( ! datadir.empty() )
247  ret = datadir.begin().asString();
248  }
249  return ret;
250  }
251  }
253 
255  {
257  // medianumber and path
258  unsigned medianr;
259  const char * file = ::solvable_lookup_location( _solvable, &medianr );
260  if ( ! file )
261  return OnMediaLocation();
262  if ( ! medianr )
263  medianr = 1;
264 
265  OnMediaLocation ret;
266 
267  Pathname path;
268  switch ( repository().info().type().toEnum() )
269  {
271  {
272  path = lookupDatadirIn( repository() );
273  if ( ! path.empty() )
275  }
276  break;
277 
279  {
280  path = lookupDatadirIn( repository() );
281  if ( path.empty() )
282  path = "suse";
283  }
284  break;
285 
286  default:
287  break;
288  }
289  ret.setLocation ( path/file, medianr );
292  // Not needed/available for solvables?
293  //ret.setOpenSize ( ByteCount( lookupNumAttribute( SolvAttr::opensize ) ) );
294  //ret.setOpenChecksum( lookupCheckSumAttribute( SolvAttr::openchecksum ) );
295  return ret;
296  }
297 
299  {
301  // detect srcpackages by 'arch'
302  switch ( _solvable->arch )
303  {
304  case ARCH_SRC:
305  case ARCH_NOSRC:
306  return ResKind::srcpackage;
307  break;
308  }
309 
310  const char * ident = IdString( _solvable->name ).c_str();
311  const char * sep = ::strchr( ident, ':' );
312 
313  // no ':' in package names (hopefully)
314  if ( ! sep )
315  return ResKind::package;
316 
317  // quick check for well known kinds
318  if ( sep-ident >= 4 )
319  {
320  switch ( ident[3] )
321  {
322 #define OUTS(K,S) if ( !::strncmp( ident, ResKind::K.c_str(), S ) ) return ResKind::K
323  // ----v
324  case 'c': OUTS( patch, 5 ); break;
325  case 'd': OUTS( product, 7 ); break;
326  case 'k': OUTS( package, 7 ); break;
327  case 'p': OUTS( srcpackage, 10 ); break;
328  case 't': OUTS( pattern, 7 ); break;
329 #undef OUTS
330  }
331  }
332 
333  // an unknown kind
334  return ResKind( std::string( ident, sep-ident ) );
335  }
336 
337  bool Solvable::isKind( const ResKind & kind_r ) const
338  {
339  NO_SOLVABLE_RETURN( false );
340 
341  // detect srcpackages by 'arch'
342  switch ( _solvable->arch )
343  {
344  case ARCH_SRC:
345  case ARCH_NOSRC:
346  return( kind_r == ResKind::srcpackage );
347  break;
348  }
349 
350  // no ':' in package names (hopefully)
351  const char * ident = IdString( _solvable->name ).c_str();
352  if ( kind_r == ResKind::package )
353  {
354  return( ::strchr( ident, ':' ) == 0 );
355  }
356 
357  // look for a 'kind:' prefix
358  const char * kind = kind_r.c_str();
359  unsigned ksize = ::strlen( kind );
360  return( ::strncmp( ident, kind, ksize ) == 0
361  && ident[ksize] == ':' );
362  }
363 
364  std::string Solvable::name() const
365  {
366  NO_SOLVABLE_RETURN( std::string() );
367  const char * ident = IdString( _solvable->name ).c_str();
368  const char * sep = ::strchr( ident, ':' );
369  return( sep ? sep+1 : ident );
370  }
371 
373  {
375  return Edition( _solvable->evr );
376  }
377 
379  {
380  NO_SOLVABLE_RETURN( Arch_noarch ); //ArchId() );
381  switch ( _solvable->arch )
382  {
383  case ARCH_SRC:
384  case ARCH_NOSRC:
385  return Arch_noarch; //ArchId( ARCH_NOARCH );
386  break;
387  }
388  return Arch( IdString(_solvable->arch).asString() );
389  //return ArchId( _solvable->arch );
390  }
391 
393  {
394  return myPool().isMultiversion( ident() );
395  }
396 
398  {
400  return IdString( _solvable->vendor );
401  }
402 
404  {
405  switch( which_r.inSwitch() )
406  {
407  case Dep::PROVIDES_e: return provides(); break;
408  case Dep::REQUIRES_e: return requires(); break;
409  case Dep::CONFLICTS_e: return conflicts(); break;
410  case Dep::OBSOLETES_e: return obsoletes(); break;
411  case Dep::RECOMMENDS_e: return recommends(); break;
412  case Dep::SUGGESTS_e: return suggests(); break;
413  case Dep::ENHANCES_e: return enhances(); break;
414  case Dep::SUPPLEMENTS_e: return supplements(); break;
415  case Dep::PREREQUIRES_e: return prerequires(); break;
416  }
417  return Capabilities();
418  }
419 
420  inline Capabilities _getCapabilities( detail::IdType * idarraydata_r, ::Offset offs_r )
421  {
422  return offs_r ? Capabilities( idarraydata_r + offs_r ) : Capabilities();
423  }
425  {
427  return _getCapabilities( _solvable->repo->idarraydata, _solvable->provides );
428  }
430  {
432  return _getCapabilities( _solvable->repo->idarraydata, _solvable->requires );
433  }
435  {
437  return _getCapabilities( _solvable->repo->idarraydata, _solvable->conflicts );
438  }
440  {
442  return _getCapabilities( _solvable->repo->idarraydata, _solvable->obsoletes );
443  }
445  {
447  return _getCapabilities( _solvable->repo->idarraydata, _solvable->recommends );
448  }
450  {
452  return _getCapabilities( _solvable->repo->idarraydata, _solvable->suggests );
453  }
455  {
457  return _getCapabilities( _solvable->repo->idarraydata, _solvable->enhances );
458  }
460  {
462  return _getCapabilities( _solvable->repo->idarraydata, _solvable->supplements );
463  }
465  {
467  // prerequires are a subset of requires
468  ::Offset offs = _solvable->requires;
469  return offs ? Capabilities( _solvable->repo->idarraydata + offs, detail::solvablePrereqMarker )
470  : Capabilities();
471  }
472 
473  CapabilitySet Solvable::providesNamespace( const std::string & namespace_r ) const
474  {
476  CapabilitySet ret;
477  Capabilities caps( provides() );
478  for_( it, caps.begin(), caps.end() )
479  {
480  CapDetail caprep( it->detail() );
481  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
482  ret.insert( *it );
483  }
484  return ret;
485  }
486 
487  CapabilitySet Solvable::valuesOfNamespace( const std::string & namespace_r ) const
488  {
490  CapabilitySet ret;
491  Capabilities caps( provides() );
492  for_( it, caps.begin(), caps.end() )
493  {
494  CapDetail caprep( it->detail() );
495  if ( str::hasPrefix( caprep.name().c_str(), namespace_r ) && *(caprep.name().c_str()+namespace_r.size()) == '(' )
496  {
497  std::string value( caprep.name().c_str()+namespace_r.size()+1 );
498  value[value.size()-1] = '\0'; // erase the trailing ')'
499  ret.insert( Capability( value, caprep.op(), caprep.ed() ) );
500  }
501  }
502  return ret;
503  }
504 
505 
506  std::string Solvable::asString() const
507  {
508  NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
509  return str::form( "%s-%s.%s",
510  IdString( _solvable->name ).c_str(),
511  IdString( _solvable->evr ).c_str(),
512  IdString( _solvable->arch ).c_str() );
513  }
514 
515  std::string Solvable::asUserString() const\
516  {
517  NO_SOLVABLE_RETURN( (_id == detail::systemSolvableId ? "systemSolvable" : "noSolvable") );
518  return str::form( "%s-%s.%s(%s)",
519  IdString( _solvable->name ).c_str(),
520  IdString( _solvable->evr ).c_str(),
521  IdString( _solvable->arch ).c_str(),
522  repository().asUserString().c_str() );
523  }
524 
525  bool Solvable::identical( Solvable rhs ) const
526  {
527  NO_SOLVABLE_RETURN( ! rhs.get() );
528  ::_Solvable * rhssolvable( rhs.get() );
529  return rhssolvable && ( _solvable == rhssolvable || ::solvable_identical( _solvable, rhssolvable ) );
530  }
531 
533  namespace
534  {
535 
539  int invokeOnEachSupportedLocale( Capability cap_r, function<bool (const Locale &)> fnc_r )
540  {
541  CapDetail detail( cap_r );
542  if ( detail.kind() == CapDetail::EXPRESSION )
543  {
544  switch ( detail.capRel() )
545  {
546  case CapDetail::CAP_AND:
547  case CapDetail::CAP_OR:
548  // expand
549  {
550  int res = invokeOnEachSupportedLocale( detail.lhs(), fnc_r );
551  if ( res < 0 )
552  return res; // negative on abort.
553  int res2 = invokeOnEachSupportedLocale( detail.rhs(), fnc_r );
554  if ( res2 < 0 )
555  return -res + res2; // negative on abort.
556  return res + res2;
557  }
558  break;
559 
561  if ( detail.lhs().id() == NAMESPACE_LANGUAGE )
562  {
563  return ( !fnc_r || fnc_r( Locale( IdString(detail.rhs().id()) ) ) ) ? 1 : -1; // negative on abort.
564  }
565  break;
566 
567  case CapDetail::REL_NONE:
568  case CapDetail::CAP_WITH:
569  case CapDetail::CAP_ARCH:
570  break; // unwanted
571  }
572  }
573  return 0;
574  }
575 
580  inline int invokeOnEachSupportedLocale( Capabilities cap_r, function<bool (const Locale &)> fnc_r )
581  {
582  int cnt = 0;
583  for_( cit, cap_r.begin(), cap_r.end() )
584  {
585  int res = invokeOnEachSupportedLocale( *cit, fnc_r );
586  if ( res < 0 )
587  return -cnt + res; // negative on abort.
588  cnt += res;
589  }
590  return cnt;
591  }
593 
594  // Functor returning false if a Locale is in the set.
595  struct NoMatchIn
596  {
597  NoMatchIn( const LocaleSet & locales_r ) : _locales( locales_r ) {}
598 
599  bool operator()( const Locale & locale_r ) const
600  {
601  return _locales.find( locale_r ) == _locales.end();
602  }
603 
605  };
606 
607  }
608 
610  {
611  // false_c stops on 1st Locale.
612  return invokeOnEachSupportedLocale( supplements(), functor::false_c() ) < 0;
613  }
614 
615  bool Solvable::supportsLocale( const Locale & locale_r ) const
616  {
617  // not_equal_to stops on == Locale.
618  return invokeOnEachSupportedLocale( supplements(), bind( std::not_equal_to<Locale>(), locale_r, _1 ) ) < 0;
619  }
620 
621  bool Solvable::supportsLocale( const LocaleSet & locales_r ) const
622  {
623  if ( locales_r.empty() )
624  return false;
625  // NoMatchIn stops if Locale is included.
626  return invokeOnEachSupportedLocale( supplements(), NoMatchIn(locales_r) ) < 0;
627  }
628 
630  { return supportsLocale( myPool().getRequestedLocales() ); }
631 
632  void Solvable::getSupportedLocales( LocaleSet & locales_r ) const
633  {
634  invokeOnEachSupportedLocale( supplements(),
635  functor::Collector( std::inserter( locales_r, locales_r.begin() ) ) );
636  }
637 
638  /******************************************************************
639  **
640  ** FUNCTION NAME : operator<<
641  ** FUNCTION TYPE : std::ostream &
642  */
643  std::ostream & operator<<( std::ostream & str, const Solvable & obj )
644  {
645  if ( ! obj )
646  return str << (obj.isSystem() ? "systemSolvable" : "noSolvable" );
647 
648  return str << "(" << obj.id() << ")"
649  << ( obj.isKind( ResKind::srcpackage ) ? "srcpackage:" : "" ) << obj.ident()
650  << '-' << obj.edition() << '.' << obj.arch() << "("
651  << obj.repository().alias() << ")";
652  }
653 
654  /******************************************************************
655  **
656  ** FUNCTION NAME : dumpOn
657  ** FUNCTION TYPE : std::ostream &
658  */
659  std::ostream & dumpOn( std::ostream & str, const Solvable & obj )
660  {
661  str << obj;
662  if ( obj )
663  {
664 #define OUTS(X) if ( ! obj[Dep::X].empty() ) str << endl << " " #X " " << obj[Dep::X]
665  OUTS(PROVIDES);
666  OUTS(PREREQUIRES);
667  OUTS(REQUIRES);
668  OUTS(CONFLICTS);
669  OUTS(OBSOLETES);
670  OUTS(RECOMMENDS);
671  OUTS(SUGGESTS);
672  OUTS(ENHANCES);
673  OUTS(SUPPLEMENTS);
674 #undef OUTS
675  }
676  return str;
677  }
678 
679  std::ostream & dumpAsXmlOn( std::ostream & str, const Solvable & obj )
680  {
681  xmlout::Node guard( str, "solvable" );
682 
683  dumpAsXmlOn( *guard, obj.kind() );
684  *xmlout::Node( *guard, "name" ) << obj.name();
685  dumpAsXmlOn( *guard, obj.edition() );
686  dumpAsXmlOn( *guard, obj.arch() );
687  dumpAsXmlOn( *guard, obj.repository() );
688  return str;
689  }
690 
692  } // namespace sat
695 } // namespace zypp
Repository repository() const
The Repository this Solvable belongs to.
Definition: Solvable.cc:148
static const Locale noCode
No or empty code.
Definition: Locale.h:71
RepoInfo info() const
Return any associated RepoInfo.
Definition: Repository.cc:201
Interface to gettext.
bool isSystemRepo(::_Repo *repo_r) const
Definition: PoolImpl.h:90
int IdType
Generic Id type.
Definition: PoolMember.h:82
A Solvable object within the sat Pool.
Definition: Solvable.h:55
Arch arch() const
Definition: Solvable.cc:378
Capabilities recommends() const
Definition: Solvable.cc:444
CapabilitySet providesNamespace(const std::string &namespace_r) const
Return the namespaced provides &#39;namespace([value])[ op edition]&#39; of this Solvable.
Definition: Solvable.cc:473
Container of Capability (currently read only).
Definition: Capabilities.h:35
static const ResKind package
Definition: ResKind.h:43
std::string alias() const
Short unique string to identify a repo.
Definition: Repository.cc:57
IdString ident() const
The identifier.
Definition: Solvable.cc:165
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:604
Enumeration class of dependency types.
Definition: Dep.h:29
Helper providing more detailed information about a Capability.
Definition: Capability.h:289
Architecture.
Definition: Arch.h:36
bool supportsLocale(const Locale &locale_r) const
Whether this Solvable supports a specific Locale.
Definition: Solvable.cc:615
Store and operate with byte count.
Definition: ByteCount.h:30
#define OUTS(V)
Lightweight attribute value lookup.
Definition: LookupAttr.h:111
RAII writing a nodes start/end tag.
Definition: Xml.h:82
sat::SolvAttr attr
Definition: PoolQuery.cc:303
#define NO_SOLVABLE_RETURN(VAL)
Definition: Solvable.cc:127
bool supportsLocales() const
Whether this Solvable claims to support locales.
Definition: Solvable.cc:609
Capabilities supplements() const
Definition: Solvable.cc:459
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:171
std::string asString() const
String representation &quot;ident-edition.arch&quot; or &quot;noSolvable&quot;.
Definition: Solvable.cc:506
bool isSystem() const
Return whether this Solvable belongs to the system repo.
Definition: Solvable.cc:154
static ResKind explicitKind(IdString ident_r)
Return an idents explicit kind prefix, or ResKind() if none.
Definition: Solvable.h:282
std::ostream & operator<<(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:643
bool isKind() const
Definition: Solvable.h:162
unsigned SolvableIdType
Id type to connect Solvable and sat-solvable.
Definition: PoolMember.h:98
Capabilities suggests() const
Definition: Solvable.cc:449
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:191
::_Solvable * get() const
Expert backdoor.
Definition: Solvable.cc:124
static const ResKind srcpackage
Definition: ResKind.h:47
Access to the sat-pools string space.
Definition: IdString.h:39
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:27
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
const Arch Arch_noarch(_noarch())
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:487
std::string asUserString() const
String representation &quot;ident-edition.arch(repo)&quot; or &quot;noSolvable&quot;.
Definition: Solvable.cc:515
std::tr1::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
static CheckSum md5(const std::string &checksum)
Definition: CheckSum.h:65
Capabilities _getCapabilities(detail::IdType *idarraydata_r,::Offset offs_r)
Definition: Solvable.cc:420
Capabilities provides() const
Definition: Solvable.cc:424
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:209
std::string asString() const
Conversion to std::string
Definition: IdString.h:83
std::string asUserString() const
User string.
Definition: Repository.h:85
OnMediaLocation & setDownloadSize(const ByteCount &val_r)
Set the files size.
False false_c()
Convenience function for creating a False.
Definition: Functional.h:267
std::string name() const
Definition: Solvable.cc:364
Locale fallback() const
Return a fallback locale for this locale, when giving up, returns empty Locale()
Definition: Locale.cc:223
Solvable attribute keys.
Definition: SolvAttr.h:40
bool isMultiversion(IdString ident_r) const
Definition: PoolImpl.h:240
OnMediaLocation lookupLocation() const
returns OnMediaLocation data: This is everything we need to download e.g.
Definition: Solvable.cc:254
Lightweight repository attribute value lookup.
Definition: LookupAttr.h:260
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:215
Convenience char* constructible from std::string and char*, it maps (char*)0 to an empty string...
Definition: String.h:81
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:629
bool lookupBoolAttribute(const SolvAttr &attr) const
returns the boolean attribute value for attr or false if it does not exists.
Definition: Solvable.cc:203
bool isOnSystemByUser(IdString ident_r) const
Definition: PoolImpl.h:259
bool onSystemByUser() const
Whether this is known to be installed on behalf of a user request.
Definition: Solvable.cc:160
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:197
LocaleSet getSupportedLocales() const
Definition: Solvable.h:249
std::tr1::unordered_set< Locale > LocaleSet
Definition: Locale.h:28
std::ostream & dumpOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:659
OnMediaLocation & setChecksum(const CheckSum &val_r)
Set the files checksum.
static const SolvAttr checksum
Definition: SolvAttr.h:86
static PoolImpl & myPool()
Definition: PoolImpl.cc:164
static const SolvAttr downloadsize
Definition: SolvAttr.h:79
const char * c_str() const
Conversion to const char *
Definition: IdString.cc:42
Solvable nextInRepo() const
Return next Solvable in Repo (or noSolvable).
Definition: Solvable.cc:134
static CheckSum sha256(const std::string &checksum)
Definition: CheckSum.h:71
Capabilities enhances() const
Definition: Solvable.cc:454
std::string form(const char *format,...)
Printf style construction of std::string.
Definition: String.cc:34
const_iterator end() const
Iterator pointing behind the last Capability.
Definition: Capabilities.h:165
IdString vendor() const
Definition: Solvable.cc:397
ResKind kind() const
Definition: Solvable.cc:298
const char * c_str() const
Definition: IdStringType.h:105
Solvable nextInPool() const
Return next Solvable in Pool (or noSolvable).
Definition: Solvable.cc:131
Solvable()
Default ctor creates noSolvable.
Definition: Solvable.h:62
Capabilities conflicts() const
Definition: Solvable.cc:434
bool multiversionInstall() const
Whether different versions of this package can be installed at the same time.
Definition: Solvable.cc:392
static const Repository noRepository
Represents no Repository.
Definition: Repository.h:57
std::ostream & dumpAsXmlOn(std::ostream &str, const Solvable &obj)
Definition: Solvable.cc:679
Capabilities prerequires() const
Definition: Solvable.cc:464
A sat capability.
Definition: Capability.h:59
static const IdType noId(0)
::_Solvable * getSolvable(SolvableIdType id_r) const
Return pointer to the sat-solvable or NULL if it is not valid.
Definition: PoolImpl.h:149
Capabilities operator[](Dep which_r) const
Definition: Solvable.cc:403
Capabilities requires() const
Definition: Solvable.cc:429
static const IdType solvablePrereqMarker(15)
Internal ids satlib includes in dependencies.
for_use_in_switch inSwitch() const
Enumarator provided for use in switch statement.
Definition: Dep.h:84
static CheckSum sha1(const std::string &checksum)
Definition: CheckSum.h:69
IdType id() const
Expert backdoor.
Definition: Solvable.h:296
bool isKind(const ResKind &kind_r) const
Test whether a Solvable is of a certain ResKind.
Definition: Solvable.cc:337
Resolvable kinds.
Definition: ResKind.h:35
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:828
const_iterator begin() const
Iterator pointing to the first Capability.
Definition: Capabilities.h:162
Edition edition() const
Definition: Solvable.cc:372
OnMediaLocation & setLocation(const Pathname &val_r, unsigned mediaNumber_r=1)
Set filename and media number (defaults to 1).
Capabilities obsoletes() const
Definition: Solvable.cc:439
bool identical(Solvable rhs) const
Test whether two Solvables have the same content.
Definition: Solvable.cc:525