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