9 libsolv-bindings - access libsolv from perl/python/ruby
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
23 Libsolv's perl bindings can be loaded with the following statement:
27 Objects are either created by calling the new() method on a class or they
28 are returned by calling methods on other objects.
30 my $pool = solv::Pool->new();
31 my $repo = $pool->add_repo("my_first_repo");
33 Swig encapsulates all objects as tied hashes, thus the attributes can be
34 accessed by treating the object as standard hash reference:
36 $pool->{appdata} = 42;
37 printf "appdata is %d\n", $pool->{appdata};
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:
42 my $iter = $pool->solvables_iter();
43 for my $solvable (@$iter) { ... };
45 As a downside of this approach, iterator objects cannot have attributes.
47 If an array needs to be passed to a method it is usually done by reference,
48 if a method returns an array it returns it on the stack:
50 my @problems = $solver->solve(\@jobs);
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.
55 print $dep->str() . "\n";
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:
61 $pool->set_flag($solv::Pool::POOL_FLAG_OBSOLETEUSESCOLORS, 1);
66 The python bindings can be loaded with:
70 Objects are either created by calling the constructor method for a class or they
71 are returned by calling methods on other objects.
74 repo = pool.add_repo("my_first_repo")
76 Attributes can be accessed as usual:
79 print "appdata is %d" % (pool.appdata)
81 Iterators also work as expected:
83 for solvable in pool.solvables_iter():
85 Arrays are passed and returned as list objects:
88 problems = solver.solve(jobs)
90 The bindings define stringification for many classes, some also have a
91 __repr__ method to ease debugging.
96 Constants are attributes of the classes:
98 pool.set_flag(solv.Pool.POOL_FLAG_OBSOLETEUSESCOLORS, 1);
103 The ruby bindings can be loaded with:
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''.
111 pool = Solv::Pool.new
112 repo = pool.add_repo("my_first_repo")
114 Attributes can be accessed as usual:
117 puts "appdata is #{pool.appdata}"
119 Iterators also work as expected:
121 for solvable in pool.solvables_iter() do ...
123 Arrays are passed and returned as array objects:
126 problems = solver.solve(jobs)
128 Most classes define a to_s method, so objects can be easily stringified.
129 Many also define an inspect() method.
134 Constants live in the namespace of the class they belong to:
136 pool.set_flag(Solv::Pool::POOL_FLAG_OBSOLETEUSESCOLORS, 1);
138 Note that boolean methods have an added trailing ``?'', to be consistent with
141 puts "empty" if repo.isempty?
146 Libsolv's tcl bindings can be loaded with the following statement:
148 TCL package require solv
150 Objects are either created by calling class name prefixed with ``new_'',
151 or they are returned by calling methods on other objects.
153 TCL set pool [solv::new_Pool]
154 TCL set repo [$pool add_repo "my_first_repo"]
156 Swig provides a ``cget'' method to read object attributes, and a
157 ``configure'' method to write them:
159 TCL $pool configure -appdata 42
160 TCL puts "appdata is [$pool cget -appdata]"
162 The tcl bindings provide a little helper to work with iterators in
165 TCL set iter [$pool solvables_iter]
166 TCL solv::iter s $iter { ... }
168 libsolv's arrays are mapped to tcl's lists:
170 TCL set jobs [list $job1 $job2]
171 TCL set problems [$solver solve $jobs]
172 TCL puts "We have [llength $problems] problems..."
174 Stringification is done by calling the object's ``str'' method.
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
183 Swig implements all constants as numeric variables, constants belonging
184 to a libsolv class are prefixed with the class name:
186 TCL $pool set_flag $solv::Pool_POOL_FLAG_OBSOLETEUSESCOLORS 1
187 TCL puts [$solvable lookup_str $solv::SOLVABLE_SUMMARY]
192 This is the main namespace of the library, you cannot create objects of this
193 type but it contains some useful constants.
197 Relational flag constants, the first three can be or-ed together
200 the ``less than'' bit
203 the ``equals to'' bit
206 the ``greater than'' bit
209 used for relations that describe an extra architecture filter, the
210 version part of the relation is interpreted as architecture.
215 Access the meta section of a repository or repodata area. This is
216 like an extra Solvable that has the Id SOLVID_META.
219 Use the data position stored inside of the pool instead of accessing
220 some solvable by Id. The bindings have the Datapos objects as an
221 abstraction mechanism, so you do not need this constant.
229 Always one, describes the empty string
232 The keyname Id of the name of the solvable.
235 see the libsolv-constantids manpage for a list of fixed Ids.
240 The pool is libsolv's central resource manager. A pool consists of Solvables,
241 Repositories, Dependencies, each indexed by Ids.
243 === CLASS METHODS ===
246 my $pool = solv::Pool->new();
248 pool = Solv::Pool.new()
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.
257 void *appdata; /* read/write */
262 Application specific data that may be used in any way by the code using the
265 Solvable solvables[]; /* read only */
266 my $solvable = $pool->{solvables}->[$solvid];
267 solvable = pool.solvables[solvid]
268 solvable = pool.solvables[solvid]
270 Look up a Solvable by its id.
272 Repo repos[]; /* read only */
273 my $repo = $pool->{repos}->[$repoid];
274 repo = pool.repos[repoid]
275 repo = pool.repos[repoid]
277 Look up a Repository by its id.
279 Repo *installed; /* read/write */
280 $pool->{installed} = $repo;
281 pool.installed = repo
282 pool.installed = repo
284 Define which repository contains all the installed packages.
286 const char *errstr; /* read only */
287 my $err = $pool->{errstr};
291 Return the last error string that was stored in the pool.
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.
300 *POOL_FLAG_FORBIDSELFCONFLICTS*::
301 Disallow the installation of packages that conflict with themselves.
302 Debian always allows self-conflicting packages, rpm used to forbid
303 them but switched to also allowing them recently.
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.
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.
317 *POOL_FLAG_OBSOLETEUSESCOLORS*::
318 Rpm's multilib implementation (used in RedHat and Fedora)
319 distinguishes between 32bit and 64bit packages (the terminology
320 is that they have a different color). If obsoleteusescolors is
321 set, packages with different colors will not obsolete each other.
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).
330 *POOL_FLAG_NOINSTALLEDOBSOLETES*::
331 New versions of rpm consider the obsoletes of installed packages
332 when checking for dependency, thus you may not install a package
333 that is obsoleted by some other installed package, unless you
334 also erase the other package.
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
341 *POOL_FLAG_NOOBSOLETESMULTIVERSION*::
342 If a package is installed in multiversionmode, rpm used to ignore
343 both the implicit obsoletes and the obsolete dependency of a
344 package. This was changed to ignoring just the implicit obsoletes,
345 thus you may install multiple versions of the same name, but
346 obsoleted packages still get removed.
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()
362 Force a free of the pool. After this call, you must not access any object
363 that still references the pool.
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
375 void setdebuglevel(int level)
376 $pool->setdebuglevel($level);
377 pool.setdebuglevel(level)
378 pool.setdebuglevel(level)
380 Set the debug level. A value of zero means no debug output, the higher the
381 value, the more output is generated.
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)
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)
393 Set/get a pool specific flag. The flags define how the system works, e.g. how
394 the package manager treats obsoletes. The default flags should be sane for most
395 applications, but in some cases you may want to tweak a flag, for example if
396 you want to solv package dependencies for some other system than yours.
398 void set_rootdir(const char *rootdir)
399 $pool->set_rootdir(rootdir);
400 pool.set_rootdir(rootdir)
401 pool.set_rootdir(rootdir)
403 const char *get_rootdir()
404 my $rootdir = $pool->get_rootdir();
405 rootdir = pool.get_rootdir()
406 rootdir = pool.get_rootdir()
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.
413 void setarch(const char *arch = 0)
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''.
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)
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.
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()
434 Iterate over the existing repositories.
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()
441 Iterate over the existing solvables.
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)
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.
451 void addfileprovides()
452 $pool->addfileprovides();
453 pool.addfileprovides()
454 pool.addfileprovides()
456 Id *addfileprovides_queue()
457 my @ids = $pool->addfileprovides_queue();
458 ids = pool.addfileprovides_queue()
459 ids = pool.addfileprovides_queue()
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.
472 void createwhatprovides()
473 $pool->createwhatprovides();
474 pool.createwhatprovides()
475 pool.createwhatprovides()
477 Create the internal ``whatprovides'' hash over all of the provides of all
478 packages. This method must be called before doing any lookups on provides.
479 It's encouraged to do it right after all repos are set up, usually right after
480 the call to addfileprovides().
482 Solvable *whatprovides(DepId dep)
483 my @solvables = $pool->whatprovides($dep);
484 solvables = pool.whatprovides(dep)
485 solvables = pool.whatprovides(dep)
487 Return all solvables that provide the specified dependency. You can use either
488 a Dep object or a simple Id as argument.
490 Id *matchprovidingids(const char *match, int flags)
491 my @ids = $pool->matchprovidingids($match, $flags);
492 ids = pool.matchprovidingids(match, flags)
493 ids = pool.matchprovidingids(match, flags)
495 Search the names of all provides and return the ones matching the specified
496 string. See the Dataiterator class for the allowed flags.
498 Id towhatprovides(Id *ids)
499 my $offset = $pool->towhatprovides(\@ids);
500 offset = pool.towhatprovides(ids)
501 offset = pool.towhatprovides(ids)
503 ``Internalize'' an array containing Ids. The returned value can be used to
504 create solver jobs working on a specific set of packages. See the Solver class
505 for more information.
507 bool isknownarch(DepId id)
508 my $bool = $pool->isknownarch($id);
509 bool = pool.isknownarch(id)
510 bool = pool.isknownarch?(id)
512 Return true if the specified Id describes a known architecture.
515 my $solver = $pool->Solver();
516 solver = pool.Solver()
517 solver = pool.Solver()
519 Create a new solver object.
521 Job Job(int how, Id what)
522 my $job = $pool->Job($how, $what);
523 job = pool.Job(how, what)
524 job = pool.Job(how, what)
526 Create a new Job object. Kind of low level, in most cases you would use a
527 Selection or Dep job constructor instead.
529 Selection Selection()
530 my $sel = $pool->Selection();
531 sel = pool.Selection()
532 sel = pool.Selection()
534 Create an empty selection. Useful as a starting point for merging other
537 Selection Selection_all()
538 my $sel = $pool->Selection_all();
539 sel = pool.Selection_all()
540 sel = pool.Selection_all()
542 Create a selection containing all packages. Useful as starting point for
543 intersecting other selections or for update/distupgrade jobs.
545 Selection select(const char *name, int flags)
546 my $sel = $pool->select($name, $flags);
547 sel = pool.select(name, flags)
548 sel = pool.select(name, flags)
550 Create a selection by matching packages against the specified string. See the
551 Selection class for a list of flags and how to create solver jobs from a
554 void setpooljobs(Jobs *jobs)
555 $pool->setpooljobs(\@jobs);
556 pool.setpooljobs(jobs)
557 pool.setpooljobs(jobs)
560 @jobs = $pool->getpooljobs();
561 jobs = pool.getpooljobs()
562 jobs = pool.getpooljobs()
564 Get/Set fixed jobs stored in the pool. Those jobs are automatically appended to
565 all solver jobs, they are meant for fixed configurations like which packages
566 can be multiversion installed, which packages were userinstalled or must not be
569 void set_loadcallback(Callable *callback)
570 $pool->setloadcallback(\&callbackfunction);
571 pool.setloadcallback(callbackfunction)
572 pool.setloadcallback { |repodata| ... }
574 Set the callback function called when repository metadata needs to be loaded on
575 demand. To make use of this feature, you need to create repodata stubs that
576 tell the library which data is available but not loaded. If later on the data
577 needs to be accessed, the callback function is called with a repodata argument.
578 You can then load the data (maybe fetching it first from a remote server).
579 The callback should return true if the data has been made available.
582 $pool->appdata_disown()
583 pool.appdata_disown()
584 pool.appdata_disown()
586 Decrement the reference count of the appdata object. This can be used to break
587 circular references (e.g. if the pool's appdata value points to some meta data
588 structure that contains a pool handle). If used incorrectly, this method can
589 lead to application crashes, so beware. (This method is a no-op for ruby and tcl.)
591 === DATA RETRIEVAL METHODS ===
593 In the following functions, the _keyname_ argument describes what to retrieve.
594 For the standard cases you can use the available Id constants. For example,
596 $solv::SOLVABLE_SUMMARY
597 solv.SOLVABLE_SUMMARY
598 Solv::SOLVABLE_SUMMARY
600 selects the ``Summary'' entry of a solvable. The _solvid_ argument selects the
601 desired solvable by Id.
603 const char *lookup_str(Id solvid, Id keyname)
604 my $string = $pool->lookup_str($solvid, $keyname);
605 string = pool.lookup_str(solvid, keyname)
606 string = pool.lookup_str(solvid, keyname)
608 Id lookup_id(Id solvid, Id keyname)
609 my $id = $pool->lookup_id($solvid, $keyname);
610 id = pool.lookup_id(solvid, keyname)
611 id = pool.lookup_id(solvid, keyname)
613 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
614 my $num = $pool->lookup_num($solvid, $keyname);
615 num = pool.lookup_num(solvid, keyname)
616 num = pool.lookup_num(solvid, keyname)
618 bool lookup_void(Id solvid, Id keyname)
619 my $bool = $pool->lookup_void($solvid, $keyname);
620 bool = pool.lookup_void(solvid, keyname)
621 bool = pool.lookup_void(solvid, keyname)
623 Id *lookup_idarray(Id solvid, Id keyname)
624 my @ids = $pool->lookup_idarray($solvid, $keyname);
625 ids = pool.lookup_idarray(solvid, keyname)
626 ids = pool.lookup_idarray(solvid, keyname)
628 Chksum lookup_checksum(Id solvid, Id keyname)
629 my $chksum = $pool->lookup_checksum($solvid, $keyname);
630 chksum = pool.lookup_checksum(solvid, keyname)
631 chksum = pool.lookup_checksum(solvid, keyname)
633 Lookup functions. Return the data element stored in the specified solvable.
634 You should probably use the methods of the Solvable class instead.
636 Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
637 my $di = $pool->Dataiterator($keyname, $match, $flags);
638 di = pool.Dataiterator(keyname, match, flags)
639 di = pool.Dataiterator(keyname, match, flags)
641 Dataiterator Dataiterator_solvid(Id solvid, Id keyname, const char *match = 0, int flags = 0)
642 my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
643 di = pool.Dataiterator(solvid, keyname, match, flags)
644 di = pool.Dataiterator(solvid, keyname, match, flags)
650 Iterate over the matching data elements. See the Dataiterator class for more
651 information. The Dataiterator method iterates over all solvables in the pool,
652 whereas the Dataiterator_solvid only iterates over the specified solvable.
656 The following methods deal with Ids, i.e. integers representing objects in the
657 pool. They are considered ``low level'', in most cases you would not use them
658 but instead the object orientated methods.
661 $repo = $pool->id2repo($id);
662 repo = pool.id2repo(id)
663 repo = pool.id2repo(id)
665 Lookup an existing Repository by id. You can also do this by using the *repos*
668 Solvable id2solvable(Id id)
669 $solvable = $pool->id2solvable($id);
670 solvable = pool.id2solvable(id)
671 solvable = pool.id2solvable(id)
673 Lookup an existing Repository by id. You can also do this by using the
674 *solvables* attribute.
676 const char *solvid2str(Id id)
677 my $str = $pool->solvid2str($id);
678 str = pool.solvid2str(id)
679 str = pool.solvid2str(id)
681 Return a string describing the Solvable with the specified id. The string
682 consists of the name, version, and architecture of the Solvable.
684 Id str2id(const char *str, bool create = 1)
685 my $id = pool->str2id($string);
686 id = pool.str2id(string)
687 id = pool.str2id(string)
689 const char *id2str(Id id)
690 $string = pool->id2str($id);
691 string = pool.id2str(id)
692 string = pool.id2str(id)
694 Convert a string into an Id and back. If the string is currently not in the
695 pool and _create_ is false, zero is returned.
697 Id rel2id(Id name, Id evr, int flags, bool create = 1)
698 my $id = pool->rel2id($nameid, $evrid, $flags);
699 id = pool.rel2id(nameid, evrid, flags)
700 id = pool.rel2id(nameid, evrid, flags)
702 Create a ``relational'' dependency. Such dependencies consist of a name part,
703 the _flags_ describing the relation, and a version part. The flags are:
705 $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
706 solv.REL_EQ | solv.REL_GT | solv.REL_LT
707 Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
709 Thus, if you want a ``\<='' relation, you would use *REL_LT | REL_EQ*.
711 Id id2langid(Id id, const char *lang, bool create = 1)
712 my $id = $pool->id2langid($id, $language);
713 id = pool.id2langid(id, language)
714 id = pool.id2langid(id, language)
716 Create a language specific Id from some other id. This function simply converts
717 the id into a string, appends a dot and the specified language to the string
718 and converts the result back into an Id.
720 const char *dep2str(Id id)
721 $string = pool->dep2str($id);
722 string = pool.dep2str(id)
723 string = pool.dep2str(id)
725 Convert a dependency id into a string. If the id is just a string, this
726 function has the same effect as id2str(). For relational dependencies, the
727 result is the correct ``name relation evr'' string.
732 The dependency class is an object orientated way to work with strings and
733 dependencies. Internally, dependencies are represented as Ids, i.e. simple
734 numbers. Dependency objects can be constructed by using the Pool's Dep()
739 Pool *pool; /* read only */
744 Back reference to the pool this dependency belongs to.
746 Id id; /* read only */
751 The id of this dependency.
755 Dep Rel(int flags, DepId evrid, bool create = 1)
756 my $reldep = $dep->Rel($flags, $evrdep);
757 reldep = dep.Rel(flags, evrdep)
758 reldep = dep.Rel(flags, evrdep)
760 Create a relational dependency from to string dependencies and a flags
761 argument. See the pool's rel2id method for a description of the flags.
763 Selection Selection_name(int setflags = 0)
764 my $sel = $dep->Selection_name();
765 sel = dep.Selection_name()
766 sel = dep.Selection_name()
768 Create a Selection from a dependency. The selection consists of all packages
769 that have a name equal to the dependency. If the dependency is of a relational
770 type, the packages version must also fulfill the dependency.
772 Selection Selection_provides(int setflags = 0)
773 my $sel = $dep->Selection_provides();
774 sel = dep.Selection_provides()
775 sel = dep.Selection_provides()
777 Create a Selection from a dependency. The selection consists of all packages
778 that have at least one provides matching the dependency.
781 my $str = $dep->str();
785 Return a string describing the dependency.
792 Same as calling the str() method.
799 The dependencies are equal if they are part of the same pool and have the same
805 A Repository describes a group of packages, normally coming from the same
806 source. Repositories are created by the Pool's add_repo() method.
810 Pool *pool; /* read only */
815 Back reference to the pool this dependency belongs to.
817 Id id; /* read only */
822 The id of the repository.
824 const char *name; /* read/write */
829 The repositories name. To libsolv, the name is just a string with no specific
832 int priority; /* read/write */
837 The priority of the repository. A higher number means that packages of this
838 repository will be chosen over other repositories, even if they have a greater
841 int subpriority; /* read/write */
846 The sub-priority of the repository. This value is compared when the priorities
847 of two repositories are the same. It is useful to make the library prefer
848 on-disk repositories to remote ones.
850 int nsolvables; /* read only */
855 The number of solvables in this repository.
857 void *appdata; /* read/write */
862 Application specific data that may be used in any way by the code using the
865 Datapos *meta; /* read only */
870 Return a Datapos object of the repodata's metadata. You can use the lookup
871 methods of the Datapos class to lookup metadata attributes, like the repository
876 *REPO_REUSE_REPODATA*::
877 Reuse the last repository data area (``repodata'') instead of creating a
880 *REPO_NO_INTERNALIZE*::
881 Do not internalize the added repository data. This is useful if
882 you plan to add more data because internalization is a costly
886 Use the repodata's pool for Id storage instead of the global pool. Useful
887 if you don't want to pollute the global pool with many unneeded ids, like
888 when storing the filelist.
891 Use the repodata that is currently being loaded instead of creating a new
892 one. This only makes sense if used in a load callback.
894 *REPO_EXTEND_SOLVABLES*::
895 Do not create new solvables for the new data, but match existing solvables
896 and add the data to them. Repository metadata is often split into multiple
897 parts, with one primary file describing all packages and other parts
898 holding information that is normally not needed, like the changelog.
901 Prepend the pool's rootdir to the path when doing file operations.
904 Do not add a location element to the solvables. Useful if the solvables
905 are not in the final position, so you can add the correct location later
908 *SOLV_ADD_NO_STUBS*::
909 Do not create stubs for repository parts that can be downloaded on demand.
911 *SUSETAGS_RECORD_SHARES*::
912 This is specific to the add_susetags() method. Susetags allows one to refer to
913 already read packages to save disk space. If this data sharing needs to
914 work over multiple calls to add_susetags, you need to specify this flag so
915 that the share information is made available to subsequent calls.
919 void free(bool reuseids = 0)
924 Free the repository and all solvables it contains. If _reuseids_ is set to
925 true, the solvable ids and the repository id may be reused by the library when
926 added new solvables. Thus you should leave it false if you are not sure that
927 somebody holds a reference.
929 void empty(bool reuseids = 0)
934 Free all the solvables in a repository. The repository will be empty after this
935 call. See the free() method for the meaning of _reuseids_.
942 Return true if there are no solvables in this repository.
945 $repo->internalize();
949 Internalize added data. Data must be internalized before it is available to the
950 lookup and data iterator functions.
957 Write a repo as a ``solv'' file. These files can be read very fast and thus are
958 a good way to cache repository data. Returns false if there was some error
961 Solvableiterator solvables_iter()
962 for my $solvable (@{$repo->solvables_iter()})
963 for solvable in repo.solvables_iter():
964 for solvable in repo.solvables_iter()
966 Iterate over all solvables in a repository.
968 Repodata add_repodata(int flags = 0)
969 my $repodata = $repo->add_repodata();
970 repodata = repo.add_repodata()
971 repodata = repo.add_repodata()
973 Add a new repodata area to the repository. This is normally automatically
974 done by the repo_add methods, so you need this method only in very
978 $repo->create_stubs();
982 Calls the create_stubs() repodata method for the last repodata of the
986 $repo->iscontiguous()
990 Return true if the solvables of this repository are all in a single block with
991 no holes, i.e. they have consecutive ids.
993 Repodata first_repodata()
994 my $repodata = $repo->first_repodata();
995 repodata = repo.first_repodata()
996 repodata = repo.first_repodata()
998 Checks if all repodatas but the first repodata are extensions, and return the
999 first repodata if this is the case. Useful if you want to do a store/retrieve
1000 sequence on the repository to reduce the memory using and enable paging, as
1001 this does not work if the repository contains multiple non-extension repodata
1004 Selection Selection(int setflags = 0)
1005 my $sel = $repo->Selection();
1006 sel = repo.Selection()
1007 sel = repo.Selection()
1009 Create a Selection consisting of all packages in the repository.
1011 Dataiterator Dataiterator(Id key, const char *match = 0, int flags = 0)
1012 my $di = $repo->Dataiterator($keyname, $match, $flags);
1013 di = repo.Dataiterator(keyname, match, flags)
1014 di = repo.Dataiterator(keyname, match, flags)
1016 Dataiterator Dataiterator_meta(Id key, const char *match = 0, int flags = 0)
1017 my $di = $repo->Dataiterator_meta($keyname, $match, $flags);
1018 di = repo.Dataiterator_meta(keyname, match, flags)
1019 di = repo.Dataiterator_meta(keyname, match, flags)
1025 Iterate over the matching data elements in this repository. See the
1026 Dataiterator class for more information. The Dataiterator() method
1027 iterates over all solvables in a repository, whereas the Dataiterator_meta
1028 method only iterates over the repository's meta data.
1031 my $str = $repo->str;
1035 Return the name of the repository, or "Repo#<id>" if no name is set.
1038 if ($repo1 == $repo2)
1042 Two repositories are equal if they belong to the same pool and have the same id.
1044 === DATA ADD METHODS ===
1046 Solvable add_solvable()
1047 $repo->add_solvable();
1051 Add a single empty solvable to the repository. Returns a Solvable object, see
1052 the Solvable class for more information.
1054 bool add_solv(const char *name, int flags = 0)
1055 $repo->add_solv($name);
1059 bool add_solv(FILE *fp, int flags = 0)
1060 $repo->add_solv($fp);
1064 Read a ``solv'' file and add its contents to the repository. These files can be
1065 written with the write() method and are normally used as fast cache for
1066 repository metadata.
1068 bool add_rpmdb(int flags = 0)
1073 bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
1074 $repo->add_rpmdb_reffp($reffp);
1075 repo.add_rpmdb_reffp(reffp)
1076 repo.add_rpmdb_reffp(reffp)
1078 Add the contents of the rpm database to the repository. If a solv file
1079 containing an old version of the database is available, it can be passed as
1080 reffp to speed up reading.
1082 Solvable add_rpm(const char *filename, int flags = 0)
1083 my $solvable = $repo->add_rpm($filename);
1084 solvable = repo.add_rpm(filename)
1085 solvable = repo.add_rpm(filename)
1087 Add the metadata of a single rpm package to the repository.
1089 bool add_rpmdb_pubkeys(int flags = 0)
1090 $repo->add_rpmdb_pubkeys();
1091 repo.add_rpmdb_pubkeys()
1092 repo.add_rpmdb_pubkeys()
1094 Add all pubkeys contained in the rpm database to the repository. Note that
1095 newer rpm versions also allow to store the pubkeys in some directory instead
1096 of the rpm database.
1098 Solvable add_pubkey(const char *keyfile, int flags = 0)
1099 my $solvable = $repo->add_pubkey($keyfile);
1100 solvable = repo.add_pubkey(keyfile)
1101 solvable = repo.add_pubkey(keyfile)
1103 Add a pubkey from a file to the repository.
1105 bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
1106 $repo->add_rpmmd($fp, undef);
1107 repo.add_rpmmd(fp, None)
1108 repo.add_rpmmd(fp, nil)
1110 Add metadata stored in the "rpm-md" format (i.e. from files in the ``repodata''
1111 directory) to a repository. Supported files are "primary", "filelists",
1112 "other", "suseinfo". Do not forget to specify the *REPO_EXTEND_SOLVABLES* for
1113 extension files like "filelists" and "other". Use the _language_ parameter if
1114 you have language extension files, otherwise simply use a *undef*/*None*/*nil*
1117 bool add_repomdxml(FILE *fp, int flags = 0)
1118 $repo->add_repomdxml($fp);
1119 repo.add_repomdxml(fp)
1120 repo.add_repomdxml(fp)
1122 Add the repomd.xml meta description from the "rpm-md" format to the repository.
1123 This file contains information about the repository like keywords, and also a
1124 list of all database files with checksums. The data is added to the "meta"
1125 section of the repository, i.e. no package gets created.
1127 bool add_updateinfoxml(FILE *fp, int flags = 0)
1128 $repo->add_updateinfoxml($fp);
1129 repo.add_updateinfoxml(fp)
1130 repo.add_updateinfoxml(fp)
1132 Add the updateinfo.xml file containing available maintenance updates to the
1133 repository. All updates are created as special packages that have a "patch:"
1134 prefix in their name.
1136 bool add_deltainfoxml(FILE *fp, int flags = 0)
1137 $repo->add_deltainfoxml($fp);
1138 repo.add_deltainfoxml(fp)
1139 repo.add_deltainfoxml(fp)
1141 Add the deltainfo.xml file (also called prestodelta.xml) containing available
1142 delta-rpms to the repository. The data is added to the "meta" section, i.e. no
1143 package gets created.
1145 bool add_debdb(int flags = 0)
1150 Add the contents of the debian installed package database to the repository.
1152 bool add_debpackages(FILE *fp, int flags = 0)
1153 $repo->add_debpackages($fp);
1154 repo.add_debpackages($fp)
1155 repo.add_debpackages($fp)
1157 Add the contents of the debian repository metadata (the "packages" file)
1160 Solvable add_deb(const char *filename, int flags = 0)
1161 my $solvable = $repo->add_deb($filename);
1162 solvable = repo.add_deb(filename)
1163 solvable = repo.add_deb(filename)
1165 Add the metadata of a single deb package to the repository.
1167 bool add_mdk(FILE *fp, int flags = 0)
1168 $repo->add_mdk($fp);
1172 Add the contents of the mageia/mandriva repository metadata (the
1173 "synthesis.hdlist" file) to the repository.
1175 bool add_mdk_info(FILE *fp, int flags = 0)
1176 $repo->add_mdk($fp);
1180 Extend the packages from the synthesis file with the info.xml and files.xml
1181 data. Do not forget to specify *REPO_EXTEND_SOLVABLES*.
1183 bool add_arch_repo(FILE *fp, int flags = 0)
1184 $repo->add_arch_repo($fp);
1185 repo.add_arch_repo(fp)
1186 repo.add_arch_repo(fp)
1188 Add the contents of the archlinux repository metadata (the ".db.tar" file) to
1191 bool add_arch_local(const char *dir, int flags = 0)
1192 $repo->add_arch_local($dir);
1193 repo.add_arch_local(dir)
1194 repo.add_arch_local(dir)
1196 Add the contents of the archlinux installed package database to the repository.
1197 The _dir_ parameter is usually set to "/var/lib/pacman/local".
1199 bool add_content(FILE *fp, int flags = 0)
1200 $repo->add_content($fp);
1201 repo.add_content(fp)
1202 repo.add_content(fp)
1204 Add the ``content'' meta description from the susetags format to the repository.
1205 This file contains information about the repository like keywords, and also
1206 a list of all database files with checksums. The data is added to the "meta"
1207 section of the repository, i.e. no package gets created.
1209 bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
1210 $repo->add_susetags($fp, $defvendor, $language);
1211 repo.add_susetags(fp, defvendor, language)
1212 repo.add_susetags(fp, defvendor, language)
1214 Add repository metadata in the susetags format to the repository. Like with
1215 add_rpmmd, you can specify a language if you have language extension files. The
1216 _defvendor_ parameter provides a default vendor for packages with missing
1217 vendors, it is usually provided in the content file.
1219 bool add_products(const char *dir, int flags = 0)
1220 $repo->add_products($dir);
1221 repo.add_products(dir)
1222 repo.add_products(dir)
1224 Add the installed SUSE products database to the repository. The _dir_ parameter
1225 is usually "/etc/products.d".
1230 A solvable describes all the information of one package. Each solvable
1231 belongs to one repository, it can be added and filled manually but in
1232 most cases solvables will get created by the repo_add methods.
1236 Repo *repo; /* read only */
1241 The repository this solvable belongs to.
1243 Pool *pool; /* read only */
1248 The pool this solvable belongs to, same as the pool of the repo.
1250 Id id; /* read only */
1255 The specific id of the solvable.
1257 char *name; /* read/write */
1262 char *evr; /* read/write */
1267 char *arch; /* read/write */
1272 char *vendor; /* read/write */
1277 Easy access to often used attributes of solvables. They are
1278 internally stored as Ids.
1280 Id nameid; /* read/write */
1285 Id evrid; /* read/write */
1290 Id archid; /* read/write */
1295 Id vendorid; /* read/write */
1296 $solvable->{vendorid}
1300 Raw interface to the ids. Useful if you want to search for
1301 a specific id and want to avoid the string compare overhead.
1305 const char *lookup_str(Id keyname)
1306 my $string = $solvable->lookup_str($keyname);
1307 string = solvable.lookup_str(keyname)
1308 string = solvable.lookup_str(keyname)
1310 Id lookup_id(Id keyname)
1311 my $id = $solvable->lookup_id($keyname);
1312 id = solvable.lookup_id(solvid)
1313 id = solvable.lookup_id(solvid)
1315 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
1316 my $num = $solvable->lookup_num($keyname);
1317 num = solvable.lookup_num(keyname)
1318 num = solvable.lookup_num(keyname)
1320 bool lookup_void(Id keyname)
1321 my $bool = $solvable->lookup_void($keyname);
1322 bool = solvable.lookup_void(keyname)
1323 bool = solvable.lookup_void(keyname)
1325 Chksum lookup_checksum(Id keyname)
1326 my $chksum = $solvable->lookup_checksum($keyname);
1327 chksum = solvable.lookup_checksum(keyname)
1328 chksum = solvable.lookup_checksum(keyname)
1330 Id *lookup_idarray(Id keyname, Id marker = -1)
1331 my @ids = $solvable->lookup_idarray($keyname);
1332 ids = solvable.lookup_idarray(keyname)
1333 ids = solvable.lookup_idarray(keyname)
1335 Dep *lookup_deparray(Id keyname, Id marker = -1)
1336 my @deps = $solvable->lookup_deparray($keyname);
1337 deps = solvable.lookup_deparray(keyname)
1338 deps = solvable.lookup_deparray(keyname)
1340 Generic lookup methods. Retrieve data stored for the specific keyname.
1341 The lookup_idarray() method will return an array of Ids, use
1342 lookup_deparray if you want an array of Dependency objects instead.
1343 Some Id arrays contain two parts of data divided by a specific marker,
1344 for example the provides array uses the SOLVABLE_FILEMARKER id to
1345 store both the ids provided by the package and the ids added by
1346 the addfileprovides method. The default, -1, translates to the
1347 correct marker for the keyname and returns the first part of the
1348 array, use 1 to select the second part or 0 to retrieve all ids
1349 including the marker.
1351 const char *lookup_location(unsigned int *OUTPUT);
1352 my ($location, $medianr) = $solvable->lookup_location();
1353 location, medianr = solvable.lookup_location()
1354 location, medianr = solvable.lookup_location()
1356 Return a tuple containing the on-media location and an optional
1357 media number for multi-part repositories (e.g. repositories
1358 spawning multiple DVDs).
1360 Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
1361 my $di = $solvable->Dataiterator($keyname, $match, $flags);
1362 di = solvable.Dataiterator(keyname, match, flags)
1363 di = solvable.Dataiterator(keyname, match, flags)
1369 Iterate over the matching data elements. See the Dataiterator class for more
1372 void add_deparray(Id keyname, DepId dep, Id marker = -1);
1373 $solvable->add_deparray($keyname, $dep);
1374 solvable.add_deparray(keyname, dep)
1375 solvable.add_deparray(keyname, dep)
1377 Add a new dependency to the attributes stored in keyname.
1379 void unset(Id keyname);
1380 $solvable->unset($keyname);
1381 solvable.unset(keyname)
1382 solvable.unset(keyname)
1384 Delete data stored for the specific keyname.
1387 $solvable->installable()
1388 solvable.installable()
1389 solvable.installable?
1391 Return true if the solvable is installable on the system. Solvables
1392 are not installable if the system does not support their architecture.
1395 $solvable->isinstalled()
1396 solvable.isinstalled()
1397 solvable.isinstalled?
1399 Return true if the solvable is installed on the system.
1401 bool identical(Solvable *other)
1402 $solvable->identical($other)
1403 solvable.identical(other)
1404 solvable.identical?(other)
1406 Return true if the two solvables are identical.
1408 int evrcmp(Solvable *other)
1409 $solvable->evrcmp($other)
1410 solvable.evrcmp(other)
1411 solvable.evrcmp(other)
1413 Returns -1 if the epoch/version/release of the solvable is less than the
1414 one from the other solvable, 1 if it is greater, and 0 if they are equal.
1415 Note that "equal" does not mean that the evr is identical.
1417 int matchesdep(Id keyname, DepId id, Id marker = -1)
1418 $solvable->matchesdep($keyname, $dep)
1419 solvable.matchesdep(keyname, dep)
1420 solvable.matchesdep?(keyname, dep)
1422 Return true if the dependencies stored in keyname match the specified dependeny.
1424 Selection Selection(int setflags = 0)
1425 my $sel = $solvable->Selection();
1426 sel = solvable.Selection()
1427 sel = solvable.Selection()
1429 Create a Selection containing just the single solvable.
1432 my $str = $solvable->str();
1433 str = $solvable.str()
1434 str = $solvable.str()
1436 Return a string describing the solvable. The string consists of the name,
1437 version, and architecture of the Solvable.
1440 my $str = $solvable->str;
1444 Same as calling the str() method.
1447 if ($solvable1 == $solvable2)
1448 if solvable1 == solvable2:
1449 if solvable1 == solvable2
1451 Two solvables are equal if they are part of the same pool and have the same
1455 The Dataiterator Class
1456 ----------------------
1457 Dataiterators can be used to do complex string searches or
1458 to iterate over arrays. They can be created via the
1459 constructors in the Pool, Repo, and Solvable classes. The
1460 Repo and Solvable constructors will limit the search to
1461 the repository or the specific package.
1466 Return a match if the search string matches the value.
1468 *SEARCH_STRINGSTART*::
1469 Return a match if the value starts with the search string.
1471 *SEARCH_STRINGEND*::
1472 Return a match if the value ends with the search string.
1474 *SEARCH_SUBSTRING*::
1475 Return a match if the search string can be matched somewhere in the value.
1478 Do a glob match of the search string against the value.
1481 Do a regular expression match of the search string against the value.
1484 Ignore case when matching strings. Works for all the above match types.
1487 Match the complete filenames of the file list, not just the base name.
1489 *SEARCH_COMPLETE_FILELIST*::
1490 When matching the file list, check every file of the package not just the
1491 subset from the primary metadata.
1493 *SEARCH_CHECKSUMS*::
1494 Allow the matching of checksum entries.
1498 void prepend_keyname(Id keyname);
1499 $di->prepend_keyname($keyname);
1500 di.prepend_keyname(keyname)
1501 di.prepend_keyname(keyname)
1503 Do a sub-search in the array stored in keyname.
1505 void skip_solvable();
1506 $di->kip_solvable();
1510 Stop matching the current solvable and advance to the next
1518 Iterate through the matches. If there is a match, the object
1519 in d will be of type Datamatch.
1523 Objects of this type will be created for every value matched
1528 Pool *pool; /* read only */
1533 Back pointer to pool.
1535 Repo *repo; /* read only */
1540 The repository containing the matched object.
1542 Solvable *solvable; /* read only */
1547 The solvable containing the value that was matched.
1549 Id solvid; /* read only */
1554 The id of the solvable that matched.
1561 const char *key_idstr;
1566 The keyname that matched, either as id or string.
1573 const char *type_idstr;
1578 The key type of the value that was matched, either as id or string.
1590 The Id of the value that was matched (only valid for id types),
1591 either as id or string.
1598 The string value that was matched (only valid for string types).
1600 unsigned long long num;
1605 The numeric value that was matched (only valid for numeric types).
1612 The secondary numeric value that was matched (only valid for types
1613 containing two values).
1615 unsigned int binary;
1620 The value in binary form, useful for checksums and other data
1621 that cannot be represented as a string.
1626 my $pos = $d->pos();
1630 The position object of the current match. It can be used to do
1631 sub-searches starting at the match (if it is of an array type).
1632 See the Datapos class for more information.
1634 Datapos parentpos();
1635 my $pos = $d->parentpos();
1639 The position object of the array containing the current match.
1640 It can be used to do sub-searches, see the Datapos class for more
1648 Return the stringification of the matched value. Stringification
1649 depends on the search flags, for file list entries it will return
1650 just the base name unless SEARCH_FILES is used, for checksums
1651 it will return an empty string unless SEARCH_CHECKSUMS is used.
1652 Numeric values are currently stringified to an empty string.
1657 Selections are a way to easily deal with sets of packages.
1658 There are multiple constructors to create them, the most useful
1659 is probably the select() method in the Pool class.
1664 Create the selection by matching package names.
1666 *SELECTION_PROVIDES*::
1667 Create the selection by matching package provides.
1669 *SELECTION_FILELIST*::
1670 Create the selection by matching package files.
1673 Create the selection by matching the canonical representation
1674 of the package. This is normally a combination of the name,
1675 the version, and the architecture of a package.
1677 *SELECTION_DOTARCH*::
1678 Allow an ``.<architecture>'' suffix when matching names or
1682 Allow the specification of a relation when matching names
1683 or provides, e.g. "name >= 1.2".
1685 *SELECTION_INSTALLED_ONLY*::
1686 Limit the package search to installed packages.
1688 *SELECTION_SOURCE_ONLY*::
1689 Limit the package search to source packages only.
1691 *SELECTION_WITH_SOURCE*::
1692 Extend the package search to also match source packages. The default is
1693 only to match binary packages.
1696 Allow glob matching for package names, package provides, and file names.
1698 *SELECTION_NOCASE*::
1699 Ignore case when matching package names, package provides, and file names.
1702 Return only one selection element describing the selected packages.
1703 The default is to create multiple elements for all globbed packages.
1704 Multiple elements are useful if you want to turn the selection into
1705 an install job, in that case you want an install job for every
1710 Pool *pool; /* read only */
1715 Back pointer to pool.
1720 my $flags = $sel->flags();
1724 Return the result flags of the selection. The flags are a subset
1725 of the ones used when creating the selection, they describe which
1726 method was used to get the result. For example, if you create the
1727 selection with ``SELECTION_NAME | SELECTION_PROVIDES'', the resulting
1728 flags will either be SELECTION_NAME or SELECTION_PROVIDES depending
1729 if there was a package that matched the name or not. If there was
1730 no match at all, the flags will be zero.
1737 Return true if the selection is empty, i.e. no package could be matched.
1739 void filter(Selection *other)
1740 $sel->filter($other);
1744 Intersect two selections. Packages will only stay in the selection if there
1745 are also included in the other selecting. Does an in-place modification.
1747 void add(Selection *other)
1752 Build the union of two selections. All packages of the other selection will
1753 be added to the set of packages of the selection object. Does an in-place
1754 modification. Note that the selection flags are no longer meaningful after the
1757 void add_raw(Id how, Id what)
1758 $sel->add_raw($how, $what);
1759 sel.add_raw(how, what)
1760 sel.add_raw(how, what)
1762 Add a raw element to the selection. Check the Job class for information about
1763 the how and what parameters.
1765 Job *jobs(int action)
1766 my @jobs = $sel->jobs($action);
1767 jobs = sel.jobs(action)
1768 jobs = sel.jobs(action)
1770 Convert a selection into an array of Job objects. The action parameter is or-ed
1771 to the ``how'' part of the job, it describes the type of job (e.g. install,
1772 erase). See the Job class for the action and action modifier constants.
1774 Solvable *solvables()
1775 my @solvables = $sel->solvables();
1776 solvables = sel.solvables()
1777 solvables = sel.solvables()
1779 Convert a selection into an array of Solvable objects.
1782 my $str = $sel->str;
1786 Return a string describing the selection.
1790 Jobs are the way to specify to the dependency solver what to do.
1791 Most of the times jobs will get created by calling the jobs() method
1792 on a Selection object, but there is also a Job() constructor in the
1797 Selection constants:
1800 The ``what'' part is the id of a solvable.
1802 *SOLVER_SOLVABLE_NAME*::
1803 The ``what'' part is the id of a package name.
1805 *SOLVER_SOLVABLE_PROVIDES*::
1806 The ``what'' part is the id of a package provides.
1808 *SOLVER_SOLVABLE_ONE_OF*::
1809 The ``what'' part is an offset into the ``whatprovides'' data, created
1810 by calling the towhatprovides() pool method.
1812 *SOLVER_SOLVABLE_REPO*::
1813 The ``what'' part is the id of a repository.
1815 *SOLVER_SOLVABLE_ALL*::
1816 The ``what'' part is ignored, all packages are selected.
1818 *SOLVER_SOLVABLE_SELECTMASK*::
1819 A mask containing all the above selection bits.
1827 Install a package of the specified set of packages. It tries to install
1828 the best matching package (i.e. the highest version of the packages from
1829 the repositories with the highest priority).
1832 Erase all of the packages from the specified set. If a package is not
1833 installed, erasing it will keep it from getting installed.
1836 Update the matching installed packages to their best version. If none
1837 of the specified packages are installed, try to update the installed
1838 packages to the specified versions. See the section about targeted
1839 updates about more information.
1841 *SOLVER_WEAKENDEPS*::
1842 Allow to break the dependencies of the matching packages. Handle with care.
1844 *SOLVER_MULTIVERSION*::
1845 Mark the matched packages for multiversion install. If they get to be
1846 installed because of some other job, the installation will keep the old
1847 version of the package installed (for rpm this is done by using ``-i''
1851 Do not change the state of the matched packages, i.e. when they are
1852 installed they stay installed, if not they are not selected for
1855 *SOLVER_DISTUPGRADE*::
1856 Update the matching installed packages to the best version included in one
1857 of the repositories. After this operation, all come from one of the available
1858 repositories except orphaned packages. Orphaned packages are packages that
1859 have no relation to the packages in the repositories, i.e. no package in the
1860 repositories have the same name or obsolete the orphaned package.
1861 This action brings the installed packages in sync with the ones in the
1862 repository. By default it also turns of arch/vendor/version locking for the
1863 affected packages to simulate a fresh installation. This means that distupgrade can
1864 actually downgrade packages if only lower versions of a package are available
1865 in the repositories. You can tweak this behavior with the SOLVER_FLAG_DUP_
1868 *SOLVER_DROP_ORPHANED*::
1869 Erase all the matching installed packages if they are orphaned. This only makes
1870 sense if there is a ``distupgrade all packages'' job. The default is to erase
1871 orphaned packages only if they block the installation of other packages.
1874 Fix dependency problems of matching installed packages. The default is to ignore
1875 dependency problems for installed packages.
1877 *SOLVER_USERINSTALLED*::
1878 The matching installed packages are considered to be installed by a user,
1879 thus not installed to fulfill some dependency. This is needed input for
1880 the calculation of unneeded packages for jobs that have the
1881 SOLVER_CLEANDEPS flag set.
1883 *SOLVER_ALLOWUNINSTALL*::
1884 Allow the solver to deinstall the matching installed packages if they get
1885 into the way of resolving a dependency. This is like the
1886 SOLVER_FLAG_ALLOW_UNINSTALL flag, but limited to a specific set of packages.
1889 Prefer the specified packages if the solver encounters an alternative. If
1890 a job contains multiple matching favor/disfavor elements, the last one takes
1894 Avoid the specified packages if the solver encounters an alternative. This
1895 can also be used to block recommended or supplemented packages from being
1899 A mask containing all the above action bits.
1901 Action modifier constants:
1904 Makes the job a weak job. The solver tries to fulfill weak jobs, but does
1905 not report a problem if it is not possible to do so.
1907 *SOLVER_ESSENTIAL*::
1908 Makes the job an essential job. If there is a problem with the job, the
1909 solver will not propose to remove the job as one solution (unless all
1910 other solutions are also to remove essential jobs).
1912 *SOLVER_CLEANDEPS*::
1913 The solver will try to also erase all packages dragged in through
1914 dependencies when erasing the package. This needs SOLVER_USERINSTALLED
1915 jobs to maximize user satisfaction.
1917 *SOLVER_FORCEBEST*::
1918 Insist on the best package for install, update, and distupgrade jobs. If
1919 this flag is not used, the solver will use the second-best package if the
1920 best package cannot be installed for some reason. When this flag is used,
1921 the solver will generate a problem instead.
1924 Forces targeted operation update and distupgrade jobs. See the section
1925 about targeted updates about more information.
1930 The job specified the exact epoch and version of the package set.
1933 The job specified the exact epoch, version, and release of the package set.
1936 The job specified the exact architecture of the packages from the set.
1938 *SOLVER_SETVENDOR*::
1939 The job specified the exact vendor of the packages from the set.
1942 The job specified the exact repository of the packages from the set.
1945 The job specified the exact name of the packages from the set.
1947 *SOLVER_NOAUTOSET*::
1948 Turn of automatic set flag generation for SOLVER_SOLVABLE jobs.
1951 A mask containing all the above set bits.
1953 See the section about set bits for more information.
1957 Pool *pool; /* read only */
1962 Back pointer to pool.
1964 Id how; /* read/write */
1969 Union of the selection, action, action modifier, and set flags.
1970 The selection part describes the semantics of the ``what'' Id.
1972 Id what; /* read/write */
1977 Id describing the set of packages, the meaning depends on the
1978 selection part of the ``how'' attribute.
1982 Solvable *solvables()
1983 my @solvables = $job->solvables();
1984 solvables = job.solvables()
1985 solvables = job.solvables()
1987 Return the set of solvables of the job as an array of Solvable
1990 bool isemptyupdate();
1991 $job->isemptyupdate()
1995 Convenience function to find out if the job describes an update
1996 job with no matching packages, i.e. a job that does nothing.
1997 Some package managers like ``zypper'' like to turn those jobs
1998 into install jobs, i.e. an update of a not-installed package
1999 will result into the installation of the package.
2002 my $str = $job->str;
2006 Return a string describing the job.
2013 Two jobs are equal if they belong to the same pool and both the
2014 ``how'' and the ``what'' attributes are the same.
2016 === TARGETED UPDATES ===
2017 Libsolv has two modes for upgrades and distupgrade: targeted and
2018 untargeted. Untargeted mode means that the installed packages from
2019 the specified set will be updated to the best version. Targeted means
2020 that packages that can be updated to a package in the specified set
2021 will be updated to the best package of the set.
2023 Here's an example to explain the subtle difference. Suppose that
2024 you have package A installed in version "1.1", "A-1.2" is available
2025 in one of the repositories and there is also package "B" that
2026 obsoletes package A.
2028 An untargeted update of "A" will update the installed "A-1.1" to
2029 package "B", because that is the newest version (B obsoletes A and
2032 A targeted update of "A" will update "A-1.1" to "A-1.2", as the
2033 set of packages contains both "A-1.1" and "A-1.2", and "A-1.2" is
2036 An untargeted update of "B" will do nothing, as "B" is not installed.
2038 An targeted update of "B" will update "A-1.1" to "B".
2040 Note that the default is to do "auto-targeting", thus if the specified
2041 set of packages does not include an installed package, the solver
2042 will assume targeted operation even if SOLVER_TARGETED is not used.
2044 This mostly matches the intent of the user, with one exception: In
2045 the example above, an update of "A-1.2" will update "A-1.1" to
2046 "A-1.2" (targeted mode), but a second update of "A-1.2" will suddenly
2047 update to "B", as untargeted mode is chosen because "A-1.2" is now
2050 If you want to have full control over when targeting mode is chosen,
2051 turn off auto-targeting with the SOLVER_FLAG_NO_AUTOTARGET solver option.
2052 In that case, all updates are considered to be untargeted unless they
2053 include the SOLVER_TARGETED flag.
2056 Set bits specify which parts of the specified packages where specified
2057 by the user. It is used by the solver when checking if an operation is
2058 allowed or not. For example, the solver will normally not allow the
2059 downgrade of an installed package. But it will not report a problem if
2060 the SOLVER_SETEVR flag is used, as it then assumes that the user specified
2061 the exact version and thus knows what he is doing.
2063 So if a package "screen-1-1" is installed for the x86_64 architecture and
2064 version "2-1" is only available for the i586 architecture, installing
2065 package "screen-2.1" will ask the user for confirmation because of the
2066 different architecture. When using the Selection class to create jobs
2067 the set bits are automatically added, e.g. selecting ``screen.i586'' will
2068 automatically add SOLVER_SETARCH, and thus no problem will be reported.
2072 Dependency solving is what this library is about. A solver object is needed
2073 for solving to store the result of the solver run. The solver object can be
2074 used multiple times for different jobs, reusing it allows the solver to
2075 re-use the dependency rules it already computed.
2079 Flags to modify some of the solver's behavior:
2081 *SOLVER_FLAG_ALLOW_DOWNGRADE*::
2082 Allow the solver to downgrade packages without asking for confirmation
2083 (i.e. reporting a problem).
2085 *SOLVER_FLAG_ALLOW_ARCHCHANGE*::
2086 Allow the solver to change the architecture of an installed package
2087 without asking for confirmation. Note that changes to/from noarch
2088 are always considered to be allowed.
2090 *SOLVER_FLAG_ALLOW_VENDORCHANGE*::
2091 Allow the solver to change the vendor of an installed package
2092 without asking for confirmation. Each vendor is part of one or more
2093 vendor equivalence classes, normally installed packages may only
2094 change their vendor if the new vendor shares at least one equivalence
2097 *SOLVER_FLAG_ALLOW_NAMECHANGE*::
2098 Allow the solver to change the name of an installed package, i.e.
2099 install a package with a different name that obsoletes the installed
2100 package. This option is on by default.
2102 *SOLVER_FLAG_ALLOW_UNINSTALL*::
2103 Allow the solver to erase installed packages to fulfill the jobs.
2104 This flag also includes the above flags. You may want to set this
2105 flag if you only have SOLVER_ERASE jobs, as in that case it's
2106 better for the user to check the transaction overview instead of
2107 approving every single package that needs to be erased.
2109 *SOLVER_FLAG_DUP_ALLOW_DOWNGRADE*::
2110 Like SOLVER_FLAG_ALLOW_DOWNGRADE, but used in distupgrade mode.
2112 *SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE*::
2113 Like SOLVER_FLAG_ALLOW_ARCHCHANGE, but used in distupgrade mode.
2115 *SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE*::
2116 Like SOLVER_FLAG_ALLOW_VENDORCHANGE, but used in distupgrade mode.
2118 *SOLVER_FLAG_DUP_ALLOW_NAMECHANGE*::
2119 Like SOLVER_FLAG_ALLOW_NAMECHANGE, but used in distupgrade mode.
2121 *SOLVER_FLAG_NO_UPDATEPROVIDE*::
2122 If multiple packages obsolete an installed package, the solver checks
2123 the provides of every such package and ignores all packages that
2124 do not provide the installed package name. Thus, you can have an
2125 official update candidate that provides the old name, and other
2126 packages that also obsolete the package but are not considered for
2127 updating. If you cannot use this feature, you can turn it off
2128 by setting this flag.
2130 *SOLVER_FLAG_NEED_UPDATEPROVIDE*::
2131 This is somewhat the opposite of SOLVER_FLAG_NO_UPDATEPROVIDE: Only
2132 packages that provied the installed package names are considered
2135 *SOLVER_FLAG_SPLITPROVIDES*::
2136 Make the solver aware of special provides of the form
2137 ``<packagename>:<path>'' used in SUSE systems to support package
2140 *SOLVER_FLAG_IGNORE_RECOMMENDED*::
2141 Do not process optional (aka weak) dependencies.
2143 *SOLVER_FLAG_ADD_ALREADY_RECOMMENDED*::
2144 Install recommended or supplemented packages even if they have no
2145 connection to the current transaction. You can use this feature
2146 to implement a simple way for the user to install new recommended
2147 packages that were not available in the past.
2149 *SOLVER_FLAG_NO_INFARCHCHECK*::
2150 Turn off the inferior architecture checking that is normally done
2151 by the solver. Normally, the solver allows only the installation
2152 of packages from the "best" architecture if a package is available
2153 for multiple architectures.
2155 *SOLVER_FLAG_BEST_OBEY_POLICY*::
2156 Make the SOLVER_FORCEBEST job option consider only packages that
2157 meet the policies for installed packages, i.e. no downgrades,
2158 no architecture change, no vendor change (see the first flags
2159 of this section). If the flag is not specified, the solver will
2160 enforce the installation of the best package ignoring the
2161 installed packages, which may conflict with the set policy.
2163 *SOLVER_FLAG_NO_AUTOTARGET*::
2164 Do not enable auto-targeting up update and distupgrade jobs. See
2165 the section on targeted updates for more information.
2167 *SOLVER_FLAG_KEEP_ORPHANS*::
2168 Do not allow orphaned packages to be deinstalled if they get
2169 in the way of resolving other packages.
2171 *SOLVER_FLAG_BREAK_ORPHANS*::
2172 Ignore dependencies of orphaned packages that get in the way
2173 of resolving non-orphaned ones. Setting the flag might result
2174 in no longer working packages in case they are orphaned.
2176 *SOLVER_FLAG_FOCUS_INSTALLED*::
2177 Resolve installed packages before resolving the given jobs.
2178 Setting this flag means that the solver will prefer picking
2179 a package version that fits the other installed packages
2180 over updating installed packages.
2182 *SOLVER_FLAG_FOCUS_BEST*::
2183 First resolve the given jobs, then the dependencies of the
2184 resulting packages, then resolve all already installed
2185 packages. This will result in more packages being updated
2186 as when the flag is not used.
2188 *SOLVER_FLAG_INSTALL_ALSO_UPDATES*::
2189 Update the package if a job is already fulfilled by an installed
2192 *SOLVER_FLAG_YUM_OBSOLETES*::
2193 Turn on yum-like package split handling. See the yum documentation
2196 *SOLVER_FLAG_URPM_REORDER*::
2197 Turn on urpm like package reordering for kernel packages. See
2198 the urpm documentation for more details.
2204 *SOLVER_RULE_UNKNOWN*::
2205 A rule of an unknown class. You should never encounter those.
2208 A package dependency rule.
2210 *SOLVER_RULE_UPDATE*::
2211 A rule to implement the update policy of installed packages. Every
2212 installed package has an update rule that consists of the packages
2213 that may replace the installed package.
2215 *SOLVER_RULE_FEATURE*::
2216 Feature rules are fallback rules used when an update rule is disabled. They
2217 include all packages that may replace the installed package ignoring the
2218 update policy, i.e. they contain downgrades, arch changes and so on.
2219 Without them, the solver would simply erase installed packages if their
2220 update rule gets disabled.
2223 Job rules implement the job given to the solver.
2225 *SOLVER_RULE_DISTUPGRADE*::
2226 These are simple negative assertions that make sure that only packages
2227 are kept that are also available in one of the repositories.
2229 *SOLVER_RULE_INFARCH*::
2230 Infarch rules are also negative assertions, they disallow the installation
2231 of packages when there are packages of the same name but with a better
2234 *SOLVER_RULE_CHOICE*::
2235 Choice rules are used to make sure that the solver prefers updating to
2236 installing different packages when some dependency is provided by
2237 multiple packages with different names. The solver may always break
2238 choice rules, so you will not see them when a problem is found.
2240 *SOLVER_RULE_LEARNT*::
2241 These rules are generated by the solver to keep it from running into
2242 the same problem multiple times when it has to backtrack. They are
2243 the main reason why a sat solver is faster than other dependency solver
2246 Special dependency rule types:
2248 *SOLVER_RULE_PKG_NOT_INSTALLABLE*::
2249 This rule was added to prevent the installation of a package of an
2250 architecture that does not work on the system.
2252 *SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP*::
2253 The package contains a required dependency which was not provided by
2256 *SOLVER_RULE_PKG_REQUIRES*::
2257 Similar to SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP, but in this case
2258 some packages provided the dependency but none of them could be
2259 installed due to other dependency issues.
2261 *SOLVER_RULE_PKG_SELF_CONFLICT*::
2262 The package conflicts with itself. This is not allowed by older rpm
2265 *SOLVER_RULE_PKG_CONFLICTS*::
2266 To fulfill the dependencies two packages need to be installed, but
2267 one of the packages contains a conflict with the other one.
2269 *SOLVER_RULE_PKG_SAME_NAME*::
2270 The dependencies can only be fulfilled by multiple versions of
2271 a package, but installing multiple versions of the same package
2274 *SOLVER_RULE_PKG_OBSOLETES*::
2275 To fulfill the dependencies two packages need to be installed, but
2276 one of the packages obsoletes the other one.
2278 *SOLVER_RULE_PKG_IMPLICIT_OBSOLETES*::
2279 To fulfill the dependencies two packages need to be installed, but
2280 one of the packages has provides a dependency that is obsoleted
2281 by the other one. See the POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES
2284 *SOLVER_RULE_PKG_INSTALLED_OBSOLETES*::
2285 To fulfill the dependencies a package needs to be installed that is
2286 obsoleted by an installed package. See the POOL_FLAG_NOINSTALLEDOBSOLETES
2289 *SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP*::
2290 The user asked for installation of a package providing a specific
2291 dependency, but no available package provides it.
2293 *SOLVER_RULE_JOB_UNKNOWN_PACKAGE*::
2294 The user asked for installation of a package with a specific name,
2295 but no available package has that name.
2297 *SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM*::
2298 The user asked for the erasure of a dependency that is provided by the
2299 system (i.e. for special hardware or language dependencies), this
2300 cannot be done with a job.
2302 *SOLVER_RULE_JOB_UNSUPPORTED*::
2303 The user asked for something that is not yet implemented, e.g. the
2304 installation of all packages at once.
2306 Policy error constants
2308 *POLICY_ILLEGAL_DOWNGRADE*::
2309 The solver ask for permission before downgrading packages.
2311 *POLICY_ILLEGAL_ARCHCHANGE*::
2312 The solver ask for permission before changing the architecture of installed
2315 *POLICY_ILLEGAL_VENDORCHANGE*::
2316 The solver ask for permission before changing the vendor of installed
2319 *POLICY_ILLEGAL_NAMECHANGE*::
2320 The solver ask for permission before replacing an installed packages with
2321 a package that has a different name.
2323 Solution element type constants
2325 *SOLVER_SOLUTION_JOB*::
2326 The problem can be solved by removing the specified job.
2328 *SOLVER_SOLUTION_POOLJOB*::
2329 The problem can be solved by removing the specified job that is defined
2332 *SOLVER_SOLUTION_INFARCH*::
2333 The problem can be solved by allowing the installation of the specified
2334 package with an inferior architecture.
2336 *SOLVER_SOLUTION_DISTUPGRADE*::
2337 The problem can be solved by allowing to keep the specified package
2340 *SOLVER_SOLUTION_BEST*::
2341 The problem can be solved by allowing to install the specified package
2342 that is not the best available package.
2344 *SOLVER_SOLUTION_ERASE*::
2345 The problem can be solved by allowing to erase the specified package.
2347 *SOLVER_SOLUTION_REPLACE*::
2348 The problem can be solved by allowing to replace the package with some
2351 *SOLVER_SOLUTION_REPLACE_DOWNGRADE*::
2352 The problem can be solved by allowing to replace the package with some
2353 other package that has a lower version.
2355 *SOLVER_SOLUTION_REPLACE_ARCHCHANGE*::
2356 The problem can be solved by allowing to replace the package with some
2357 other package that has a different architecture.
2359 *SOLVER_SOLUTION_REPLACE_VENDORCHANGE*::
2360 The problem can be solved by allowing to replace the package with some
2361 other package that has a different vendor.
2363 *SOLVER_SOLUTION_REPLACE_NAMECHANGE*::
2364 The problem can be solved by allowing to replace the package with some
2365 other package that has a different name.
2370 *SOLVER_REASON_UNRELATED*::
2371 The package status did not change as it was not related to any job.
2373 *SOLVER_REASON_UNIT_RULE*::
2374 The package was installed/erased/kept because of a unit rule, i.e. a rule
2375 where all literals but one were false.
2377 *SOLVER_REASON_KEEP_INSTALLED*::
2378 The package was chosen when trying to keep as many packages installed as
2381 *SOLVER_REASON_RESOLVE_JOB*::
2382 The decision happened to fulfill a job rule.
2384 *SOLVER_REASON_UPDATE_INSTALLED*::
2385 The decision happened to fulfill a package update request.
2387 *SOLVER_REASON_CLEANDEPS_ERASE*::
2388 The package was erased when cleaning up dependencies from other erased
2391 *SOLVER_REASON_RESOLVE*::
2392 The package was installed to fulfill package dependencies.
2394 *SOLVER_REASON_WEAKDEP*::
2395 The package was installed because of a weak dependency (Recommends or
2398 *SOLVER_REASON_RESOLVE_ORPHAN*::
2399 The decision about the package was made when deciding the fate of orphaned
2402 *SOLVER_REASON_RECOMMENDED*::
2403 This is a special case of SOLVER_REASON_WEAKDEP.
2405 *SOLVER_REASON_SUPPLEMENTED*::
2406 This is a special case of SOLVER_REASON_WEAKDEP.
2411 Pool *pool; /* read only */
2416 Back pointer to pool.
2420 int set_flag(int flag, int value)
2421 my $oldvalue = $solver->set_flag($flag, $value);
2422 oldvalue = solver.set_flag(flag, value)
2423 oldvalue = solver.set_flag(flag, value)
2425 int get_flag(int flag)
2426 my $value = $solver->get_flag($flag);
2427 value = solver.get_flag(flag)
2428 value = solver.get_flag(flag)
2430 Set/get a solver specific flag. The flags define the policies the solver has
2431 to obey. The flags are explained in the CONSTANTS section of this class.
2433 Problem *solve(Job *jobs)
2434 my @problems = $solver->solve(\@jobs);
2435 problems = solver.solve(jobs)
2436 problems = solver.solve(jobs)
2438 Solve a problem specified in the job list (plus the jobs defined in the pool).
2439 Returns an array of problems that need user interaction, or an empty array
2440 if no problems were encountered. See the Problem class on how to deal with
2443 Transaction transaction()
2444 my $trans = $solver->transaction();
2445 trans = solver.transaction()
2446 trans = solver.transaction()
2448 Return the transaction to implement the calculated package changes. A transaction
2449 is available even if problems were found, this is useful for interactive user
2450 interfaces that show both the job result and the problems.
2452 int reason = describe_decision(Solvable *s, Rule *OUTPUT)
2453 my ($reason, $rule) = $solver->describe_decision($solvable);
2454 (reason, rule) = solver.describe_decision(solvable)
2455 (reason, rule) = solver.describe_decision(solvable)
2457 Return the reason why a specific solvable was installed or erased. For most of
2458 the reasons the rule that triggered the decision is also returned.
2462 Problems are the way of the solver to interact with the user. You can simply list
2463 all problems and terminate your program, but a better way is to present solutions to
2464 the user and let him pick the ones he likes.
2468 Solver *solv; /* read only */
2473 Back pointer to solver object.
2475 Id id; /* read only */
2480 Id of the problem. The first problem has Id 1, they are numbered consecutively.
2484 Rule findproblemrule()
2485 my $probrule = $problem->findproblemrule();
2486 probrule = problem.findproblemrule()
2487 probrule = problem.findproblemrule()
2489 Return the rule that caused the problem. Of course in most situations there is no
2490 single responsible rule, but many rules that interconnect with each created the
2491 problem. Nevertheless, the solver uses some heuristic approach to find a rule
2492 that somewhat describes the problem best to the user.
2494 Rule *findallproblemrules(bool unfiltered = 0)
2495 my @probrules = $problem->findallproblemrules();
2496 probrules = problem.findallproblemrule()
2497 probrules = problem.findallproblemrule()
2499 Return all rules responsible for the problem. The returned set of rules contains
2500 all the needed information why there was a problem, but it's hard to present
2501 them to the user in a sensible way. The default is to filter out all update and
2502 job rules (unless the returned rules only consist of those types).
2504 Solution *solutions()
2505 my @solutions = $problem->solutions();
2506 solutions = problem.solutions()
2507 solutions = problem.solutions()
2509 Return an array containing multiple possible solutions to fix the problem. See
2510 the solution class for more information.
2512 int solution_count()
2513 my $cnt = $problem->solution_count();
2514 cnt = problem.solution_count()
2515 cnt = problem.solution_count()
2517 Return the number of solutions without creating solution objects.
2520 my $str = $problem->str;
2524 Return a string describing the problem. This is a convenience function, it is
2525 a shorthand for calling findproblemrule(), then ruleinfo() on the problem
2526 rule and problemstr() on the ruleinfo object.
2530 Rules are the basic block of sat solving. Each package dependency gets translated
2531 into one or multiple rules.
2535 Solver *solv; /* read only */
2540 Back pointer to solver object.
2542 Id id; /* read only */
2549 int type; /* read only */
2554 The basic type of the rule. See the constant section of the solver class for the type list.
2559 my $ruleinfo = $rule->info();
2560 ruleinfo = rule.info()
2561 ruleinfo = rule.info()
2563 Return a Ruleinfo object that contains information about why the rule was created. But
2564 see the allinfos() method below.
2566 Ruleinfo *allinfos()
2567 my @ruleinfos = $rule->allinfos();
2568 ruleinfos = rule.allinfos()
2569 ruleinfos = rule.allinfos()
2571 As the same dependency rule can get created because of multiple dependencies, one
2572 Ruleinfo is not enough to describe the reason. Thus the allinfos() method returns
2573 an array of all infos about a rule.
2576 if ($rule1 == $rule2)
2580 Two rules are equal if they belong to the same solver and have the same id.
2584 A Ruleinfo describes one reason why a rule was created.
2588 Solver *solv; /* read only */
2593 Back pointer to solver object.
2595 int type; /* read only */
2600 The type of the ruleinfo. See the constant section of the solver class for the
2601 rule type list and the special type list.
2603 Dep *dep; /* read only */
2608 The dependency leading to the creation of the rule.
2610 Dep *dep_id; /* read only */
2611 $ruleinfo->{'dep_id'}
2615 The Id of the dependency leading to the creation of the rule, or zero.
2617 Solvable *solvable; /* read only */
2618 $ruleinfo->{solvable}
2622 The involved Solvable, e.g. the one containing the dependency.
2624 Solvable *othersolvable; /* read only */
2625 $ruleinfo->{othersolvable}
2626 ruleinfo.othersolvable
2627 ruleinfo.othersolvable
2629 The other involved Solvable (if any), e.g. the one containing providing
2630 the dependency for conflicts.
2632 const char *problemstr();
2633 my $str = $ruleinfo->problemstr();
2634 str = ruleinfo.problemstr()
2635 str = ruleinfo.problemstr()
2637 A string describing the ruleinfo from a problem perspective. This probably
2638 only makes sense if the rule is part of a problem.
2642 A solution solves one specific problem. It consists of multiple solution elements
2643 that all need to be executed.
2647 Solver *solv; /* read only */
2652 Back pointer to solver object.
2654 Id problemid; /* read only */
2655 $solution->{problemid}
2659 Id of the problem the solution solves.
2661 Id id; /* read only */
2666 Id of the solution. The first solution has Id 1, they are numbered consecutively.
2670 Solutionelement *elements(bool expandreplaces = 0)
2671 my @solutionelements = $solution->elements();
2672 solutionelements = solution.elements()
2673 solutionelements = solution.elements()
2675 Return an array containing the elements describing what needs to be done to
2676 implement the specific solution. If expandreplaces is true, elements of type
2677 SOLVER_SOLUTION_REPLACE will be replaced by one or more elements replace
2678 elements describing the policy mismatches.
2681 my $cnt = $solution->solution_count();
2682 cnt = solution.element_count()
2683 cnt = solution.element_count()
2685 Return the number of solution elements without creating objects. Note that the
2686 count does not match the number of objects returned by the elements() method
2687 of expandreplaces is set to true.
2690 The Solutionelement Class
2691 -------------------------
2692 A solution element describes a single action of a solution. The action is always
2693 either to remove one specific job or to add a new job that installs or erases
2694 a single specific package.
2698 Solver *solv; /* read only */
2699 $solutionelement->{solv}
2700 solutionelement.solv
2701 solutionelement.solv
2703 Back pointer to solver object.
2705 Id problemid; /* read only */
2706 $solutionelement->{problemid}
2707 solutionelement.problemid
2708 solutionelement.problemid
2710 Id of the problem the element (partly) solves.
2712 Id solutionid; /* read only */
2713 $solutionelement->{solutionid}
2714 solutionelement.solutionid
2715 solutionelement.solutionid
2717 Id of the solution the element is a part of.
2719 Id id; /* read only */
2720 $solutionelement->{id}
2724 Id of the solution element. The first element has Id 1, they are numbered consecutively.
2726 Id type; /* read only */
2727 $solutionelement->{type}
2728 solutionelement.type
2729 solutionelement.type
2731 Type of the solution element. See the constant section of the solver class for the
2734 Solvable *solvable; /* read only */
2735 $solutionelement->{solvable}
2736 solutionelement.solvable
2737 solutionelement.solvable
2739 The installed solvable that needs to be replaced for replacement elements.
2741 Solvable *replacement; /* read only */
2742 $solutionelement->{replacement}
2743 solutionelement.replacement
2744 solutionelement.replacement
2746 The solvable that needs to be installed to fix the problem.
2748 int jobidx; /* read only */
2749 $solutionelement->{jobidx}
2750 solutionelement.jobidx
2751 solutionelement.jobidx
2753 The index of the job that needs to be removed to fix the problem, or -1 if the
2754 element is of another type. Note that it's better to change the job to SOLVER_NOOP
2755 type so that the numbering of other elements does not get disturbed. This
2756 method works both for types SOLVER_SOLUTION_JOB and SOLVER_SOLUTION_POOLJOB.
2760 Solutionelement *replaceelements()
2761 my @solutionelements = $solutionelement->replaceelements();
2762 solutionelements = solutionelement.replaceelements()
2763 solutionelements = solutionelement.replaceelements()
2765 If the solution element is of type SOLVER_SOLUTION_REPLACE, return an array of
2766 elements describing the policy mismatches, otherwise return a copy of the
2767 element. See also the ``expandreplaces'' option in the solution's elements()
2770 int illegalreplace()
2771 my $illegal = $solutionelement->illegalreplace();
2772 illegal = solutionelement.illegalreplace()
2773 illegal = solutionelement.illegalreplace()
2775 Return an integer that contains the policy mismatch bits or-ed together, or
2776 zero if there was no policy mismatch. See the policy error constants in
2780 my $job = $solutionelement->Job();
2781 illegal = solutionelement.Job()
2782 illegal = solutionelement.Job()
2784 Create a job that implements the solution element. Add this job to the array
2785 of jobs for all elements of type different to SOLVER_SOLUTION_JOB and
2786 SOLVER_SOLUTION_POOLJOB. For the later two, a SOLVER_NOOB Job is created,
2787 you should replace the old job with the new one.
2790 my $str = $solutionelement->str();
2791 str = solutionelement.str()
2792 str = solutionelement.str()
2794 A string describing the change the solution element consists of.
2796 The Transaction Class
2797 ---------------------
2798 Transactions describe the output of a solver run. A transaction contains
2799 a number of transaction elements, each either the installation of a new
2800 package or the removal of an already installed package. The Transaction
2801 class supports a classify() method that puts the elements into different
2802 groups so that a transaction can be presented to the user in a meaningful
2807 Transaction element types, both active and passive
2809 *SOLVER_TRANSACTION_IGNORE*::
2810 This element does nothing. Used to map element types that do not match
2813 *SOLVER_TRANSACTION_INSTALL*::
2814 This element installs a package.
2816 *SOLVER_TRANSACTION_ERASE*::
2817 This element erases a package.
2819 *SOLVER_TRANSACTION_MULTIINSTALL*::
2820 This element installs a package with a different version keeping the other
2823 *SOLVER_TRANSACTION_MULTIREINSTALL*::
2824 This element reinstalls an installed package keeping the other versions
2827 Transaction element types, active view
2829 *SOLVER_TRANSACTION_REINSTALL*::
2830 This element re-installs a package, i.e. installs the same package again.
2832 *SOLVER_TRANSACTION_CHANGE*::
2833 This element installs a package with same name, version, architecture but
2836 *SOLVER_TRANSACTION_UPGRADE*::
2837 This element installs a newer version of an installed package.
2839 *SOLVER_TRANSACTION_DOWNGRADE*::
2840 This element installs an older version of an installed package.
2842 *SOLVER_TRANSACTION_OBSOLETES*::
2843 This element installs a package that obsoletes an installed package.
2845 Transaction element types, passive view
2847 *SOLVER_TRANSACTION_REINSTALLED*::
2848 This element re-installs a package, i.e. installs the same package again.
2850 *SOLVER_TRANSACTION_CHANGED*::
2851 This element replaces an installed package with one of the same name,
2852 version, architecture but different content.
2854 *SOLVER_TRANSACTION_UPGRADED*::
2855 This element replaces an installed package with a new version.
2857 *SOLVER_TRANSACTION_DOWNGRADED*::
2858 This element replaces an installed package with an old version.
2860 *SOLVER_TRANSACTION_OBSOLETED*::
2861 This element replaces an installed package with a package that obsoletes
2864 Pseudo element types for showing extra information used by classify()
2866 *SOLVER_TRANSACTION_ARCHCHANGE*::
2867 This element replaces an installed package with a package of a different
2870 *SOLVER_TRANSACTION_VENDORCHANGE*::
2871 This element replaces an installed package with a package of a different
2874 Transaction mode flags
2876 *SOLVER_TRANSACTION_SHOW_ACTIVE*::
2877 Filter for active view types. The default is to return passive view type,
2878 i.e. to show how the installed packages get changed.
2880 *SOLVER_TRANSACTION_SHOW_OBSOLETES*::
2881 Do not map the obsolete view type into INSTALL/ERASE elements.
2883 *SOLVER_TRANSACTION_SHOW_ALL*::
2884 If multiple packages replace an installed package, only the best of them
2885 is kept as OBSOLETE element, the other ones are mapped to INSTALL/ERASE
2886 elements. This is because most applications want to show just one package
2887 replacing the installed one. The SOLVER_TRANSACTION_SHOW_ALL makes the
2888 library keep all OBSOLETE elements.
2890 *SOLVER_TRANSACTION_SHOW_MULTIINSTALL*::
2891 The library maps MULTIINSTALL elements to simple INSTALL elements. This
2892 flag can be used to disable the mapping.
2894 *SOLVER_TRANSACTION_CHANGE_IS_REINSTALL*::
2895 Use this flag if you want to map CHANGE elements to the REINSTALL type.
2897 *SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE*::
2898 Use this flag if you want to map OBSOLETE elements to the UPGRADE type.
2900 *SOLVER_TRANSACTION_MERGE_ARCHCHANGES*::
2901 Do not add extra categories for every architecture change, instead cumulate
2902 them in one category.
2904 *SOLVER_TRANSACTION_MERGE_VENDORCHANGES*::
2905 Do not add extra categories for every vendor change, instead cumulate
2906 them in one category.
2908 *SOLVER_TRANSACTION_RPM_ONLY*::
2909 Special view mode that just returns IGNORE, ERASE, INSTALL, MULTIINSTALL
2910 elements. Useful if you want to find out what to feed to the underlying
2913 Transaction order flags
2915 *SOLVER_TRANSACTION_KEEP_ORDERDATA*::
2916 Do not throw away the dependency graph used for ordering the transaction.
2917 This flag is needed if you want to do manual ordering.
2921 Pool *pool; /* read only */
2926 Back pointer to pool.
2935 Returns true if the transaction does not do anything, i.e. has no elements.
2937 Solvable *newsolvables();
2938 my @newsolvables = $trans->newsolvables();
2939 newsolvables = trans.newsolvables()
2940 newsolvables = trans.newsolvables()
2942 Return all packages that are to be installed by the transaction. These are
2943 the packages that need to be downloaded from the repositories.
2945 Solvable *keptsolvables();
2946 my @keptsolvables = $trans->keptsolvables();
2947 keptsolvables = trans.keptsolvables()
2948 keptsolvables = trans.keptsolvables()
2950 Return all installed packages that the transaction will keep installed.
2953 my @steps = $trans->steps();
2954 steps = trans.steps()
2955 steps = trans.steps()
2957 Return all solvables that need to be installed (if the returned solvable
2958 is not already installed) or erased (if the returned solvable is installed).
2959 A step is also called a transaction element.
2961 int steptype(Solvable *solvable, int mode)
2962 my $type = $trans->steptype($solvable, $mode);
2963 type = trans.steptype(solvable, mode)
2964 type = trans.steptype(solvable, mode)
2966 Return the transaction type of the specified solvable. See the CONSTANTS
2967 sections for the mode argument flags and the list of returned types.
2969 TransactionClass *classify(int mode = 0)
2970 my @classes = $trans->classify();
2971 classes = trans.classify()
2972 classes = trans.classify()
2974 Group the transaction elements into classes so that they can be displayed
2975 in a structured way. You can use various mapping mode flags to tweak
2976 the result to match your preferences, see the mode argument flag in
2977 the CONSTANTS section. See the TransactionClass class for how to deal
2978 with the returned objects.
2980 Solvable othersolvable(Solvable *solvable);
2981 my $other = $trans->othersolvable($solvable);
2982 other = trans.othersolvable(solvable)
2983 other = trans.othersolvable(solvable)
2985 Return the ``other'' solvable for a given solvable. For installed packages
2986 the other solvable is the best package with the same name that replaces
2987 the installed package, or the best package of the obsoleting packages if
2988 the package does not get replaced by one with the same name.
2990 For to be installed packages, the ``other'' solvable is the best installed
2991 package with the same name that will be replaced, or the best packages
2992 of all the packages that are obsoleted if the new package does not replace
2993 a package with the same name.
2995 Thus, the ``other'' solvable is normally the package that is also shown
2996 for a given package.
2998 Solvable *allothersolvables(Solvable *solvable);
2999 my @others = $trans->allothersolvables($solvable);
3000 others = trans.allothersolvables(solvable)
3001 others = trans.allothersolvables(solvable)
3003 For installed packages, returns all of the packages that replace us. For to
3004 be installed packages, returns all of the packages that the new package
3005 replaces. The special ``other'' solvable is always the first entry of the
3008 int calc_installsizechange();
3009 my $change = $trans->calc_installsizechange();
3010 change = trans.calc_installsizechange()
3011 change = trans.calc_installsizechange()
3013 Return the size change of the installed system in kilobytes (kibibytes).
3015 void order(int flags = 0);
3020 Order the steps in the transactions so that dependent packages are updated
3021 before packages that depend on them. For rpm, you can also use rpmlib's
3022 ordering functionality, debian's dpkg does not provide a way to order a
3025 === ACTIVE/PASSIVE VIEW ===
3027 Active view lists what new packages get installed, while passive view shows
3028 what happens to the installed packages. Most often there's not much
3029 difference between the two modes, but things get interesting if multiple
3030 packages get replaced by one new package. Say you have installed packages
3031 A-1-1 and B-1-1, and now install A-2-1 which has a new dependency that
3032 obsoletes B. The transaction elements will be
3034 updated A-1-1 (other: A-2-1)
3035 obsoleted B-1-1 (other: A-2-1)
3037 in passive mode, but
3039 update A-2-1 (other: A-1-1)
3042 in active mode. If the mode contains SOLVER_TRANSACTION_SHOW_ALL, the
3043 passive mode list will be unchanged but the active mode list will just
3046 The Transactionclass Class
3047 --------------------------
3048 Objects of this type are returned by the classify() Transaction method.
3052 Transaction *transaction; /* read only */
3053 $class->{transaction}
3057 Back pointer to transaction object.
3059 int type; /* read only */
3064 The type of the transaction elements in the class.
3066 int count; /* read only */
3071 The number of elements in the class.
3073 const char *fromstr;
3078 The old vendor or architecture.
3085 The new vendor or architecture.
3092 The id of the old vendor or architecture.
3099 The id of the new vendor or architecture.
3104 my @solvables = $class->solvables();
3105 solvables = class.solvables()
3106 solvables = class.solvables()
3108 Return the solvables for all transaction elements in the class.
3112 Checksums (also called hashes) are used to make sure that downloaded data is
3113 not corrupt and also as a fingerprint mechanism to check if data has changed.
3115 === CLASS METHODS ===
3117 Chksum Chksum(Id type)
3118 my $chksum = solv::Chksum->new($type);
3119 chksum = solv.Chksum(type)
3120 chksum = Solv::Chksum.new(type)
3122 Create a checksum object. Currently the following types are supported:
3128 These keys are constants in the *solv* class.
3130 Chksum Chksum(Id type, const char *hex)
3131 my $chksum = solv::Chksum->new($type, $hex);
3132 chksum = solv.Chksum(type, hex)
3133 chksum = Solv::Chksum.new(type, hex)
3135 Create an already finalized checksum object from a hex string.
3137 Chksum Chksum_from_bin(Id type, char *bin)
3138 my $chksum = solv::Chksum->from_bin($type, $bin);
3139 chksum = solv.Chksum.from_bin(type, bin)
3140 chksum = Solv::Chksum.from_bin(type, bin)
3142 Create an already finalized checksum object from a binary checksum.
3146 Id type; /* read only */
3151 Return the type of the checksum object.
3155 void add(const char *str)
3160 Add a (binary) string to the checksum.
3162 void add_fp(FILE *fp)
3163 $chksum->add_fp($file);
3167 Add the contents of a file to the checksum.
3169 void add_stat(const char *filename)
3170 $chksum->add_stat($filename);
3171 chksum.add_stat(filename)
3172 chksum.add_stat(filename)
3174 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
3175 stat fails, the members are zeroed.
3177 void add_fstat(int fd)
3178 $chksum->add_fstat($fd);
3179 chksum.add_fstat(fd)
3180 chksum.add_fstat(fd)
3182 Same as add_stat, but instead of the filename a file descriptor is used.
3184 unsigned char *raw()
3185 my $raw = $chksum->raw();
3189 Finalize the checksum and return the result as raw bytes. This means that the
3190 result can contain NUL bytes or unprintable characters.
3193 my $raw = $chksum->hex();
3197 Finalize the checksum and return the result as hex string.
3199 const char *typestr()
3200 my $typestr = $chksum->typestr();
3201 typestr = chksum.typestr
3202 typestr = chksum.typestr
3204 Return the type of the checksum as a string, e.g. "sha256".
3207 if ($chksum1 == $chksum2)
3208 if chksum1 == chksum2:
3209 if chksum1 == chksum2
3211 Checksums are equal if they are of the same type and the finalized results are
3215 my $str = $chksum->str;
3219 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
3220 Otherwise "<type>:unfinished" is returned.
3225 This functions were added because libsolv uses standard *FILE* pointers to
3226 read/write files, but languages like perl have their own implementation of
3227 files. The libsolv functions also support decompression and compression, the
3228 algorithm is selected by looking at the file name extension.
3230 FILE *xfopen(char *fn, char *mode = "r")
3231 my $file = solv::xfopen($path);
3232 file = solv.xfopen(path)
3233 file = Solv::xfopen(path)
3235 Open a file at the specified path. The `mode` argument is passed on to the
3238 FILE *xfopen_fd(char *fn, int fileno)
3239 my $file = solv::xfopen_fd($path, $fileno);
3240 file = solv.xfopen_fd(path, fileno)
3241 file = Solv::xfopen_fd(path, fileno)
3243 Create a file handle from the specified file descriptor. The path argument is
3244 only used to select the correct (de-)compression algorithm, use an empty path
3245 if you want to make sure to read/write raw data. The file descriptor is dup()ed
3246 before the file handle is created.
3251 my $fileno = $file->fileno();
3252 fileno = file.fileno()
3253 fileno = file.fileno()
3255 Return file file descriptor of the file. If the file is not open, `-1` is
3258 void cloexec(bool state)
3259 $file->cloexec($state)
3263 Set the close-on-exec flag of the file descriptor. The xfopen function
3264 returns files with close-on-exec turned on, so if you want to pass
3265 a file to some other process you need to call cloexec(0) before calling
3269 my $fileno = $file->dup();
3273 Return a copy of the descriptor of the file. If the file is not open, `-1` is
3281 Flush the file. Returns false if there was an error. Flushing a closed file
3282 always returns true.
3289 Close the file. This is needed for languages like Ruby that do not destruct
3290 objects right after they are no longer referenced. In that case, it is good
3291 style to close open files so that the file descriptors are freed right away.
3292 Returns false if there was an error.
3297 The Repodata stores attributes for packages and the repository itself, each
3298 repository can have multiple repodata areas. You normally only need to
3299 directly access them if you implement lazy downloading of repository data.
3300 Repodata areas are created by calling the repository's add_repodata() method
3301 or by using repo_add methods without the REPO_REUSE_REPODATA or REPO_USE_LOADING
3306 Repo *repo; /* read only */
3311 Back pointer to repository object.
3313 Id id; /* read only */
3318 The id of the repodata area. Repodata ids of different repositories overlap.
3323 $data->internalize();
3327 Internalize newly added data. The lookup functions will only see the new data
3328 after it has been internalized.
3330 bool write(FILE *fp);
3335 Write the contents of the repodata area as solv file.
3337 bool add_solv(FILE *fp, int flags = 0);
3338 $data->add_solv($fp);
3342 Replace a stub repodata object with the data from a solv file. This method
3343 automatically adds the REPO_USE_LOADING flag. It should only be used from
3346 void create_stubs();
3347 $data->create_stubs()
3351 Create stub repodatas from the information stored in the repodata meta
3354 void extend_to_repo();
3355 $data->extend_to_repo();
3356 data.extend_to_repo()
3357 data.extend_to_repo()
3359 Extend the repodata so that it has the same size as the repo it belongs to.
3360 This method is only needed when switching to a just written repodata extension
3361 to make the repodata match the written extension (which is always of the
3365 if ($data1 == $data2)
3369 Two repodata objects are equal if they belong to the same repository and have
3372 === DATA RETRIEVAL METHODS ===
3374 const char *lookup_str(Id solvid, Id keyname)
3375 my $string = $data->lookup_str($solvid, $keyname);
3376 string = data.lookup_str(solvid, keyname)
3377 string = data.lookup_str(solvid, keyname)
3379 Id *lookup_idarray(Id solvid, Id keyname)
3380 my @ids = $data->lookup_idarray($solvid, $keyname);
3381 ids = data.lookup_idarray(solvid, keyname)
3382 ids = data.lookup_idarray(solvid, keyname)
3384 Chksum lookup_checksum(Id solvid, Id keyname)
3385 my $chksum = $data->lookup_checksum($solvid, $keyname);
3386 chksum = data.lookup_checksum(solvid, keyname)
3387 chksum = data.lookup_checksum(solvid, keyname)
3389 Lookup functions. Return the data element stored in the specified solvable.
3390 The methods probably only make sense to retrieve data from the special
3391 SOLVID_META solvid that stores repodata meta information.
3393 === DATA STORAGE METHODS ===
3395 void set_id(Id solvid, Id keyname, DepId id);
3396 $data->set_id($solvid, $keyname, $id);
3397 data.set_id(solvid, keyname, id)
3398 data.set_id(solvid, keyname, id)
3400 void set_str(Id solvid, Id keyname, const char *str);
3401 $data->set_str($solvid, $keyname, $str);
3402 data.set_str(solvid, keyname, str)
3403 data.set_str(solvid, keyname, str)
3405 void set_poolstr(Id solvid, Id keyname, const char *str);
3406 $data->set_poolstr($solvid, $keyname, $str);
3407 data.set_poolstr(solvid, keyname, str)
3408 data.set_poolstr(solvid, keyname, str)
3410 void set_checksum(Id solvid, Id keyname, Chksum *chksum);
3411 $data->set_checksum($solvid, $keyname, $chksum);
3412 data.set_checksum(solvid, keyname, chksum)
3413 data.set_checksum(solvid, keyname, chksum)
3415 void add_idarray(Id solvid, Id keyname, DepId id);
3416 $data->add_idarray($solvid, $keyname, $id);
3417 data.add_idarray(solvid, keyname, id)
3418 data.add_idarray(solvid, keyname, id)
3421 my $handle = $data->new_handle();
3422 handle = data.new_handle()
3423 handle = data.new_handle()
3425 void add_flexarray(Id solvid, Id keyname, Id handle);
3426 $data->add_flexarray($solvid, $keyname, $handle);
3427 data.add_flexarray(solvid, keyname, handle)
3428 data.add_flexarray(solvid, keyname, handle)
3430 Data storage methods. Probably only useful to store data in the special
3431 SOLVID_META solvid that stores repodata meta information. Note that
3432 repodata areas can have their own Id pool (see the REPO_LOCALPOOL flag),
3433 so be careful if you need to store ids. Arrays are created by calling
3434 the add function for every element. A flexarray is an array of
3435 sub-structures, call new_handle to create a new structure, use the
3436 handle as solvid to fill the structure with data and call add_flexarray
3437 to put the structure in an array.
3442 Datapos objects describe a specific position in the repository data area.
3443 Thus they are only valid until the repository is modified in some way.
3444 Datapos objects can be created by the pos() and parentpos() methods of
3445 a Datamatch object or by accessing the ``meta'' attribute of a repository.
3449 Repo *repo; /* read only */
3454 Back pointer to repository object.
3458 Dataiterator(Id keyname, const char *match, int flags)
3459 my $di = $datapos->Dataiterator($keyname, $match, $flags);
3460 di = datapos.Dataiterator(keyname, match, flags)
3461 di = datapos.Dataiterator(keyname, match, flags)
3463 Create a Dataiterator at the position of the datapos object.
3465 const char *lookup_deltalocation(unsigned int *OUTPUT);
3466 my ($location, $medianr) = $datapos->lookup_deltalocation();
3467 location, medianr = datapos.lookup_deltalocation()
3468 location, medianr = datapos.lookup_deltalocation()
3470 Return a tuple containing the on-media location and an optional media number
3471 for a delta rpm. This obviously only works if the data position points to
3472 structure describing a delta rpm.
3474 const char *lookup_deltaseq();
3475 my $seq = $datapos->lookup_deltaseq();
3476 seq = datapos.lookup_deltaseq();
3477 seq = datapos.lookup_deltaseq();
3479 Return the delta rpm sequence from the structure describing a delta rpm.
3481 === DATA RETRIEVAL METHODS ===
3483 const char *lookup_str(Id keyname)
3484 my $string = $datapos->lookup_str($keyname);
3485 string = datapos.lookup_str(keyname)
3486 string = datapos.lookup_str(keyname)
3488 Id lookup_id(Id solvid, Id keyname)
3489 my $id = $datapos->lookup_id($keyname);
3490 id = datapos.lookup_id(keyname)
3491 id = datapos.lookup_id(keyname)
3493 unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
3494 my $num = $datapos->lookup_num($keyname);
3495 num = datapos.lookup_num(keyname)
3496 num = datapos.lookup_num(keyname)
3498 bool lookup_void(Id keyname)
3499 my $bool = $datapos->lookup_void($keyname);
3500 bool = datapos.lookup_void(keyname)
3501 bool = datapos.lookup_void(keyname)
3503 Id *lookup_idarray(Id keyname)
3504 my @ids = $datapos->lookup_idarray($keyname);
3505 ids = datapos.lookup_idarray(keyname)
3506 ids = datapos.lookup_idarray(keyname)
3508 Chksum lookup_checksum(Id keyname)
3509 my $chksum = $datapos->lookup_checksum($keyname);
3510 chksum = datapos.lookup_checksum(keyname)
3511 chksum = datapos.lookup_checksum(keyname)
3513 Lookup functions. Note that the returned Ids are always translated into
3514 the Ids of the global pool even if the repodata area contains its own pool.
3516 Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
3517 my $di = $datapos->Dataiterator($keyname, $match, $flags);
3518 di = datapos.Dataiterator(keyname, match, flags)
3519 di = datapos.Dataiterator(keyname, match, flags)
3525 Iterate over the matching data elements. See the Dataiterator class for more
3530 Michael Schroeder <mls@suse.de>