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