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