install manpages
[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, and ruby.
16 All example code (except in the specifics sections, of course) lists first
17 the ``C-ish'' interface, then the syntax for perl, python, and ruby (in that
18 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 An 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 stack:
49
50         my @problems = $solver->solve(\@jobs);
51
52 Due to a bug in swig, stringification does not work for libsolv's object.
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 an 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 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 an 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 repo" if repo.isempty?
142
143
144 THE SOLV CLASS
145 --------------
146 This is the main namespace of the library, you cannot create objects of this
147 type but it contains some useful constants.
148
149 === CONSTANTS ===
150
151 Relational flag constants, the first three can be or-ed together
152
153 *REL_LT*::
154   the ``less than'' bit
155
156 *REL_EQ*::
157   the ``equals to'' bit
158
159 *REL_GT*::
160   the ``greater then'' bit
161
162 *REL_ARCH*::
163   used for relations that describe an extra architecture filter, the
164   version part of the relation is interpreted as architecture.
165
166 Special Solvable Ids
167
168 *SOLVID_META*::
169   Access the meta section of a repository or repodata area. This is
170   like an extra Solvable that has the Id SOLVID_META.
171
172 *SOLVID_POS*::
173   Use the data position stored inside of the pool instead of accessing
174   some solvable by Id. The bindings have the Datapos objects as an
175   abstraction mechanism, so you do not need this constant.
176
177 Constant string Ids
178   
179 *ID_NULL*::
180   Always zero
181
182 *ID_EMPTY*::
183   Always one, describes the empty string
184
185 *SOLVABLE_NAME*::
186   The keyname Id of the name of the solvable.
187
188 *...*::
189   see the libsolv-constantids manpage for a list of fixed Ids.
190
191
192 THE POOL CLASS
193 --------------
194 The pool is libsolv's central resource manager. A pool consists of Solvables,
195 Repositories, Dependencies, each indexed by Ids.
196
197 === CLASS METHODS ===
198
199         Pool *Pool()
200         my $pool = solv::Pool->new();
201         pool = solv.Pool()
202         pool = Solv::Pool.new()
203
204 Create a new pool instance. In most cases you just need
205 one pool.
206
207 === ATTRIBUTES ===
208
209         void *appdata;                  /* read/write */
210         $pool->{appdata}
211         pool.appdata
212         pool.appdata
213
214 Application specific data that may be used in any way by the code using the
215 pool.
216
217         Solvable solvables[];           /* read only */
218         my $solvable = $pool->{solvables}->[$solvid];
219         solvable = pool.solvables[solvid]
220         solvable = pool.solvables[solvid]
221
222 Look up a Solvable by its id.
223
224         Repo repos[];                   /* read only */
225         my $repo = $pool->{repos}->[$repoid];
226         repo = pool.repos[repoid]
227         repo = pool.repos[repoid]
228
229 Look up a Repository by its id.
230
231         Repo *installed;                /* read/write */
232         $pool->{installed} = $repo;
233         pool.installed = repo
234         pool.installed = repo
235
236 Define which repository contains all the installed packages.
237
238 === CONSTANTS ===
239
240 *POOL_FLAG_PROMOTEEPOCH*::
241   Promote the epoch of the providing dependency to the requesting
242   dependency if it does not contain an epoch. Used at some time
243   in old rpm versions, modern systems should never need this.
244
245 *POOL_FLAG_FORBIDSELFCONFLICTS*::
246   Disallow the installation of packages that conflict with themselves.
247   Debian always allows self-conflicting packages, rpm used to forbid
248   them but switched to also allowing them recently.
249
250 *POOL_FLAG_OBSOLETEUSESPROVIDES*::
251   Make obsolete type dependency match against provides instead of
252   just the name and version of packages. Very old versions of rpm
253   used the name/version, then it got switched to provides and later
254   switched back again to just name/version.
255
256 *POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES*::
257   An implicit obsoletes is the internal mechanism to remove the
258   old package on an update. The default is to remove all packages
259   with the same name, rpm-5 switched to also removing packages
260   providing the same name.
261
262 *POOL_FLAG_OBSOLETEUSESCOLORS*::
263   Rpm's multilib implementation (used in RedHat and Fedora)
264   distinguishes between 32bit and 64bit packages (the terminology
265   is that they have a different color). If obsolteusescolors is
266   set, packages with different colors will not obsolete each other.
267
268 *POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS*::
269   Same as POOL_FLAG_OBSOLETEUSESCOLORS, but used to find out if
270   packages of the same name can be installed in parallel. For
271   current Fedora systems, POOL_FLAG_OBSOLETEUSESCOLORS should be
272   false and POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS should be true
273   (this is the default if FEDORA is defined when libsolv is
274   compiled).
275
276 *POOL_FLAG_NOINSTALLEDOBSOLETES*::
277   New versions of rpm consider the obsoletes of installed packages
278   when checking for dependency, thus you may not install a package
279   that is obsoleted by some other installed package, unless you
280   also erase the other package.
281
282 *POOL_FLAG_HAVEDISTEPOCH*::
283   Mandriva added a new field called distepoch that gets checked in
284   version comparison if the epoch/version/release of two packages
285   are the same.
286
287 *POOL_FLAG_NOOBSOLETESMULTIVERSION*::
288   If a package is installed in multiversionmode, rpm used to ignore
289   both the implicit obsoletes and the obsolete dependency of a
290   package. This was changed to ignoring just the implicit obsoletes,
291   thus you may install multiple versions of the same name, but
292   obsoleted packages still get removed.
293
294 *POOL_FLAG_ADDFILEPROVIDESFILTERED*::
295   Make the addfileprovides method only add files from the standard
296   locations (i.e. the ``bin'' and ``etc'' directories). This is
297   useful if you have only few packages that use non-standard file
298   dependencies, but you still wand the fast speed that addfileprovides()
299   generates.
300
301 === METHODS ===
302
303         void free()
304         $pool->free();
305         pool.free()
306         pool.free()
307
308 Free a pool. This is currently done with a method instead of relying on
309 reference counting or garbage collection because it's hard to track every
310 reference to a pool.
311
312         void setdebuglevel(int level)
313         $pool->setdebuglevel($level);
314         pool.setdebuglevel(level)
315         pool.setdebuglevel(level)
316
317 Set the debug level. A value of zero means no debug output, the higher the
318 value, the more output is generated.
319
320         int set_flag(int flag, int value)
321         my $oldvalue = $pool->set_flag($flag, $value);
322         oldvalue = pool.set_flag(flag, value)
323         oldvalue = pool.set_flag(flag, value)
324
325         int get_flag(int flag)
326         my $value = $pool->get_flag($flag);
327         value = pool.get_flag(flag)
328         value = pool.get_flag(flag)
329
330 Set/get a pool specific flag. The flags define how the system works, e.g. how
331 the package manager treats obsoletes. The default flags should be sane for most
332 applications, but in some cases you may want to tweak a flag, for example if
333 you want to solv package dependencies for some other system than yours.
334
335         void set_rootdir(const char *rootdir)
336         $pool->set_rootdir(rootdir);
337         pool.set_rootdir(rootdir)
338         pool.set_rootdir(rootdir)
339
340         const char *get_rootdir()
341         my $rootdir = $pool->get_rootdir();
342         rootdir = pool.get_rootdir()
343         rootdir = pool.get_rootdir()
344
345 Set/get the rootdir to use. This is useful if you want package management
346 to work only in some directory, for example if you want to setup a chroot
347 jail. Note that the rootdir will only be prepended to file paths if the
348 *REPO_USE_ROOTDIR* flag is used.
349
350         void setarch(const char *arch = 0)
351         $pool->setarch();
352         pool.setarch()
353         pool.setarch()
354
355 Set the architecture for your system. The architecture is used to determine
356 which packages are installable. It defaults to the result of ``uname -m''.
357
358         Repo add_repo(const char *name)
359         $repo = $pool->add_repo($name);
360         repo = pool.add_repo(name)
361         repo = pool.add_repo(name)
362
363 Add a Repository with the specified name to the pool. The repository is empty
364 on creation, use the repository methods to populate it with packages.
365
366         Repoiterator repos_iter()
367         for my $repo (@{$pool->repos_iter()})
368         for repo in pool.repos_iter():
369         for repo in pool.repos_iter()
370
371 Iterate over the existing repositories.
372
373         Solvableiterator solvables_iter()
374         for my $solvable (@{$pool->solvables_iter()})
375         for solvable in pool.solvables_iter():
376         for solvable in pool.solvables_iter()
377
378 Iterate over the existing solvables.
379
380         Dep Dep(const char *str, bool create = 1)
381         my $dep = $pool->Dep($string);
382         dep = pool.Dep(string)
383         dep = pool.Dep(string)
384
385 Create an object describing a string or dependency. If the string is currently
386 not in the pool and _create_ is false, *undef*/*None*/*nil* is returned.
387
388         void addfileprovides()
389         $pool->addfileprovides();
390         pool.addfileprovides()
391         pool.addfileprovides()
392
393         Id *addfileprovides_queue()
394         my @ids = $pool->addfileprovides_queue();
395         ids = pool.addfileprovides_queue()
396         ids = pool.addfileprovides_queue()
397
398 Some package managers like rpm allow dependencies on files contained in other
399 packages. To allow libsolv to deal with those dependencies in an efficient way,
400 you need to call the addfileprovides method after creating and reading all
401 repositories. This method will scan all dependency for file names and than scan
402 all packages for matching files. If a filename has been matched, it will be
403 added to the provides list of the corresponding package. The
404 addfileprovides_queue variant works the same way but returns an array
405 containing all file dependencies. This information can be stored in the
406 meta section of the repositories to speed up the next time the
407 repository is loaded and addfileprovides is called.
408
409         void createwhatprovides()
410         $pool->createwhatprovides();
411         pool.createwhatprovides()
412         pool.createwhatprovides()
413
414 Create the internal ``whatprovides'' hash over all of the provides of all
415 packages. This method must be called before doing any lookups on provides.
416 It's encouraged to do it right after all repos are set up, usually right after
417 the call to addfileprovides().
418
419         Solvable *whatprovides(DepId dep)
420         my @solvables = $pool->whatprovides($dep);
421         solvables = pool.whatprovides(dep)
422         solvables = pool.whatprovides(dep)
423
424 Return all solvables that provide the specified dependency. You can use either
425 a Dep object or an simple Id as argument.
426
427         Id *matchprovidingids(const char *match, int flags)
428         my @ids = $pool->matchprovidingids($match, $flags);
429         ids = pool.matchprovidingids(match, flags)
430         ids = pool.matchprovidingids(match, flags)
431
432 Search the names of all provides and return the ones matching the specified
433 string. See the Dataiterator class for the allowed flags.
434
435         Id towhatprovides(Id *ids)
436         my $offset = $pool->towhatprovides(\@ids);
437         offset = pool.towhatprovides(ids)
438         offset = pool.towhatprovides(ids)
439
440 ``Internalize'' an array containing Ids. The returned value can be used to
441 create solver jobs working on a specific set of packages. See the Solver class
442 for more information.
443
444         bool isknownarch(DepId id)
445         my $bool = $pool->isknownarch($id);
446         bool = pool.isknownarch(id)
447         bool = pool.isknownarch?(id)
448
449 Return true if the specified Id describes a known architecture.
450
451         Solver Solver()
452         my $solver = $pool->Solver();
453         solver = pool.Solver()
454         solver = pool.Solver()
455
456 Create a new solver object.
457
458         Job Job(int how, Id what)
459         my $job = $pool->Job($how, $what);
460         job = pool.Job(how, what)
461         job = pool.Job(how, what)
462
463 Create a new Job object. Kind of low level, in most cases you would use a
464 Selection or Dep job constructor instead.
465
466         Selection Selection()
467         my $sel = $pool->Selection();
468         sel = pool.Selection()
469         sel = pool.Selection()
470
471 Create an empty selection. Useful as a starting point for merging other
472 selections.
473
474         Selection Selection_all()
475         my $sel = $pool->Selection_all();
476         sel = pool.Selection_all()
477         sel = pool.Selection_all()
478         
479 Create a selection containing all packages. Useful as starting point for
480 intersecting other selections or for update/distupgrade jobs.
481
482         Selection select(const char *name, int flags)
483         my $sel = $pool->select($name, $flags);
484         sel = pool.select(name, flags)
485         sel = pool.select(name, flags)
486
487 Create a selection by matching packages against the specified string. See the
488 Selection class for a list of flags and how to create solver jobs from a
489 selection.
490
491         void setpooljobs(Jobs *jobs)
492         $pool->setpooljobs(\@jobs);
493         pool.setpooljobs(jobs)
494         pool.setpooljobs(jobs)
495
496         Job *getpooljobs()
497         @jobs = $pool->getpooljobs();
498         jobs = pool.getpooljobs()
499         jobs = pool.getpooljobs()
500
501 Get/Set fixed jobs stored in the pool. Those jobs are automatically appended to
502 all solver jobs, they are meant for fixed configurations like which packages
503 can be multiversion installed, which packages were userinstalled or must not be
504 erased.
505
506         void set_loadcallback(Callable *callback)
507         $pool->setloadcallback(\&callbackfunction);
508         pool.setloadcallback(callbackfunction)
509         pool.setloadcallback { |repodata| ... }
510
511 Set the callback function called when repository metadata needs to be loaded on
512 demand. To make use of this feature, you need to create repodata stubs that
513 tell the library which data is available but not loaded. If later on the data
514 needs to be accessed, the callback function is called with a repodata argument.
515 You can then load the data (maybe fetching it first from an remote server).
516 The callback should return true if the data has been made available.
517
518 === DATA RETRIEVAL METHODS ===
519
520 In the following functions, the _keyname_ argument describes what to retrieve.
521 For the standard cases you can use the available Id constants. For example,
522
523         $solv::SOLVABLE_SUMMARY
524         solv.SOLVABLE_SUMMARY
525         Solv::SOLVABLE_SUMMARY
526
527 selects the ``Summary'' entry of a solvable. The _solvid_ argument selects the
528 desired solvable by Id.
529
530         const char *lookup_str(Id solvid, Id keyname)
531         my $string = $pool->lookup_str($solvid, $keyname);
532         string = pool.lookup_str(solvid, keyname)
533         string = pool.lookup_str(solvid, keyname)
534
535         Id lookup_id(Id solvid, Id keyname)
536         my $id = $pool->lookup_id($solvid, $keyname);
537         id = pool.lookup_id(solvid, keyname)
538         id = pool.lookup_id(solvid, keyname)
539
540         unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
541         my $num = $pool->lookup_num($solvid, $keyname);
542         num = pool.lookup_num(solvid, keyname)
543         num = pool.lookup_num(solvid, keyname)
544
545         bool lookup_void(Id solvid, Id keyname)
546         my $bool = $pool->lookup_void($solvid, $keyname);
547         bool = pool.lookup_void(solvid, keyname)
548         bool = pool.lookup_void(solvid, keyname)
549
550         Id *lookup_idarray(Id solvid, Id keyname)
551         my @ids = $pool->lookup_idarray($solvid, $keyname);
552         ids = pool.lookup_idarray(solvid, keyname)
553         ids = pool.lookup_idarray(solvid, keyname)
554
555         Chksum lookup_checksum(Id solvid, Id keyname)
556         my $chksum = $pool->lookup_checksum($solvid, $keyname);
557         chksum = pool.lookup_checksum(solvid, keyname)
558         chksum = pool.lookup_checksum(solvid, keyname)
559
560 Lookup functions. Return the data element stored in the specified solvable.
561 You should probably use the methods of the Solvable class instead.
562
563         Dataiterator Dataiterator(Id solvid, Id keyname, const char *match, int flags)
564         my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
565         di = pool.Dataiterator(solvid, keyname, match, flags)
566         di = pool.Dataiterator(solvid, keyname, match, flags)
567
568         for my $d (@$di)
569         for d in di:
570         for d in di
571
572 Iterate over the matching data elements. See the Dataiterator class for more
573 information.
574
575 === ID METHODS ===
576
577 The following methods deal with Ids, i.e. integers representing objects in the
578 pool. They are considered ``low level'', in most cases you would not use them
579 but instead the object orientated methods.
580
581         Repo id2repo(Id id)
582         $repo = $pool->id2repo($id);
583         repo = pool.id2repo(id)
584         repo = pool.id2repo(id)
585
586 Lookup an existing Repository by id. You can also do this by using the *repos*
587 attribute.
588
589         Solvable id2solvable(Id id)
590         $solvable = $pool->id2solvable($id);
591         solvable = pool.id2solvable(id)
592         solvable = pool.id2solvable(id)
593
594 Lookup an existing Repository by id. You can also do this by using the
595 *solvables* attribute.
596
597         const char *solvid2str(Id id)
598         my $str = $pool->solvid2str($id);
599         str = pool.solvid2str(id)
600         str = pool.solvid2str(id)
601
602 Return a string describing the Solvable with the specified id. The string
603 consists of the name, version, and architecture of the Solvable.
604
605         Id str2id(const char *str, bool create = 1)
606         my $id = pool->str2id($string);
607         id = pool.str2id(string)
608         id = pool.str2id(string)
609
610         const char *id2str(Id id)
611         $string = pool->id2str($id);
612         string = pool.id2str(id)
613         string = pool.id2str(id)
614
615 Convert a string into an Id and back. If the string is currently not in the
616 pool and _create_ is false, zero is returned.
617
618         Id rel2id(Id name, Id evr, int flags, bool create = 1)
619         my $id = pool->rel2id($nameid, $evrid, $flags);
620         id = pool.rel2id(nameid, evrid, flags)
621         id = pool.rel2id(nameid, evrid, flags)
622
623 Create a ``relational'' dependency. Such dependencies consist of a name part,
624 the _flags_ describing the relation, and a version part. The flags are:
625
626         $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
627         solv.REL_EQ | solv.REL_GT | solv.REL_LT
628         Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
629
630 Thus, if you want a ``\<='' relation, you would use *REL_LT | REL_EQ*.
631
632         Id id2langid(Id id, const char *lang, bool create = 1)
633         my $id = $pool->id2langid($id, $language);
634         id = pool.id2langid(id, language)
635         id = pool.id2langid(id, language)
636
637 Create a language specific Id from some other id. This function simply converts
638 the id into a string, appends a dot and the specified language to the string
639 and converts the result back into an Id.
640
641         const char *dep2str(Id id)
642         $string = pool->dep2str($id);
643         string = pool.dep2str(id)
644         string = pool.dep2str(id)
645
646 Convert a dependency id into a string. If the id is just a string, this
647 function has the same effect as id2str(). For relational dependencies, the
648 result is the correct ``name relation evr'' string.
649
650
651 THE DEPENDENCY CLASS
652 --------------------
653 The dependency class is an object orientated way to work with strings and
654 dependencies. Internally, dependencies are represented as Ids, i.e. simple
655 numbers. Dependency objects can be constructed by using the Pool's Dep()
656 method.
657
658 === ATTRIBUTES ===
659
660         Pool *pool;             /* read only */
661         $dep->{pool}
662         dep.pool
663         dep.pool
664
665 Back reference to the pool this dependency belongs to.
666
667         Id id;          /* read only */
668         $dep->{id}
669         dep.id
670         dep.id
671
672 The id of this dependency.
673
674 == Methods ==
675
676         Dep Rel(int flags, DepId evrid, bool create = 1)
677         my $reldep = $dep->Rel($flags, $evrdep);
678         reldep = dep.Rel(flags, evrdep)
679         reldep = dep.Rel(flags, evrdep)
680
681 Create a relational dependency from to string dependencies and a flags
682 argument. See the pool's rel2id method for a description of the flags.
683
684         Selection Selection_name(int setflags = 0)
685         my $sel = $dep->Selection_name();
686         sel = dep.Selection_name()
687         sel = dep.Selection_name()
688
689 Create a Selection from a dependency. The selection consists of all packages
690 that have a name equal to the dependency. If the dependency is of a relational
691 type, the packages version must also fulfill the dependency.
692
693         Selection Selection_provides(int setflags = 0)
694         my $sel = $dep->Selection_provides();
695         sel = dep.Selection_provides()
696         sel = dep.Selection_provides()
697
698 Create a Selection from a dependency. The selection consists of all packages
699 that have at least one provides matching the dependency.
700
701         const char *str()
702         my $str = $dep->str();
703         str = $dep.str()
704         str = $dep.str()
705
706 Return a string describing the dependency.
707
708         <stringification>
709         my $str = $dep->str;
710         str = str(dep)
711         str = dep.to_s
712
713 Same as calling the str() method.
714
715         <equality>
716         if ($dep1 == $dep2)
717         if dep1 == dep2:
718         if dep1 == dep2
719
720 The dependencies are equal if they are part of the same pool and have the same
721 ids.
722
723
724 THE REPOSITORY CLASS
725 --------------------
726 A Repository describes a group of packages, normally coming from the same
727 source. Repositories are created by the Pool's add_repo() method.
728
729 === ATTRIBUTES ===
730
731         Pool *pool;                     /* read only */
732         $repo->{pool}
733         repo.pool
734         repo.pool
735
736 Back reference to the pool this dependency belongs to.
737
738         Id id;                          /* read only */
739         $repo->{id}
740         repo.id
741         repo.id
742
743 The id of the repository.
744
745         const char *name;               /* read/write */
746         $repo->{name}
747         repo.name
748         repo.name
749         
750 The repositories name. To libsolv, the name is just a string with no specific
751 meaning.
752
753         int priority;                   /* read/write */
754         $repo->{priority}
755         repo.priority
756         repo.priority
757
758 The priority of the repository. A higher number means that packages of this
759 repository will be chosen over other repositories, even if they have a greater
760 package version.
761
762         int subpriority;                /* read/write */
763         $repo->{subpriority}
764         repo.subpriority
765         repo.subpriority
766
767 The sub-priority of the repository. This value is compared when the priorities
768 of two repositories are the same. It is useful to make the library prefer
769 on-disk repositories to remote ones.
770
771         int nsolvables;                 /* read only */
772         $repo->{nsolvables}
773         repo.nsolvables
774         repo.nsolvables
775
776 The number of solvables in this repository.
777
778         void *appdata;                  /* read/write */
779         $repo->{appdata}
780         repo.appdata
781         repo.appdata
782
783 Application specific data that may be used in any way by the code using the
784 repository.
785
786         Datapos *meta;                  /* read only */
787         $repo->{meta}
788         repo.meta
789         repo.meta
790
791 Return a Datapos object of the repodata's metadata. You can use the lookup
792 methods of the Datapos class to lookup metadata attributes, like the repository
793 timestamp.
794
795 === CONSTANTS ===
796
797 *REPO_REUSE_REPODATA*::
798   Reuse the last repository data area (``repodata'') instead of creating a new
799   one.
800
801 *REPO_NO_INTERNALIZE*::
802   Do not internalize the added repository data. This is useful if
803   you plan to add more data because internalization is a costly
804   operation.
805
806 *REPO_LOCALPOOL*::
807   Use the repodata's pool for Id storage instead of the global pool. Useful
808   if you don't want to pollute the global pool with many unneeded ids, like
809   when storing the filelist.
810
811 *REPO_USE_LOADING*::
812   Use the repodata that is currently being loaded instead of creating a new one.
813   This only makes sense if used in a load callback.
814
815 *REPO_EXTEND_SOLVABLES*::
816   Do not create new solvables for the new data, but match existing solvables and
817   add the data to them. Repository metadata is often split into multiple parts,
818   with one primary file describing all packages and other parts holding
819   information that is normally not needed, like the changelog.
820
821 *REPO_USE_ROOTDIR*::
822   Prepend the pool's rootdir to the path when doing file operations.
823
824 *REPO_NO_LOCATION*::
825   Do not add a location element to the solvables. Useful if the solvables are
826   not in the final position, so you can add the correct location later in your code.
827
828 *SOLV_ADD_NO_STUBS*::
829   Do not create stubs for repository parts that can be downloaded on demand.
830
831 *SUSETAGS_RECORD_SHARES*::
832   This is specific to the add_susetags() method. Susetags allows to refer to already
833   read packages to save disk space. If this data sharing needs to work over multiple
834   calls to add_susetags, you need to specify this flag so that the share information
835   is made available to subsequent calls.
836
837 === METHODS ===
838
839         void free(bool reuseids = 0)
840         $repo->free();
841         repo.free()
842         repo.free()
843
844 Free the repository and all solvables it contains. If _reuseids_ is set to
845 true, the solvable ids and the repository id may be reused by the library when
846 added new solvables. Thus you should leave it false if you are not sure that
847 somebody holds a reference.
848
849         void empty(bool reuseids = 0)
850         $repo->empty();
851         repo.empty()
852         repo.empty()
853
854 Free all the solvables in a repository. The repository will be empty after this
855 call. See the free() method for the meaning of _reuseids_.
856
857         bool isempty()
858         $repo->isempty()
859         repo.empty()
860         repo.empty?
861
862 Return true if there are no solvables in this repository.
863
864         void internalize()
865         $repo->internalize();
866         repo.internalize()
867         repo.internalize()
868
869 Internalize added data. Data must be internalized before it is available to the
870 lookup and data iterator functions.
871
872         bool write(FILE *fp)
873         $repo->write($fp)
874         repo.write(fp)
875         repo.write(fp)
876
877 Write a repo as a ``solv'' file. These files can be read very fast and thus are
878 a good way to cache repository data. Returns false if there was some error
879 writing the file.
880
881         Solvableiterator solvables_iter()
882         for my $solvable (@{$repo->solvables_iter()})
883         for solvable in repo.solvables_iter():
884         for solvable in repo.solvables_iter()
885
886 Iterate over all solvables in a repository.
887
888         Repodata add_repodata(int flags = 0)
889         my $repodata = $repo->add_repodata();
890         repodata = repo.add_repodata()
891         repodata = repo.add_repodata()
892
893 Add a new repodata area to the repository. This is normally automatically
894 done by the repo_add methods, so you need this method only in very
895 rare circumstances.
896
897         void create_stubs()
898         $repo->create_stubs();
899         repo.create_stubs()
900         repo.create_stubs()
901
902 Calls the create_stubs() repodata method for the last repodata of the
903 repository.
904
905         bool iscontiguous()
906         $repo->iscontiguous()
907         repo.iscontiguous()
908         repo.iscontiguous?
909
910 Return true if the solvables of this repository are all in a single block with
911 no holes, i.e. they have consecutive ids.
912
913         Repodata first_repodata()
914         my $repodata = $repo->first_repodata();
915         repodata = repo.first_repodata()
916         repodata = repo.first_repodata()
917
918 Checks if all repodatas but the first repodata are extensions, and return the
919 first repodata if this is the case. Useful if you want to do a store/retrieve
920 sequence on the repository to reduce the memory using and enable paging, as
921 this does not work if the repository contains multiple non-extension repodata
922 areas.
923
924         Selection Selection(int setflags = 0)
925         my $sel = $repo->Selection();
926         sel = repo.Selection()
927         sel = repo.Selection()
928
929 Create a Selection consisting of all packages in the repository.
930
931         Dataiterator Dataiterator(Id p, Id key, const char *match, int flags)
932         my $di = $repo->Dataiterator($solvid, $keyname, $match, $flags);
933         di = repo.Dataiterator(solvid, keyname, match, flags)
934         di = repo.Dataiterator(solvid, keyname, match, flags)
935
936         for my $d (@$di)
937         for d in di:
938         for d in di
939
940 Iterate over the matching data elements in this repository. See the
941 Dataiterator class for more information.
942
943         <stringification>
944         my $str = $repo->str;
945         str = str(repo)
946         str = repo.to_s
947
948 Return the name of the repository, or "Repo#<id>" if no name is set.
949
950         <equality>
951         if ($repo1 == $repo2)
952         if repo1 == repo2:
953         if repo1 == repo2
954
955 Two repositories are equal if they belong to the same pool and have the same id.
956
957 === DATA ADD METHODS ===
958
959         Solvable add_solvable()
960         $repo->add_solvable();
961         repo.add_solvable()
962         repo.add_solvable()
963
964 Add a single empty solvable to the repository. Returns a Solvable object, see
965 the Solvable class for more information.
966
967         bool add_solv(const char *name, int flags = 0)
968         $repo->add_solv($name, $flags);
969         repo.add_solv(name, flags)
970         repo.add_solv(name, flags)
971
972         bool add_solv(FILE *fp, int flags = 0)
973         $repo->add_solv($fp, $flags);
974         repo.add_solv(fp, flags)
975         repo.add_solv(fp, flags)
976
977 Read a ``solv'' file and add its contents to the repository. These files can be
978 written with the write() method and are normally used as fast cache for
979 repository metadata.
980
981         bool add_rpmdb(int flags = 0)
982         $repo->add_rpmdb($flags);
983         repo.add_rpmdb(flags)
984         repo.add_rpmdb(flags)
985
986         bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
987         $repo->add_rpmdb_reffp($reffp, $flags);
988         repo.add_rpmdb_reffp($reffp, flags)
989         repo.add_rpmdb_reffp($reffp, flags)
990
991 Add the contents of the rpm database to the repository. If a solv file
992 containing an old version of the database is available, it can be passed as
993 reffp to speed up reading.
994
995         bool add_rpm(const char *name, int flags = 0)
996         $repo->add_rpm($name, $flags);
997         repo.add_rpm(name, flags)
998         repo.add_rpm(name, flags)
999
1000 Add the metadata of a single rpm package to the repository.
1001
1002         bool add_rpmdb_pubkeys(int flags = 0)
1003         $repo->add_rpmdb_pubkeys();
1004         repo.add_rpmdb_pubkeys()
1005         repo.add_rpmdb_pubkeys()
1006
1007 Add all pubkeys contained in the rpm database to the repository. Note that
1008 newer rpm versions also allow to store the pubkeys in some directory instead
1009 of the rpm database.
1010
1011         bool add_pubkey(const char *keyfile, int flags = 0)
1012         $repo->add_pubkey($keyfile);
1013         repo.add_pubkey($keyfile)
1014         repo.add_pubkey($keyfile)
1015
1016 Add a pubkey from a file to the repository.
1017
1018         bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
1019         $repo->add_rpmmd($fp, $language);
1020         repo.add_rpmmd(fp, language)
1021         repo.add_rpmmd(fp, language)
1022
1023 Add metadata stored in the "rpm-md" format (i.e. from files in the ``repodata''
1024 directory) to a repository. Supported files are "primary", "filelists",
1025 "other", "suseinfo". Do not forget to specify the *REPO_EXTEND_SOLVABLES* for
1026 extension files like "filelists" and "other". Use the _language_ parameter if
1027 you have language extension files, otherwise simply use a *undef*/*None*/*nil*
1028 parameter.
1029
1030         bool add_repomdxml(FILE *fp, int flags = 0)
1031         $repo->add_repomdxml($fp);
1032         repo.add_repomdxml(fp)
1033         repo.add_repomdxml(fp)
1034
1035 Add the repomd.xml meta description from the "rpm-md" format to the repository.
1036 This file contains information about the repository like keywords, and also a
1037 list of all database files with checksums. The data is added the the "meta"
1038 section of the repository, i.e. no package gets created.
1039
1040         bool add_updateinfoxml(FILE *fp, int flags = 0)
1041         $repo->add_updateinfoxml($fp);
1042         repo.add_updateinfoxml(fp)
1043         repo.add_updateinfoxml(fp)
1044
1045 Add the updateinfo.xml file containing available maintenance updates to the
1046 repository. All updates are created as special packages that have a "patch:"
1047 prefix in their name.
1048
1049         bool add_deltainfoxml(FILE *fp, int flags = 0)
1050         $repo->add_deltainfoxml($fp);
1051         repo.add_deltainfoxml(fp)
1052         repo.add_deltainfoxml(fp)
1053
1054 Add the deltainfo.xml file (also called prestodelta.xml) containing available
1055 delta-rpms to the repository. The data is added to the "meta" section, i.e. no
1056 package gets created.
1057
1058         bool add_debdb(int flags = 0)
1059         $repo->add_debdb();
1060         repo.add_debdb()
1061         repo.add_debdb()
1062
1063 Add the contents of the debian installed package database to the repository.
1064
1065         bool add_debpackages(FILE *fp, int flags = 0)
1066         $repo->add_debpackages($fp);
1067         repo.add_debpackages($fp)
1068         repo.add_debpackages($fp)
1069
1070 Add the contents of the debian repository metadata (the "packages" file)
1071 to the repository.
1072
1073         bool add_deb(const char *filename, int flags = 0)
1074         $repo->add_deb($filename);
1075         repo.add_deb(filename)
1076         repo.add_deb(filename)
1077
1078 Add the metadata of a single deb package to the repository.
1079
1080         bool add_mdk(FILE *fp, int flags = 0)
1081         $repo->add_mdk($fp);
1082         repo.add_mdk($fp)
1083         repo.add_mdk($fp)
1084
1085 Add the contents of the mageia/mandriva repository metadata (the
1086 "synthesis.hdlist" file) to the repository.
1087
1088         bool add_mdk_info(FILE *fp, int flags = 0)
1089         $repo->add_mdk($fp);
1090         repo.add_mdk($fp)
1091         repo.add_mdk($fp)
1092
1093 Extend the packages from the synthesis file with the info.xml and files.xml
1094 data. Do not forget to specify *REPO_EXTEND_SOLVABLES*.
1095
1096         bool add_arch_repo(FILE *fp, int flags = 0)
1097         $repo->add_arch_repo($fp);
1098         repo.add_arch_repo($fp)
1099         repo.add_arch_repo($fp)
1100
1101 Add the contents of the archlinux repository metadata (the ".db.tar" file) to
1102 the repository.
1103
1104         bool add_arch_local(const char *dir, int flags = 0)
1105         $repo->add_arch_local($dir);
1106         repo.add_arch_local($dir)
1107         repo.add_arch_local($dir)
1108
1109 Add the contents of the archlinux installed package database to the repository.
1110 The _dir_ parameter is usually set to "/var/lib/pacman/local".
1111
1112         bool add_content(FILE *fp, int flags = 0)
1113         $repo->add_content($fp);
1114         repo.add_content(fp)
1115         repo.add_content(fp)
1116
1117 Add the ``content'' meta description from the susetags format to the repository.
1118 This file contains information about the repository like keywords, and also
1119 a list of all database files with checksums. The data is added the the "meta"
1120 section of the repository, i.e. no package gets created.
1121
1122         bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
1123         $repo->add_susetags($fp, $defvendor, $language);
1124         repo.add_susetags(fp, defvendor, language)
1125         repo.add_susetags(fp, defvendor, language)
1126
1127 Add repository metadata in the susetags format to the repository. Like with
1128 add_rpmmd, you can specify a language if you have language extension files. The
1129 _defvendor_ parameter provides a default vendor for packages with missing
1130 vendors, it is usually provided in the content file.
1131
1132         bool add_products(const char *dir, int flags = 0)
1133         $repo->add_products($dir);
1134         repo.add_products(dir)
1135         repo.add_products(dir)
1136
1137 Add the installed SUSE products database to the repository. The _dir_ parameter
1138 is usually "/etc/products.d".
1139
1140
1141 THE SOLVABLE CLASS
1142 ------------------
1143 A solvable describes all the information of one package. Each solvable
1144 belongs to one repository, it can be added and filled manually but in
1145 most cases solvables will get created by the repo_add methods.
1146
1147 === ATTRIBUTES ===
1148
1149         Repo *repo;                     /* read only */
1150         $solvable->{repo}
1151         solvable.repo
1152         solvable.repo
1153
1154 The repository this solvable belongs to.
1155
1156         Pool *pool;                     /* read only */
1157         $solvable->{pool}
1158         solvable.pool
1159         solvable.pool
1160
1161 The pool this solvable belongs to, same as the pool of the repo.
1162
1163         Id id;                          /* read only */
1164         $solvable->{id}
1165         solvable.id
1166         solvable.id
1167
1168 The specific id of the solvable.
1169
1170         char *name;                     /* read/write */
1171         $solvable->{name}
1172         solvable.name
1173         solvable.name
1174
1175         char *evr;                      /* read/write */
1176         $solvable->{evr}
1177         solvable.evr
1178         solvable.evr
1179
1180         char *arch;                     /* read/write */
1181         $solvable->{arch}
1182         solvable.arch
1183         solvable.arch
1184
1185         char *vendor;                   /* read/write */
1186         $solvable->{vendor}
1187         solvable.vendor
1188         solvable.vendor
1189
1190 Easy access to often used attributes of solvables. They are
1191 internally stored as Ids.
1192
1193         Id nameid;                      /* read/write */
1194         $solvable->{nameid}
1195         solvable.nameid
1196         solvable.nameid
1197
1198         Id evrid;                       /* read/write */
1199         $solvable->{evrid}
1200         solvable.evrid
1201         solvable.evrid
1202
1203         Id archid;                      /* read/write */
1204         $solvable->{archid}
1205         solvable.archid
1206         solvable.archid
1207
1208         Id vendorid;                    /* read/write */
1209         $solvable->{vendorid}
1210         solvable.vendorid
1211         solvable.vendorid
1212
1213 Raw interface to the ids. Useful if you want to search for
1214 a specific id and want to avoid the string compare overhead.
1215
1216 === METHODS ===
1217
1218         const char *lookup_str(Id keyname)
1219         my $string = $solvable->lookup_str($keyname);
1220         string = solvable.lookup_str(keyname)
1221         string = solvable.lookup_str(keyname)
1222
1223         Id lookup_id(Id keyname)
1224         my $id = $solvable->lookup_id($keyname);
1225         id = solvable.lookup_id(solvid)
1226         id = solvable.lookup_id(solvid)
1227
1228         unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
1229         my $num = $solvable->lookup_num($keyname);
1230         num = solvable.lookup_num(keyname)
1231         num = solvable.lookup_num(keyname)
1232
1233         bool lookup_void(Id keyname)
1234         my $bool = $solvable->lookup_void($keyname);
1235         bool = solvable.lookup_void(keyname)
1236         bool = solvable.lookup_void(keyname)
1237
1238         Chksum lookup_checksum(Id keyname)
1239         my $chksum = $solvable->lookup_checksum($keyname);
1240         chksum = solvable.lookup_checksum(keyname)
1241         chksum = solvable.lookup_checksum(keyname)
1242
1243         Id *lookup_idarray(Id keyname, Id marker = -1)
1244         my @ids = $solvable->lookup_idarray($keyname);
1245         ids = solvable.lookup_idarray(keyname)
1246         ids = solvable.lookup_idarray(keyname)
1247
1248         Dep *lookup_deparray(Id keyname, Id marker = -1)
1249         my @deps = $solvable->lookup_deparray($keyname);
1250         deps = solvable.lookup_deparray(keyname)
1251         deps = solvable.lookup_deparray(keyname)
1252         
1253 Generic lookup methods. Retrieve data stored for the specific keyname.
1254 The lookup_idarray() method will return an array of Ids, use
1255 lookup_deparray if you want an array of Dependency objects instead.
1256 Some Id arrays contain two parts of data divided by a specific marker,
1257 for example the provides array uses the SOLVABLE_FILEMARKER id to
1258 store both the ids provided by the package and the ids added by
1259 the addfileprovides method. The default, -1, translates to the
1260 correct marker for the keyname and returns the first part of the
1261 array, use 1 to select the second part or 0 to retrieve all ids
1262 including the marker.
1263
1264         const char *lookup_location(unsigned int *OUTPUT);
1265         my ($location, $medianr) = $solvable->lookup_location();
1266         location, medianr = solvable.lookup_location()
1267         location, medianr = solvable.lookup_location()
1268
1269 Return a tuple containing the on-media location and an optional
1270 media number for multi-part repositories (e.g. repositories
1271 spawning multiple DVDs).
1272
1273         void add_deparray(Id keyname, DepId dep, Id marker = -1);
1274         $solvable->add_deparray($keyname, $dep);
1275         solvable.add_deparray(keyname, dep)
1276         solvable.add_deparray(keyname, dep)
1277
1278 Add a new dependency to the attributes stored in keyname.
1279
1280         bool installable();
1281         $solvable->installable()
1282         solvable.installable()
1283         solvable.installable?
1284
1285 Return true if the solvable is installable on the system. Solvables
1286 are not installable if the system does not support their architecture.
1287
1288         bool isinstalled();
1289         $solvable->isinstalled()
1290         solvable.isinstalled()
1291         solvable.isinstalled?
1292
1293 Return true if the solvable is installed on the system.
1294
1295         Selection Selection(int setflags = 0)
1296         my $sel = $solvable->Selection();
1297         sel = solvable.Selection()
1298         sel = solvable.Selection()
1299
1300 Create a Selection containing just the single solvable.
1301
1302         const char *str()
1303         my $str = $solvable->str();
1304         str = $solvable.str()
1305         str = $solvable.str()
1306
1307 Return a string describing the solvable. The string consists of the name,
1308 version, and architecture of the Solvable.
1309
1310         <stringification>
1311         my $str = $solvable->str;
1312         str = str(solvable)
1313         str = solvable.to_s
1314
1315 Same as calling the str() method.
1316
1317         <equality>
1318         if ($solvable1 == $solvable2)
1319         if solvable1 == solvable2:
1320         if solvable1 == solvable2
1321
1322 Two solvables are equal if they are part of the same pool and have the same
1323 ids.
1324
1325
1326 THE DATAITERATOR CLASS
1327 ----------------------
1328 Dataiterators can be used to do complex string searches or
1329 to iterate over arrays. They can be created via the
1330 constructors in the Pool, Repo, and Solvable classes. The
1331 Repo and Solvable constructors will limit the search to
1332 the repository or the specific package.
1333
1334 === CONSTANTS ===
1335
1336 *SEARCH_STRING*::
1337   Return a match if the search string matches the value.
1338
1339 *SEARCH_STRINGSTART*::
1340   Return a match if the value starts with the search string.
1341
1342 *SEARCH_STRINGEND*::
1343   Return a match if the value ends with the search string.
1344
1345 *SEARCH_SUBSTRING*::
1346   Return a match if the search string can be matched somewhere
1347   in the value.
1348
1349 *SEARCH_GLOB*::
1350   Do a glob match of the search string against the value.
1351
1352 *SEARCH_REGEX*::
1353   Do a regular expression match of the search string against
1354   the value.
1355
1356 *SEARCH_NOCASE*::
1357   Ignore case when matching strings. Works for all the above
1358   match types.
1359
1360 *SEARCH_FILES*::
1361   Match the complete filenames of the file list, not just the
1362   base name.
1363
1364 *SEARCH_COMPLETE_FILELIST*::
1365   When matching the file list, check every file of the package
1366   not just the subset from the primary metadata.
1367
1368 *SEARCH_CHECKSUMS*::
1369   Allow the matching of checksum entries.
1370
1371 === METHODS ===
1372
1373         void prepend_keyname(Id keyname);
1374         $di->prepend_keyname($keyname);
1375         di.prepend_keyname(keyname)
1376         di.prepend_keyname(keyname)
1377
1378 Do a sub-search in the array stored in keyname.
1379
1380         void skip_solvable();
1381         $di->kip_solvable();
1382         di.skip_solvable()
1383         di.skip_solvable()
1384
1385 Stop matching the current solvable and advance to the next
1386 one.
1387
1388         <iteration>
1389         for my $d (@$di)
1390         for d in di:
1391         for d in di
1392
1393 Iterate through the matches. If there is a match, the object
1394 in d will be of type Datamatch.
1395
1396 THE DATAMATCH CLASS
1397 -------------------
1398 Objects of this type will be created for every value matched
1399 by a dataiterator.
1400
1401 === ATTRIBUTES ===
1402
1403         Pool *pool;                             /* read only */
1404         $d->{pool}
1405         d.pool
1406         d.pool
1407
1408 Back pointer to pool.
1409
1410         Repo *repo;                             /* read only */
1411         $d->{repo}
1412         d.repo
1413         d.repo
1414
1415 The repository containing the matched object.
1416
1417         Solvable *solvable;                     /* read only */
1418         $d->{solvable}
1419         d.solvable
1420         d.solvable
1421
1422 The solvable containing the value that was matched.
1423
1424         Id solvid;                              /* read only */
1425         $d->{solvid}
1426         d.solvid
1427         d.solvid
1428
1429 The id of the solvable that matched.
1430
1431 === METHODS ===
1432
1433         Id key_id();
1434         $d->key_id()
1435         d.key_id()
1436         d.key_id()
1437
1438         const char *key_idstr();
1439         $d->key_idstr()
1440         d.key_idstr()
1441         d.key_idstr()
1442
1443 The keyname that matched, either as id or string.
1444
1445         Id type_id();
1446         $d->type_id()
1447         d.type_id()
1448         d.type_id()
1449
1450         const char *type_idstr();
1451         $d->type_idstr();
1452         d.type_idstr()
1453         d.type_idstr()
1454
1455 The key type of the value that was matched, either as id or string.
1456
1457         Id id();
1458         $d->id()
1459         d.id()
1460         d.id()
1461
1462         Id idstr();
1463         $d->idstr()
1464         d.idstr()
1465         d.idstr()
1466
1467 The Id of the value that was matched (only valid for id types),
1468 either as id or string.
1469
1470         const char *str();
1471         $d->str()
1472         d.str()
1473         d.str()
1474
1475 The string value that was matched (only valid for string types).
1476
1477         unsigned long long num();
1478         $d->num()
1479         d.num()
1480         d.num()
1481
1482 The numeric value that was matched (only valid for numeric types).
1483
1484         unsigned int num2();
1485         $d->num2()
1486         d.num2()
1487         d.num2()
1488
1489 The secondary numeric value that was matched (only valid for types
1490 containing two values).
1491
1492         Datapos pos();
1493         my $pos = $d->pos();
1494         pos = d.pos()
1495         pos = d.pos()
1496
1497 The position object of the current match. It can be used to do
1498 sub-searches starting at the match (if it is of an array type).
1499 See the Datapos class for more information.
1500
1501         Datapos parentpos();
1502         my $pos = $d->parentpos();
1503         pos = d.parentpos()
1504         pos = d.parentpos()
1505
1506 The position object of the array containing the current match.
1507 It can be used to do sub-searches, see the Datapos class for more
1508 information.
1509
1510         <stringification>
1511         my $str = $d->str;
1512         str = str(d)
1513         str = d.to_s
1514
1515 Return the stringification of the matched value. Stringification
1516 depends on the search flags, for file list entries it will return
1517 just the base name unless SEARCH_FILES is used, for checksums
1518 it will return an empty string unless SEARCH_CHECKSUMS is used.
1519 Numeric values are currently stringified to an empty string.
1520
1521
1522 THE SELECTION CLASS
1523 -------------------
1524 Selections are a way to easily deal with sets of packages.
1525 There are multiple constructors to create them, the most useful
1526 is probably the select() method in the Pool class.
1527
1528 === CONSTANTS ===
1529
1530 *SELECTION_NAME*::
1531   Create the selection by matching package names
1532
1533 *SELECTION_PROVIDES*::
1534   Create the selection by matching package provides
1535
1536 *SELECTION_FILELIST*::
1537   Create the selection by matching package files
1538
1539 *SELECTION_CANON*::
1540   Create the selection by matching the canonical representation
1541   of the package. This is normally a combination of the name,
1542   the version, and the architecture of a package.
1543
1544 *SELECTION_DOTARCH*::
1545   Allow an ``.<architecture>'' suffix when matching names or
1546   provides.
1547  
1548 *SELECTION_REL*::
1549   Allow the specification of a relation when matching names
1550   or provides, e.g. "name >= 1.2".
1551
1552 *SELECTION_INSTALLED_ONLY*::
1553   Limit the package search to installed packages.
1554
1555 *SELECTION_SOURCE_ONLY*::
1556   Limit the package search to source packages only.
1557
1558 *SELECTION_WITH_SOURCE*::
1559   Extend the package search to also match source packages. The
1560   default is only to match binary packages.
1561
1562 *SELECTION_GLOB*::
1563   Allow glob matching for package names, package provides, and
1564   file names.
1565
1566 *SELECTION_NOCASE*::
1567   Ignore case when matching package names, package provides,
1568   and file names.
1569
1570 *SELECTION_FLAT*::
1571   Return only one selection element describing the selected packages.
1572   The default is to create multiple elements for all globbed packages.
1573   Multiple elements are useful if you want to turn the selection into
1574   an install job, in that case you want an install job for every
1575   globbed package.
1576
1577 === ATTRIBUTES ===
1578
1579         Pool *pool;                             /* read only */
1580         $d->{pool}
1581         d.pool
1582         d.pool
1583
1584 Back pointer to pool.
1585
1586 === METHODS ===
1587
1588         int flags();
1589         my $flags = $sel->flags();
1590         flags = sel.flags()
1591         flags = sel.flags()
1592
1593 Return the result flags of the selection. The flags are a subset
1594 of the ones used when creating the selection, they describe which
1595 method was used to get the result. For example, if you create the
1596 selection with ``SELECTION_NAME | SELECTION_PROVIDES'', the resulting
1597 flags will either be SELECTION_NAME or SELECTION_PROVIDES depending
1598 if there was a package that matched the name or not. If there was
1599 no match at all, the flags will be zero.
1600
1601         bool isempty();
1602         $sel->isempty()
1603         sel.isempty()
1604         sel.isempty?
1605
1606 Return true if the selection is empty, i.e. no package could be matched.
1607
1608         void filter(Selection *other)
1609         $sel->filter($other);
1610         sel.filter(other)
1611         sel.filter(other)
1612
1613 Intersect two selections. Packages will only stay in the selection if there
1614 are also included in the other selecting. Does an in-place modification.
1615
1616         void add(Selection *other)
1617         $sel->add($other);
1618         sel.add(other)
1619         sel.add(other)
1620
1621 Build the union of two selections. All packages of the other selection will
1622 be added to the set of packages of the selection object. Does an in-place
1623 modification. Note that the selection flags are no longer meaningful after the
1624 add operation.
1625
1626         void add_raw(Id how, Id what)
1627         $sel->add_raw($how, $what);
1628         sel.add_raw(how, what)
1629         sel.add_raw(how, what)
1630
1631 Add a raw element to the selection. Check the Job class for information about
1632 the how and what parameters.
1633
1634         Job *jobs(int action)
1635         my @jobs = $sel->jobs($action);
1636         jobs = sel.jobs(action)
1637         jobs = sel.jobs(action)
1638
1639 Convert a selection into an array of Job objects. The action parameter is or-ed
1640 to the ``how'' part of the job, it describes the type of job (e.g. install,
1641 erase). See the Job class for the action and action modifier constants.
1642
1643         Solvable *solvables()
1644         my @solvables = $sel->solvables();
1645         solvables = sel.solvables()
1646         solvables = sel.solvables()
1647
1648 Convert a selection into an array of Solvable objects.
1649
1650         <stringification>
1651         my $str = $sel->str;
1652         str = str(sel)
1653         str = sel.to_s
1654
1655 Return a string describing the selection.
1656
1657 THE JOB CLASS
1658 -------------
1659 Jobs are the way to specify to the dependency solver what to do.
1660 Most of the times jobs will get created by calling the jobs() method
1661 on a Selection object, but there is also a Job() constructor in the
1662 Pool class.
1663
1664 === CONSTANTS ===
1665
1666 Selection constants:
1667
1668 *SOLVER_SOLVABLE*::
1669   The ``what'' part is the id of a solvable.
1670
1671 *SOLVER_SOLVABLE_NAME*::
1672   The ``what'' part is the id of a package name.
1673
1674 *SOLVER_SOLVABLE_PROVIDES*::
1675   The ``what'' part is the id of a package provides.
1676
1677 *SOLVER_SOLVABLE_ONE_OF*::
1678   The ``what'' part is an offset into the ``whatprovides'' data, created
1679   by calling the towhatprovides() pool method.
1680
1681 *SOLVER_SOLVABLE_REPO*::
1682   The ``what'' part is the id of a repository.
1683
1684 *SOLVER_SOLVABLE_ALL*::
1685   The ``what'' part is ignored, all packages are selected.
1686
1687 *SOLVER_SOLVABLE_SELECTMASK*::
1688   A mask containing all the above selection bits.
1689
1690 Action constants:
1691
1692 *SOLVER_NOOP*::
1693   Do nothing.
1694
1695 *SOLVER_INSTALL*::
1696   Install a package of the specified set of packages. It tries to install
1697   the best matching package (i.e. the highest version of the packages from
1698   the repositories with the highest priority).
1699
1700 *SOLVER_ERASE*::
1701   Erase all of the packages from the specified set. If a package is not
1702   installed, erasing it will keep it from getting installed.
1703
1704 *SOLVER_UPDATE*::
1705   Update the matching installed packages to their best version. If none
1706   of the specified packages are installed, try to update the installed
1707   packages to the specified versions. See the section about targeted
1708   updates about more information.
1709   
1710 *SOLVER_WEAKENDEPS*::
1711   Allow to break the dependencies of the matching packages. Handle with care.
1712
1713 *SOLVER_MULTIVERSION*::
1714   Mark the matched packages for multiversion install. If they get to be installed
1715   because of some other job, the installation will keep the old version of the
1716   package installed (for rpm by using ``-i'' instead of ``-U'').
1717
1718 *SOLVER_LOCK*::
1719   Do not change the state of the matched packages, i.e. when they are installed
1720   they stay installed, if not they are not selected for installation.
1721
1722 *SOLVER_DISTUPGRADE*::
1723   Update the matching installed packages to the best version included in one
1724   of the repositories. After this operation, all come from one of the available
1725   repositories except orphaned packages. Orphaned packages are packages that
1726   have no relation to the packages in the repositories, i.e. no package in the
1727   repositories have the same name or obsolete the orphaned package.
1728   This action brings the installed packages in sync with the ones in the
1729   repository. It also turns of arch/vendor/version locking for the affected
1730   packages to simulate a fresh installation. This means that distupgrade can
1731   actually downgrade packages if only lower versions of a package are available
1732   in the repositories.
1733
1734 *SOLVER_DROP_ORPHANED*::
1735   Erase all the matching installed packages if they are orphaned. This only makes
1736   sense if there is a ``distupgrade all packages'' job. The default is to erase
1737   orphaned packages only if they block the installation of other packages.
1738
1739 *SOLVER_VERIFY*::
1740   Fix dependency problems of matching installed packages. The default is to ignore
1741   dependency problems for installed packages.
1742
1743 *SOLVER_USERINSTALLED*::
1744   The matching installed packages are considered to be installed by a user, thus
1745   not installed to fulfill some dependency. This is needed input for the calculation
1746   of unneeded packages for jobs that have the SOLVER_CLEANDEPS flag set.
1747
1748 *SOLVER_JOBMASK*::
1749   A mask containing all the above action bits.
1750
1751 Action modifier constants:
1752
1753 *SOLVER_WEAK*::
1754   Makes the job a weak job. The solver tries to fulfill weak jobs, but does not
1755   report a problem if it is not possible to do so.
1756
1757 *SOLVER_ESSENTIAL*::
1758   Makes the job an essential job. If there is a problem with the job, the solver
1759   will not propose to remove the job as one solution (unless all other solutions
1760   are also to remove essential jobs).
1761
1762 *SOLVER_CLEANDEPS*::
1763   The solver will try to also erase all packages dragged in through dependencies
1764   when erasing the package. This needs SOLVER_USERINSTALLED jobs to maximize user
1765   satisfaction.
1766
1767 *SOLVER_FORCEBEST*::
1768   Insist on the best package for install, update, and distupgrade jobs. If this
1769   flag is not used, the solver will use the second-best package if the best
1770   package cannot be installed for some reason. When this flag is used, the solver
1771   will generate a problem instead.
1772
1773 *SOLVER_TARGETED*::
1774   Forces targeted operation update and distupgrade jobs. See the section about
1775   targeted updates about more information.
1776
1777 Set constants.
1778
1779 *SOLVER_SETEV*::
1780   The job specified the exact epoch and version of the package set.
1781
1782 *SOLVER_SETEVR*::
1783   The job specified the exact epoch, version, and release of the package set.
1784
1785 *SOLVER_SETARCH*::
1786   The job specified the exact architecture of the packages from the set.
1787
1788 *SOLVER_SETVENDOR*::
1789   The job specified the exact vendor of the packages from the set.
1790
1791 *SOLVER_SETREPO*::
1792   The job specified the exact repository of the packages from the set.
1793
1794 *SOLVER_SETNAME*::
1795   The job specified the exact name of the packages from the set.
1796
1797 *SOLVER_NOAUTOSET*::
1798   Turn of automatic set flag generation for SOLVER_SOLVABLE jobs.
1799
1800 *SOLVER_SETMASK*::
1801   A mask containing all the above set bits.
1802
1803 See the section about set bits for more information.
1804
1805 === ATTRIBUTES ===
1806
1807         Pool *pool;                             /* read only */
1808         $job->{pool}
1809         d.pool
1810         d.pool
1811
1812 Back pointer to pool.
1813
1814         Id how;                                 /* read/write */
1815         $job->{how}
1816         d.how
1817         d.how
1818
1819 Union of the selection, action, action modifier, and set flags.
1820 The selection part describes the semantics of the ``what'' Id.
1821
1822         Id what;                                /* read/write */
1823         $job->{what}
1824         d.what
1825         d.what
1826
1827 Id describing the set of packages, the meaning depends on the
1828 selection part of the ``how'' attribute.
1829
1830 === METHODS ===
1831
1832         Solvable *solvables()
1833         my @solvables = $job->solvables();
1834         solvables = job.solvables()
1835         solvables = job.solvables()
1836
1837 Return the set of solvables of the job as an array of Solvable
1838 objects.
1839
1840         bool isemptyupdate();
1841         $job->isemptyupdate()
1842         job.isemptyupdate()
1843         job.isemptyupdate?
1844
1845 Convenience function to find out if the job describes an update
1846 job with no matching packages, i.e. a job that does nothing.
1847 Some package managers like ``zypper'' like to turn those jobs
1848 into install jobs, i.e. an update of a not-installed package
1849 will result into the installation of the package.
1850
1851         <stringification>
1852         my $str = $job->str;
1853         str = str(job)
1854         str = job.to_s
1855
1856 Return a string describing the job.
1857
1858         <equality>
1859         if ($job1 == $job2)
1860         if job1 == job2:
1861         if job1 == job2
1862
1863 Two jobs are equal if they belong to the same pool and both the
1864 ``how'' and the ``what'' attributes are the same.
1865
1866 === TARGETED UPDATES ===
1867 Libsolv has two modes for upgrades and distupgrade: targeted and
1868 untargeted. Untargeted mode means that the installed packages from
1869 the specified set will be updated to the best version. Targeted means
1870 that packages that can be updated to a package in the specified set
1871 will be updated to the best package of the set.
1872
1873 Here's an example to explain the subtle difference. Suppose that
1874 you have package A installed in version "1.1", "A-1.2" is available
1875 in one of the repositories and there is also package "B" that
1876 obsoletes package A.
1877
1878 An untargeted update of "A" will update the installed "A-1.1" to
1879 package "B", because that is the newest version (B obsoletes A and
1880 is thus newer).
1881
1882 A targeted update of "A" will update "A-1.1" to "A-1.2", as the
1883 set of packages contains both "A-1.1" and "A-1.2", and "A-1.2" is
1884 the newer one.
1885
1886 An untargeted update of "B" will do nothing, as "B" is not installed.
1887
1888 An targeted update of "B" will update "A-1.1" to "B".
1889
1890 Note that the default is to do "auto-targeting", thus if the specified
1891 set of packages does not include an installed package, the solver
1892 will assume targeted operation even if SOLVER_TARGETED is not used.
1893
1894 This mostly matches the intent of the user, with one exception: In
1895 the example above, an update of "A-1.2" will update "A-1.1" to
1896 "A-1.2" (targeted mode), but a second update of "A-1.2" will suddenly
1897 update to "B", as untargeted mode is chosen because "A-1.2" is now
1898 installed.
1899
1900 If you want to have full control over when targeting mode is chosen,
1901 turn off auto-targeting with the SOLVER_FLAG_NO_AUTOTARGET solver option.
1902 In that case, all updates are considered to be untargeted unless they
1903 include the SOLVER_TARGETED flag.
1904
1905 === SET BITS ===
1906 Set bits specify which parts of the specified packages where specified
1907 by the user. It is used by the solver when checking if an operation is
1908 allowed or not. For example, the solver will normally not allow the
1909 downgrade of an installed package. But it will not report a problem if
1910 the SOLVER_SETEVR flag is used, as it then assumes that the user specified
1911 the exact version and thus knows what he is doing.
1912
1913 So if a package "screen-1-1" is installed for the x86_64 architecture and
1914 version "2-1" is only available for the i586 architecture, installing
1915 package "screen-2.1" will ask the user for confirmation because of the
1916 different architecture. When using the Selection class to create jobs
1917 the set bits are automatically added, e.g. selecting ``screen.i586'' will
1918 automatically add SOLVER_SETARCH, and thus no problem will be reported.
1919
1920 THE SOLVER CLASS
1921 ----------------
1922 Dependency solving is what this library is about. A solver object is needed
1923 for solving to store the result of the solver run. The solver object can be
1924 used multiple times for different jobs, reusing it allows the solver to
1925 re-use the dependency rules it already computed.
1926
1927 === CONSTANTS ===
1928
1929 Flags to modify some of the solver's behavior:
1930
1931 *SOLVER_FLAG_ALLOW_DOWNGRADE*::
1932   Allow the solver to downgrade packages without asking for confirmation
1933   (i.e. reporting a problem).
1934
1935 *SOLVER_FLAG_ALLOW_ARCHCHANGE*::
1936   Allow the solver to change the architecture of an installed package
1937   without asking for confirmation. Note that changes to/from noarch
1938   are always considered to be allowed.
1939   
1940 *SOLVER_FLAG_ALLOW_VENDORCHANGE*::
1941   Allow the solver to change the vendor of an installed package
1942   without asking for confirmation. Each vendor is part of one or more
1943   vendor equivalence classes, normally installed packages may only
1944   change their vendor if the new vendor shares at least one equivalence
1945   class.
1946
1947 *SOLVER_FLAG_ALLOW_NAMECHANGE*::
1948   Allow the solver to change the name of an installed package, i.e.
1949   install a package with a different name that obsoletes the installed
1950   package. This option is on by default.
1951
1952 *SOLVER_FLAG_ALLOW_UNINSTALL*::
1953   Allow the solver to erase installed packages to fulfill the jobs.
1954   This flag also includes the above flags. You may want to set this
1955   flag if you only have SOLVER_ERASE jobs, as in that case it's
1956   better for the user to check the transaction overview instead of
1957   approving every single package that needs to be erased.
1958
1959 *SOLVER_FLAG_NO_UPDATEPROVIDE*::
1960   If multiple packages obsolete an installed package, the solver checks
1961   the provides of every such package and ignores all packages that
1962   do not provide the installed package name. Thus, you can have an
1963   official update candidate that provides the old name, and other
1964   packages that also obsolete the package but are not considered for
1965   updating. If you cannot use this feature, you can turn it off
1966   by setting this flag.
1967
1968 *SOLVER_FLAG_SPLITPROVIDES*::
1969   Make the solver aware of special provides of the form
1970   ``<packagename>:<path>'' used in SUSE systems to support package
1971   splits.
1972
1973 *SOLVER_FLAG_IGNORE_RECOMMENDED*::
1974   Do not process optional (aka weak) dependencies.
1975
1976 *SOLVER_FLAG_ADD_ALREADY_RECOMMENDED*::
1977   Install recommended or supplemented packages even if they have no
1978   connection to the current transaction. You can use this feature
1979   to implement a simple way for the user to install new recommended
1980   packages that were not available in the past.
1981   
1982 *SOLVER_FLAG_NO_INFARCHCHECK*::
1983   Turn off the inferior architecture checking that is normally done
1984   by the solver. Normally, the solver allows only the installation
1985   of packages from the "best" architecture if a package is available
1986   for multiple architectures.
1987
1988 *SOLVER_FLAG_BEST_OBEY_POLICY*::
1989   Make the SOLVER_FORCEBEST job option consider only packages that
1990   meet the policies for installed packages, i.e. no downgrades,
1991   no architecture change, no vendor change (see the first flags
1992   of this section). If the flag is not specified, the solver will
1993   enforce the installation of the best package ignoring the
1994   installed packages, which may conflict with the set policy.
1995
1996 *SOLVER_FLAG_NO_AUTOTARGET*::
1997   Do not enable auto-targeting up update and distupgrade jobs. See
1998   the section on targeted updates for more information.
1999
2000 Basic rule types:
2001
2002 *SOLVER_RULE_UNKNOWN*::
2003   A rule of an unknown class. You should never encounter those.
2004
2005 *SOLVER_RULE_RPM*::
2006   A package dependency rule, called rpm rule for historical reasons.
2007
2008 *SOLVER_RULE_UPDATE*::
2009   A rule to implement the update policy of installed packages. Every
2010   installed package has an update rule that consists of the packages
2011   that may replace the installed package.
2012
2013 *SOLVER_RULE_FEATURE*::
2014   Feature rules are fallback rules used when a update rule is disabled.
2015   They include all packages that may replace the installed package
2016   ignoring the update policy, i.e. they contain downgrades, arch
2017   changes and so on. Without them, the solver would simply erase
2018   installed packages if their update rule gets disabled.
2019
2020 *SOLVER_RULE_JOB*::
2021   Job rules implement the job given to the solver.
2022
2023 *SOLVER_RULE_DISTUPGRADE*::
2024   This are simple negative assertions that make sure that only packages
2025   are kept that are also available in one of the repositories.
2026
2027 *SOLVER_RULE_INFARCH*::
2028   Infarch rules are also negative assertions, they disallow the installation
2029   of packages when there are packages of the same name but with a better
2030   architecture.
2031
2032 *SOLVER_RULE_CHOICE*::
2033   Choice rules are used to make sure that the solver prefers updating to
2034   installing different packages when some dependency is provided by
2035   multiple packages with different names. The solver may always break
2036   choice rules, so you will not see them when a problem is found.
2037
2038 *SOLVER_RULE_LEARNT*::
2039   These rules are generated by the solver to keep it from running into
2040   the same problem multiple times when it has to backtrack. They are
2041   the main reason why a sat solver is faster then other dependency solver
2042   implementations.
2043
2044 Special dependency rule types:
2045
2046 *SOLVER_RULE_RPM_NOT_INSTALLABLE*::
2047   This rule was added to prevent the installation of a package of an
2048   architecture that does not work on the system.
2049
2050 *SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP*::
2051   The package contains a required dependency which was not provided by
2052   any package.
2053
2054 *SOLVER_RULE_RPM_PACKAGE_REQUIRES*::
2055   Similar to SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP, but in this case
2056   some packages provided the dependency but none of them could be
2057   installed due to other dependency issues.
2058
2059 *SOLVER_RULE_RPM_SELF_CONFLICT*::
2060   The package conflicts with itself. This is not allowed by older rpm
2061   versions.
2062
2063 *SOLVER_RULE_RPM_PACKAGE_CONFLICT*::
2064   To fulfill the dependencies two packages need to be installed, but
2065   one of the packages contains a conflict with the other one.
2066
2067 *SOLVER_RULE_RPM_SAME_NAME*::
2068   The dependencies can only be fulfilled by multiple versions of
2069   a package, but installing multiple versions of the same package
2070   is not allowed.
2071
2072 *SOLVER_RULE_RPM_PACKAGE_OBSOLETES*::
2073   To fulfill the dependencies two packages need to be installed, but
2074   one of the packages obsoletes the other one.
2075
2076 *SOLVER_RULE_RPM_IMPLICIT_OBSOLETES*::
2077   To fulfill the dependencies two packages need to be installed, but
2078   one of the packages has provides a dependency that is obsoleted
2079   by the other one. See the POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES
2080   flag.
2081
2082 *SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES*::
2083   To fulfill the dependencies a package needs to be installed that is
2084   obsoleted by an installed package. See the POOL_FLAG_NOINSTALLEDOBSOLETES
2085   flag.
2086
2087 *SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP*::
2088   The user asked for installation of a package providing a specific
2089   dependency, but no available package provides it.
2090
2091 *SOLVER_RULE_JOB_UNKNOWN_PACKAGE*::
2092   The user asked for installation of a package with a specific name,
2093   but no available package has that name.
2094
2095 *SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM*::
2096   The user asked for the erasure of a dependency that is provided by the
2097   system (i.e. for special hardware or language dependencies), this
2098   cannot be done with a job.
2099
2100 *SOLVER_RULE_JOB_UNSUPPORTED*::
2101   The user asked for something that is not yet implemented, e.g. the
2102   installation of all packages at once.
2103
2104 Policy error constants
2105
2106 *POLICY_ILLEGAL_DOWNGRADE*::
2107   The solver ask for permission before downgrading packages.
2108
2109 *POLICY_ILLEGAL_ARCHCHANGE*::
2110   The solver ask for permission before changing the architecture of installed
2111   packages.
2112
2113 *POLICY_ILLEGAL_VENDORCHANGE*::
2114   The solver ask for permission before changing the vendor of installed
2115   packages.
2116
2117 *POLICY_ILLEGAL_NAMECHANGE*::
2118   The solver ask for permission before replacing an installed packages with
2119   a package that has a different name.
2120
2121 Solution element type constants
2122
2123 *SOLVER_SOLUTION_JOB*::
2124   The problem can be solved by removing the specified job.
2125
2126 *SOLVER_SOLUTION_POOLJOB*::
2127   The problem can be solved by removing the specified job that is defined in the pool.
2128
2129 *SOLVER_SOLUTION_INFARCH*::
2130   The problem can be solved by allowing the installation of the specified package
2131   with an inferior architecture.
2132
2133 *SOLVER_SOLUTION_DISTUPGRADE*::
2134   The problem can be solved by allowing to keep the specified package installed.
2135
2136 *SOLVER_SOLUTION_BEST*::
2137   The problem can be solved by allowing to install the specified package that is
2138   not the best available package.
2139
2140 *SOLVER_SOLUTION_ERASE*::
2141   The problem can be solved by allowing to erase the specified package.
2142
2143 *SOLVER_SOLUTION_REPLACE*::
2144   The problem can be solved by allowing to replace the package with some other
2145   package.
2146
2147 *SOLVER_SOLUTION_REPLACE_DOWNGRADE*::
2148   The problem can be solved by allowing to replace the package with some other
2149   package that has a lower version.
2150
2151 *SOLVER_SOLUTION_REPLACE_ARCHCHANGE*::
2152   The problem can be solved by allowing to replace the package with some other
2153   package that has a different architecture.
2154
2155 *SOLVER_SOLUTION_REPLACE_VENDORCHANGE*::
2156   The problem can be solved by allowing to replace the package with some other
2157   package that has a different vendor.
2158
2159 *SOLVER_SOLUTION_REPLACE_NAMECHANGE*::
2160   The problem can be solved by allowing to replace the package with some other
2161   package that has a different name.
2162
2163
2164 === ATTRIBUTES ===
2165
2166         Pool *pool;                             /* read only */
2167         $job->{pool}
2168         d.pool
2169         d.pool
2170
2171 Back pointer to pool.
2172
2173 === METHODS ===
2174
2175         int set_flag(int flag, int value)
2176         my $oldvalue = $pool->set_flag($flag, $value);
2177         oldvalue = pool.set_flag(flag, value)
2178         oldvalue = pool.set_flag(flag, value)
2179
2180         int get_flag(int flag)
2181         my $value = $pool->get_flag($flag);
2182         value = pool.get_flag(flag)
2183         value = pool.get_flag(flag)
2184
2185 Set/get a solver specific flag. The flags define the policies the solver has
2186 to obey. The flags are explained in the CONSTANTS section of this class.
2187
2188         Problem *solve(Job *jobs)
2189         my @problems = $solver->solve(\@jobs);
2190         problems = solver.solve(jobs)
2191         problems = solver.solve(jobs)
2192
2193 Solve a problem specified in the job list (plus the jobs defined in the pool).
2194 Returns an array of problems that need user interaction, or an empty array
2195 if no problems were encountered. See the Problem class on how to deal with
2196 problems.
2197
2198         Transaction transaction()
2199         my $trans = $solver->transaction();
2200         trans = solver.transaction()
2201         trans = solver.transaction()
2202
2203 Return the transaction to implement the calculated package changes. A transaction
2204 is available even if problems were found, this is useful for interactive user
2205 interfaces that show both the job result and the problems.
2206
2207 THE PROBLEM CLASS
2208 -----------------
2209 Problems are the way of the solver to interact with the user. You can simply list
2210 all problems and terminate your program, but a better way is to present solutions to
2211 the user and let him pick the ones he likes.
2212
2213 === ATTRIBUTES ===
2214
2215         Solver *solv;                           /* read only */
2216         $problem->{solv}
2217         problem.solv
2218         problem.solv
2219
2220 Back pointer to solver object.
2221
2222         Id id;                                  /* read only */
2223         $problem->{id}
2224         problem.id
2225         problem.id
2226
2227 Id of the problem. The first problem has Id 1, they are numbered consecutively.
2228
2229 === METHODS ===
2230
2231         Rule findproblemrule()
2232         my $probrule = $problem->findproblemrule();
2233         probrule = problem.findproblemrule()
2234         probrule = problem.findproblemrule()
2235
2236 Return the rule that caused the problem. Of course in most situations there is no
2237 single responsible rule, but many rules that interconnect with each created the
2238 problem. Nevertheless, the solver uses some heuristic approach to find a rule
2239 that somewhat describes the problem best to the user.
2240
2241         Rule *findallproblemrules(bool unfiltered = 0)
2242         my @probrules = $problem->findallproblemrules();
2243         probrules = problem.findallproblemrule()
2244         probrules = problem.findallproblemrule()
2245
2246 Return all rules responsible for the problem. The returned set of rules contains
2247 all the needed information why there was a problem, but it's hard to present
2248 them to the user in a sensible way. The default is to filter out all update and
2249 job rules (unless the returned rules only consist of those types).
2250
2251         Solution *solutions()
2252         my @solutions = $problem->solutions();
2253         solutions = problem.solutions()
2254         solutions = problem.solutions()
2255
2256 Return an array containing multiple possible solutions to fix the problem. See
2257 the solution class for more information.
2258
2259         int solution_count()
2260         my $cnt = $problem->solution_count();
2261         cnt = problem.solution_count()
2262         cnt = problem.solution_count()
2263
2264 Return the number of solutions without creating solution objects.
2265
2266 THE RULE CLASS
2267 --------------
2268 Rules are the basic block of sat solving. Each package dependency gets translated
2269 into one or multiple rules.
2270
2271 === ATTRIBUTES ===
2272
2273         Solver *solv;                           /* read only */
2274         $rule->{solv}
2275         rule.solv
2276         rule.solv
2277
2278 Back pointer to solver object.
2279
2280         Id id;                                  /* read only */
2281         $rule->{id}
2282         rule.id
2283         rule.id
2284
2285 The id of the rule.
2286
2287         int type;                               /* read only */
2288         $rule->{type}
2289         rule.type
2290         rule.type
2291
2292 The basic type of the rule. See the constant section of the solver class for the type list.
2293
2294 === METHODS ===
2295
2296         Ruleinfo info()
2297         my $ruleinfo = $rule->info();
2298         ruleinfo = rule.info()
2299         ruleinfo = rule.info()
2300
2301 Return a Ruleinfo object that contains information about why the rule was created. But
2302 see the allinfos() method below.
2303
2304         Ruleinfo *allinfos()
2305         my @ruleinfos = $rule->allinfos();
2306         ruleinfos = rule.allinfos()
2307         ruleinfos = rule.allinfos()
2308
2309 As the same dependency rule can get created because of multiple dependencies, one
2310 Ruleinfo is not enough to describe the reason. Thus the allinfos() method returns
2311 an array of all infos about a rule.
2312
2313         <equality>
2314         if ($rule1 == $rule2)
2315         if rule1 == rule2:
2316         if rule1 == rule2
2317
2318 Two rules are equal if they belong to the same solver and have the same id.
2319
2320 THE RULEINFO CLASS
2321 ------------------
2322 A Ruleinfo describes one reason why a rule was created.
2323
2324 === ATTRIBUTES ===
2325
2326         Solver *solv;                           /* read only */
2327         $ruleinfo->{solv}
2328         ruleinfo.solv
2329         ruleinfo.solv
2330
2331 Back pointer to solver object.
2332
2333         int type;                               /* read only */
2334         $ruleinfo->{type}
2335         ruleinfo.type
2336         ruleinfo.type
2337
2338 The type of the ruleinfo. See the constant section of the solver class for the
2339 rule type list and the special type list.
2340
2341         Dep *dep;                               /* read only */
2342         $ruleinfo->{dep}
2343         ruleinfo.dep
2344         ruleinfo.dep
2345
2346 The dependency leading to the creation of the rule.
2347
2348         Dep *dep_id;                            /* read only */
2349         $ruleinfo->{'dep_id'}
2350         ruleinfo.dep_id
2351         ruleinfo.dep_id
2352
2353 The Id of the dependency leading to the creation of the rule, or zero.
2354
2355         Solvable *solvable;                     /* read only */
2356         $ruleinfo->{solvable}
2357         ruleinfo.solvable
2358         ruleinfo.solvable
2359
2360 The involved Solvable, e.g. the one containing the dependency.
2361
2362         Solvable *othersolvable;                /* read only */
2363         $ruleinfo->{othersolvable}
2364         ruleinfo.othersolvable
2365         ruleinfo.othersolvable
2366
2367 The other involved Solvable (if any), e.g. the one containing providing
2368 the dependency for conflicts.
2369
2370         const char *problemstr();
2371         my $str = $ruleinfo->problemstr();
2372         str = ruleinfo.problemstr()
2373         str = ruleinfo.problemstr()
2374
2375 A string describing the ruleinfo from a problem perspective. This probably
2376 only makes sense if the rule is part of a problem.
2377
2378 THE SOLUTION CLASS
2379 ------------------
2380 A solution solves one specific problem. It consists of multiple solution elements
2381 that all need to be executed.
2382
2383 === ATTRIBUTES ===
2384
2385         Solver *solv;                           /* read only */
2386         $solution->{solv}
2387         solution.solv
2388         solution.solv
2389
2390 Back pointer to solver object.
2391
2392         Id problemid;                           /* read only */
2393         $solution->{problemid}
2394         solution.problemid
2395         solution.problemid
2396
2397 Id of the problem the solution solves.
2398
2399         Id id;                                  /* read only */
2400         $solution->{id}
2401         solution.id
2402         solution.id
2403
2404 Id of the solution. The first solution has Id 1, they are numbered consecutively.
2405
2406 === METHODS ===
2407
2408         Solutionelement *elements(bool expandreplaces = 0)
2409         my @solutionelements = $solution->elements();
2410         solutionelements = solution.elements()
2411         solutionelements = solution.elements()
2412
2413 Return an array containing the elements describing what needs to be done to
2414 implement the specific solution. If expandreplaces is true, elements of type
2415 SOLVER_SOLUTION_REPLACE will be replaced by one or more elements replace
2416 elements describing the policy mismatches.
2417
2418         int element_count()
2419         my $cnt = $solution->solution_count();
2420         cnt = solution.element_count()
2421         cnt = solution.element_count()
2422
2423 Return the number of solution elements without creating objects. Note that the
2424 count does not match the number of objects returned by the elements() method
2425 of expandreplaces is set to true.
2426
2427
2428 THE SOLUTIONELEMENT CLASS
2429 -------------------------
2430 A solution element describes a single action of a solution. The action is always
2431 either to remove one specific job or to add a new job that installs or erases
2432 a single specific package.
2433
2434 === ATTRIBUTES ===
2435
2436         Solver *solv;                           /* read only */
2437         $solutionelement->{solv}
2438         solutionelement.solv
2439         solutionelement.solv
2440
2441 Back pointer to solver object.
2442
2443         Id problemid;                           /* read only */
2444         $solutionelement->{problemid}
2445         solutionelement.problemid
2446         solutionelement.problemid
2447
2448 Id of the problem the element (partly) solves.
2449
2450         Id solutionid;                          /* read only */
2451         $solutionelement->{solutionid}
2452         solutionelement.solutionid
2453         solutionelement.solutionid
2454
2455 Id of the solution the element is a part of.
2456
2457         Id id;                                  /* read only */
2458         $solutionelement->{id}
2459         solutionelement.id
2460         solutionelement.id
2461
2462 Id of the solution element. The first element has Id 1, they are numbered consecutively.
2463
2464         Id type;                                /* read only */
2465         $solutionelement->{type}
2466         solutionelement.type
2467         solutionelement.type
2468
2469 Type of the solution element. See the constant section of the solver class for the
2470 existing types.
2471
2472         Solvable *solvable;                     /* read only */
2473         $solutionelement->{solvable}
2474         solutionelement.solvable
2475         solutionelement.solvable
2476
2477 The installed solvable that needs to be replaced for replacement elements.
2478
2479         Solvable *replacement;                  /* read only */
2480         $solutionelement->{replacement}
2481         solutionelement.replacement
2482         solutionelement.replacement
2483
2484 The solvable that needs to be installed to fix the problem.
2485
2486         int jobidx;                             /* read only */
2487         $solutionelement->{jobidx}
2488         solutionelement.jobidx
2489         solutionelement.jobidx
2490
2491 The index of the job that needs to be removed to fix the problem, or -1 if the
2492 element is of another type. Note that it's better to change the job to SOLVER_NOOP
2493 type so that the numbering of other elements does not get disturbed. This
2494 method works both for types SOLVER_SOLUTION_JOB and SOLVER_SOLUTION_POOLJOB.
2495
2496 === METHODS ===
2497
2498         Solutionelement *replaceelements()
2499         my @solutionelements = $solutionelement->replaceelements();
2500         solutionelements = solutionelement.replaceelements()
2501         solutionelements = solutionelement.replaceelements()
2502
2503 If the solution element is of type SOLVER_SOLUTION_REPLACE, return an array of
2504 elements describing the policy mismatches, otherwise return a copy of the
2505 element. See also the ``expandreplaces'' option in the solution's elements()
2506 method.
2507
2508         int illegalreplace()
2509         my $illegal = $solutionelement->illegalreplace();
2510         illegal = solutionelement.illegalreplace()
2511         illegal = solutionelement.illegalreplace()
2512
2513 Return an integer that contains the policy mismatch bits or-ed together, or
2514 zero if there was no policy mismatch. See the policy error constants in
2515 the solver class.
2516
2517         Job Job()
2518         my $job = $solutionelement->Job();
2519         illegal = solutionelement.Job()
2520         illegal = solutionelement.Job()
2521
2522 Create a job that implements the solution element. Add this job to the array
2523 of jobs for all elements of type different to SOLVER_SOLUTION_JOB and
2524 SOLVER_SOLUTION_POOLJOB. For the later two, a SOLVER_NOOB Job is created,
2525 you should replace the old job with the new one.
2526
2527         const char *str()
2528         my $str = $solutionelement->str();
2529         str = solutionelement.str()
2530         str = solutionelement.str()
2531
2532 A string describing the change the solution element consists of.
2533
2534 THE TRANSACTION CLASS
2535 ---------------------
2536 Transactions describe the output of a solver run. A transaction contains
2537 a number of transaction elements, each either the installation of a new
2538 package or the removal of an already installed package. The Transaction
2539 class supports a classify() method that puts the elements into different
2540 groups so that a transaction can be presented to the user in a meaningful
2541 way.
2542
2543 === CONSTANTS ===
2544
2545 Transaction element types, both active and passive
2546
2547 *SOLVER_TRANSACTION_IGNORE*::
2548   This element does nothing. Used to map element types that do not
2549   match the view mode.
2550
2551 *SOLVER_TRANSACTION_INSTALL*::
2552   This element installs a package.
2553
2554 *SOLVER_TRANSACTION_ERASE*::
2555   This element erases a package.
2556
2557 *SOLVER_TRANSACTION_MULTIINSTALL*::
2558   This element installs a package with a different version keeping the
2559   other versions installed.
2560
2561 *SOLVER_TRANSACTION_MULTIREINSTALL*::
2562   This element reinstalls a installed package keeping the other versions
2563   installed.
2564
2565 Transaction element types, active view
2566
2567 *SOLVER_TRANSACTION_REINSTALL*::
2568   This element re-installs a package, i.e. installs the same package again.
2569
2570 *SOLVER_TRANSACTION_CHANGE*::
2571   This element installs a package with same name, version, architecture but
2572   different content.
2573
2574 *SOLVER_TRANSACTION_UPGRADE*::
2575   This element installs a newer version of an installed package.
2576
2577 *SOLVER_TRANSACTION_DOWNGRADE*::
2578   This element installs a older version of an installed package.
2579
2580 *SOLVER_TRANSACTION_OBSOLETES*::
2581   This element installs a package that obsoletes an installed package.
2582
2583 Transaction element types, passive view
2584
2585 *SOLVER_TRANSACTION_REINSTALLED*::
2586   This element re-installs a package, i.e. installs the same package again.
2587
2588 *SOLVER_TRANSACTION_CHANGED*::
2589   This element replaces an installed package with one of the same name,
2590   version, architecture but different content.
2591
2592 *SOLVER_TRANSACTION_UPGRADED*::
2593   This element replaces an installed package with a new version.
2594
2595 *SOLVER_TRANSACTION_DOWNGRADED*::
2596   This element replaces an installed package with an old version.
2597
2598 *SOLVER_TRANSACTION_OBSOLETED*::
2599   This element replaces an installed package with a package that obsoletes
2600   it.
2601
2602 Pseudo element types for showing extra information used by classify()
2603
2604 *SOLVER_TRANSACTION_ARCHCHANGE*::
2605   This element replaces an installed package with a package of a different
2606   architecture.
2607
2608 *SOLVER_TRANSACTION_VENDORCHANGE*::
2609   This element replaces an installed package with a package of a different
2610   vendor.
2611
2612 Transaction mode flags
2613
2614 *SOLVER_TRANSACTION_SHOW_ACTIVE*::
2615   Filter for active view types. The default is to return passive view type,
2616   i.e. to show how the installed packages get changed.
2617
2618 *SOLVER_TRANSACTION_SHOW_OBSOLETES*::
2619   Do not map the obsolete view type into INSTALL/ERASE elements.
2620
2621 *SOLVER_TRANSACTION_SHOW_ALL*::
2622   If multiple packages replace an installed package, only the best of them
2623   is kept as OBSOLETE element, the other ones are mapped to INSTALL/ERASE
2624   elements. This is because most applications want to show just one package
2625   replacing the installed one. The SOLVER_TRANSACTION_SHOW_ALL makes the
2626   library keep all OBSOLETE elements.
2627
2628 *SOLVER_TRANSACTION_SHOW_MULTIINSTALL*::
2629   The library maps MULTIINSTALL elements to simple INSTALL elements. This
2630   flag can be used to disable the mapping.
2631
2632 *SOLVER_TRANSACTION_CHANGE_IS_REINSTALL*::
2633   Use this flag if you want to map CHANGE elements to the REINSTALL type.
2634
2635 *SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE*::
2636   Use this flag if you want to map OBSOLETE elements to the UPGRADE type.
2637
2638 *SOLVER_TRANSACTION_MERGE_ARCHCHANGES*::
2639   Do not add extra categories for every architecture change, instead cumulate
2640   them in one category.
2641   
2642 *SOLVER_TRANSACTION_MERGE_VENDORCHANGES*::
2643   Do not add extra categories for every vendor change, instead cumulate
2644   them in one category.
2645
2646 *SOLVER_TRANSACTION_RPM_ONLY*::
2647   Special view mode that just returns IGNORE, ERASE, INSTALL, MULTIINSTALL
2648   elements. Useful if you want to find out what to feed to the underlying
2649   package manager.
2650
2651 Transaction order flags
2652
2653 *SOLVER_TRANSACTION_KEEP_ORDERDATA*::
2654   Do not throw away the dependency graph used for ordering the transaction.
2655   This flag is needed if you want to do manual ordering.
2656
2657 === ATTRIBUTES ===
2658
2659         Pool *pool;                             /* read only */
2660         $trans->{pool}
2661         trans.pool
2662         trans.pool
2663
2664 Back pointer to pool.
2665
2666 === METHODS ===
2667
2668         bool isempty();
2669         $trans->isempty()
2670         trans.isempty()
2671         trans.isempty?
2672
2673 Returns true if the transaction does not do anything, i.e. has no elements.
2674
2675         Solvable *newsolvables();
2676         my @newsolvables = $trans->newsolvables();
2677         newsolvables = trans.newsolvables()
2678         newsolvables = trans.newsolvables()
2679
2680 Return all packages that are to be installed by the transaction. This are
2681 the packages that need to be downloaded from the repositories.
2682
2683         Solvable *keptsolvables();
2684         my @keptsolvables = $trans->keptsolvables();
2685         keptsolvables = trans.keptsolvables()
2686         keptsolvables = trans.keptsolvables()
2687
2688 Return all installed packages that the transaction will keep installed.
2689
2690         Solvable *steps();
2691         my @steps = $trans->steps();
2692         steps = trans.steps()
2693         steps = trans.steps()
2694
2695 Return all solvables that need to be installed (if the returned solvable
2696 is not already installed) or erased (if the returned solvable is installed).
2697 A step is also called a transaction element.
2698
2699         int steptype(Solvable *solvable, int mode)
2700         my $type = $trans->steptype($solvable, $mode);
2701         type = trans.steptype(solvable, mode)
2702         type = trans.steptype(solvable, mode)
2703
2704 Return the transaction type of the specified solvable. See the CONSTANTS
2705 sections for the mode argument flags and the list of returned types.
2706
2707         TransactionClass *classify(int mode = 0)
2708         my @classes = $trans->classify();
2709         classes = trans.classify()
2710         classes = trans.classify()
2711
2712 Group the transaction elements into classes so that they can be displayed
2713 in a structured way. You can use various mapping mode flags to tweak
2714 the result to match your preferences, see the mode argument flag in
2715 the CONSTANTS section. See the TransactionClass class for how to deal
2716 with the returned objects.
2717
2718         Solvable othersolvable(Solvable *solvable);
2719         my $other = $trans->othersolvable($solvable);
2720         other = trans.othersolvable(solvable)
2721         other = trans.othersolvable(solvable)
2722
2723 Return the ``other'' solvable for a given solvable. For installed packages
2724 the other solvable is the best package with the same name that replaces
2725 the installed package, or the best package of the obsoleting packages if
2726 the package does not get replaced by one with the same name.
2727
2728 For to be installed packages, the ``other'' solvable is the best installed
2729 package with the same name that will be replaced, or the best packages
2730 of all the packages that are obsoleted if the new package does not replace
2731 a package with the same name.
2732
2733 Thus, the ``other'' solvable is normally the package that is also shown
2734 for a given package.
2735
2736         Solvable *allothersolvables(Solvable *solvable);
2737         my @others = $trans->allothersolvables($solvable);
2738         others = trans.allothersolvables(solvable)
2739         others = trans.allothersolvables(solvable)
2740
2741 For installed packages, returns all of the packages that replace us. For to
2742 be installed packages, returns all of the packages that the new package
2743 replaces. The special ``other'' solvable is always the first entry of the
2744 returned array.
2745
2746         int calc_installsizechange();
2747         my $change = $trans->calc_installsizechange();
2748         change = trans.calc_installsizechange()
2749         change = trans.calc_installsizechange()
2750
2751 Return the size change of the installed system in kilobytes (kibibytes).
2752
2753         void order(int flags = 0);
2754         $trans->order();
2755         trans.order()
2756         trans.order()
2757
2758 Order the steps in the transactions so that dependant packages are updated
2759 before packages that depend on them. For rpm, you can also use rpmlib's
2760 ordering functionality, debian's dpkg does not provide a way to order a
2761 transaction.
2762
2763 === ACTIVE/PASSIVE VIEW ===
2764
2765 Active view list what new packages get installed, while passive view shows
2766 what happens to the installed packages. Most often there's not much
2767 difference between the two modes, but things get interesting of multiple
2768 package get replaced by one new package. Say you have installed package
2769 A-1-1 and B-1-1, and now install A-2-1 with has a new dependency that
2770 obsoletes B. The transaction elements will be
2771
2772   updated   A-1-1 (other: A-2-1)
2773   obsoleted B-1-1 (other: A-2-1)
2774
2775 in passive mode, but
2776
2777   update A-2-1 (other: A-1-1)
2778   erase  B
2779
2780 in active mode. If the mode contains SOLVER_TRANSACTION_SHOW_ALL, the 
2781 passive mode list will be unchanged but the active mode list will just
2782 contain A-2-1.
2783
2784 THE TRANSACTIONCLASS CLASS
2785 --------------------------
2786 Objects of this type are returned by the classify() Transaction method.
2787
2788 === ATTRIBUTES ===
2789
2790         Transaction *transaction;               /* read only */
2791         $class->{transaction}
2792         class.transaction
2793         class.transaction
2794
2795 Back pointer to transaction object.
2796
2797         int type;                               /* read only */
2798         $class->{type}
2799         class.type
2800         class.type
2801
2802 The type of the transaction elements in the class.
2803
2804         int count;                              /* read only */
2805         $class->{count}
2806         class.count
2807         class.count
2808
2809 The number of elements in the class.
2810
2811         const char *fromstr;
2812         $class->{fromstr}
2813         class.fromstr
2814         class.fromstr
2815
2816 The old vendor or architecture.
2817
2818         const char *tostr;
2819         $class->{tostr}
2820         class.tostr
2821         class.tostr
2822
2823 The new vendor or architecture.
2824
2825         Id fromid;
2826         $class->{fromid}
2827         class.fromid
2828         class.fromid
2829
2830 The id of the old vendor or architecture.
2831
2832         Id toid;
2833         $class->{toid}
2834         class.toid
2835         class.toid
2836
2837 The id of the new vendor or architecture.
2838
2839 === METHODS ===
2840
2841         void solvables();
2842         my @solvables = $class->solvables();
2843         solvables = class.solvables()
2844         solvables = class.solvables()
2845
2846 Return the solvables for all transaction elements in the class.
2847
2848 CHECKSUMS
2849 ---------
2850 Checksums (also called hashes) are used to make sure that downloaded data is
2851 not corrupt and also as a fingerprint mechanism to check if data has changed.
2852
2853 === CLASS METHODS ===
2854
2855         Chksum Chksum(Id type)
2856         my $chksum = solv::Chksum->new($type);
2857         chksum = solv.Chksum(type)
2858         chksum = Solv::Chksum.new(type)
2859
2860 Create a checksum object. Currently the following types are supported:
2861
2862         REPOKEY_TYPE_MD5
2863         REPOKEY_TYPE_SHA1
2864         REPOKEY_TYPE_SHA256
2865
2866 These keys are constants in the *solv* class.
2867
2868         Chksum Chksum(Id type, const char *hex)
2869         my $chksum = solv::Chksum->new($type, $hex);
2870         chksum = solv.Chksum(type, hex)
2871         chksum = Solv::Chksum.new(type, hex)
2872
2873 Create an already finalized checksum object.
2874
2875 === ATTRIBUTES ===
2876
2877         Id type;                        /* read only */
2878         $chksum->{type}
2879         chksum.type
2880         chksum.type
2881
2882 Return the type of the checksum object.
2883
2884 === METHODS ===
2885
2886         void add(const char *str)
2887         $chksum->add($str);
2888         chksum.add(str)
2889         chksum.add(str)
2890
2891 Add a string to the checksum.
2892
2893         void add_fp(FILE *fp)
2894         $chksum->add_fp($file);
2895         chksum.add_fp(file)
2896         chksum.add_fp(file)
2897
2898 Add the contents of a file to the checksum.
2899         
2900         void add_stat(const char *filename)
2901         $chksum->add_stat($filename);
2902         chksum.add_stat(filename)
2903         chksum.add_stat(filename)
2904
2905 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
2906 stat fails, the members are zeroed.
2907
2908         void add_fstat(int fd)
2909         $chksum->add_fstat($fd);
2910         chksum.add_fstat(fd)
2911         chksum.add_fstat(fd)
2912
2913 Same as add_stat, but instead of the filename a file descriptor is used.
2914
2915         unsigned char *raw()
2916         my $raw = $chksum->raw();
2917         raw = chksum.raw()
2918         raw = chksum.raw()
2919
2920 Finalize the checksum and return the result as raw bytes. This means that the
2921 result can contain NUL bytes or unprintable characters.
2922
2923         const char *hex()
2924         my $raw = $chksum->hex();
2925         raw = chksum.hex()
2926         raw = chksum.hex()
2927
2928 Finalize the checksum and return the result as hex string.
2929
2930         <equality>
2931         if ($chksum1 == $chksum2)
2932         if chksum1 == chksum2:
2933         if chksum1 == chksum2
2934
2935 Checksums are equal if they are of the same type and the finalized results are
2936 the same.
2937
2938         <stringification>
2939         my $str = $chksum->str;
2940         str = str(chksum)
2941         str = chksum.to_s
2942
2943 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
2944 Otherwise "<type>:unfinished" is returned.
2945
2946
2947 FILE MANAGEMENT
2948 ---------------
2949 This functions were added because libsolv uses standard *FILE* pointers to
2950 read/write files, but languages like perl have their own implementation of
2951 files. The libsolv functions also support decompression and compression, the
2952 algorithm is selected by looking at the file name extension.
2953
2954         FILE *xfopen(char *fn, char *mode = "r")
2955         my $file = solv::xfopen($path);
2956         file = solv.xfopen(path)
2957         file = Solv::xfopen(path)
2958
2959 Open a file at the specified path. The `mode` argument is passed on to the
2960 stdio library.
2961
2962         FILE *xfopen_fd(char *fn, int fileno)
2963         my $file = solv::xfopen_fd($path, $fileno);
2964         file = solv.xfopen_fd(path, fileno)
2965         file = Solv::xfopen_fd(path, fileno)
2966
2967 Create a file handle from the specified file descriptor. The path argument is
2968 only used to select the correct (de-)compression algorithm, use an empty path
2969 if you want to make sure to read/write raw data.
2970
2971 === METHODS ===
2972
2973         int fileno()
2974         my $fileno = $file->fileno();
2975         fileno = file.fileno()
2976         fileno = file.fileno()
2977
2978 Return file file descriptor of the file. If the file is not open, `-1` is
2979 returned.
2980
2981         int dup()
2982         my $fileno = $file->dup();
2983         fileno = file.dup()
2984         fileno = file.dup()
2985
2986 Return a copy of the descriptor of the file. If the file is not open, `-1` is
2987 returned.
2988
2989         bool flush()
2990         $file->flush();
2991         file.flush()
2992         file.flush()
2993
2994 Flush the file. Returns false if there was an error. Flushing a closed file
2995 always returns true.
2996
2997         bool close()
2998         $file->close();
2999         file.close()
3000         file.close()
3001
3002 Close the file. This is needed for languages like Ruby, that do not destruct
3003 objects right after they are no longer referenced. In that case, it is good
3004 style to close open files so that the file descriptors are freed right away.
3005 Returns false if there was an error.
3006
3007
3008 THE REPODATA CLASS
3009 ------------------
3010 The Repodata stores attributes for packages and the repository itself, each
3011 repository can have multiple repodata areas. You normally only need to
3012 directly access them if you implement lazy downloading of repository data.
3013 Repodata areas are created by calling the repository's add_repodata() method 
3014 or by using repo_add methods without the REPO_REUSE_REPODATA or REPO_USE_LOADING
3015 flag.
3016
3017 === ATTRIBUTES ===
3018
3019         Repo *repo;                     /* read only */
3020         $data->{repo}
3021         data.repo
3022         data.repo
3023
3024 Back pointer to repository object.
3025
3026         Id id;                                  /* read only */
3027         $data->{id}
3028         data.id
3029         data.id
3030
3031 The id of the repodata area. Repodata ids of different repositories overlap.
3032
3033 === METHODS ====
3034
3035         internalize();
3036         $data->internalize();
3037         data.internalize()
3038         data.internalize()
3039
3040 Internalize newly added data. The lookup functions will only see the new data
3041 after it has been internalized.
3042
3043         bool write(FILE *fp);
3044         $data->write($fp);
3045         data.write(fp)
3046         data.write(fp)
3047
3048 Write the contents of the repodata area as solv file.
3049
3050         bool add_solv(FILE *fp, int flags = 0);
3051         $data->add_solv($fp);
3052         data.add_solv(fp)
3053         data.add_solv(fp)
3054
3055 Replace a stub repodata object with the data from a solv file. This method
3056 automatically adds the REPO_USE_LOADING flag. It should only be used from
3057 a load callback.
3058
3059         void create_stubs();
3060         $data->create_stubs()
3061         data.create_stubs()
3062         data.create_stubs()
3063
3064 Create stub repodatas from the information stored in the repodata meta
3065 area.
3066
3067         void extend_to_repo();
3068         $data->extend_to_repo();
3069         data.extend_to_repo()
3070         data.extend_to_repo()
3071
3072 Extend the repodata so that it has the same size as the repo it belongs to.
3073 This method is only needed when switching to a just written repodata extension
3074 to make the repodata match the written extension (which is always of the
3075 size of the repo).
3076
3077         <equality>
3078         if ($data1 == $data2)
3079         if data1 == data2:
3080         if data1 == data2
3081
3082 Two repodata objects are equal if they belong to the same repository and have
3083 the same id.
3084
3085 === DATA RETRIEVAL METHODS ===
3086
3087         const char *lookup_str(Id solvid, Id keyname)
3088         my $string = $data->lookup_str($solvid, $keyname);
3089         string = data.lookup_str(solvid, keyname)
3090         string = data.lookup_str(solvid, keyname)
3091
3092         Id *lookup_idarray(Id solvid, Id keyname)
3093         my @ids = $data->lookup_idarray($solvid, $keyname);
3094         ids = data.lookup_idarray(solvid, keyname)
3095         ids = data.lookup_idarray(solvid, keyname)
3096
3097         Chksum lookup_checksum(Id solvid, Id keyname)
3098         my $chksum = $data->lookup_checksum($solvid, $keyname);
3099         chksum = data.lookup_checksum(solvid, keyname)
3100         chksum = data.lookup_checksum(solvid, keyname)
3101
3102 Lookup functions. Return the data element stored in the specified solvable.
3103 The methods probably only make sense to retrieve data from the special
3104 SOLVID_META solvid that stores repodata meta information.
3105
3106 === DATA STORAGE METHODS ===
3107
3108         void set_id(Id solvid, Id keyname, DepId id);
3109         $data->set_id($solvid, $keyname, $id);
3110         data.set_id(solvid, keyname, id)
3111         data.set_id(solvid, keyname, id)
3112
3113         void set_str(Id solvid, Id keyname, const char *str);
3114         $data->set_str($solvid, $keyname, $str);
3115         data.set_str(solvid, keyname, str)
3116         data.set_str(solvid, keyname, str)
3117
3118         void set_poolstr(Id solvid, Id keyname, const char *str);
3119         $data->set_poolstr($solvid, $keyname, $str);
3120         data.set_poolstr(solvid, keyname, str)
3121         data.set_poolstr(solvid, keyname, str)
3122
3123         void set_checksum(Id solvid, Id keyname, Chksum *chksum);
3124         $data->set_checksum($solvid, $keyname, $chksum);
3125         data.set_checksum(solvid, keyname, chksum)
3126         data.set_checksum(solvid, keyname, chksum)
3127
3128         void add_idarray(Id solvid, Id keyname, DepId id);
3129         $data->add_idarray($solvid, $keyname, $id);
3130         data.add_idarray(solvid, keyname, id)
3131         data.add_idarray(solvid, keyname, id)
3132
3133         Id new_handle();
3134         my $handle = $data->new_handle();
3135         handle = data.new_handle()
3136         handle = data.new_handle()
3137
3138         void add_flexarray(Id solvid, Id keyname, Id handle);
3139         $data->add_flexarray($solvid, $keyname, $handle);
3140         data.add_flexarray(solvid, keyname, handle)
3141         data.add_flexarray(solvid, keyname, handle)
3142
3143 Data storage methods. Probably only useful to store data in the special
3144 SOLVID_META solvid that stores repodata meta information. Note that
3145 repodata areas can have their own Id pool (see the REPO_LOCALPOOL flag),
3146 so be careful if you need to store ids. Arrays are created by calling
3147 the add function for every element. A flexarray is an array of
3148 sub-structures, call new_handle to create a new structure, use the
3149 handle as solvid to fill the structure with data and call add_flexarray
3150 to put the structure in an array.
3151
3152
3153 THE DATAPOS CLASS
3154 -----------------
3155 Datapos objects describe a specific position in the repository data area.
3156 Thus they are only valid until the repository is modified in some way.
3157 Datapos objects can be created by the pos() and parentpos() methods of
3158 a Datamatch object or by accessing the ``meta'' attribute of a repository.
3159
3160 === ATTRIBUTES ===
3161
3162         Repo *repo;                     /* read only */
3163         $data->{repo}
3164         data.repo
3165         data.repo
3166
3167 Back pointer to repository object.
3168
3169 === METHODS ===
3170
3171         Dataiterator(Id keyname, const char *match, int flags)
3172         my $di = $datapos->Dataiterator($keyname, $match, $flags);
3173         di = datapos.Dataiterator(keyname, match, flags)
3174         di = datapos.Dataiterator(keyname, match, flags)
3175
3176 Create a Dataiterator at the position of the datapos object.
3177
3178         const char *lookup_deltalocation(unsigned int *OUTPUT);
3179         my ($location, $medianr) = $datapos->lookup_deltalocation();
3180         location, medianr = datapos.lookup_deltalocation()
3181         location, medianr = datapos.lookup_deltalocation()
3182
3183 Return a tuple containing the on-media location and an optional media number
3184 for a delta rpm. This obviously only works if the data position points to
3185 structure describing a delta rpm.
3186
3187         const char *lookup_deltaseq();
3188         my $seq = $datapos->lookup_deltaseq();
3189         seq = datapos.lookup_deltaseq();
3190         seq = datapos.lookup_deltaseq();
3191
3192 Return the delta rpm sequence from the structure describing a delta rpm.
3193
3194 === DATA RETRIEVAL METHODS ===
3195
3196         const char *lookup_str(Id keyname)
3197         my $string = $datapos->lookup_str($keyname);
3198         string = datapos.lookup_str(keyname)
3199         string = datapos.lookup_str(keyname)
3200
3201         Id lookup_id(Id solvid, Id keyname)
3202         my $id = $datapos->lookup_id($keyname);
3203         id = datapos.lookup_id(keyname)
3204         id = datapos.lookup_id(keyname)
3205
3206         unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
3207         my $num = $datapos->lookup_num($keyname);
3208         num = datapos.lookup_num(keyname)
3209         num = datapos.lookup_num(keyname)
3210
3211         bool lookup_void(Id keyname)
3212         my $bool = $datapos->lookup_void($keyname);
3213         bool = datapos.lookup_void(keyname)
3214         bool = datapos.lookup_void(keyname)
3215
3216         Id *lookup_idarray(Id keyname)
3217         my @ids = $datapos->lookup_idarray($keyname);
3218         ids = datapos.lookup_idarray(keyname)
3219         ids = datapos.lookup_idarray(keyname)
3220
3221         Chksum lookup_checksum(Id keyname)
3222         my $chksum = $datapos->lookup_checksum($keyname);
3223         chksum = datapos.lookup_checksum(keyname)
3224         chksum = datapos.lookup_checksum(keyname)
3225
3226 Lookup functions. Note that the returned Ids are always translated into
3227 the Ids of the global pool even if the repodata area contains its own pool.
3228
3229 Author
3230 ------
3231 Michael Schroeder <mls@suse.de>
3232