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