Imported Upstream version 0.7.27
[platform/upstream/libsolv.git] / doc / libsolv-bindings.txt
1 Libsolv-Bindings(3)
2 ===================
3 :man manual: LIBSOLV
4 :man source: libsolv
5
6
7 Name
8 ----
9 libsolv-bindings - access libsolv from perl/python/ruby
10
11
12 Description
13 -----------
14 Libsolv's language bindings offer an abstract, object orientated interface
15 to the library. The supported languages are currently perl, python, ruby and
16 tcl. All example code (except in the specifics sections, of course) lists
17 first the ``C-ish'' interface, then the syntax for perl, python, and ruby
18 (in that order).
19
20
21 Perl Specifics
22 --------------
23 Libsolv's perl bindings can be loaded with the following statement:
24
25         use solv;
26
27 Objects are either created by calling the new() method on a class or they
28 are returned by calling methods on other objects.
29
30         my $pool = solv::Pool->new();
31         my $repo = $pool->add_repo("my_first_repo");
32
33 Swig encapsulates all objects as tied hashes, thus the attributes can be
34 accessed by treating the object as standard hash reference:
35
36         $pool->{appdata} = 42;
37         printf "appdata is %d\n", $pool->{appdata};
38
39 A special exception to this are iterator objects, they are encapsulated as
40 tied arrays so that it is possible to iterate with a for() statement:
41
42         my $iter = $pool->solvables_iter();
43         for my $solvable (@$iter) { ... };
44
45 As a downside of this approach, iterator objects cannot have attributes.
46
47 If an array needs to be passed to a method it is usually done by reference,
48 if a method returns an array it returns it on the perl stack:
49
50         my @problems = $solver->solve(\@jobs);
51
52 Due to a bug in swig, stringification does not work for libsolv's objects.
53 Instead, you have to call the object's str() method.
54
55         print $dep->str() . "\n";
56
57 Swig implements all constants as numeric variables (instead of the more
58 natural constant subs), so don't forget the leading ``$'' when accessing a
59 constant. Also do not forget to prepend the namespace of the constant:
60
61         $pool->set_flag($solv::Pool::POOL_FLAG_OBSOLETEUSESCOLORS, 1);
62
63
64 Python Specifics
65 ----------------
66 The python bindings can be loaded with:
67
68         import solv
69
70 Objects are either created by calling the constructor method for a class or they
71 are returned by calling methods on other objects.
72
73         pool = solv.Pool()
74         repo = pool.add_repo("my_first_repo")
75
76 Attributes can be accessed as usual:
77
78         pool.appdata = 42
79         print "appdata is %d" % (pool.appdata)
80
81 Iterators also work as expected:
82
83         for solvable in pool.solvables_iter():
84
85 Arrays are passed and returned as list objects:
86
87         jobs = []
88         problems = solver.solve(jobs)
89
90 The bindings define stringification for many classes, some also have a
91 __repr__ method to ease debugging.
92
93         print dep
94         print repr(repo)
95
96 Constants are attributes of the corresponding classes:
97
98         pool.set_flag(solv.Pool.POOL_FLAG_OBSOLETEUSESCOLORS, 1);
99
100
101 Ruby Specifics
102 --------------
103 The ruby bindings can be loaded with:
104
105         require 'solv'
106
107 Objects are either created by calling the new method on a class or they
108 are returned by calling methods on other objects. Note that all classes start
109 with an uppercase letter in ruby, so the class is called ``Solv''.
110
111         pool = Solv::Pool.new
112         repo = pool.add_repo("my_first_repo")
113
114 Attributes can be accessed as usual:
115
116         pool.appdata = 42
117         puts "appdata is #{pool.appdata}"
118
119 Iterators also work as expected:
120
121         for solvable in pool.solvables_iter() do ...
122
123 Arrays are passed and returned as array objects:
124
125         jobs = []
126         problems = solver.solve(jobs)
127
128 Most classes define a to_s method, so objects can be easily stringified.
129 Many also define an inspect() method.
130
131         puts dep
132         puts repo.inspect
133
134 Constants live in the namespace of the class they belong to:
135
136         pool.set_flag(Solv::Pool::POOL_FLAG_OBSOLETEUSESCOLORS, 1);
137
138 Note that boolean methods have an added trailing ``?'', to be consistent with
139 other ruby modules:
140
141         puts "empty" if repo.isempty?
142
143
144 Tcl Specifics
145 -------------
146 Libsolv's tcl bindings can be loaded with the following statement:
147
148         TCL package require solv
149
150 Objects are either created by calling class name prefixed with ``new_'',
151 or they are returned by calling methods on other objects.
152
153         TCL set pool [solv::new_Pool]
154         TCL set repo [$pool add_repo "my_first_repo"]
155
156 Swig provides a ``cget'' method to read object attributes, and a
157 ``configure'' method to write them:
158
159         TCL $pool configure -appdata 42
160         TCL puts "appdata is [$pool cget -appdata]"
161
162 The tcl bindings provide a little helper to work with iterators in
163 a foreach style:
164
165         TCL set iter [$pool solvables_iter]
166         TCL solv::iter s $iter { ... }
167
168 libsolv's arrays are mapped to tcl's lists:
169
170         TCL set jobs [list $job1 $job2]
171         TCL set problems [$solver solve $jobs]
172         TCL puts "We have [llength $problems] problems..."
173
174 Stringification is done by calling the object's ``str'' method.
175
176         TCL puts [$dep str]
177
178 There is one exception: you have to use ``stringify'' for Datamatch
179 objects, as swig reports a clash with the ``str'' attribute.
180 Some objects also support a ``=='' method for equality tests, and a
181 ``!='' method.
182
183 Swig implements all constants as numeric variables, constants belonging
184 to a libsolv class are prefixed with the class name:
185
186         TCL $pool set_flag $solv::Pool_POOL_FLAG_OBSOLETEUSESCOLORS 1
187         TCL puts [$solvable lookup_str $solv::SOLVABLE_SUMMARY]
188
189
190 The Solv Class
191 --------------
192 This is the main namespace of the library, you cannot create objects of this
193 type but it contains some useful constants.
194
195 === CONSTANTS ===
196
197 Relational flag constants, the first three can be or-ed together
198
199 *REL_LT*::
200 the ``less than'' bit
201
202 *REL_EQ*::
203 the ``equals to'' bit
204
205 *REL_GT*::
206 the ``greater than'' bit
207
208 *REL_ARCH*::
209 used for relations that describe an extra architecture filter, the
210 version part of the relation is interpreted as architecture.
211
212 Special Solvable Ids
213
214 *SOLVID_META*::
215 Access the meta section of a repository or repodata area. This is
216 like an extra Solvable that has the Id SOLVID_META.
217
218 *SOLVID_POS*::
219 Use the data position stored inside of the pool instead of accessing
220 some solvable by Id. The bindings have the Datapos objects as an
221 abstraction mechanism, so you most likely do not need this constant.
222
223 Constant string Ids
224
225 *ID_NULL*::
226 Always zero
227
228 *ID_EMPTY*::
229 Always one, describes the empty string
230
231 *SOLVABLE_NAME*::
232 The keyname Id of the name of the solvable.
233
234 *...*::
235 see the libsolv-constantids manpage for a list of fixed Ids.
236
237
238 The Pool Class
239 --------------
240 The pool is libsolv's central resource manager. A pool consists of Solvables,
241 Repositories, Dependencies, each indexed by Ids.
242
243 === CLASS METHODS ===
244
245         Pool *Pool()
246         my $pool = solv::Pool->new();
247         pool = solv.Pool()
248         pool = Solv::Pool.new()
249
250 Create a new pool instance. In most cases you just need one pool.
251 Note that the returned object "owns" the pool, i.e. if the object is
252 freed, the pool is also freed. You can use the disown method to
253 break this ownership relation.
254
255 === ATTRIBUTES ===
256
257         void *appdata;                  /* read/write */
258         $pool->{appdata}
259         pool.appdata
260         pool.appdata
261
262 Application specific data that may be used in any way by the code using the
263 pool.
264
265         Solvable solvables[];           /* read only */
266         my $solvable = $pool->{solvables}->[$solvid];
267         solvable = pool.solvables[solvid]
268         solvable = pool.solvables[solvid]
269
270 Look up a Solvable by its id.
271
272         Repo repos[];                   /* read only */
273         my $repo = $pool->{repos}->[$repoid];
274         repo = pool.repos[repoid]
275         repo = pool.repos[repoid]
276
277 Look up a Repository by its id.
278
279         Repo *installed;                /* read/write */
280         $pool->{installed} = $repo;
281         pool.installed = repo
282         pool.installed = repo
283
284 Define which repository contains all the installed packages.
285
286         const char *errstr;             /* read only */
287         my $err = $pool->{errstr};
288         err = pool.errstr
289         err = pool.errstr
290
291 Return the last error string that was stored in the pool.
292
293 === CONSTANTS ===
294
295 *POOL_FLAG_PROMOTEEPOCH*::
296 Promote the epoch of the providing dependency to the requesting
297 dependency if it does not contain an epoch. Used at some time
298 in old rpm versions, modern systems should never need this.
299
300 *POOL_FLAG_FORBIDSELFCONFLICTS*::
301 Disallow the installation of packages that conflict with themselves.
302 Debian always allows self-conflicting packages, rpm used to forbid
303 them but switched to also allowing them since rpm-4.9.0.
304
305 *POOL_FLAG_OBSOLETEUSESPROVIDES*::
306 Make obsolete type dependency match against provides instead of
307 just the name and version of packages. Very old versions of rpm
308 used the name/version, then it got switched to provides and later
309 switched back again to just name/version.
310
311 *POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES*::
312 An implicit obsoletes is the internal mechanism to remove the
313 old package on an update. The default is to remove all packages
314 with the same name, rpm-5 switched to also removing packages
315 providing the same name.
316
317 *POOL_FLAG_OBSOLETEUSESCOLORS*::
318 Rpm's multilib implementation distinguishes between 32bit and 64bit
319 packages (the terminology is that they have a different color).
320 If obsoleteusescolors is set, packages with different colors will
321 not obsolete each other.
322
323 *POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS*::
324 Same as POOL_FLAG_OBSOLETEUSESCOLORS, but used to find out if
325 packages of the same name can be installed in parallel. For
326 current Fedora systems, POOL_FLAG_OBSOLETEUSESCOLORS should be
327 false and POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS should be true
328 (this is the default if FEDORA is defined when libsolv is compiled).
329
330 *POOL_FLAG_NOINSTALLEDOBSOLETES*::
331 Since version 4.9.0 rpm considers the obsoletes of installed packages
332 when checking for dependency conflicts, thus you may not install a
333 package that is obsoleted by some other installed package unless you
334 also erase the other package.
335
336 *POOL_FLAG_HAVEDISTEPOCH*::
337 Mandriva added a new field called distepoch that gets checked in
338 version comparison if the epoch/version/release of two packages
339 are the same.
340
341 *POOL_FLAG_NOOBSOLETESMULTIVERSION*::
342 If a package is installed in multiversion mode, rpm used to ignore
343 both the implicit obsoletes and the obsolete dependency of a
344 package. This was changed to ignoring just the implicit obsoletes,
345 thus you may install multiple versions of the same name, but
346 obsoleted packages still get removed.
347
348 *POOL_FLAG_ADDFILEPROVIDESFILTERED*::
349 Make the addfileprovides method only add files from the standard
350 locations (i.e. the ``bin'' and ``etc'' directories). This is
351 useful if you have only few packages that use non-standard file
352 dependencies, but you still want the fast speed that addfileprovides()
353 generates.
354
355 *POOL_FLAG_NOWHATPROVIDESAUX*::
356 Disable the creation of the auxillary whatprovides index. This saves
357 a bit of memory but also makes the whatprovides lookups a bit slower.
358
359 *POOL_FLAG_WHATPROVIDESWITHDISABLED*::
360 Make the whatprovides index also contain disabled packages. This
361 means that you do not need to recreate the index if a package is
362 enabled/disabled, i.e. the pool->considered bitmap is changed.
363
364 === METHODS ===
365
366         void free()
367         $pool->free();
368         pool.free()
369         pool.free()
370
371 Force a free of the pool. After this call, you must not access any object
372 that still references the pool.
373
374         void disown()
375         $pool->disown();
376         pool.disown()
377         pool.disown()
378
379 Break the ownership relation between the binding object and the pool. After
380 this call, the pool will not get freed even if the object goes out of
381 scope. This also means that you must manually call the free method to free
382 the pool data.
383
384         void setdebuglevel(int level)
385         $pool->setdebuglevel($level);
386         pool.setdebuglevel(level)
387         pool.setdebuglevel(level)
388
389 Set the debug level. A value of zero means no debug output, the higher the
390 value, the more output is generated.
391
392         int set_flag(int flag, int value)
393         my $oldvalue = $pool->set_flag($flag, $value);
394         oldvalue = pool.set_flag(flag, value)
395         oldvalue = pool.set_flag(flag, value)
396
397         int get_flag(int flag)
398         my $value = $pool->get_flag($flag);
399         value = pool.get_flag(flag)
400         value = pool.get_flag(flag)
401
402 Set/get a pool specific flag. The flags define how the system works, e.g. how
403 the package manager treats obsoletes. The default flags should be sane for most
404 applications, but in some cases you may want to tweak a flag, for example if
405 you want to solve package dependencies for some other system.
406
407         void set_rootdir(const char *rootdir)
408         $pool->set_rootdir(rootdir);
409         pool.set_rootdir(rootdir)
410         pool.set_rootdir(rootdir)
411
412         const char *get_rootdir()
413         my $rootdir = $pool->get_rootdir();
414         rootdir = pool.get_rootdir()
415         rootdir = pool.get_rootdir()
416
417 Set/get the rootdir to use. This is useful if you want package management
418 to work only in some directory, for example if you want to setup a chroot
419 jail. Note that the rootdir will only be prepended to file paths if the
420 *REPO_USE_ROOTDIR* flag is used.
421
422         void setarch(const char *arch = 0)
423         $pool->setarch();
424         pool.setarch()
425         pool.setarch()
426
427 Set the architecture for your system. The architecture is used to determine
428 which packages are installable. It defaults to the result of ``uname -m''.
429
430         Repo add_repo(const char *name)
431         $repo = $pool->add_repo($name);
432         repo = pool.add_repo(name)
433         repo = pool.add_repo(name)
434
435 Add a Repository with the specified name to the pool. The repository is empty
436 on creation, use the repository methods to populate it with packages.
437
438         Repoiterator repos_iter()
439         for my $repo (@{$pool->repos_iter()})
440         for repo in pool.repos_iter():
441         for repo in pool.repos_iter()
442
443 Iterate over the existing repositories.
444
445         Solvableiterator solvables_iter()
446         for my $solvable (@{$pool->solvables_iter()})
447         for solvable in pool.solvables_iter():
448         for solvable in pool.solvables_iter()
449
450 Iterate over the existing solvables.
451
452         Dep Dep(const char *str, bool create = 1)
453         my $dep = $pool->Dep($string);
454         dep = pool.Dep(string)
455         dep = pool.Dep(string)
456
457 Create an object describing a string or dependency. If the string is currently
458 not in the pool and _create_ is false, *undef*/*None*/*nil* is returned.
459
460         void addfileprovides()
461         $pool->addfileprovides();
462         pool.addfileprovides()
463         pool.addfileprovides()
464
465         Id *addfileprovides_queue()
466         my @ids = $pool->addfileprovides_queue();
467         ids = pool.addfileprovides_queue()
468         ids = pool.addfileprovides_queue()
469
470 Some package managers like rpm allow dependencies on files contained in other
471 packages. To allow libsolv to deal with those dependencies in an efficient way,
472 you need to call the addfileprovides method after creating and reading all
473 repositories. This method will scan all dependency for file names and then scan
474 all packages for matching files. If a filename has been matched, it will be
475 added to the provides list of the corresponding package. The
476 addfileprovides_queue variant works the same way but returns an array
477 containing all file dependencies. This information can be stored in the
478 meta section of the repositories to speed up the next time the
479 repository is loaded and addfileprovides is called.
480
481         void createwhatprovides()
482         $pool->createwhatprovides();
483         pool.createwhatprovides()
484         pool.createwhatprovides()
485
486 Create the internal ``whatprovides'' hash over all of the provides of all
487 installable packages. This method must be called before doing any lookups on
488 provides.
489 It's encouraged to do it right after all repos are set up, usually right after
490 the call to addfileprovides().
491
492         Solvable *whatprovides(DepId dep)
493         my @solvables = $pool->whatprovides($dep);
494         solvables = pool.whatprovides(dep)
495         solvables = pool.whatprovides(dep)
496
497 Return all solvables that provide the specified dependency. You can use either
498 a Dep object or a simple Id as argument.
499
500         Solvable *best_solvables(Solvable *solvables, int flags = 0)
501         my @solvables = $pool->best_solvables($solvables);
502         solvables = pool.best_solvables(solvables)
503         solvables = pool.best_solvables(solvables)
504
505 Filter list of solvables by repo priority, architecture and version.
506
507         Solvable *whatcontainsdep(Id keyname, DepId dep, Id marker = -1)
508         my @solvables = $pool->whatcontainsdep($keyname, $dep);
509         solvables = pool.whatcontainsdep(keyname, dep)
510         solvables = pool.whatcontainsdep(keyname, dep)
511
512 Return all solvables for which keyname contains the dependency.
513
514         Solvable *whatmatchesdep(Id keyname, DepId dep, Id marker = -1)
515         my @solvables = $pool->whatmatchesdep($keyname, $sdep);
516         solvables = pool.whatmatchesdep(keyname, dep)
517         solvables = pool.whatmatchesdep(keyname, dep)
518
519 Return all solvables that have dependencies in keyname that match the dependency.
520
521         Solvable *whatmatchessolvable(Id keyname, Solvable solvable, Id marker = -1)
522         my @solvables = $pool->whatmatchessolvable($keyname, $solvable);
523         solvables = pool.whatmatchessolvable(keyname, solvable)
524         solvables = pool.whatmatchessolvable(keyname, solvable)
525
526 Return all solvables that match package dependencies against solvable's
527 provides.
528
529         Id *matchprovidingids(const char *match, int flags)
530         my @ids = $pool->matchprovidingids($match, $flags);
531         ids = pool.matchprovidingids(match, flags)
532         ids = pool.matchprovidingids(match, flags)
533
534 Search the names of all provides and return the ones matching the specified
535 string. See the Dataiterator class for the allowed flags.
536
537         Id towhatprovides(Id *ids)
538         my $offset = $pool->towhatprovides(\@ids);
539         offset = pool.towhatprovides(ids)
540         offset = pool.towhatprovides(ids)
541
542 ``Internalize'' an array containing Ids. The returned value can be used to
543 create solver jobs working on a specific set of packages. See the Solver class
544 for more information.
545
546         void set_namespaceproviders(DepId ns, DepId evr, bool value = 1)
547         $pool->set_namespaceproviders($ns, $evr, 1);
548         pool.set_namespaceproviders(ns, evr, True)
549         pool.set_namespaceproviders(ns, evr, true)
550
551 Manually set a namespace provides entry in the whatprovides index.
552
553         void flush_namespaceproviders(DepId ns, DepId evr)
554         $pool->flush_namespaceproviders($ns, $evr);
555         $pool.flush_namespaceproviders(ns, evr)
556         $pool.flush_namespaceproviders(ns, evr)
557
558 Flush the cache of all namespaceprovides matching the specified namespace
559 dependency. You can use zero as a wildcard argument.
560
561         bool isknownarch(DepId id)
562         my $bool = $pool->isknownarch($id);
563         bool = pool.isknownarch(id)
564         bool = pool.isknownarch?(id)
565
566 Return true if the specified Id describes a known architecture.
567
568         Solver Solver()
569         my $solver = $pool->Solver();
570         solver = pool.Solver()
571         solver = pool.Solver()
572
573 Create a new solver object.
574
575         Job Job(int how, Id what)
576         my $job = $pool->Job($how, $what);
577         job = pool.Job(how, what)
578         job = pool.Job(how, what)
579
580 Create a new Job object. Kind of low level, in most cases you would
581 instead use a Selection or Dep job constructor.
582
583         Selection Selection()
584         my $sel = $pool->Selection();
585         sel = pool.Selection()
586         sel = pool.Selection()
587
588 Create an empty selection. Useful as a starting point for merging other
589 selections.
590
591         Selection Selection_all()
592         my $sel = $pool->Selection_all();
593         sel = pool.Selection_all()
594         sel = pool.Selection_all()
595
596 Create a selection containing all packages. Useful as starting point for
597 intersecting other selections or for update/distupgrade jobs.
598
599         Selection select(const char *name, int flags)
600         my $sel = $pool->select($name, $flags);
601         sel = pool.select(name, flags)
602         sel = pool.select(name, flags)
603
604 Create a selection by matching packages against the specified string. See the
605 Selection class for a list of flags and how to create solver jobs from a
606 selection.
607
608         Selection matchdeps(const char *name, int flags, Id keyname, Id marker = -1)
609         my $sel = $pool->matchdeps($name, $flags, $keyname);
610         sel = pool.matchdeps(name, flags, keyname)
611         sel = pool.matchdeps(name, flags, keyname)
612
613 Create a selection by matching package dependencies against the specified string.
614 This can be used if you want to match other dependency types than ``provides''.
615
616         Selection matchdepid(DepId dep, int flags, Id keyname, Id marker = -1)
617         my $sel = $pool->matchdepid($dep, $flags, $keyname);
618         sel = pool.matchdepid(dep, flags, keyname)
619         sel = pool.matchdepid(dep, flags, keyname)
620
621 Create a selection by matching package dependencies against the specified
622 dependency. This may be faster than matchdeps and also works with complex
623 dependencies. The downside is that you cannot use globs or case insensitive
624 matching.
625
626         Selection matchsolvable(Solvable solvable, int flags, Id keyname, Id marker = -1)
627         my $sel = $pool->matchsolvable($solvable, $flags, $keyname);
628         sel = pool.matchsolvable(solvable, flags, keyname)
629         sel = pool.matchsolvable(solvable, flags, keyname)
630
631 Create a selection by matching package dependencies against the specified
632 solvable's provides.
633
634         void setpooljobs(Jobs *jobs)
635         $pool->setpooljobs(\@jobs);
636         pool.setpooljobs(jobs)
637         pool.setpooljobs(jobs)
638
639         Job *getpooljobs()
640         @jobs = $pool->getpooljobs();
641         jobs = pool.getpooljobs()
642         jobs = pool.getpooljobs()
643
644 Get/Set fixed jobs stored in the pool. Those jobs are automatically appended to
645 all solver jobs, they are meant for fixed configurations like which packages
646 can be multiversion installed, which packages were userinstalled, or which
647 packages must not be erased.
648
649         void set_loadcallback(Callable *callback)
650         $pool->setloadcallback(\&callbackfunction);
651         pool.setloadcallback(callbackfunction)
652         pool.setloadcallback { |repodata| ... }
653
654 Set the callback function called when repository metadata needs to be loaded on
655 demand. To make use of this feature, you need to create repodata stubs that
656 tell the library which data is available but not loaded. If later on the data
657 needs to be accessed, the callback function is called with a repodata argument.
658 You can then load the data (maybe fetching it first from a remote server).
659 The callback should return true if the data has been made available.
660
661         /* bindings only */
662         $pool->appdata_disown()
663         pool.appdata_disown()
664         pool.appdata_disown()
665
666 Decrement the reference count of the appdata object. This can be used to break
667 circular references (e.g. if the pool's appdata value points to some meta data
668 structure that contains a pool handle). If used incorrectly, this method can
669 lead to application crashes, so beware. (This method is a no-op for ruby and tcl.)
670
671         Id *get_considered_list()
672         my @ids = $pool->get_considered_list();
673         ids = pool.get_considered_list()
674         ids = pool.get_considered_list()
675
676         void set_considered_list(Id *ids)
677         $pool->set_considered_list(\@ids);
678         pool.set_considered_list(ids)
679         pool.set_considered_list(ids)
680
681 Get/set the list of solvables that are eligible for installation. Note that
682 you need to recreate the whatprovides hash after changing the list.
683
684         Id *get_disabled_list()
685         my @ids = $pool->get_disabled_list();
686         ids = pool.get_disabled_list()
687         ids = pool.get_disabled_list()
688
689         void set_disabled_list(Id *ids)
690         $pool->set_disabled_list(\@ids);
691         pool.set_disabled_list(ids)
692         pool.set_disabled_list(ids)
693
694 Get/set the list of solvables that are not eligible for installation. This is
695 basically the inverse of the ``considered'' methods above, i.e. calling
696 ``set_disabled_list()'' with an empty list will make all solvables eligible for
697 installation. Note you need to recreate the whatprovides hash after changing the
698 list.
699
700         const char *solvableset2str(Solvable *solvables)
701         my $str = $pool->solvableset2str($solvables);
702         str = pool.solvableset2str(solvables)
703         str = pool.solvableset2str(solvables)
704
705 Return a string describing a list of solvables. The method tries to reduce
706 the output by using version ranges if possible.
707
708 === DATA RETRIEVAL METHODS ===
709
710 In the following functions, the _keyname_ argument describes what to retrieve.
711 For the standard cases you can use the available Id constants. For example,
712
713         $solv::SOLVABLE_SUMMARY
714         solv.SOLVABLE_SUMMARY
715         Solv::SOLVABLE_SUMMARY
716
717 selects the ``Summary'' entry of a solvable. The _solvid_ argument selects the
718 desired solvable by Id.
719
720         const char *lookup_str(Id solvid, Id keyname)
721         my $string = $pool->lookup_str($solvid, $keyname);
722         string = pool.lookup_str(solvid, keyname)
723         string = pool.lookup_str(solvid, keyname)
724
725         Id lookup_id(Id solvid, Id keyname)
726         my $id = $pool->lookup_id($solvid, $keyname);
727         id = pool.lookup_id(solvid, keyname)
728         id = pool.lookup_id(solvid, keyname)
729
730         unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
731         my $num = $pool->lookup_num($solvid, $keyname);
732         num = pool.lookup_num(solvid, keyname)
733         num = pool.lookup_num(solvid, keyname)
734
735         bool lookup_void(Id solvid, Id keyname)
736         my $bool = $pool->lookup_void($solvid, $keyname);
737         bool = pool.lookup_void(solvid, keyname)
738         bool = pool.lookup_void(solvid, keyname)
739
740         Id *lookup_idarray(Id solvid, Id keyname)
741         my @ids = $pool->lookup_idarray($solvid, $keyname);
742         ids = pool.lookup_idarray(solvid, keyname)
743         ids = pool.lookup_idarray(solvid, keyname)
744
745         Chksum lookup_checksum(Id solvid, Id keyname)
746         my $chksum = $pool->lookup_checksum($solvid, $keyname);
747         chksum = pool.lookup_checksum(solvid, keyname)
748         chksum = pool.lookup_checksum(solvid, keyname)
749
750 Lookup functions. Return the data element stored in the specified solvable.
751 You should probably use the methods of the Solvable class instead.
752
753         Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
754         my $di = $pool->Dataiterator($keyname, $match, $flags);
755         di = pool.Dataiterator(keyname, match, flags)
756         di = pool.Dataiterator(keyname, match, flags)
757
758         Dataiterator Dataiterator_solvid(Id solvid, Id keyname, const char *match = 0, int flags = 0)
759         my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
760         di = pool.Dataiterator(solvid, keyname, match, flags)
761         di = pool.Dataiterator(solvid, keyname, match, flags)
762
763         for my $d (@$di)
764         for d in di:
765         for d in di
766
767 Iterate over the matching data elements. See the Dataiterator class for more
768 information. The Dataiterator method iterates over all solvables in the pool,
769 whereas the Dataiterator_solvid only iterates over the specified solvable.
770
771 === ID METHODS ===
772
773 The following methods deal with Ids, i.e. integers representing objects in the
774 pool. They are considered ``low level'', in most cases you would not use them
775 but instead the object orientated methods.
776
777         Repo id2repo(Id id)
778         $repo = $pool->id2repo($id);
779         repo = pool.id2repo(id)
780         repo = pool.id2repo(id)
781
782 Lookup an existing Repository by id. You can also do this by using the *repos*
783 attribute.
784
785         Solvable id2solvable(Id id)
786         $solvable = $pool->id2solvable($id);
787         solvable = pool.id2solvable(id)
788         solvable = pool.id2solvable(id)
789
790 Lookup an existing Repository by id. You can also do this by using the
791 *solvables* attribute.
792
793         const char *solvid2str(Id id)
794         my $str = $pool->solvid2str($id);
795         str = pool.solvid2str(id)
796         str = pool.solvid2str(id)
797
798 Return a string describing the Solvable with the specified id. The string
799 consists of the name, version, and architecture of the Solvable.
800
801         const char *solvidset2str(Id *solvids)
802         my $str = $pool->solvidset2str(\@solvids);
803         str = pool.solvidset2str(solvids)
804         str = pool.solvidset2str(solvids)
805
806 Return a string describing a list of solvables. The method tries to reduce
807 the output by using version ranges if possible.
808
809         Id str2id(const char *str, bool create = 1)
810         my $id = pool->str2id($string);
811         id = pool.str2id(string)
812         id = pool.str2id(string)
813
814         const char *id2str(Id id)
815         $string = pool->id2str($id);
816         string = pool.id2str(id)
817         string = pool.id2str(id)
818
819 Convert a string into an Id and back. If the string is currently not in the
820 pool and _create_ is false, zero is returned.
821
822         Id rel2id(Id name, Id evr, int flags, bool create = 1)
823         my $id = pool->rel2id($nameid, $evrid, $flags);
824         id = pool.rel2id(nameid, evrid, flags)
825         id = pool.rel2id(nameid, evrid, flags)
826
827 Create a ``relational'' dependency. Such dependencies consist of a name part,
828 _flags_ describing the relation, and a version part. The flags are:
829
830         $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
831         solv.REL_EQ | solv.REL_GT | solv.REL_LT
832         Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
833
834 Thus, if you want a ``\<='' relation, you would use *REL_LT | REL_EQ*.
835
836         Id id2langid(Id id, const char *lang, bool create = 1)
837         my $id = $pool->id2langid($id, $language);
838         id = pool.id2langid(id, language)
839         id = pool.id2langid(id, language)
840
841 Create a language specific Id from some other id. This function simply converts
842 the id into a string, appends a dot and the specified language to the string
843 and converts the result back into an Id.
844
845         const char *dep2str(Id id)
846         $string = pool->dep2str($id);
847         string = pool.dep2str(id)
848         string = pool.dep2str(id)
849
850 Convert a dependency id into a string. If the id is just a string, this
851 function has the same effect as id2str(). For relational dependencies, the
852 result is the correct ``name relation evr'' string.
853
854
855 The Dependency Class
856 --------------------
857 The dependency class is an object orientated way to work with strings and
858 dependencies. Internally, dependencies are represented as Ids, i.e. simple
859 numbers. Dependency objects can be constructed by using the Pool's Dep()
860 method.
861
862 === ATTRIBUTES ===
863
864         Pool *pool;             /* read only */
865         $dep->{pool}
866         dep.pool
867         dep.pool
868
869 Back reference to the pool this dependency belongs to.
870
871         Id id;          /* read only */
872         $dep->{id}
873         dep.id
874         dep.id
875
876 The id of this dependency.
877
878 === METHODS ===
879
880         Dep Rel(int flags, DepId evrid, bool create = 1)
881         my $reldep = $dep->Rel($flags, $evrdep);
882         reldep = dep.Rel(flags, evrdep)
883         reldep = dep.Rel(flags, evrdep)
884
885 Create a relational dependency from the caller dependency, the flags,
886 and a dependency describing the ``version'' part.
887 See the pool's rel2id method for a description of the flags.
888
889         Selection Selection_name(int setflags = 0)
890         my $sel = $dep->Selection_name();
891         sel = dep.Selection_name()
892         sel = dep.Selection_name()
893
894 Create a Selection from a dependency. The selection consists of all packages
895 that have a name equal to the dependency. If the dependency is of a relational
896 type, the packages version must also fulfill the dependency.
897
898         Selection Selection_provides(int setflags = 0)
899         my $sel = $dep->Selection_provides();
900         sel = dep.Selection_provides()
901         sel = dep.Selection_provides()
902
903 Create a Selection from a dependency. The selection consists of all packages
904 that have at least one provides matching the dependency.
905
906         const char *str()
907         my $str = $dep->str();
908         str = $dep.str()
909         str = $dep.str()
910
911 Return a string describing the dependency.
912
913         <stringification>
914         my $str = $dep->str;
915         str = str(dep)
916         str = dep.to_s
917
918 Same as calling the str() method.
919
920         <equality>
921         if ($dep1 == $dep2)
922         if dep1 == dep2:
923         if dep1 == dep2
924
925 Two dependencies are equal if they are part of the same pool and have the same
926 ids.
927
928
929 The Repository Class
930 --------------------
931 A Repository describes a group of packages, normally coming from the same
932 source. Repositories are created by the Pool's add_repo() method.
933
934 === ATTRIBUTES ===
935
936         Pool *pool;                     /* read only */
937         $repo->{pool}
938         repo.pool
939         repo.pool
940
941 Back reference to the pool this dependency belongs to.
942
943         Id id;                          /* read only */
944         $repo->{id}
945         repo.id
946         repo.id
947
948 The id of the repository.
949
950         const char *name;               /* read/write */
951         $repo->{name}
952         repo.name
953         repo.name
954
955 The repositories name. To libsolv, the name is just a string with no specific
956 meaning.
957
958         int priority;                   /* read/write */
959         $repo->{priority}
960         repo.priority
961         repo.priority
962
963 The priority of the repository. A higher number means that packages of this
964 repository will be chosen over other repositories, even if they have a greater
965 package version.
966
967         int subpriority;                /* read/write */
968         $repo->{subpriority}
969         repo.subpriority
970         repo.subpriority
971
972 The sub-priority of the repository. This value is compared when the priorities
973 of two repositories are the same. It is useful to make the library prefer
974 on-disk repositories to remote ones.
975
976         int nsolvables;                 /* read only */
977         $repo->{nsolvables}
978         repo.nsolvables
979         repo.nsolvables
980
981 The number of solvables in this repository.
982
983         void *appdata;                  /* read/write */
984         $repo->{appdata}
985         repo.appdata
986         repo.appdata
987
988 Application specific data that may be used in any way by the code using the
989 repository.
990
991         Datapos *meta;                  /* read only */
992         $repo->{meta}
993         repo.meta
994         repo.meta
995
996 Return a Datapos object of the repodata's metadata. You can use the lookup
997 methods of the Datapos class to lookup metadata attributes, like the repository
998 timestamp.
999
1000 === CONSTANTS ===
1001
1002 *REPO_REUSE_REPODATA*::
1003 Reuse the last repository data area (``repodata'') instead of creating a
1004 new area.
1005
1006 *REPO_NO_INTERNALIZE*::
1007 Do not internalize the added repository data. This is useful if
1008 you plan to add more data because internalization is a costly
1009 operation.
1010
1011 *REPO_LOCALPOOL*::
1012 Use the repodata's pool for Id storage instead of the global pool. Useful
1013 if you don't want to pollute the global pool with many unneeded ids, like
1014 when storing the filelist.
1015
1016 *REPO_USE_LOADING*::
1017 Use the repodata that is currently being loaded instead of creating a new
1018 one. This only makes sense if used in a load callback.
1019
1020 *REPO_EXTEND_SOLVABLES*::
1021 Do not create new solvables for the new data, but match existing solvables
1022 and add the data to them. Repository metadata is often split into multiple
1023 parts, with one primary file describing all packages and other parts
1024 holding information that is normally not needed, like the changelog.
1025
1026 *REPO_USE_ROOTDIR*::
1027 Prepend the pool's rootdir to the path when doing file operations.
1028
1029 *REPO_NO_LOCATION*::
1030 Do not add a location element to the solvables. Useful if the solvables
1031 are not in the final position, so you can add the correct location later
1032 in your code.
1033
1034 *SOLV_ADD_NO_STUBS*::
1035 Do not create stubs for repository parts that can be downloaded on demand.
1036
1037 *SUSETAGS_RECORD_SHARES*::
1038 This is specific to the add_susetags() method. Susetags allows one to refer to
1039 already read packages to save disk space. If this data sharing needs to
1040 work over multiple calls to add_susetags, you need to specify this flag so
1041 that the share information is made available to subsequent calls.
1042
1043 === METHODS ===
1044
1045         void free(bool reuseids = 0)
1046         $repo->free();
1047         repo.free()
1048         repo.free()
1049
1050 Free the repository and all solvables it contains. If _reuseids_ is set to
1051 true, the solvable ids and the repository id may be reused by the library when
1052 added new solvables. Thus you should leave it false if you are not sure that
1053 somebody holds a reference.
1054
1055         void empty(bool reuseids = 0)
1056         $repo->empty();
1057         repo.empty()
1058         repo.empty()
1059
1060 Free all the solvables in a repository. The repository will be empty after this
1061 call. See the free() method for the meaning of _reuseids_.
1062
1063         bool isempty()
1064         $repo->isempty()
1065         repo.empty()
1066         repo.empty?
1067
1068 Return true if there are no solvables in this repository.
1069
1070         void internalize()
1071         $repo->internalize();
1072         repo.internalize()
1073         repo.internalize()
1074
1075 Internalize added data. Data must be internalized before it is available to the
1076 lookup and data iterator functions.
1077
1078         bool write(FILE *fp)
1079         $repo->write($fp)
1080         repo.write(fp)
1081         repo.write(fp)
1082
1083 Write a repo as a ``solv'' file. These files can be read very fast and thus are
1084 a good way to cache repository data. Returns false if there was some error
1085 writing the file.
1086
1087         Solvableiterator solvables_iter()
1088         for my $solvable (@{$repo->solvables_iter()})
1089         for solvable in repo.solvables_iter():
1090         for solvable in repo.solvables_iter()
1091
1092 Iterate over all solvables in a repository.
1093
1094         Repodata add_repodata(int flags = 0)
1095         my $repodata = $repo->add_repodata();
1096         repodata = repo.add_repodata()
1097         repodata = repo.add_repodata()
1098
1099 Add a new repodata area to the repository. This is normally automatically
1100 done by the repo_add methods, so you need this method only in very
1101 rare circumstances.
1102
1103         void create_stubs()
1104         $repo->create_stubs();
1105         repo.create_stubs()
1106         repo.create_stubs()
1107
1108 Calls the create_stubs() repodata method for the last repodata of the
1109 repository.
1110
1111         bool iscontiguous()
1112         $repo->iscontiguous()
1113         repo.iscontiguous()
1114         repo.iscontiguous?
1115
1116 Return true if the solvables of this repository are all in a single block with
1117 no holes, i.e. they have consecutive ids.
1118
1119         Repodata first_repodata()
1120         my $repodata = $repo->first_repodata();
1121         repodata = repo.first_repodata()
1122         repodata = repo.first_repodata()
1123
1124 Checks if all repodatas but the first repodata are extensions, and return the
1125 first repodata if this is the case. Useful if you want to do a store/retrieve
1126 sequence on the repository to reduce the memory using and enable paging, as
1127 this does not work if the repository contains multiple non-extension repodata
1128 areas.
1129
1130         Selection Selection(int setflags = 0)
1131         my $sel = $repo->Selection();
1132         sel = repo.Selection()
1133         sel = repo.Selection()
1134
1135 Create a Selection consisting of all packages in the repository.
1136
1137         Dataiterator Dataiterator(Id key, const char *match = 0, int flags = 0)
1138         my $di = $repo->Dataiterator($keyname, $match, $flags);
1139         di = repo.Dataiterator(keyname, match, flags)
1140         di = repo.Dataiterator(keyname, match, flags)
1141
1142         Dataiterator Dataiterator_meta(Id key, const char *match = 0, int flags = 0)
1143         my $di = $repo->Dataiterator_meta($keyname, $match, $flags);
1144         di = repo.Dataiterator_meta(keyname, match, flags)
1145         di = repo.Dataiterator_meta(keyname, match, flags)
1146
1147         for my $d (@$di)
1148         for d in di:
1149         for d in di
1150
1151 Iterate over the matching data elements in this repository. See the
1152 Dataiterator class for more information. The Dataiterator() method
1153 iterates over all solvables in a repository, whereas the Dataiterator_meta
1154 method only iterates over the repository's meta data.
1155
1156         <stringification>
1157         my $str = $repo->str;
1158         str = str(repo)
1159         str = repo.to_s
1160
1161 Return the name of the repository, or "Repo#<id>" if no name is set.
1162
1163         <equality>
1164         if ($repo1 == $repo2)
1165         if repo1 == repo2:
1166         if repo1 == repo2
1167
1168 Two repositories are equal if they belong to the same pool and have the same id.
1169
1170 === DATA ADD METHODS ===
1171
1172         Solvable add_solvable()
1173         $repo->add_solvable();
1174         repo.add_solvable()
1175         repo.add_solvable()
1176
1177 Add a single empty solvable to the repository. Returns a Solvable object, see
1178 the Solvable class for more information.
1179
1180         bool add_solv(const char *name, int flags = 0)
1181         $repo->add_solv($name);
1182         repo.add_solv(name)
1183         repo.add_solv(name)
1184
1185         bool add_solv(FILE *fp, int flags = 0)
1186         $repo->add_solv($fp);
1187         repo.add_solv(fp)
1188         repo.add_solv(fp)
1189
1190 Read a ``solv'' file and add its contents to the repository. These files can be
1191 written with the write() method and are normally used as fast cache for
1192 repository metadata.
1193
1194         bool add_rpmdb(int flags = 0)
1195         $repo->add_rpmdb();
1196         repo.add_rpmdb()
1197         repo.add_rpmdb()
1198
1199         bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
1200         $repo->add_rpmdb_reffp($reffp);
1201         repo.add_rpmdb_reffp(reffp)
1202         repo.add_rpmdb_reffp(reffp)
1203
1204 Add the contents of the rpm database to the repository. If a solv file
1205 containing an old version of the database is available, it can be passed as
1206 reffp to speed up reading.
1207
1208         Solvable add_rpm(const char *filename, int flags = 0)
1209         my $solvable = $repo->add_rpm($filename);
1210         solvable = repo.add_rpm(filename)
1211         solvable = repo.add_rpm(filename)
1212
1213 Add the metadata of a single rpm package to the repository.
1214
1215         bool add_rpmdb_pubkeys(int flags = 0)
1216         $repo->add_rpmdb_pubkeys();
1217         repo.add_rpmdb_pubkeys()
1218         repo.add_rpmdb_pubkeys()
1219
1220 Add all pubkeys contained in the rpm database to the repository. Note that
1221 newer rpm versions also allow to store the pubkeys in some directory instead
1222 of the rpm database.
1223
1224         Solvable add_pubkey(const char *keyfile, int flags = 0)
1225         my $solvable = $repo->add_pubkey($keyfile);
1226         solvable = repo.add_pubkey(keyfile)
1227         solvable = repo.add_pubkey(keyfile)
1228
1229 Add a pubkey from a file to the repository.
1230
1231         bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
1232         $repo->add_rpmmd($fp, undef);
1233         repo.add_rpmmd(fp, None)
1234         repo.add_rpmmd(fp, nil)
1235
1236 Add metadata stored in the "rpm-md" format (i.e. from files in the ``repodata''
1237 directory) to a repository. Supported files are "primary", "filelists",
1238 "other", "suseinfo". Do not forget to specify the *REPO_EXTEND_SOLVABLES* for
1239 extension files like "filelists" and "other". Use the _language_ parameter if
1240 you have language extension files, otherwise simply use a *undef*/*None*/*nil*
1241 parameter.
1242
1243         bool add_repomdxml(FILE *fp, int flags = 0)
1244         $repo->add_repomdxml($fp);
1245         repo.add_repomdxml(fp)
1246         repo.add_repomdxml(fp)
1247
1248 Add the repomd.xml meta description from the "rpm-md" format to the repository.
1249 This file contains information about the repository like keywords, and also a
1250 list of all database files with checksums. The data is added to the "meta"
1251 section of the repository, i.e. no package gets created.
1252
1253         bool add_updateinfoxml(FILE *fp, int flags = 0)
1254         $repo->add_updateinfoxml($fp);
1255         repo.add_updateinfoxml(fp)
1256         repo.add_updateinfoxml(fp)
1257
1258 Add the updateinfo.xml file containing available maintenance updates to the
1259 repository. All updates are created as special packages that have a "patch:"
1260 prefix in their name.
1261
1262         bool add_deltainfoxml(FILE *fp, int flags = 0)
1263         $repo->add_deltainfoxml($fp);
1264         repo.add_deltainfoxml(fp)
1265         repo.add_deltainfoxml(fp)
1266
1267 Add the deltainfo.xml file (also called prestodelta.xml) containing available
1268 delta-rpms to the repository. The data is added to the "meta" section, i.e. no
1269 package gets created.
1270
1271         bool add_debdb(int flags = 0)
1272         $repo->add_debdb();
1273         repo.add_debdb()
1274         repo.add_debdb()
1275
1276 Add the contents of the debian installed package database to the repository.
1277
1278         bool add_debpackages(FILE *fp, int flags = 0)
1279         $repo->add_debpackages($fp);
1280         repo.add_debpackages($fp)
1281         repo.add_debpackages($fp)
1282
1283 Add the contents of the debian repository metadata (the "packages" file)
1284 to the repository.
1285
1286         Solvable add_deb(const char *filename, int flags = 0)
1287         my $solvable = $repo->add_deb($filename);
1288         solvable = repo.add_deb(filename)
1289         solvable = repo.add_deb(filename)
1290
1291 Add the metadata of a single deb package to the repository.
1292
1293         bool add_mdk(FILE *fp, int flags = 0)
1294         $repo->add_mdk($fp);
1295         repo.add_mdk(fp)
1296         repo.add_mdk(fp)
1297
1298 Add the contents of the mageia/mandriva repository metadata (the
1299 "synthesis.hdlist" file) to the repository.
1300
1301         bool add_mdk_info(FILE *fp, int flags = 0)
1302         $repo->add_mdk_info($fp);
1303         repo.add_mdk_info(fp)
1304         repo.add_mdk_info(fp)
1305
1306 Extend the packages from the synthesis file with the info.xml and files.xml
1307 data. Do not forget to specify *REPO_EXTEND_SOLVABLES*.
1308
1309         bool add_arch_repo(FILE *fp, int flags = 0)
1310         $repo->add_arch_repo($fp);
1311         repo.add_arch_repo(fp)
1312         repo.add_arch_repo(fp)
1313
1314 Add the contents of the archlinux repository metadata (the ".db.tar" file) to
1315 the repository.
1316
1317         bool add_arch_local(const char *dir, int flags = 0)
1318         $repo->add_arch_local($dir);
1319         repo.add_arch_local(dir)
1320         repo.add_arch_local(dir)
1321
1322 Add the contents of the archlinux installed package database to the repository.
1323 The _dir_ parameter is usually set to "/var/lib/pacman/local".
1324
1325         bool add_content(FILE *fp, int flags = 0)
1326         $repo->add_content($fp);
1327         repo.add_content(fp)
1328         repo.add_content(fp)
1329
1330 Add the ``content'' meta description from the susetags format to the repository.
1331 This file contains information about the repository like keywords, and also
1332 a list of all database files with checksums. The data is added to the "meta"
1333 section of the repository, i.e. no package gets created.
1334
1335         bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
1336         $repo->add_susetags($fp, $defvendor, $language);
1337         repo.add_susetags(fp, defvendor, language)
1338         repo.add_susetags(fp, defvendor, language)
1339
1340 Add repository metadata in the susetags format to the repository. Like with
1341 add_rpmmd, you can specify a language if you have language extension files. The
1342 _defvendor_ parameter provides a default vendor for packages with missing
1343 vendors, it is usually provided in the content file.
1344
1345         bool add_products(const char *dir, int flags = 0)
1346         $repo->add_products($dir);
1347         repo.add_products(dir)
1348         repo.add_products(dir)
1349
1350 Add the installed SUSE products database to the repository. The _dir_ parameter
1351 is usually "/etc/products.d".
1352
1353
1354 The Solvable Class
1355 ------------------
1356 A solvable describes all the information of one package. Each solvable
1357 belongs to one repository, it can be added and filled manually but in
1358 most cases solvables will get created by the repo_add methods.
1359
1360 === ATTRIBUTES ===
1361
1362         Repo *repo;                     /* read only */
1363         $solvable->{repo}
1364         solvable.repo
1365         solvable.repo
1366
1367 The repository this solvable belongs to.
1368
1369         Pool *pool;                     /* read only */
1370         $solvable->{pool}
1371         solvable.pool
1372         solvable.pool
1373
1374 The pool this solvable belongs to, same as the pool of the repo.
1375
1376         Id id;                          /* read only */
1377         $solvable->{id}
1378         solvable.id
1379         solvable.id
1380
1381 The specific id of the solvable.
1382
1383         char *name;                     /* read/write */
1384         $solvable->{name}
1385         solvable.name
1386         solvable.name
1387
1388         char *evr;                      /* read/write */
1389         $solvable->{evr}
1390         solvable.evr
1391         solvable.evr
1392
1393         char *arch;                     /* read/write */
1394         $solvable->{arch}
1395         solvable.arch
1396         solvable.arch
1397
1398         char *vendor;                   /* read/write */
1399         $solvable->{vendor}
1400         solvable.vendor
1401         solvable.vendor
1402
1403 Easy access to often used attributes of solvables. They are
1404 internally stored as Ids.
1405
1406         Id nameid;                      /* read/write */
1407         $solvable->{nameid}
1408         solvable.nameid
1409         solvable.nameid
1410
1411         Id evrid;                       /* read/write */
1412         $solvable->{evrid}
1413         solvable.evrid
1414         solvable.evrid
1415
1416         Id archid;                      /* read/write */
1417         $solvable->{archid}
1418         solvable.archid
1419         solvable.archid
1420
1421         Id vendorid;                    /* read/write */
1422         $solvable->{vendorid}
1423         solvable.vendorid
1424         solvable.vendorid
1425
1426 Raw interface to the ids. Useful if you want to search for
1427 a specific id and want to avoid the string compare overhead.
1428
1429 === METHODS ===
1430
1431         const char *lookup_str(Id keyname)
1432         my $string = $solvable->lookup_str($keyname);
1433         string = solvable.lookup_str(keyname)
1434         string = solvable.lookup_str(keyname)
1435
1436         Id lookup_id(Id keyname)
1437         my $id = $solvable->lookup_id($keyname);
1438         id = solvable.lookup_id(keyname)
1439         id = solvable.lookup_id(keyname)
1440
1441         unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
1442         my $num = $solvable->lookup_num($keyname);
1443         num = solvable.lookup_num(keyname)
1444         num = solvable.lookup_num(keyname)
1445
1446         bool lookup_void(Id keyname)
1447         my $bool = $solvable->lookup_void($keyname);
1448         bool = solvable.lookup_void(keyname)
1449         bool = solvable.lookup_void(keyname)
1450
1451         Chksum lookup_checksum(Id keyname)
1452         my $chksum = $solvable->lookup_checksum($keyname);
1453         chksum = solvable.lookup_checksum(keyname)
1454         chksum = solvable.lookup_checksum(keyname)
1455
1456         Id *lookup_idarray(Id keyname, Id marker = -1)
1457         my @ids = $solvable->lookup_idarray($keyname);
1458         ids = solvable.lookup_idarray(keyname)
1459         ids = solvable.lookup_idarray(keyname)
1460
1461         Dep *lookup_deparray(Id keyname, Id marker = -1)
1462         my @deps = $solvable->lookup_deparray($keyname);
1463         deps = solvable.lookup_deparray(keyname)
1464         deps = solvable.lookup_deparray(keyname)
1465
1466 Generic lookup methods. Retrieve data stored for the specific keyname.
1467 The lookup_idarray() method will return an array of Ids, use
1468 lookup_deparray if you want an array of Dependency objects instead.
1469 Some Id arrays contain two parts of data divided by a specific marker,
1470 for example the provides array uses the SOLVABLE_FILEMARKER id to
1471 store both the ids provided by the package and the ids added by
1472 the addfileprovides method. The default, -1, translates to the
1473 correct marker for the keyname and returns the first part of the
1474 array, use 1 to select the second part or 0 to retrieve all ids
1475 including the marker.
1476
1477         const char *lookup_location(unsigned int *OUTPUT)
1478         my ($location, $mediano) = $solvable->lookup_location();
1479         location, mediano = solvable.lookup_location()
1480         location, mediano = solvable.lookup_location()
1481
1482 Return a tuple containing the on-media location and an optional
1483 media number for multi-part repositories (e.g. repositories
1484 spawning multiple DVDs).
1485
1486         const char *lookup_sourcepkg()
1487         my $sourcepkg = $solvable->lookup_sourcepkg();
1488         sourcepkg = solvable.lookup_sourcepkg()
1489         sourcepkg = solvable.lookup_sourcepkg()
1490
1491 Return a sourcepkg name associated with solvable.
1492
1493         Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
1494         my $di = $solvable->Dataiterator($keyname, $match, $flags);
1495         di = solvable.Dataiterator(keyname, match, flags)
1496         di = solvable.Dataiterator(keyname, match, flags)
1497
1498         for my $d (@$di)
1499         for d in di:
1500         for d in di
1501
1502 Iterate over the matching data elements. See the Dataiterator class for more
1503 information.
1504
1505         void add_deparray(Id keyname, DepId dep, Id marker = -1)
1506         $solvable->add_deparray($keyname, $dep);
1507         solvable.add_deparray(keyname, dep)
1508         solvable.add_deparray(keyname, dep)
1509
1510 Add a new dependency to the attributes stored in keyname.
1511
1512         void unset(Id keyname)
1513         $solvable->unset($keyname);
1514         solvable.unset(keyname)
1515         solvable.unset(keyname)
1516
1517 Delete data stored for the specific keyname.
1518
1519         bool installable()
1520         $solvable->installable()
1521         solvable.installable()
1522         solvable.installable?
1523
1524 Return true if the solvable is installable on the system. Solvables
1525 are not installable if the system does not support their architecture.
1526
1527         bool isinstalled()
1528         $solvable->isinstalled()
1529         solvable.isinstalled()
1530         solvable.isinstalled?
1531
1532 Return true if the solvable is installed on the system.
1533
1534         bool identical(Solvable *other)
1535         $solvable->identical($other)
1536         solvable.identical(other)
1537         solvable.identical?(other)
1538
1539 Return true if the two solvables are identical.
1540
1541         int evrcmp(Solvable *other)
1542         $solvable->evrcmp($other)
1543         solvable.evrcmp(other)
1544         solvable.evrcmp(other)
1545
1546 Returns -1 if the epoch/version/release of the solvable is less than the
1547 one from the other solvable, 1 if it is greater, and 0 if they are equal.
1548 Note that "equal" does not mean that the evr is identical.
1549
1550         int matchesdep(Id keyname, DepId id, Id marker = -1)
1551         $solvable->matchesdep($keyname, $dep)
1552         solvable.matchesdep(keyname, dep)
1553         solvable.matchesdep?(keyname, dep)
1554
1555 Return true if the dependencies stored in keyname match the specified dependency.
1556
1557         Selection Selection(int setflags = 0)
1558         my $sel = $solvable->Selection();
1559         sel = solvable.Selection()
1560         sel = solvable.Selection()
1561
1562 Create a Selection containing just the single solvable.
1563
1564         const char *str()
1565         my $str = $solvable->str();
1566         str = $solvable.str()
1567         str = $solvable.str()
1568
1569 Return a string describing the solvable. The string consists of the name,
1570 version, and architecture of the Solvable.
1571
1572         <stringification>
1573         my $str = $solvable->str;
1574         str = str(solvable)
1575         str = solvable.to_s
1576
1577 Same as calling the str() method.
1578
1579         <equality>
1580         if ($solvable1 == $solvable2)
1581         if solvable1 == solvable2:
1582         if solvable1 == solvable2
1583
1584 Two solvables are equal if they are part of the same pool and have the same
1585 ids.
1586
1587
1588 The Dataiterator Class
1589 ----------------------
1590 Dataiterators can be used to do complex string searches or
1591 to iterate over arrays. They can be created via the
1592 constructors in the Pool, Repo, and Solvable classes. The
1593 Repo and Solvable constructors will limit the search to
1594 the repository or the specific package.
1595
1596 === CONSTANTS ===
1597
1598 *SEARCH_STRING*::
1599 Return a match if the search string matches the value.
1600
1601 *SEARCH_STRINGSTART*::
1602 Return a match if the value starts with the search string.
1603
1604 *SEARCH_STRINGEND*::
1605 Return a match if the value ends with the search string.
1606
1607 *SEARCH_SUBSTRING*::
1608 Return a match if the search string can be matched somewhere in the value.
1609
1610 *SEARCH_GLOB*::
1611 Do a glob match of the search string against the value.
1612
1613 *SEARCH_REGEX*::
1614 Do a regular expression match of the search string against the value.
1615
1616 *SEARCH_NOCASE*::
1617 Ignore case when matching strings. Works for all the above match types.
1618
1619 *SEARCH_FILES*::
1620 Match the complete filenames of the file list, not just the base name.
1621
1622 *SEARCH_COMPLETE_FILELIST*::
1623 When matching the file list, check every file of the package not just the
1624 subset from the primary metadata.
1625
1626 *SEARCH_CHECKSUMS*::
1627 Allow the matching of checksum entries.
1628
1629 === METHODS ===
1630
1631         void prepend_keyname(Id keyname);
1632         $di->prepend_keyname($keyname);
1633         di.prepend_keyname(keyname)
1634         di.prepend_keyname(keyname)
1635
1636 Do a sub-search in the array stored in keyname.
1637
1638         void skip_solvable();
1639         $di->skip_solvable();
1640         di.skip_solvable()
1641         di.skip_solvable()
1642
1643 Stop matching the current solvable and advance to the next
1644 one.
1645
1646         <iteration>
1647         for my $d (@$di)
1648         for d in di:
1649         for d in di
1650
1651 Iterate through the matches. If there is a match, the object
1652 in d will be of type Datamatch.
1653
1654
1655 The Datamatch Class
1656 -------------------
1657 Objects of this type will be created for every value matched
1658 by a dataiterator.
1659
1660 === ATTRIBUTES ===
1661
1662         Pool *pool;                             /* read only */
1663         $d->{pool}
1664         d.pool
1665         d.pool
1666
1667 Back pointer to pool.
1668
1669         Repo *repo;                             /* read only */
1670         $d->{repo}
1671         d.repo
1672         d.repo
1673
1674 The repository containing the matched object.
1675
1676         Solvable *solvable;                     /* read only */
1677         $d->{solvable}
1678         d.solvable
1679         d.solvable
1680
1681 The solvable containing the value that was matched.
1682
1683         Id solvid;                              /* read only */
1684         $d->{solvid}
1685         d.solvid
1686         d.solvid
1687
1688 The id of the solvable that matched.
1689
1690         Id key_id;
1691         $d->{key_id}
1692         d.key_id
1693         d.key_id
1694
1695         const char *key_idstr;
1696         $d->{key_idstr}
1697         d.key_idstr
1698         d.key_idstr
1699
1700 The keyname that matched, either as id or string.
1701
1702         Id type_id;
1703         $d->{type_id}
1704         d.type_id
1705         d.type_id
1706
1707         const char *type_idstr;
1708         $d->{type_idstr};
1709         d.type_idstr
1710         d.type_idstr
1711
1712 The key type of the value that was matched, either as id or string.
1713
1714         Id id;
1715         $d->{id}
1716         d.id
1717         d.id
1718
1719         Id idstr;
1720         $d->{idstr}
1721         d.idstr
1722         d.idstr
1723
1724 The Id of the value that was matched (only valid for id types),
1725 either as id or string.
1726
1727         const char *str;
1728         $d->{str}
1729         d.str
1730         d.str
1731
1732 The string value that was matched (only valid for string types).
1733
1734         unsigned long long num;
1735         $d->{num}
1736         d.num
1737         d.num
1738
1739 The numeric value that was matched (only valid for numeric types).
1740
1741         unsigned int num2;
1742         $d->{num2}
1743         d.num2
1744         d.num2
1745
1746 The secondary numeric value that was matched (only valid for types
1747 containing two values).
1748
1749         unsigned int binary;
1750         $d->{binary}
1751         d.binary
1752         d.binary
1753
1754 The value in binary form, useful for checksums and other data
1755 that cannot be represented as a string.
1756
1757 === METHODS ===
1758
1759         Datapos pos()
1760         my $pos = $d->pos();
1761         pos = d.pos()
1762         pos = d.pos()
1763
1764 The position object of the current match. It can be used to do
1765 sub-searches starting at the match (if it is of an array type).
1766 See the Datapos class for more information.
1767
1768         Datapos parentpos()
1769         my $pos = $d->parentpos();
1770         pos = d.parentpos()
1771         pos = d.parentpos()
1772
1773 The position object of the array containing the current match.
1774 It can be used to do sub-searches, see the Datapos class for more
1775 information.
1776
1777         <stringification>
1778         my $str = $d->str;
1779         str = str(d)
1780         str = d.to_s
1781
1782 Return the stringification of the matched value. Stringification
1783 depends on the search flags, for file list entries it will return
1784 just the base name unless SEARCH_FILES is used, for checksums
1785 it will return an empty string unless SEARCH_CHECKSUMS is used.
1786 Numeric values are currently stringified to an empty string.
1787
1788
1789 The Selection Class
1790 -------------------
1791 Selections are a way to easily deal with sets of packages.
1792 There are multiple constructors to create them, the most useful
1793 is probably the select() method in the Pool class.
1794
1795 === CONSTANTS ===
1796
1797 *SELECTION_NAME*::
1798 Create the selection by matching package names.
1799
1800 *SELECTION_PROVIDES*::
1801 Create the selection by matching package provides.
1802
1803 *SELECTION_FILELIST*::
1804 Create the selection by matching package files.
1805
1806 *SELECTION_CANON*::
1807 Create the selection by matching the canonical representation
1808 of the package. This is normally a combination of the name,
1809 the version, and the architecture of a package.
1810
1811 *SELECTION_DOTARCH*::
1812 Allow an ".<architecture>" suffix when matching names or
1813 provides.
1814
1815 *SELECTION_REL*::
1816 Allow the specification of a relation when matching names
1817 or dependencies, e.g. "name >= 1.2".
1818
1819 *SELECTION_GLOB*::
1820 Allow glob matching for package names, package provides, and file names.
1821
1822 *SELECTION_NOCASE*::
1823 Ignore case when matching package names, package provides, and file names.
1824
1825 *SELECTION_FLAT*::
1826 Return only one selection element describing the selected packages.
1827 The default is to create multiple elements for all globbed packages.
1828 Multiple elements are useful if you want to turn the selection into
1829 an install job, in that case you want an install job for every
1830 globbed package.
1831
1832 *SELECTION_SKIP_KIND*::
1833 Remove a "packagekind:" prefix from the package names.
1834
1835 *SELECTION_MATCH_DEPSTR*::
1836 When matching dependencies, do a string match on the result of dep2str
1837 instead of using the normal dependency intersect algorithm.
1838
1839 *SELECTION_INSTALLED_ONLY*::
1840 Limit the package search to installed packages.
1841
1842 *SELECTION_SOURCE_ONLY*::
1843 Limit the package search to source packages only.
1844
1845 *SELECTION_WITH_SOURCE*::
1846 Extend the package search to also match source packages. The default is
1847 only to match binary packages.
1848
1849 *SELECTION_WITH_DISABLED*::
1850 Extend the package search to also include disabled packages.
1851
1852 *SELECTION_WITH_BADARCH*::
1853 Extend the package search to also include packages that are not installable
1854 on the configured architecture.
1855
1856 *SELECTION_WITH_ALL*::
1857 Shortcut for selecting the three modifiers above.
1858
1859 *SELECTION_ADD*::
1860 Add the result of the match to the current selection instead of replacing it.
1861
1862 *SELECTION_SUBTRACT*::
1863 Remove the result of the match to the current selection instead of replacing it.
1864
1865 *SELECTION_FILTER*::
1866 Intersect the result of the match to the current selection instead of replacing it.
1867
1868 === ATTRIBUTES ===
1869
1870         Pool *pool;                             /* read only */
1871         $d->{pool}
1872         d.pool
1873         d.pool
1874
1875 Back pointer to pool.
1876
1877         int flags;                              /* read only */
1878         $sel->{flags}
1879         flags = sel.flags
1880         flags = sel.flags
1881
1882 The result flags of the selection. The flags are a subset
1883 of the ones used when creating the selection, they describe which
1884 method was used to get the result. For example, if you create the
1885 selection with ``SELECTION_NAME | SELECTION_PROVIDES'', the resulting
1886 flags will either be SELECTION_NAME or SELECTION_PROVIDES depending
1887 if there was a package that matched the name or not. If there was
1888 no match at all, the flags will be zero.
1889
1890 === METHODS ===
1891
1892         bool isempty()
1893         $sel->isempty()
1894         sel.isempty()
1895         sel.isempty?
1896
1897 Return true if the selection is empty, i.e. no package could be matched.
1898
1899         Selection clone(int flags = 0)
1900         my $cloned = $sel->clone();
1901         cloned = sel.clone()
1902         cloned = sel.clone()
1903
1904 Return a copy of a selection.
1905
1906         void filter(Selection *other)
1907         $sel->filter($other);
1908         sel.filter(other)
1909         sel.filter(other)
1910
1911 Intersect two selections. Packages will only stay in the selection if there
1912 are also included in the other selecting. Does an in-place modification.
1913
1914         void add(Selection *other)
1915         $sel->add($other);
1916         sel.add(other)
1917         sel.add(other)
1918
1919 Build the union of two selections. All packages of the other selection will
1920 be added to the set of packages of the selection object. Does an in-place
1921 modification. Note that the selection flags are no longer meaningful after the
1922 add operation.
1923
1924         void subtract(Selection *other)
1925         $sel->subtract($other);
1926         sel.subtract(other)
1927         sel.subtract(other)
1928
1929 Remove the packages of the other selection from the packages of the selection
1930 object. Does an in-place modification.
1931
1932         void add_raw(Id how, Id what)
1933         $sel->add_raw($how, $what);
1934         sel.add_raw(how, what)
1935         sel.add_raw(how, what)
1936
1937 Add a raw element to the selection. Check the Job class for information about
1938 the how and what parameters. Note that the selection flags are no longer meaningful
1939 after the add_raw operation.
1940
1941         Job *jobs(int action)
1942         my @jobs = $sel->jobs($action);
1943         jobs = sel.jobs(action)
1944         jobs = sel.jobs(action)
1945
1946 Convert a selection into an array of Job objects. The action parameter is or-ed
1947 to the ``how'' part of the job, it describes the type of job (e.g. install,
1948 erase). See the Job class for the action and action modifier constants.
1949
1950         Solvable *solvables()
1951         my @solvables = $sel->solvables();
1952         solvables = sel.solvables()
1953         solvables = sel.solvables()
1954
1955 Convert a selection into an array of Solvable objects.
1956
1957         void select(const char *name, int flags)
1958         $sel->select($name, $flags);
1959         sel.select(name, flags)
1960         sel.select(name, flags)
1961
1962 Do a select operation and combine the result with the current selection. You
1963 can choose the desired combination method by using either the SELECTION_ADD,
1964 SELECTION_SUBTRACT, or SELECTION_FILTER flag. If none of the flags are
1965 used, SELECTION_FILTER|SELECTION_WITH_ALL is assumed.
1966
1967         void matchdeps(const char *name, int flags, Id keyname, Id marker = -1)
1968         $sel->matchdeps($name, $flags, $keyname);
1969         sel.matchdeps(name, flags, keyname)
1970         sel.matchdeps(name, flags, keyname)
1971
1972 Do a matchdeps operation and combine the result with the current selection.
1973
1974         void matchdepid(DepId dep, int flags, Id keyname, Id marker = -1)
1975         $sel->matchdepid($dep, $flags, $keyname);
1976         sel.matchdepid(dep, flags, keyname)
1977         sel.matchdepid(dep, flags, keyname)
1978
1979 Do a matchdepid operation and combine the result with the current selection.
1980
1981         void matchsolvable(Solvable solvable, int flags, Id keyname, Id marker = -1)
1982         $sel->matchsolvable($solvable, $flags, $keyname);
1983         sel.matchsolvable(solvable, flags, keyname)
1984         sel.matchsolvable(solvable, flags, keyname)
1985
1986 Do a matchsolvable operation and combine the result with the current selection.
1987
1988         <stringification>
1989         my $str = $sel->str;
1990         str = str(sel)
1991         str = sel.to_s
1992
1993 Return a string describing the selection.
1994
1995
1996 The Job Class
1997 -------------
1998 Jobs are the way to specify to the dependency solver what to do.
1999 Most of the times jobs will get created by calling the jobs() method
2000 on a Selection object, but there is also a Job() constructor in the
2001 Pool class.
2002
2003 === CONSTANTS ===
2004
2005 Selection constants:
2006
2007 *SOLVER_SOLVABLE*::
2008 The ``what'' part is the id of a solvable.
2009
2010 *SOLVER_SOLVABLE_NAME*::
2011 The ``what'' part is the id of a package name.
2012
2013 *SOLVER_SOLVABLE_PROVIDES*::
2014 The ``what'' part is the id of a package provides.
2015
2016 *SOLVER_SOLVABLE_ONE_OF*::
2017 The ``what'' part is an offset into the ``whatprovides'' data, created
2018 by calling the towhatprovides() pool method.
2019
2020 *SOLVER_SOLVABLE_REPO*::
2021 The ``what'' part is the id of a repository.
2022
2023 *SOLVER_SOLVABLE_ALL*::
2024 The ``what'' part is ignored, all packages are selected.
2025
2026 *SOLVER_SOLVABLE_SELECTMASK*::
2027 A mask containing all the above selection bits.
2028
2029 Action constants:
2030
2031 *SOLVER_NOOP*::
2032 Do nothing.
2033
2034 *SOLVER_INSTALL*::
2035 Install a package of the specified set of packages. It tries to install
2036 the best matching package (i.e. the highest version of the packages from
2037 the repositories with the highest priority).
2038
2039 *SOLVER_ERASE*::
2040 Erase all of the packages from the specified set. If a package is not
2041 installed, erasing it will keep it from getting installed.
2042
2043 *SOLVER_UPDATE*::
2044 Update the matching installed packages to their best version. If none
2045 of the specified packages are installed, try to update the installed
2046 packages to the specified versions. See the section about targeted
2047 updates about more information.
2048
2049 *SOLVER_WEAKENDEPS*::
2050 Allow to break the dependencies of the matching packages. Handle with care.
2051
2052 *SOLVER_MULTIVERSION*::
2053 Mark the matched packages for multiversion install. If they get to be
2054 installed because of some other job, the installation will keep the old
2055 version of the package installed (for rpm this is done by using ``-i''
2056 instead of ``-U'').
2057
2058 *SOLVER_LOCK*::
2059 Do not change the state of the matched packages, i.e. when they are
2060 installed they stay installed, if not they are not selected for
2061 installation.
2062
2063 *SOLVER_DISTUPGRADE*::
2064 Update the matching installed packages to the best version included in one
2065 of the repositories. After this operation, all come from one of the available
2066 repositories except orphaned packages. Orphaned packages are packages that
2067 have no relation to the packages in the repositories, i.e. no package in the
2068 repositories have the same name or obsolete the orphaned package.
2069 This action brings the installed packages in sync with the ones in the
2070 repository. By default it also turns of arch/vendor/version locking for the
2071 affected packages to simulate a fresh installation. This means that distupgrade can
2072 actually downgrade packages if only lower versions of a package are available
2073 in the repositories. You can tweak this behavior with the SOLVER_FLAG_DUP_
2074 solver flags.
2075
2076 *SOLVER_DROP_ORPHANED*::
2077 Erase all the matching installed packages if they are orphaned. This only makes
2078 sense if there is a ``distupgrade all packages'' job. The default is to erase
2079 orphaned packages only if they block the installation of other packages.
2080
2081 *SOLVER_VERIFY*::
2082 Fix dependency problems of matching installed packages. The default is to ignore
2083 dependency problems for installed packages.
2084
2085 *SOLVER_USERINSTALLED*::
2086 The matching installed packages are considered to be installed by a user,
2087 thus not installed to fulfill some dependency. This is needed input for
2088 the calculation of unneeded packages for jobs that have the
2089 SOLVER_CLEANDEPS flag set.
2090
2091 *SOLVER_ALLOWUNINSTALL*::
2092 Allow the solver to deinstall the matching installed packages if they get
2093 into the way of resolving a dependency. This is like the
2094 SOLVER_FLAG_ALLOW_UNINSTALL flag, but limited to a specific set of packages.
2095
2096 *SOLVER_FAVOR*::
2097 Prefer the specified packages if the solver encounters an alternative. If
2098 a job contains multiple matching favor/disfavor elements, the last one takes
2099 precedence.
2100
2101 *SOLVER_DISFAVOR*::
2102 Avoid the specified packages if the solver encounters an alternative. This
2103 can also be used to block recommended or supplemented packages from being
2104 installed.
2105
2106 *SOLVER_EXCLUDEFROMWEAK*::
2107 Avoid the specified packages to satisfy recommended or supplemented dependencies.
2108 Unlike SOLVER_DISFAVOR, it does not interfere with other rules.
2109
2110 *SOLVER_JOBMASK*::
2111 A mask containing all the above action bits.
2112
2113 Action modifier constants:
2114
2115 *SOLVER_WEAK*::
2116 Makes the job a weak job. The solver tries to fulfill weak jobs, but does
2117 not report a problem if it is not possible to do so.
2118
2119 *SOLVER_ESSENTIAL*::
2120 Makes the job an essential job. If there is a problem with the job, the
2121 solver will not propose to remove the job as one solution (unless all
2122 other solutions are also to remove essential jobs).
2123
2124 *SOLVER_CLEANDEPS*::
2125 The solver will try to also erase all packages dragged in through
2126 dependencies when erasing the package. This needs SOLVER_USERINSTALLED
2127 jobs to maximize user satisfaction.
2128
2129 *SOLVER_FORCEBEST*::
2130 Insist on the best package for install, update, and distupgrade jobs. If
2131 this flag is not used, the solver will use the second-best package if the
2132 best package cannot be installed for some reason. When this flag is used,
2133 the solver will generate a problem instead.
2134
2135 *SOLVER_TARGETED*::
2136 Forces targeted operation update and distupgrade jobs. See the section
2137 about targeted updates about more information.
2138
2139 Set constants.
2140
2141 *SOLVER_SETEV*::
2142 The job specified the exact epoch and version of the package set.
2143
2144 *SOLVER_SETEVR*::
2145 The job specified the exact epoch, version, and release of the package set.
2146
2147 *SOLVER_SETARCH*::
2148 The job specified the exact architecture of the packages from the set.
2149
2150 *SOLVER_SETVENDOR*::
2151 The job specified the exact vendor of the packages from the set.
2152
2153 *SOLVER_SETREPO*::
2154 The job specified the exact repository of the packages from the set.
2155
2156 *SOLVER_SETNAME*::
2157 The job specified the exact name of the packages from the set.
2158
2159 *SOLVER_NOAUTOSET*::
2160 Turn of automatic set flag generation for SOLVER_SOLVABLE jobs.
2161
2162 *SOLVER_SETMASK*::
2163 A mask containing all the above set bits.
2164
2165 See the section about set bits for more information.
2166
2167 === ATTRIBUTES ===
2168
2169         Pool *pool;                             /* read only */
2170         $job->{pool}
2171         d.pool
2172         d.pool
2173
2174 Back pointer to pool.
2175
2176         Id how;                                 /* read/write */
2177         $job->{how}
2178         d.how
2179         d.how
2180
2181 Union of the selection, action, action modifier, and set flags.
2182 The selection part describes the semantics of the ``what'' Id.
2183
2184         Id what;                                /* read/write */
2185         $job->{what}
2186         d.what
2187         d.what
2188
2189 Id describing the set of packages, the meaning depends on the
2190 selection part of the ``how'' attribute.
2191
2192 === METHODS ===
2193
2194         Solvable *solvables()
2195         my @solvables = $job->solvables();
2196         solvables = job.solvables()
2197         solvables = job.solvables()
2198
2199 Return the set of solvables of the job as an array of Solvable
2200 objects.
2201
2202         bool isemptyupdate()
2203         $job->isemptyupdate()
2204         job.isemptyupdate()
2205         job.isemptyupdate?
2206
2207 Convenience function to find out if the job describes an update
2208 job with no matching packages, i.e. a job that does nothing.
2209 Some package managers like ``zypper'' like to turn those jobs
2210 into install jobs, i.e. an update of a not-installed package
2211 will result into the installation of the package.
2212
2213         <stringification>
2214         my $str = $job->str;
2215         str = str(job)
2216         str = job.to_s
2217
2218 Return a string describing the job.
2219
2220         <equality>
2221         if ($job1 == $job2)
2222         if job1 == job2:
2223         if job1 == job2
2224
2225 Two jobs are equal if they belong to the same pool and both the
2226 ``how'' and the ``what'' attributes are the same.
2227
2228 === TARGETED UPDATES ===
2229 Libsolv has two modes for upgrades and distupgrade: targeted and
2230 untargeted. Untargeted mode means that the installed packages from
2231 the specified set will be updated to the best version. Targeted means
2232 that packages that can be updated to a package in the specified set
2233 will be updated to the best package of the set.
2234
2235 Here's an example to explain the subtle difference. Suppose that
2236 you have package A installed in version "1.1", "A-1.2" is available
2237 in one of the repositories and there is also package "B" that
2238 obsoletes package A.
2239
2240 An untargeted update of "A" will update the installed "A-1.1" to
2241 package "B", because that is the newest version (B obsoletes A and
2242 is thus newer).
2243
2244 A targeted update of "A" will update "A-1.1" to "A-1.2", as the
2245 set of packages contains both "A-1.1" and "A-1.2", and "A-1.2" is
2246 the newer one.
2247
2248 An untargeted update of "B" will do nothing, as "B" is not installed.
2249
2250 An targeted update of "B" will update "A-1.1" to "B".
2251
2252 Note that the default is to do "auto-targeting", thus if the specified
2253 set of packages does not include an installed package, the solver
2254 will assume targeted operation even if SOLVER_TARGETED is not used.
2255
2256 This mostly matches the intent of the user, with one exception: In
2257 the example above, an update of "A-1.2" will update "A-1.1" to
2258 "A-1.2" (targeted mode), but a second update of "A-1.2" will suddenly
2259 update to "B", as untargeted mode is chosen because "A-1.2" is now
2260 installed.
2261
2262 If you want to have full control over when targeting mode is chosen,
2263 turn off auto-targeting with the SOLVER_FLAG_NO_AUTOTARGET solver option.
2264 In that case, all updates are considered to be untargeted unless they
2265 include the SOLVER_TARGETED flag.
2266
2267 === SET BITS ===
2268 Set bits specify which parts of the specified packages where specified
2269 by the user. It is used by the solver when checking if an operation is
2270 allowed or not. For example, the solver will normally not allow the
2271 downgrade of an installed package. But it will not report a problem if
2272 the SOLVER_SETEVR flag is used, as it then assumes that the user specified
2273 the exact version and thus knows what he is doing.
2274
2275 So if a package "screen-1-1" is installed for the x86_64 architecture and
2276 version "2-1" is only available for the i586 architecture, installing
2277 package "screen-2.1" will ask the user for confirmation because of the
2278 different architecture. When using the Selection class to create jobs
2279 the set bits are automatically added, e.g. selecting ``screen.i586'' will
2280 automatically add SOLVER_SETARCH, and thus no problem will be reported.
2281
2282
2283 The Solver Class
2284 ----------------
2285 Dependency solving is what this library is about. A solver object is needed
2286 for solving to store the result of the solver run. The solver object can be
2287 used multiple times for different jobs, reusing it allows the solver to
2288 re-use the dependency rules it already computed.
2289
2290 === CONSTANTS ===
2291
2292 Flags to modify some of the solver's behavior:
2293
2294 *SOLVER_FLAG_ALLOW_DOWNGRADE*::
2295 Allow the solver to downgrade packages without asking for confirmation
2296 (i.e. reporting a problem).
2297
2298 *SOLVER_FLAG_ALLOW_ARCHCHANGE*::
2299 Allow the solver to change the architecture of an installed package
2300 without asking for confirmation. Note that changes to/from noarch
2301 are always considered to be allowed.
2302
2303 *SOLVER_FLAG_ALLOW_VENDORCHANGE*::
2304 Allow the solver to change the vendor of an installed package
2305 without asking for confirmation. Each vendor is part of one or more
2306 vendor equivalence classes, normally installed packages may only
2307 change their vendor if the new vendor shares at least one equivalence
2308 class.
2309
2310 *SOLVER_FLAG_ALLOW_NAMECHANGE*::
2311 Allow the solver to change the name of an installed package, i.e.
2312 install a package with a different name that obsoletes the installed
2313 package. This option is on by default.
2314
2315 *SOLVER_FLAG_ALLOW_UNINSTALL*::
2316 Allow the solver to erase installed packages to fulfill the jobs.
2317 This flag also includes the above flags. You may want to set this
2318 flag if you only have SOLVER_ERASE jobs, as in that case it's
2319 better for the user to check the transaction overview instead of
2320 approving every single package that needs to be erased.
2321
2322 *SOLVER_FLAG_DUP_ALLOW_DOWNGRADE*::
2323 Like SOLVER_FLAG_ALLOW_DOWNGRADE, but used in distupgrade mode.
2324
2325 *SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE*::
2326 Like SOLVER_FLAG_ALLOW_ARCHCHANGE, but used in distupgrade mode.
2327
2328 *SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE*::
2329 Like SOLVER_FLAG_ALLOW_VENDORCHANGE, but used in distupgrade mode.
2330
2331 *SOLVER_FLAG_DUP_ALLOW_NAMECHANGE*::
2332 Like SOLVER_FLAG_ALLOW_NAMECHANGE, but used in distupgrade mode.
2333
2334 *SOLVER_FLAG_NO_UPDATEPROVIDE*::
2335 If multiple packages obsolete an installed package, the solver checks
2336 the provides of every such package and ignores all packages that
2337 do not provide the installed package name. Thus, you can have an
2338 official update candidate that provides the old name, and other
2339 packages that also obsolete the package but are not considered for
2340 updating. If you cannot use this feature, you can turn it off
2341 by setting this flag.
2342
2343 *SOLVER_FLAG_NEED_UPDATEPROVIDE*::
2344 This is somewhat the opposite of SOLVER_FLAG_NO_UPDATEPROVIDE: Only
2345 packages that provide the installed package names are considered
2346 for updating.
2347
2348 *SOLVER_FLAG_SPLITPROVIDES*::
2349 Make the solver aware of special provides of the form
2350 ``<packagename>:<path>'' used in SUSE systems to support package
2351 splits.
2352
2353 *SOLVER_FLAG_IGNORE_RECOMMENDED*::
2354 Do not process optional (aka weak) dependencies.
2355
2356 *SOLVER_FLAG_ADD_ALREADY_RECOMMENDED*::
2357 Install recommended or supplemented packages even if they have no
2358 connection to the current transaction. You can use this feature
2359 to implement a simple way for the user to install new recommended
2360 packages that were not available in the past.
2361
2362 *SOLVER_FLAG_NO_INFARCHCHECK*::
2363 Turn off the inferior architecture checking that is normally done
2364 by the solver. Normally, the solver allows only the installation
2365 of packages from the "best" architecture if a package is available
2366 for multiple architectures.
2367
2368 *SOLVER_FLAG_BEST_OBEY_POLICY*::
2369 Make the SOLVER_FORCEBEST job option consider only packages that
2370 meet the policies for installed packages, i.e. no downgrades,
2371 no architecture change, no vendor change (see the first flags
2372 of this section). If the flag is not specified, the solver will
2373 enforce the installation of the best package ignoring the
2374 installed packages, which may conflict with the set policy.
2375
2376 *SOLVER_FLAG_NO_AUTOTARGET*::
2377 Do not enable auto-targeting up update and distupgrade jobs. See
2378 the section on targeted updates for more information.
2379
2380 *SOLVER_FLAG_KEEP_ORPHANS*::
2381 Do not allow orphaned packages to be deinstalled if they get
2382 in the way of resolving other packages.
2383
2384 *SOLVER_FLAG_BREAK_ORPHANS*::
2385 Ignore dependencies of orphaned packages that get in the way
2386 of resolving non-orphaned ones. Setting the flag might result
2387 in no longer working packages in case they are orphaned.
2388
2389 *SOLVER_FLAG_FOCUS_INSTALLED*::
2390 Resolve installed packages before resolving the given jobs.
2391 Setting this flag means that the solver will prefer picking
2392 a package version that fits the other installed packages
2393 over updating installed packages.
2394
2395 *SOLVER_FLAG_FOCUS_BEST*::
2396 First resolve the given jobs, then the dependencies of the
2397 resulting packages, then resolve all already installed
2398 packages. This will result in more packages being updated
2399 as when the flag is not used.
2400
2401 *SOLVER_FLAG_INSTALL_ALSO_UPDATES*::
2402 Update the package if a job is already fulfilled by an installed
2403 package.
2404
2405 *SOLVER_FLAG_YUM_OBSOLETES*::
2406 Turn on yum-like package split handling. See the yum documentation
2407 for more details.
2408
2409 *SOLVER_FLAG_URPM_REORDER*::
2410 Turn on urpm like package reordering for kernel packages. See
2411 the urpm documentation for more details.
2412
2413
2414
2415 Basic rule types:
2416
2417 *SOLVER_RULE_UNKNOWN*::
2418 A rule of an unknown class. You should never encounter those.
2419
2420 *SOLVER_RULE_PKG*::
2421 A rule generated because of a package dependency.
2422
2423 *SOLVER_RULE_UPDATE*::
2424 A rule to implement the update policy of installed packages. Every
2425 installed package has an update rule that consists of the packages
2426 that may replace the installed package.
2427
2428 *SOLVER_RULE_FEATURE*::
2429 Feature rules are fallback rules used when an update rule is disabled. They
2430 include all packages that may replace the installed package ignoring the
2431 update policy, i.e. they contain downgrades, arch changes and so on.
2432 Without them, the solver would simply erase installed packages if their
2433 update rule gets disabled.
2434
2435 *SOLVER_RULE_JOB*::
2436 Job rules implement the job given to the solver.
2437
2438 *SOLVER_RULE_DISTUPGRADE*::
2439 These are simple negative assertions that make sure that only packages
2440 are kept that are also available in one of the repositories.
2441
2442 *SOLVER_RULE_INFARCH*::
2443 Infarch rules are also negative assertions, they disallow the installation
2444 of packages when there are packages of the same name but with a better
2445 architecture.
2446
2447 *SOLVER_RULE_CHOICE*::
2448 Choice rules are used to make sure that the solver prefers updating to
2449 installing different packages when some dependency is provided by
2450 multiple packages with different names. The solver may always break
2451 choice rules, so you will not see them when a problem is found.
2452
2453 *SOLVER_RULE_LEARNT*::
2454 These rules are generated by the solver to keep it from running into
2455 the same problem multiple times when it has to backtrack. They are
2456 the main reason why a sat solver is faster than other dependency solver
2457 implementations.
2458
2459 Special dependency rule types:
2460
2461 *SOLVER_RULE_PKG_NOT_INSTALLABLE*::
2462 This rule was added to prevent the installation of a package of an
2463 architecture that does not work on the system.
2464
2465 *SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP*::
2466 The package contains a required dependency which was not provided by
2467 any package.
2468
2469 *SOLVER_RULE_PKG_REQUIRES*::
2470 The package contains a required dependency which was provided by at
2471 least one package.
2472
2473 *SOLVER_RULE_PKG_SELF_CONFLICT*::
2474 The package conflicts with itself. This is not allowed by older rpm
2475 versions.
2476
2477 *SOLVER_RULE_PKG_CONFLICTS*::
2478 The package conflices with some other package.
2479
2480 *SOLVER_RULE_PKG_SAME_NAME*::
2481 This rules make sure that only one version of a package is installed
2482 in the system.
2483
2484 *SOLVER_RULE_PKG_OBSOLETES*::
2485 To fulfill the dependencies two packages need to be installed, but
2486 one of the packages obsoletes the other one.
2487
2488 *SOLVER_RULE_PKG_IMPLICIT_OBSOLETES*::
2489 To fulfill the dependencies two packages need to be installed, but
2490 one of the packages has provides a dependency that is obsoleted
2491 by the other one. See the POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES
2492 flag.
2493
2494 *SOLVER_RULE_PKG_INSTALLED_OBSOLETES*::
2495 To fulfill the dependencies a package needs to be installed that is
2496 obsoleted by an installed package. See the POOL_FLAG_NOINSTALLEDOBSOLETES
2497 flag.
2498
2499 *SOLVER_RULE_PKG_RECOMMENDS*::
2500 The package contains a recommended dependency.
2501
2502 *SOLVER_RULE_PKG_SUPPLEMENTS*::
2503 The package contains a dependency to specify it supplements another package.
2504
2505 *SOLVER_RULE_PKG_CONSTRAINS*::
2506 The package contains a constraint against some other package (disttype conda).
2507
2508 *SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP*::
2509 The user asked for installation of a package providing a specific
2510 dependency, but no available package provides it.
2511
2512 *SOLVER_RULE_JOB_UNKNOWN_PACKAGE*::
2513 The user asked for installation of a package with a specific name,
2514 but no available package has that name.
2515
2516 *SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM*::
2517 The user asked for the erasure of a dependency that is provided by the
2518 system (i.e. for special hardware or language dependencies), this
2519 cannot be done with a job.
2520
2521 *SOLVER_RULE_JOB_UNSUPPORTED*::
2522 The user asked for something that is not yet implemented, e.g. the
2523 installation of all packages at once.
2524
2525 Policy error constants
2526
2527 *POLICY_ILLEGAL_DOWNGRADE*::
2528 The solver ask for permission before downgrading packages.
2529
2530 *POLICY_ILLEGAL_ARCHCHANGE*::
2531 The solver ask for permission before changing the architecture of installed
2532 packages.
2533
2534 *POLICY_ILLEGAL_VENDORCHANGE*::
2535 The solver ask for permission before changing the vendor of installed
2536 packages.
2537
2538 *POLICY_ILLEGAL_NAMECHANGE*::
2539 The solver ask for permission before replacing an installed packages with
2540 a package that has a different name.
2541
2542 Solution element type constants
2543
2544 *SOLVER_SOLUTION_JOB*::
2545 The problem can be solved by removing the specified job.
2546
2547 *SOLVER_SOLUTION_POOLJOB*::
2548 The problem can be solved by removing the specified job that is defined
2549 in the pool.
2550
2551 *SOLVER_SOLUTION_INFARCH*::
2552 The problem can be solved by allowing the installation of the specified
2553 package with an inferior architecture.
2554
2555 *SOLVER_SOLUTION_DISTUPGRADE*::
2556 The problem can be solved by allowing to keep the specified package
2557 installed.
2558
2559 *SOLVER_SOLUTION_BEST*::
2560 The problem can be solved by allowing to install the specified package
2561 that is not the best available package.
2562
2563 *SOLVER_SOLUTION_ERASE*::
2564 The problem can be solved by allowing to erase the specified package.
2565
2566 *SOLVER_SOLUTION_REPLACE*::
2567 The problem can be solved by allowing to replace the package with some
2568 other package.
2569
2570 *SOLVER_SOLUTION_REPLACE_DOWNGRADE*::
2571 The problem can be solved by allowing to replace the package with some
2572 other package that has a lower version.
2573
2574 *SOLVER_SOLUTION_REPLACE_ARCHCHANGE*::
2575 The problem can be solved by allowing to replace the package with some
2576 other package that has a different architecture.
2577
2578 *SOLVER_SOLUTION_REPLACE_VENDORCHANGE*::
2579 The problem can be solved by allowing to replace the package with some
2580 other package that has a different vendor.
2581
2582 *SOLVER_SOLUTION_REPLACE_NAMECHANGE*::
2583 The problem can be solved by allowing to replace the package with some
2584 other package that has a different name.
2585
2586
2587 Reason constants
2588
2589 *SOLVER_REASON_UNRELATED*::
2590 The package status did not change as it was not related to any job.
2591
2592 *SOLVER_REASON_UNIT_RULE*::
2593 The package was installed/erased/kept because of a unit rule, i.e. a rule
2594 where all literals but one were false.
2595
2596 *SOLVER_REASON_KEEP_INSTALLED*::
2597 The package was chosen when trying to keep as many packages installed as
2598 possible.
2599
2600 *SOLVER_REASON_RESOLVE_JOB*::
2601 The decision happened to fulfill a job rule.
2602
2603 *SOLVER_REASON_UPDATE_INSTALLED*::
2604 The decision happened to fulfill a package update request.
2605
2606 *SOLVER_REASON_CLEANDEPS_ERASE*::
2607 The package was erased when cleaning up dependencies from other erased
2608 packages.
2609
2610 *SOLVER_REASON_RESOLVE*::
2611 The package was installed to fulfill package dependencies.
2612
2613 *SOLVER_REASON_WEAKDEP*::
2614 The package was installed because of a weak dependency (Recommends or
2615 Supplements).
2616
2617 *SOLVER_REASON_RESOLVE_ORPHAN*::
2618 The decision about the package was made when deciding the fate of orphaned
2619 packages.
2620
2621 *SOLVER_REASON_RECOMMENDED*::
2622 This is a special case of SOLVER_REASON_WEAKDEP.
2623
2624 *SOLVER_REASON_SUPPLEMENTED*::
2625 This is a special case of SOLVER_REASON_WEAKDEP.
2626
2627 *SOLVER_REASON_UNSOLVABLE*::
2628 This is a special case where a rule cannot be fulfilled.
2629
2630 *SOLVER_REASON_PREMISE*::
2631 This is a special case for the premises of learnt rules.
2632
2633 === ATTRIBUTES ===
2634
2635         Pool *pool;                             /* read only */
2636         $job->{pool}
2637         d.pool
2638         d.pool
2639
2640 Back pointer to pool.
2641
2642 === METHODS ===
2643
2644         int set_flag(int flag, int value)
2645         my $oldvalue = $solver->set_flag($flag, $value);
2646         oldvalue = solver.set_flag(flag, value)
2647         oldvalue = solver.set_flag(flag, value)
2648
2649         int get_flag(int flag)
2650         my $value = $solver->get_flag($flag);
2651         value = solver.get_flag(flag)
2652         value = solver.get_flag(flag)
2653
2654 Set/get a solver specific flag. The flags define the policies the solver has
2655 to obey. The flags are explained in the CONSTANTS section of this class.
2656
2657         Problem *solve(Job *jobs)
2658         my @problems = $solver->solve(\@jobs);
2659         problems = solver.solve(jobs)
2660         problems = solver.solve(jobs)
2661
2662 Solve a problem specified in the job list (plus the jobs defined in the pool).
2663 Returns an array of problems that need user interaction, or an empty array
2664 if no problems were encountered. See the Problem class on how to deal with
2665 problems.
2666
2667         Transaction transaction()
2668         my $trans = $solver->transaction();
2669         trans = solver.transaction()
2670         trans = solver.transaction()
2671
2672 Return the transaction to implement the calculated package changes. A transaction
2673 is available even if problems were found, this is useful for interactive user
2674 interfaces that show both the job result and the problems.
2675
2676         Solvable *get_recommended(bool noselected=0)
2677         my @solvables = $solver->get_recommended();
2678         solvables = solver.get_recommended()
2679         solvables = solver.get_recommended()
2680
2681 Return all solvables that are recommended by the solver run result. This includes
2682 solvables included in the result; set noselected if you want to filter those.
2683
2684         Solvable *get_suggested(bool noselected=0)
2685         my @solvables = $solver->get_suggested();
2686         solvables = solver.get_suggested()
2687         solvables = solver.get_suggested()
2688
2689 Return all solvables that are suggested by the solver run result. This includes
2690 solvables included in the result; set noselected if you want to filter those.
2691
2692         Decision = get_decision(Solvable *s)
2693         my $decision = $solver->get_decision($solvable);
2694         decision = solver.get_decision(solvable);
2695         decision = solver.get_decision(solvable);
2696
2697 Return a decision object that describes why a specific solvable was installed or erased.
2698 See the Decision class for more information.
2699
2700         Decision *get_decisionlist(Solvable *s)
2701         my @decisions = $solver->get_decisionlist($solvable);
2702         decisions = solver.get_decisionlist(solvable)
2703         decisions = solver.get_decisionlist(solvable)
2704
2705 Return a list of decisions that caused the specific solvable to be installed or
2706 erased. This is usually more useful than the get_decision() method, as it
2707 returns every involved decision instead of just a single one.
2708
2709         Alternative *alternatives()
2710         my @alternatives = $solver->alternatives();
2711         alternatives = solver.alternatives()
2712         alternatives = solver.alternatives()
2713
2714 Return all alternatives recorded in the solver run. See the Alternative class
2715 for more information.
2716
2717         int alternatives_count()
2718         my $cnt = $solver->alternatives_count();
2719         cnt = solver.alternatives_count()
2720         cnt = solver.alternatives_count()
2721
2722 Return the number of alternatives without creating alternative objects.
2723
2724
2725 The Problem Class
2726 -----------------
2727 Problems are the way of the solver to interact with the user. You can simply list
2728 all problems and terminate your program, but a better way is to present solutions to
2729 the user and let him pick the ones he likes.
2730
2731 === ATTRIBUTES ===
2732
2733         Solver *solv;                           /* read only */
2734         $problem->{solv}
2735         problem.solv
2736         problem.solv
2737
2738 Back pointer to solver object.
2739
2740         Id id;                                  /* read only */
2741         $problem->{id}
2742         problem.id
2743         problem.id
2744
2745 Id of the problem. The first problem has Id 1, they are numbered consecutively.
2746
2747 === METHODS ===
2748
2749         Rule findproblemrule()
2750         my $probrule = $problem->findproblemrule();
2751         probrule = problem.findproblemrule()
2752         probrule = problem.findproblemrule()
2753
2754 Return the rule that caused the problem. Of course in most situations there is no
2755 single responsible rule, but many rules that interconnect with each created the
2756 problem. Nevertheless, the solver uses some heuristic approach to find a rule
2757 that somewhat describes the problem best to the user.
2758
2759         Rule *findallproblemrules(bool unfiltered = 0)
2760         my @probrules = $problem->findallproblemrules();
2761         probrules = problem.findallproblemrules()
2762         probrules = problem.findallproblemrules()
2763
2764 Return all rules responsible for the problem. The returned set of rules contains
2765 all the needed information why there was a problem, but it's hard to present
2766 them to the user in a sensible way. The default is to filter out all update and
2767 job rules (unless the returned rules only consist of those types).
2768
2769         Decision *get_decisionlist()
2770         my @decisions = $problem->get_decisionlist();
2771         decisions = problem.get_decisionlist()
2772         decisions = problem.get_decisionlist()
2773
2774 Return a list of decisions prooving the problem. This is somewhat similar to
2775 the findallproblemrules(), but the output is in an order that makes it easier
2776 to understand why the solver could not find a solution.
2777
2778         Decisionset *get_decisionsetlist()
2779         my @decisionsets = $problem->get_decisionsetlist();
2780         decisionsets = problem.get_decisionsetlist()
2781         decisionsets = problem.get_decisionsetlist()
2782
2783 Like the get_decisionlist() method, but the decisions are merged into
2784 individual sets.
2785
2786         Rule *get_learnt()
2787         my @learnt = $problem->get_learnt();
2788         learnt = problem.get_learnt()
2789         learnt = problem.get_lerant()
2790
2791 Return a list of learnt rules that are part of the problem proof. This
2792 is useful for presenting a complete proof to the user.
2793
2794         Solution *solutions()
2795         my @solutions = $problem->solutions();
2796         solutions = problem.solutions()
2797         solutions = problem.solutions()
2798
2799 Return an array containing multiple possible solutions to fix the problem. See
2800 the solution class for more information.
2801
2802         int solution_count()
2803         my $cnt = $problem->solution_count();
2804         cnt = problem.solution_count()
2805         cnt = problem.solution_count()
2806
2807 Return the number of solutions without creating solution objects.
2808
2809         <stringification>
2810         my $str = $problem->str;
2811         str = str(problem)
2812         str = problem.to_s
2813
2814 Return a string describing the problem. This is a convenience function, it is
2815 a shorthand for calling findproblemrule(), then ruleinfo() on the problem
2816 rule and problemstr() on the ruleinfo object.
2817
2818
2819 The Rule Class
2820 --------------
2821 Rules are the basic block of sat solving. Each package dependency gets translated
2822 into one or multiple rules.
2823
2824 === ATTRIBUTES ===
2825
2826         Solver *solv;                           /* read only */
2827         $rule->{solv}
2828         rule.solv
2829         rule.solv
2830
2831 Back pointer to solver object.
2832
2833         Id id;                                  /* read only */
2834         $rule->{id}
2835         rule.id
2836         rule.id
2837
2838 The id of the rule.
2839
2840         int type;                               /* read only */
2841         $rule->{type}
2842         rule.type
2843         rule.type
2844
2845 The basic type of the rule. See the constant section of the solver class for the type list.
2846
2847 === METHODS ===
2848
2849         Ruleinfo info()
2850         my $ruleinfo = $rule->info();
2851         ruleinfo = rule.info()
2852         ruleinfo = rule.info()
2853
2854 Return a Ruleinfo object that contains information about why the rule was created. But
2855 see the allinfos() method below.
2856
2857         Ruleinfo *allinfos()
2858         my @ruleinfos = $rule->allinfos();
2859         ruleinfos = rule.allinfos()
2860         ruleinfos = rule.allinfos()
2861
2862 As the same dependency rule can get created because of multiple dependencies, one
2863 Ruleinfo is not enough to describe the reason. Thus the allinfos() method returns
2864 an array of all infos about a rule.
2865
2866         Decision *get_decisionlist()
2867         my @decisions = $rule->get_decisionlist();
2868         decisions = rule.get_decisionlist()
2869         decisions = rule.get_decisionlist()
2870
2871 Return a list of decisions prooving a learnt rule.
2872
2873         Decision *get_decisionsetlist()
2874         my @decisionsets = $rule->get_decisionsetlist();
2875         decisionsets = rule.get_decisionsetlist()
2876         decisionsets = rule.get_decisionsetlist()
2877
2878 Like the get_decisionlist() method, but the decisions are merged into
2879 individual sets.
2880
2881         Rule *get_learnt()
2882         my @learnt = $rule->get_learnt();
2883         learnt = rule.get_learnt()
2884         learnt = rule.get_lerant()
2885
2886 Return a list of learnt rules that are part of the learnt rule proof.
2887
2888         <equality>
2889         if ($rule1 == $rule2)
2890         if rule1 == rule2:
2891         if rule1 == rule2
2892
2893 Two rules are equal if they belong to the same solver and have the same id.
2894
2895
2896 The Ruleinfo Class
2897 ------------------
2898 A Ruleinfo describes one reason why a rule was created.
2899
2900 === ATTRIBUTES ===
2901
2902         Solver *solv;                           /* read only */
2903         $ruleinfo->{solv}
2904         ruleinfo.solv
2905         ruleinfo.solv
2906
2907 Back pointer to solver object.
2908
2909         int type;                               /* read only */
2910         $ruleinfo->{type}
2911         ruleinfo.type
2912         ruleinfo.type
2913
2914 The type of the ruleinfo. See the constant section of the solver class for the
2915 rule type list and the special type list.
2916
2917         Dep *dep;                               /* read only */
2918         $ruleinfo->{dep}
2919         ruleinfo.dep
2920         ruleinfo.dep
2921
2922 The dependency leading to the creation of the rule.
2923
2924         Dep *dep_id;                            /* read only */
2925         $ruleinfo->{dep_id}
2926         ruleinfo.dep_id
2927         ruleinfo.dep_id
2928
2929 The Id of the dependency leading to the creation of the rule, or zero.
2930
2931         Solvable *solvable;                     /* read only */
2932         $ruleinfo->{solvable}
2933         ruleinfo.solvable
2934         ruleinfo.solvable
2935
2936 The involved Solvable, e.g. the one containing the dependency.
2937
2938         Solvable *othersolvable;                /* read only */
2939         $ruleinfo->{othersolvable}
2940         ruleinfo.othersolvable
2941         ruleinfo.othersolvable
2942
2943 The other involved Solvable (if any), e.g. the one providing
2944 the dependency.
2945
2946         const char *problemstr();
2947         my $str = $ruleinfo->problemstr();
2948         str = ruleinfo.problemstr()
2949         str = ruleinfo.problemstr()
2950
2951 A string describing the ruleinfo from a problem perspective. This probably
2952 only makes sense if the rule is part of a problem.
2953
2954         <stringification>
2955         my $str = $ruleinfo->str;
2956         str = str(ruleinfo)
2957         str = ruleinfo.to_s
2958
2959 A string describing the ruleinfo, i.e. the reason why the corresponding rule
2960 has been created.
2961
2962
2963 The Solution Class
2964 ------------------
2965 A solution solves one specific problem. It consists of multiple solution elements
2966 that all need to be executed.
2967
2968 === ATTRIBUTES ===
2969
2970         Solver *solv;                           /* read only */
2971         $solution->{solv}
2972         solution.solv
2973         solution.solv
2974
2975 Back pointer to solver object.
2976
2977         Id problemid;                           /* read only */
2978         $solution->{problemid}
2979         solution.problemid
2980         solution.problemid
2981
2982 Id of the problem the solution solves.
2983
2984         Id id;                                  /* read only */
2985         $solution->{id}
2986         solution.id
2987         solution.id
2988
2989 Id of the solution. The first solution has Id 1, they are numbered consecutively.
2990
2991 === METHODS ===
2992
2993         Solutionelement *elements(bool expandreplaces = 0)
2994         my @solutionelements = $solution->elements();
2995         solutionelements = solution.elements()
2996         solutionelements = solution.elements()
2997
2998 Return an array containing the elements describing what needs to be done to
2999 implement the specific solution. If expandreplaces is true, elements of type
3000 SOLVER_SOLUTION_REPLACE will be replaced by one or more elements replace
3001 elements describing the policy mismatches.
3002
3003         int element_count()
3004         my $cnt = $solution->solution_count();
3005         cnt = solution.element_count()
3006         cnt = solution.element_count()
3007
3008 Return the number of solution elements without creating objects. Note that the
3009 count does not match the number of objects returned by the elements() method
3010 of expandreplaces is set to true.
3011
3012
3013 The Solutionelement Class
3014 -------------------------
3015 A solution element describes a single action of a solution. The action is always
3016 either to remove one specific job or to add a new job that installs or erases
3017 a single specific package.
3018
3019 === ATTRIBUTES ===
3020
3021         Solver *solv;                           /* read only */
3022         $solutionelement->{solv}
3023         solutionelement.solv
3024         solutionelement.solv
3025
3026 Back pointer to solver object.
3027
3028         Id problemid;                           /* read only */
3029         $solutionelement->{problemid}
3030         solutionelement.problemid
3031         solutionelement.problemid
3032
3033 Id of the problem the element (partly) solves.
3034
3035         Id solutionid;                          /* read only */
3036         $solutionelement->{solutionid}
3037         solutionelement.solutionid
3038         solutionelement.solutionid
3039
3040 Id of the solution the element is a part of.
3041
3042         Id id;                                  /* read only */
3043         $solutionelement->{id}
3044         solutionelement.id
3045         solutionelement.id
3046
3047 Id of the solution element. The first element has Id 1, they are numbered consecutively.
3048
3049         Id type;                                /* read only */
3050         $solutionelement->{type}
3051         solutionelement.type
3052         solutionelement.type
3053
3054 Type of the solution element. See the constant section of the solver class for the
3055 existing types.
3056
3057         Solvable *solvable;                     /* read only */
3058         $solutionelement->{solvable}
3059         solutionelement.solvable
3060         solutionelement.solvable
3061
3062 The installed solvable that needs to be replaced for replacement elements.
3063
3064         Solvable *replacement;                  /* read only */
3065         $solutionelement->{replacement}
3066         solutionelement.replacement
3067         solutionelement.replacement
3068
3069 The solvable that needs to be installed to fix the problem.
3070
3071         int jobidx;                             /* read only */
3072         $solutionelement->{jobidx}
3073         solutionelement.jobidx
3074         solutionelement.jobidx
3075
3076 The index of the job that needs to be removed to fix the problem, or -1 if the
3077 element is of another type. Note that it's better to change the job to SOLVER_NOOP
3078 type so that the numbering of other elements does not get disturbed. This
3079 method works both for types SOLVER_SOLUTION_JOB and SOLVER_SOLUTION_POOLJOB.
3080
3081 === METHODS ===
3082
3083         Solutionelement *replaceelements()
3084         my @solutionelements = $solutionelement->replaceelements();
3085         solutionelements = solutionelement.replaceelements()
3086         solutionelements = solutionelement.replaceelements()
3087
3088 If the solution element is of type SOLVER_SOLUTION_REPLACE, return an array of
3089 elements describing the policy mismatches, otherwise return a copy of the
3090 element. See also the ``expandreplaces'' option in the solution's elements()
3091 method.
3092
3093         int illegalreplace()
3094         my $illegal = $solutionelement->illegalreplace();
3095         illegal = solutionelement.illegalreplace()
3096         illegal = solutionelement.illegalreplace()
3097
3098 Return an integer that contains the policy mismatch bits or-ed together, or
3099 zero if there was no policy mismatch. See the policy error constants in
3100 the solver class.
3101
3102         Job Job()
3103         my $job = $solutionelement->Job();
3104         illegal = solutionelement.Job()
3105         illegal = solutionelement.Job()
3106
3107 Create a job that implements the solution element. Add this job to the array
3108 of jobs for all elements of type different to SOLVER_SOLUTION_JOB and
3109 SOLVER_SOLUTION_POOLJOB. For the latter two, a SOLVER_NOOB Job is created,
3110 you should replace the old job with the new one.
3111
3112         const char *str()
3113         my $str = $solutionelement->str();
3114         str = solutionelement.str()
3115         str = solutionelement.str()
3116
3117 A string describing the change the solution element consists of.
3118
3119
3120 The Transaction Class
3121 ---------------------
3122 Transactions describe the output of a solver run. A transaction contains
3123 a number of transaction elements, each either the installation of a new
3124 package or the removal of an already installed package. The Transaction
3125 class supports a classify() method that puts the elements into different
3126 groups so that a transaction can be presented to the user in a meaningful
3127 way.
3128
3129 === CONSTANTS ===
3130
3131 Transaction element types, both active and passive
3132
3133 *SOLVER_TRANSACTION_IGNORE*::
3134 This element does nothing. Used to map element types that do not match
3135 the view mode.
3136
3137 *SOLVER_TRANSACTION_INSTALL*::
3138 This element installs a package.
3139
3140 *SOLVER_TRANSACTION_ERASE*::
3141 This element erases a package.
3142
3143 *SOLVER_TRANSACTION_MULTIINSTALL*::
3144 This element installs a package with a different version keeping the other
3145 versions installed.
3146
3147 *SOLVER_TRANSACTION_MULTIREINSTALL*::
3148 This element reinstalls an installed package keeping the other versions
3149 installed.
3150
3151 Transaction element types, active view
3152
3153 *SOLVER_TRANSACTION_REINSTALL*::
3154 This element re-installs a package, i.e. installs the same package again.
3155
3156 *SOLVER_TRANSACTION_CHANGE*::
3157 This element installs a package with same name, version, architecture but
3158 different content.
3159
3160 *SOLVER_TRANSACTION_UPGRADE*::
3161 This element installs a newer version of an installed package.
3162
3163 *SOLVER_TRANSACTION_DOWNGRADE*::
3164 This element installs an older version of an installed package.
3165
3166 *SOLVER_TRANSACTION_OBSOLETES*::
3167 This element installs a package that obsoletes an installed package.
3168
3169 Transaction element types, passive view
3170
3171 *SOLVER_TRANSACTION_REINSTALLED*::
3172 This element re-installs a package, i.e. installs the same package again.
3173
3174 *SOLVER_TRANSACTION_CHANGED*::
3175 This element replaces an installed package with one of the same name,
3176 version, architecture but different content.
3177
3178 *SOLVER_TRANSACTION_UPGRADED*::
3179 This element replaces an installed package with a new version.
3180
3181 *SOLVER_TRANSACTION_DOWNGRADED*::
3182 This element replaces an installed package with an old version.
3183
3184 *SOLVER_TRANSACTION_OBSOLETED*::
3185 This element replaces an installed package with a package that obsoletes
3186 it.
3187
3188 Pseudo element types for showing extra information used by classify()
3189
3190 *SOLVER_TRANSACTION_ARCHCHANGE*::
3191 This element replaces an installed package with a package of a different
3192 architecture.
3193
3194 *SOLVER_TRANSACTION_VENDORCHANGE*::
3195 This element replaces an installed package with a package of a different
3196 vendor.
3197
3198 Transaction mode flags
3199
3200 *SOLVER_TRANSACTION_SHOW_ACTIVE*::
3201 Filter for active view types. The default is to return passive view type,
3202 i.e. to show how the installed packages get changed.
3203
3204 *SOLVER_TRANSACTION_SHOW_OBSOLETES*::
3205 Do not map the obsolete view type into INSTALL/ERASE elements.
3206
3207 *SOLVER_TRANSACTION_SHOW_ALL*::
3208 If multiple packages replace an installed package, only the best of them
3209 is kept as OBSOLETE element, the other ones are mapped to INSTALL/ERASE
3210 elements. This is because most applications want to show just one package
3211 replacing the installed one. The SOLVER_TRANSACTION_SHOW_ALL makes the
3212 library keep all OBSOLETE elements.
3213
3214 *SOLVER_TRANSACTION_SHOW_MULTIINSTALL*::
3215 The library maps MULTIINSTALL elements to simple INSTALL elements. This
3216 flag can be used to disable the mapping.
3217
3218 *SOLVER_TRANSACTION_CHANGE_IS_REINSTALL*::
3219 Use this flag if you want to map CHANGE elements to the REINSTALL type.
3220
3221 *SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE*::
3222 Use this flag if you want to map OBSOLETE elements to the UPGRADE type.
3223
3224 *SOLVER_TRANSACTION_MERGE_ARCHCHANGES*::
3225 Do not add extra categories for every architecture change, instead cumulate
3226 them in one category.
3227
3228 *SOLVER_TRANSACTION_MERGE_VENDORCHANGES*::
3229 Do not add extra categories for every vendor change, instead cumulate
3230 them in one category.
3231
3232 *SOLVER_TRANSACTION_RPM_ONLY*::
3233 Special view mode that just returns IGNORE, ERASE, INSTALL, MULTIINSTALL
3234 elements. Useful if you want to find out what to feed to the underlying
3235 package manager.
3236
3237 Transaction order flags
3238
3239 *SOLVER_TRANSACTION_KEEP_ORDERDATA*::
3240 Do not throw away the dependency graph used for ordering the transaction.
3241 This flag is needed if you want to do manual ordering.
3242
3243 === ATTRIBUTES ===
3244
3245         Pool *pool;                             /* read only */
3246         $trans->{pool}
3247         trans.pool
3248         trans.pool
3249
3250 Back pointer to pool.
3251
3252 === METHODS ===
3253
3254         bool isempty()
3255         $trans->isempty()
3256         trans.isempty()
3257         trans.isempty?
3258
3259 Returns true if the transaction does not do anything, i.e. has no elements.
3260
3261         Solvable *newsolvables()
3262         my @newsolvables = $trans->newsolvables();
3263         newsolvables = trans.newsolvables()
3264         newsolvables = trans.newsolvables()
3265
3266 Return all packages that are to be installed by the transaction. These are
3267 the packages that need to be downloaded from the repositories.
3268
3269         Solvable *keptsolvables()
3270         my @keptsolvables = $trans->keptsolvables();
3271         keptsolvables = trans.keptsolvables()
3272         keptsolvables = trans.keptsolvables()
3273
3274 Return all installed packages that the transaction will keep installed.
3275
3276         Solvable *steps()
3277         my @steps = $trans->steps();
3278         steps = trans.steps()
3279         steps = trans.steps()
3280
3281 Return all solvables that need to be installed (if the returned solvable
3282 is not already installed) or erased (if the returned solvable is installed).
3283 A step is also called a transaction element.
3284
3285         int steptype(Solvable *solvable, int mode)
3286         my $type = $trans->steptype($solvable, $mode);
3287         type = trans.steptype(solvable, mode)
3288         type = trans.steptype(solvable, mode)
3289
3290 Return the transaction type of the specified solvable. See the CONSTANTS
3291 sections for the mode argument flags and the list of returned types.
3292
3293         TransactionClass *classify(int mode = 0)
3294         my @classes = $trans->classify();
3295         classes = trans.classify()
3296         classes = trans.classify()
3297
3298 Group the transaction elements into classes so that they can be displayed
3299 in a structured way. You can use various mapping mode flags to tweak
3300 the result to match your preferences, see the mode argument flag in
3301 the CONSTANTS section. See the TransactionClass class for how to deal
3302 with the returned objects.
3303
3304         Solvable othersolvable(Solvable *solvable)
3305         my $other = $trans->othersolvable($solvable);
3306         other = trans.othersolvable(solvable)
3307         other = trans.othersolvable(solvable)
3308
3309 Return the ``other'' solvable for a given solvable. For installed packages
3310 the other solvable is the best package with the same name that replaces
3311 the installed package, or the best package of the obsoleting packages if
3312 the package does not get replaced by one with the same name.
3313
3314 For to be installed packages, the ``other'' solvable is the best installed
3315 package with the same name that will be replaced, or the best packages
3316 of all the packages that are obsoleted if the new package does not replace
3317 a package with the same name.
3318
3319 Thus, the ``other'' solvable is normally the package that is also shown
3320 for a given package.
3321
3322         Solvable *allothersolvables(Solvable *solvable)
3323         my @others = $trans->allothersolvables($solvable);
3324         others = trans.allothersolvables(solvable)
3325         others = trans.allothersolvables(solvable)
3326
3327 For installed packages, returns all of the packages that replace us. For to
3328 be installed packages, returns all of the packages that the new package
3329 replaces. The special ``other'' solvable is always the first entry of the
3330 returned array.
3331
3332         long long calc_installsizechange()
3333         my $change = $trans->calc_installsizechange();
3334         change = trans.calc_installsizechange()
3335         change = trans.calc_installsizechange()
3336
3337 Return the size change of the installed system in kilobytes (kibibytes).
3338
3339         void order(int flags = 0)
3340         $trans->order();
3341         trans.order()
3342         trans.order()
3343
3344 Order the steps in the transactions so that dependent packages are updated
3345 before packages that depend on them. For rpm, you can also use rpmlib's
3346 ordering functionality, debian's dpkg does not provide a way to order a
3347 transaction.
3348
3349 === ACTIVE/PASSIVE VIEW ===
3350
3351 Active view lists what new packages get installed, while passive view shows
3352 what happens to the installed packages. Most often there's not much
3353 difference between the two modes, but things get interesting if multiple
3354 packages get replaced by one new package. Say you have installed packages
3355 A-1-1 and B-1-1, and now install A-2-1 which has a new dependency that
3356 obsoletes B. The transaction elements will be
3357
3358   updated   A-1-1 (other: A-2-1)
3359   obsoleted B-1-1 (other: A-2-1)
3360
3361 in passive mode, but
3362
3363   update A-2-1 (other: A-1-1)
3364   erase  B
3365
3366 in active mode. If the mode contains SOLVER_TRANSACTION_SHOW_ALL, the
3367 passive mode list will be unchanged but the active mode list will just
3368 contain A-2-1.
3369
3370
3371 The Transactionclass Class
3372 --------------------------
3373 Objects of this type are returned by the classify() Transaction method.
3374
3375 === ATTRIBUTES ===
3376
3377         Transaction *transaction;               /* read only */
3378         $class->{transaction}
3379         class.transaction
3380         class.transaction
3381
3382 Back pointer to transaction object.
3383
3384         int type;                               /* read only */
3385         $class->{type}
3386         class.type
3387         class.type
3388
3389 The type of the transaction elements in the class.
3390
3391         int count;                              /* read only */
3392         $class->{count}
3393         class.count
3394         class.count
3395
3396 The number of elements in the class.
3397
3398         const char *fromstr;
3399         $class->{fromstr}
3400         class.fromstr
3401         class.fromstr
3402
3403 The old vendor or architecture.
3404
3405         const char *tostr;
3406         $class->{tostr}
3407         class.tostr
3408         class.tostr
3409
3410 The new vendor or architecture.
3411
3412         Id fromid;
3413         $class->{fromid}
3414         class.fromid
3415         class.fromid
3416
3417 The id of the old vendor or architecture.
3418
3419         Id toid;
3420         $class->{toid}
3421         class.toid
3422         class.toid
3423
3424 The id of the new vendor or architecture.
3425
3426 === METHODS ===
3427
3428         void solvables();
3429         my @solvables = $class->solvables();
3430         solvables = class.solvables()
3431         solvables = class.solvables()
3432
3433 Return the solvables for all transaction elements in the class.
3434
3435
3436 Checksums
3437 ---------
3438 Checksums (also called hashes) are used to make sure that downloaded data is
3439 not corrupt and also as a fingerprint mechanism to check if data has changed.
3440
3441 === CLASS METHODS ===
3442
3443         Chksum Chksum(Id type)
3444         my $chksum = solv::Chksum->new($type);
3445         chksum = solv.Chksum(type)
3446         chksum = Solv::Chksum.new(type)
3447
3448 Create a checksum object. Currently the following types are supported:
3449
3450         REPOKEY_TYPE_MD5
3451         REPOKEY_TYPE_SHA1
3452         REPOKEY_TYPE_SHA224
3453         REPOKEY_TYPE_SHA256
3454         REPOKEY_TYPE_SHA384
3455         REPOKEY_TYPE_SHA512
3456
3457 These keys are constants in the *solv* class.
3458
3459         Chksum Chksum(Id type, const char *hex)
3460         my $chksum = solv::Chksum->new($type, $hex);
3461         chksum = solv.Chksum(type, hex)
3462         chksum = Solv::Chksum.new(type, hex)
3463
3464 Create an already finalized checksum object from a hex string.
3465
3466         Chksum Chksum_from_bin(Id type, char *bin)
3467         my $chksum = solv::Chksum->from_bin($type, $bin);
3468         chksum = solv.Chksum.from_bin(type, bin)
3469         chksum = Solv::Chksum.from_bin(type, bin)
3470
3471 Create an already finalized checksum object from a binary checksum.
3472
3473 === ATTRIBUTES ===
3474
3475         Id type;                        /* read only */
3476         $chksum->{type}
3477         chksum.type
3478         chksum.type
3479
3480 Return the type of the checksum object.
3481
3482 === METHODS ===
3483
3484         void add(const char *str)
3485         $chksum->add($str);
3486         chksum.add(str)
3487         chksum.add(str)
3488
3489 Add a (binary) string to the checksum.
3490
3491         void add_fp(FILE *fp)
3492         $chksum->add_fp($file);
3493         chksum.add_fp(file)
3494         chksum.add_fp(file)
3495
3496 Add the contents of a file to the checksum.
3497
3498         void add_stat(const char *filename)
3499         $chksum->add_stat($filename);
3500         chksum.add_stat(filename)
3501         chksum.add_stat(filename)
3502
3503 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
3504 stat fails, the members are zeroed.
3505
3506         void add_fstat(int fd)
3507         $chksum->add_fstat($fd);
3508         chksum.add_fstat(fd)
3509         chksum.add_fstat(fd)
3510
3511 Same as add_stat, but instead of the filename a file descriptor is used.
3512
3513         unsigned char *raw()
3514         my $raw = $chksum->raw();
3515         raw = chksum.raw()
3516         raw = chksum.raw()
3517
3518 Finalize the checksum and return the result as raw bytes. This means that the
3519 result can contain NUL bytes or unprintable characters.
3520
3521         const char *hex()
3522         my $raw = $chksum->hex();
3523         raw = chksum.hex()
3524         raw = chksum.hex()
3525
3526 Finalize the checksum and return the result as hex string.
3527
3528         const char *typestr()
3529         my $typestr = $chksum->typestr();
3530         typestr = chksum.typestr
3531         typestr = chksum.typestr
3532
3533 Return the type of the checksum as a string, e.g. "sha256".
3534
3535         <equality>
3536         if ($chksum1 == $chksum2)
3537         if chksum1 == chksum2:
3538         if chksum1 == chksum2
3539
3540 Checksums are equal if they are of the same type and the finalized results are
3541 the same.
3542
3543         <stringification>
3544         my $str = $chksum->str;
3545         str = str(chksum)
3546         str = chksum.to_s
3547
3548 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
3549 Otherwise "<type>:unfinished" is returned.
3550
3551
3552 File Management
3553 ---------------
3554 This functions were added because libsolv uses standard *FILE* pointers to
3555 read/write files, but languages like perl have their own implementation of
3556 files. The libsolv functions also support decompression and compression, the
3557 algorithm is selected by looking at the file name extension.
3558
3559         FILE *xfopen(char *fn, char *mode = "r")
3560         my $file = solv::xfopen($path);
3561         file = solv.xfopen(path)
3562         file = Solv::xfopen(path)
3563
3564 Open a file at the specified path. The `mode` argument is passed on to the
3565 stdio library.
3566
3567         FILE *xfopen_fd(char *fn, int fileno)
3568         my $file = solv::xfopen_fd($path, $fileno);
3569         file = solv.xfopen_fd(path, fileno)
3570         file = Solv::xfopen_fd(path, fileno)
3571
3572 Create a file handle from the specified file descriptor. The path argument is
3573 only used to select the correct (de-)compression algorithm, use an empty path
3574 if you want to make sure to read/write raw data. The file descriptor is dup()ed
3575 before the file handle is created.
3576
3577 === METHODS ===
3578
3579         int fileno()
3580         my $fileno = $file->fileno();
3581         fileno = file.fileno()
3582         fileno = file.fileno()
3583
3584 Return file file descriptor of the file. If the file is not open, `-1` is
3585 returned.
3586
3587         void cloexec(bool state)
3588         $file->cloexec($state);
3589         file.cloexec(state)
3590         file.cloexec(state)
3591
3592 Set the close-on-exec flag of the file descriptor. The xfopen function
3593 returns files with close-on-exec turned on, so if you want to pass
3594 a file to some other process you need to call cloexec(0) before calling
3595 exec.
3596
3597         int dup()
3598         my $fileno = $file->dup();
3599         fileno = file.dup()
3600         fileno = file.dup()
3601
3602 Return a copy of the descriptor of the file. If the file is not open, `-1` is
3603 returned.
3604
3605         bool flush()
3606         $file->flush();
3607         file.flush()
3608         file.flush()
3609
3610 Flush the file. Returns false if there was an error. Flushing a closed file
3611 always returns true.
3612
3613         bool close()
3614         $file->close();
3615         file.close()
3616         file.close()
3617
3618 Close the file. This is needed for languages like Ruby that do not destruct
3619 objects right after they are no longer referenced. In that case, it is good
3620 style to close open files so that the file descriptors are freed right away.
3621 Returns false if there was an error.
3622
3623
3624 The Repodata Class
3625 ------------------
3626 The Repodata stores attributes for packages and the repository itself, each
3627 repository can have multiple repodata areas. You normally only need to
3628 directly access them if you implement lazy downloading of repository data.
3629 Repodata areas are created by calling the repository's add_repodata() method
3630 or by using repo_add methods without the REPO_REUSE_REPODATA or REPO_USE_LOADING
3631 flag.
3632
3633 === ATTRIBUTES ===
3634
3635         Repo *repo;                     /* read only */
3636         $data->{repo}
3637         data.repo
3638         data.repo
3639
3640 Back pointer to repository object.
3641
3642         Id id;                                  /* read only */
3643         $data->{id}
3644         data.id
3645         data.id
3646
3647 The id of the repodata area. Repodata ids of different repositories overlap.
3648
3649 === METHODS ===
3650
3651         internalize()
3652         $data->internalize();
3653         data.internalize()
3654         data.internalize()
3655
3656 Internalize newly added data. The lookup functions will only see the new data
3657 after it has been internalized.
3658
3659         bool write(FILE *fp)
3660         $data->write($fp);
3661         data.write(fp)
3662         data.write(fp)
3663
3664 Write the contents of the repodata area as solv file.
3665
3666         Id str2dir(const char *dir, bool create = 1)
3667         my $did = data->str2dir($dir);
3668         did = data.str2dir(dir)
3669         did = data.str2dir(dir)
3670
3671         const char *dir2str(Id did, const char *suffix = 0)
3672         $dir = pool->dir2str($did);
3673         dir = pool.dir2str(did)
3674         dir = pool.dir2str(did)
3675
3676 Convert a string (directory) into an Id and back. If the string is currently not in the
3677 pool and _create_ is false, zero is returned.
3678
3679         void add_dirstr(Id solvid, Id keyname, Id dir, const char *str)
3680         $data->add_dirstr($solvid, $keyname, $dir, $string);
3681         data.add_dirstr(solvid, keyname, dir, string)
3682         data.add_dirstr(solvid, keyname, dir, string)
3683
3684 Add a file path consisting of a dirname Id and a basename string.
3685
3686         bool add_solv(FILE *fp, int flags = 0)
3687         $data->add_solv($fp);
3688         data.add_solv(fp)
3689         data.add_solv(fp)
3690
3691 Replace a stub repodata object with the data from a solv file. This method
3692 automatically adds the REPO_USE_LOADING flag. It should only be used from
3693 a load callback.
3694
3695         void create_stubs()
3696         $data->create_stubs();
3697         data.create_stubs()
3698         data.create_stubs()
3699
3700 Create stub repodatas from the information stored in the repodata meta
3701 area.
3702
3703         void extend_to_repo()
3704         $data->extend_to_repo();
3705         data.extend_to_repo()
3706         data.extend_to_repo()
3707
3708 Extend the repodata so that it has the same size as the repo it belongs to.
3709 This method is needed when setting up a new extension repodata so that it
3710 matches the repository size. It is also needed when switching to a just written
3711 repodata extension to make the repodata match the written extension (which is
3712 always of the size of the repo).
3713
3714         <equality>
3715         if ($data1 == $data2)
3716         if data1 == data2:
3717         if data1 == data2
3718
3719 Two repodata objects are equal if they belong to the same repository and have
3720 the same id.
3721
3722 === DATA RETRIEVAL METHODS ===
3723
3724         const char *lookup_str(Id solvid, Id keyname)
3725         my $string = $data->lookup_str($solvid, $keyname);
3726         string = data.lookup_str(solvid, keyname)
3727         string = data.lookup_str(solvid, keyname)
3728
3729         const char *lookup_id(Id solvid, Id keyname)
3730         my $string = $data->lookup_id($solvid, $keyname);
3731         string = data.lookup_id(solvid, keyname)
3732         string = data.lookup_id(solvid, keyname)
3733
3734         unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
3735         my $num = $data->lookup_num($solvid, $keyname);
3736         num = data.lookup_num(solvid, keyname)
3737         num = data.lookup_num(solvid, keyname)
3738
3739         bool lookup_void(Id solvid, Id keyname)
3740         my $bool = $data->lookup_void($solvid, $keyname);
3741         bool = data.lookup_void(solvid, keyname)
3742         bool = data.lookup_void(solvid, keyname)
3743
3744         Id *lookup_idarray(Id solvid, Id keyname)
3745         my @ids = $data->lookup_idarray($solvid, $keyname);
3746         ids = data.lookup_idarray(solvid, keyname)
3747         ids = data.lookup_idarray(solvid, keyname)
3748
3749         Chksum lookup_checksum(Id solvid, Id keyname)
3750         my $chksum = $data->lookup_checksum($solvid, $keyname);
3751         chksum = data.lookup_checksum(solvid, keyname)
3752         chksum = data.lookup_checksum(solvid, keyname)
3753
3754 Lookup functions. Return the data element stored in the specified solvable.
3755 The methods probably only make sense to retrieve data from the special
3756 SOLVID_META solvid that stores repodata meta information.
3757
3758 === DATA STORAGE METHODS ===
3759
3760         void set_str(Id solvid, Id keyname, const char *str)
3761         $data->set_str($solvid, $keyname, $str);
3762         data.set_str(solvid, keyname, str)
3763         data.set_str(solvid, keyname, str)
3764
3765         void set_id(Id solvid, Id keyname, DepId id)
3766         $data->set_id($solvid, $keyname, $id);
3767         data.set_id(solvid, keyname, id)
3768         data.set_id(solvid, keyname, id)
3769
3770         void set_num(Id solvid, Id keyname, unsigned long long num)
3771         $data->set_num($solvid, $keyname, $num);
3772         data.set_num(solvid, keyname, num)
3773         data.set_num(solvid, keyname, num)
3774
3775         void set_void(Id solvid, Id keyname)
3776         $data->set_void($solvid, $keyname);
3777         data.set_void(solvid, keyname)
3778         data.set_void(solvid, keyname)
3779
3780         void set_poolstr(Id solvid, Id keyname, const char *str)
3781         $data->set_poolstr($solvid, $keyname, $str);
3782         data.set_poolstr(solvid, keyname, str)
3783         data.set_poolstr(solvid, keyname, str)
3784
3785         void set_checksum(Id solvid, Id keyname, Chksum *chksum)
3786         $data->set_checksum($solvid, $keyname, $chksum);
3787         data.set_checksum(solvid, keyname, chksum)
3788         data.set_checksum(solvid, keyname, chksum)
3789
3790         void set_sourcepkg(Id solvid, const char *sourcepkg)
3791         $data.set_sourcepkg($solvid, $sourcepkg);
3792         data.set_sourcepkg(solvid, sourcepkg)
3793         data.set_sourcepkg(solvid, sourcepkg)
3794
3795         void set_location(Id solvid, unsigned int mediano, const char *location)
3796         $data.set_location($solvid, $mediano, $location);
3797         data.set_location(solvid, mediano, location)
3798         data.set_location(solvid, mediano, location)
3799
3800         void add_idarray(Id solvid, Id keyname, DepId id)
3801         $data->add_idarray($solvid, $keyname, $id);
3802         data.add_idarray(solvid, keyname, id)
3803         data.add_idarray(solvid, keyname, id)
3804
3805         Id new_handle()
3806         my $handle = $data->new_handle();
3807         handle = data.new_handle()
3808         handle = data.new_handle()
3809
3810         void add_flexarray(Id solvid, Id keyname, Id handle)
3811         $data->add_flexarray($solvid, $keyname, $handle);
3812         data.add_flexarray(solvid, keyname, handle)
3813         data.add_flexarray(solvid, keyname, handle)
3814
3815         void unset(Id solvid, Id keyname)
3816         $data->unset($solvid, $keyname);
3817         data.unset(solvid, keyname)
3818         data.unset(solvid, keyname)
3819
3820 Data storage methods. Probably only useful to store data in the special
3821 SOLVID_META solvid that stores repodata meta information. Note that
3822 repodata areas can have their own Id pool (see the REPO_LOCALPOOL flag),
3823 so be careful if you need to store ids. Arrays are created by calling
3824 the add function for every element. A flexarray is an array of
3825 sub-structures, call new_handle to create a new structure, use the
3826 handle as solvid to fill the structure with data and call add_flexarray
3827 to put the structure in an array.
3828
3829
3830 The Datapos Class
3831 -----------------
3832 Datapos objects describe a specific position in the repository data area.
3833 Thus they are only valid until the repository is modified in some way.
3834 Datapos objects can be created by the pos() and parentpos() methods of
3835 a Datamatch object or by accessing the ``meta'' attribute of a repository.
3836
3837 === ATTRIBUTES ===
3838
3839         Repo *repo;                     /* read only */
3840         $data->{repo}
3841         data.repo
3842         data.repo
3843
3844 Back pointer to repository object.
3845
3846 === METHODS ===
3847
3848         Dataiterator(Id keyname, const char *match, int flags)
3849         my $di = $datapos->Dataiterator($keyname, $match, $flags);
3850         di = datapos.Dataiterator(keyname, match, flags)
3851         di = datapos.Dataiterator(keyname, match, flags)
3852
3853 Create a Dataiterator at the position of the datapos object.
3854
3855         const char *lookup_deltalocation(unsigned int *OUTPUT)
3856         my ($location, $mediano) = $datapos->lookup_deltalocation();
3857         location, mediano = datapos.lookup_deltalocation()
3858         location, mediano = datapos.lookup_deltalocation()
3859
3860 Return a tuple containing the on-media location and an optional media number
3861 for a delta rpm. This obviously only works if the data position points to
3862 structure describing a delta rpm.
3863
3864         const char *lookup_deltaseq()
3865         my $seq = $datapos->lookup_deltaseq();
3866         seq = datapos.lookup_deltaseq();
3867         seq = datapos.lookup_deltaseq();
3868
3869 Return the delta rpm sequence from the structure describing a delta rpm.
3870
3871 === DATA RETRIEVAL METHODS ===
3872
3873         const char *lookup_str(Id keyname)
3874         my $string = $datapos->lookup_str($keyname);
3875         string = datapos.lookup_str(keyname)
3876         string = datapos.lookup_str(keyname)
3877
3878         Id lookup_id(Id solvid, Id keyname)
3879         my $id = $datapos->lookup_id($keyname);
3880         id = datapos.lookup_id(keyname)
3881         id = datapos.lookup_id(keyname)
3882
3883         unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
3884         my $num = $datapos->lookup_num($keyname);
3885         num = datapos.lookup_num(keyname)
3886         num = datapos.lookup_num(keyname)
3887
3888         bool lookup_void(Id keyname)
3889         my $bool = $datapos->lookup_void($keyname);
3890         bool = datapos.lookup_void(keyname)
3891         bool = datapos.lookup_void(keyname)
3892
3893         Id *lookup_idarray(Id keyname)
3894         my @ids = $datapos->lookup_idarray($keyname);
3895         ids = datapos.lookup_idarray(keyname)
3896         ids = datapos.lookup_idarray(keyname)
3897
3898         Chksum lookup_checksum(Id keyname)
3899         my $chksum = $datapos->lookup_checksum($keyname);
3900         chksum = datapos.lookup_checksum(keyname)
3901         chksum = datapos.lookup_checksum(keyname)
3902
3903 Lookup functions. Note that the returned Ids are always translated into
3904 the Ids of the global pool even if the repodata area contains its own pool.
3905
3906         Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
3907         my $di = $datapos->Dataiterator($keyname, $match, $flags);
3908         di = datapos.Dataiterator(keyname, match, flags)
3909         di = datapos.Dataiterator(keyname, match, flags)
3910
3911         for my $d (@$di)
3912         for d in di:
3913         for d in di
3914
3915 Iterate over the matching data elements. See the Dataiterator class for more
3916 information.
3917
3918
3919 The Alternative Class
3920 ---------------------
3921 An Alternative object describes a branch point in the solving process. The
3922 solver found more than one good way to fulfill a dependency and chose one.
3923 It recorded the other possibilities in the alternative object so that they
3924 can be presented to the user in the case a different solution is preferable.
3925
3926 === ATTRIBUTES ===
3927
3928         Solver *solv;                   /* read only */
3929         $alternative->{solv}
3930         alternative.solv
3931         alternative.solv
3932
3933 Back pointer to solver object.
3934
3935         Id type;                        /* read only */
3936         $alternative->{type}
3937         alternative.type
3938         alternative.type
3939
3940 The type of the alternative. Alternatives can be created because of rule
3941 fulfillment, because of recommended packages, and because of suggested
3942 packages (currently unused). See below for a list of valid types.
3943
3944         Rule rule;                      /* read only */
3945         $alternative->{rule}
3946         alternative.rule
3947         alternative.rule
3948
3949 The rule that caused the creation of the alternative (SOLVER_ALTERNATIVE_TYPE_RULE).
3950
3951         Dep *dep;                       /* read only */
3952         $ruleinfo->{dep}
3953         ruleinfo.dep
3954         ruleinfo.dep
3955
3956 The dependency that caused the creation of the alternative (SOLVER_ALTERNATIVE_TYPE_RECOMMENDS).
3957
3958         Dep *depsolvable;               /* read only */
3959         $ruleinfo->{depsolvable}
3960         ruleinfo.depsolvable
3961         ruleinfo.depsolvable
3962
3963 The package containing the dependency (SOLVER_ALTERNATIVE_TYPE_RECOMMENDS).
3964
3965         Solvable chosen;                /* read only */
3966         $alternative->{chosen}
3967         alternative.chosen
3968         alternative.chosen
3969
3970 The solvable that the solver chose from the alternative's package set.
3971
3972 === CONSTANTS ===
3973
3974 *SOLVER_ALTERNATIVE_TYPE_RULE*::
3975
3976 The alternative was created when fulfilling a rule.
3977
3978 *SOLVER_ALTERNATIVE_TYPE_RECOMMENDS*::
3979
3980 The alternative was created when fulfilling a recommends dependency.
3981
3982 *SOLVER_ALTERNATIVE_TYPE_SUGGESTS*::
3983
3984 The alternative was created when fulfilling a suggests dependency.
3985
3986 === METHODS ===
3987
3988         Solvable *choices()
3989         my @choices = $alternative->choices();
3990         choices = alternative.choices
3991         choices = alternative.choices
3992
3993 Return the set of solvables that the solver could choose from when
3994 creating the alternative.
3995
3996         <stringification>
3997         my $str = $alternative->str;
3998         str = str(alternative)
3999         str = alternative.to_s
4000
4001 Return a string describing the alternative.
4002
4003
4004 The Decision Class
4005 ------------------
4006 A decision is created when the solver fulfills dependencies. It can be
4007 either to install a package to satisfy a dependency or to conflict a
4008 dependency because it conflicts with another package or its dependencies
4009 cannot be met. Most decisions are caused by rule processing, but there
4010 are some other types like orphaned package handling or weak dependency
4011 handling.
4012
4013 === ATTRIBUTES ===
4014
4015         Solver *solv;                   /* read only */
4016         $decision->{solv}
4017         decision.solv
4018         decision.solv
4019
4020 Back pointer to solver object.
4021
4022         Id p;                           /* read only */
4023         $decision->{p}
4024         decision.p
4025         decision.p
4026
4027 The decision package id, positive for installs and negative for conflicts.
4028
4029         int reason;                     /* read only */
4030         $decision->{reason}
4031         decision.reason
4032         decision.reason
4033
4034 The reason for the decision. See the SOLVER_REASON_ constants.
4035
4036         int infoid;                     /* read only */
4037         $decision->{infoid}
4038         decision.infoid
4039         decision.infoid
4040
4041 Extra info for the decision. This is the rule id for decisions caused
4042 by rule fulfillment.
4043
4044         Solvable solvable;              /* read only */
4045         $decision->{solvable}
4046         decision.solvable
4047         decision.solvable
4048
4049 The decision package object.
4050
4051         Rule rule()                     /* read only */
4052         $decision->{rule}
4053         decision.rule
4054         decision.rule
4055
4056 The rule object for decisions that where caused by rule fulfilment.
4057
4058 === METHODS ===
4059
4060         Ruleinfo info()
4061         my $info = $decision->info();
4062         info = decision.info()
4063         info = decision.info()
4064
4065 Return a Ruleinfo object describing the decision. Some reasons like
4066 SOLVER_REASON_WEAKDEP are not caused by rules, but can be expressed
4067 by a Ruleinfo object.
4068
4069         Ruleinfo *allinfos()
4070         my @infos = $decision->allinfos();
4071         infos = decision.allinfos()
4072         infos = decision.allinfos()
4073
4074 Same as info(), but all Ruleinfo objects describing the decision are
4075 returned.
4076
4077         const char *reasonstr()
4078         my str = $decision->reasonstr()
4079         str = decision.reasonstr()
4080         str = decision.reasonstr()
4081
4082 Return a string describing why a decision was done (but without
4083 the decision itself).
4084
4085         <stringification>
4086         my $str = $decison->str;
4087         str = str(decision)
4088         str = decision.to_s
4089
4090 Return a string describing the decision (but without the reason).
4091
4092
4093 The Decisionset Class
4094 ---------------------
4095 A decisionset consists of multiple decisions of the same reason and type
4096 that can be presented to the user as a single action.
4097
4098 === ATTRIBUTES ===
4099
4100         Solver *solv;                   /* read only */
4101         $decision->{solv}
4102         decision.solv
4103         decision.solv
4104
4105 Back pointer to solver object.
4106
4107         Id p;                           /* read only */
4108         $decision->{p}
4109         decision.p
4110         decision.p
4111
4112 The package id of the first decision, positive for installs and negative for conflicts.
4113
4114         int reason;                     /* read only */
4115         $decision->{reason}
4116         decision.reason
4117         decision.reason
4118
4119 The reason for the decisions in the set. See the SOLVER_REASON_ constants.
4120
4121         int type;                       /* read only */
4122         $ruleinfo->{type}
4123         ruleinfo.type
4124         ruleinfo.type
4125
4126 The type of the decision info. See the constant section of the solver class for the
4127 rule type list and the special type list.
4128
4129         Dep *dep;                       /* read only */
4130         $ruleinfo->{dep}
4131         ruleinfo.dep
4132         ruleinfo.dep
4133
4134 The dependency that caused the decision
4135
4136         Dep *dep_id;                    /* read only */
4137         $ruleinfo->{dep_id}
4138         ruleinfo.dep_id
4139         ruleinfo.dep_id
4140
4141 The Id of the dependency that caused the decision.
4142
4143 === METHODS ===
4144
4145         Decision *decisions()
4146         my @decisions = $decisionset->decisions();
4147         decisions = decisionset.decisions()
4148         decisions = decisionset.decisions()
4149
4150 Return all the decisions of the set.
4151
4152         Solvable *solvables()
4153         my @pkgs = $decisionset->solvables();
4154         pkgs = decisionset.solvables()
4155         pkgs = decisionset.solvables()
4156
4157 Return all the packages that were decided in the set.
4158
4159         const char *reasonstr()
4160         my str = $decision->reasonstr();
4161         str = decision.reasonstr()
4162         str = decision.reasonstr()
4163
4164 Return a string describing why the decisions were done (but without
4165 the decisions themself).
4166
4167         <stringification>
4168         my $str = $decison->str;
4169         str = str(decision)
4170         str = decision.to_s
4171
4172 Return a string describing the decisions (but without the reason).
4173
4174
4175 Author
4176 ------
4177 Michael Schroeder <mls@suse.de>
4178
4179 ////
4180 vim: syntax=asciidoc
4181 ////