Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > 306478f13dfea2a6bc940ce4a8808dea > files > 2

libsolv-doc-0.7.4-1.1.mga7.armv7hl.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Libsolv-Bindings(3)</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /></head><body><div xml:lang="en" class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="idp155849548"></a>Libsolv-Bindings(3)</h2></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name">1. Name</a></span></dt><dt><span class="section"><a href="#_description">2. Description</a></span></dt><dt><span class="section"><a href="#_perl_specifics">3. Perl Specifics</a></span></dt><dt><span class="section"><a href="#_python_specifics">4. Python Specifics</a></span></dt><dt><span class="section"><a href="#_ruby_specifics">5. Ruby Specifics</a></span></dt><dt><span class="section"><a href="#_tcl_specifics">6. Tcl Specifics</a></span></dt><dt><span class="section"><a href="#_the_solv_class">7. The Solv Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_constants">7.1. CONSTANTS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_pool_class">8. The Pool Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_class_methods">8.1. CLASS METHODS</a></span></dt><dt><span class="section"><a href="#_attributes">8.2. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_constants_2">8.3. CONSTANTS</a></span></dt><dt><span class="section"><a href="#_methods">8.4. METHODS</a></span></dt><dt><span class="section"><a href="#_data_retrieval_methods">8.5. DATA RETRIEVAL METHODS</a></span></dt><dt><span class="section"><a href="#_id_methods">8.6. ID METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_dependency_class">9. The Dependency Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_2">9.1. ATTRIBUTES</a></span></dt></dl></dd><dt><span class="section"><a href="#_methods_2">10. Methods</a></span></dt><dt><span class="section"><a href="#_the_repository_class">11. The Repository Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_3">11.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_constants_3">11.2. CONSTANTS</a></span></dt><dt><span class="section"><a href="#_methods_3">11.3. METHODS</a></span></dt><dt><span class="section"><a href="#_data_add_methods">11.4. DATA ADD METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_solvable_class">12. The Solvable Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_4">12.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_4">12.2. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_dataiterator_class">13. The Dataiterator Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_constants_4">13.1. CONSTANTS</a></span></dt><dt><span class="section"><a href="#_methods_5">13.2. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_datamatch_class">14. The Datamatch Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_5">14.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_6">14.2. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_selection_class">15. The Selection Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_constants_5">15.1. CONSTANTS</a></span></dt><dt><span class="section"><a href="#_attributes_6">15.2. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_7">15.3. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_job_class">16. The Job Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_constants_6">16.1. CONSTANTS</a></span></dt><dt><span class="section"><a href="#_attributes_7">16.2. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_8">16.3. METHODS</a></span></dt><dt><span class="section"><a href="#_targeted_updates">16.4. TARGETED UPDATES</a></span></dt><dt><span class="section"><a href="#_set_bits">16.5. SET BITS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_solver_class">17. The Solver Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_constants_7">17.1. CONSTANTS</a></span></dt><dt><span class="section"><a href="#_attributes_8">17.2. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_9">17.3. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_problem_class">18. The Problem Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_9">18.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_10">18.2. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_rule_class">19. The Rule Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_10">19.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_11">19.2. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_ruleinfo_class">20. The Ruleinfo Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_11">20.1. ATTRIBUTES</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_solution_class">21. The Solution Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_12">21.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_12">21.2. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_solutionelement_class">22. The Solutionelement Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_13">22.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_13">22.2. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_transaction_class">23. The Transaction Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_constants_8">23.1. CONSTANTS</a></span></dt><dt><span class="section"><a href="#_attributes_14">23.2. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_14">23.3. METHODS</a></span></dt><dt><span class="section"><a href="#_active_passive_view">23.4. ACTIVE/PASSIVE VIEW</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_transactionclass_class">24. The Transactionclass Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_15">24.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_15">24.2. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_checksums">25. Checksums</a></span></dt><dd><dl><dt><span class="section"><a href="#_class_methods_2">25.1. CLASS METHODS</a></span></dt><dt><span class="section"><a href="#_attributes_16">25.2. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_16">25.3. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_file_management">26. File Management</a></span></dt><dd><dl><dt><span class="section"><a href="#_methods_17">26.1. METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_repodata_class">27. The Repodata Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_17">27.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_18">27.2. METHODS</a></span></dt><dt><span class="section"><a href="#_data_retrieval_methods_2">27.3. DATA RETRIEVAL METHODS</a></span></dt><dt><span class="section"><a href="#_data_storage_methods">27.4. DATA STORAGE METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_the_datapos_class">28. The Datapos Class</a></span></dt><dd><dl><dt><span class="section"><a href="#_attributes_18">28.1. ATTRIBUTES</a></span></dt><dt><span class="section"><a href="#_methods_19">28.2. METHODS</a></span></dt><dt><span class="section"><a href="#_data_retrieval_methods_3">28.3. DATA RETRIEVAL METHODS</a></span></dt></dl></dd><dt><span class="section"><a href="#_author">29. Author</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name"></a>1. Name</h2></div></div></div><p>libsolv-bindings - access libsolv from perl/python/ruby</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description"></a>2. Description</h2></div></div></div><p>Libsolv’s language bindings offer an abstract, object orientated interface
to the library. The supported languages are currently perl, python, and ruby.
All example code (except in the specifics sections, of course) lists first
the “C-ish” interface, then the syntax for perl, python, and ruby (in that
order).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_perl_specifics"></a>3. Perl Specifics</h2></div></div></div><p>Libsolv’s perl bindings can be loaded with the following statement:</p><pre class="literallayout">use solv;</pre><p>Objects are either created by calling the new() method on a class or they
are returned by calling methods on other objects.</p><pre class="literallayout">my $pool = solv::Pool-&gt;new();
my $repo = $pool-&gt;add_repo("my_first_repo");</pre><p>Swig encapsulates all objects as tied hashes, thus the attributes can be
accessed by treating the object as standard hash reference:</p><pre class="literallayout">$pool-&gt;{appdata} = 42;
printf "appdata is %d\n", $pool-&gt;{appdata};</pre><p>A special exception to this are iterator objects, they are encapsulated as
tied arrays so that it is possible to iterate with a for() statement:</p><pre class="literallayout">my $iter = $pool-&gt;solvables_iter();
for my $solvable (@$iter) { ... };</pre><p>As a downside of this approach, iterator objects cannot have attributes.</p><p>If an array needs to be passed to a method it is usually done by reference,
if a method returns an array it returns it on the perl stack:</p><pre class="literallayout">my @problems = $solver-&gt;solve(\@jobs);</pre><p>Due to a bug in swig, stringification does not work for libsolv’s objects.
Instead, you have to call the object’s str() method.</p><pre class="literallayout">print $dep-&gt;str() . "\n";</pre><p>Swig implements all constants as numeric variables (instead of the more
natural constant subs), so don’t forget the leading “$” when accessing a
constant. Also do not forget to prepend the namespace of the constant:</p><pre class="literallayout">$pool-&gt;set_flag($solv::Pool::POOL_FLAG_OBSOLETEUSESCOLORS, 1);</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_python_specifics"></a>4. Python Specifics</h2></div></div></div><p>The python bindings can be loaded with:</p><pre class="literallayout">import solv</pre><p>Objects are either created by calling the constructor method for a class or they
are returned by calling methods on other objects.</p><pre class="literallayout">pool = solv.Pool()
repo = pool.add_repo("my_first_repo")</pre><p>Attributes can be accessed as usual:</p><pre class="literallayout">pool.appdata = 42
print "appdata is %d" % (pool.appdata)</pre><p>Iterators also work as expected:</p><pre class="literallayout">for solvable in pool.solvables_iter():</pre><p>Arrays are passed and returned as list objects:</p><pre class="literallayout">jobs = []
problems = solver.solve(jobs)</pre><p>The bindings define stringification for many classes, some also have a
<span class="emphasis"><em>repr</em></span> method to ease debugging.</p><pre class="literallayout">print dep
print repr(repo)</pre><p>Constants are attributes of the corresponding classes:</p><pre class="literallayout">pool.set_flag(solv.Pool.POOL_FLAG_OBSOLETEUSESCOLORS, 1);</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_ruby_specifics"></a>5. Ruby Specifics</h2></div></div></div><p>The ruby bindings can be loaded with:</p><pre class="literallayout">require 'solv'</pre><p>Objects are either created by calling the new method on a class or they
are returned by calling methods on other objects. Note that all classes start
with an uppercase letter in ruby, so the class is called “Solv”.</p><pre class="literallayout">pool = Solv::Pool.new
repo = pool.add_repo("my_first_repo")</pre><p>Attributes can be accessed as usual:</p><pre class="literallayout">pool.appdata = 42
puts "appdata is #{pool.appdata}"</pre><p>Iterators also work as expected:</p><pre class="literallayout">for solvable in pool.solvables_iter() do ...</pre><p>Arrays are passed and returned as array objects:</p><pre class="literallayout">jobs = []
problems = solver.solve(jobs)</pre><p>Most classes define a to_s method, so objects can be easily stringified.
Many also define an inspect() method.</p><pre class="literallayout">puts dep
puts repo.inspect</pre><p>Constants live in the namespace of the class they belong to:</p><pre class="literallayout">pool.set_flag(Solv::Pool::POOL_FLAG_OBSOLETEUSESCOLORS, 1);</pre><p>Note that boolean methods have an added trailing “?”, to be consistent with
other ruby modules:</p><pre class="literallayout">puts "empty" if repo.isempty?</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_tcl_specifics"></a>6. Tcl Specifics</h2></div></div></div><p>Libsolv’s tcl bindings can be loaded with the following statement:</p><pre class="literallayout">TCL package require solv</pre><p>Objects are either created by calling class name prefixed with “new_”,
or they are returned by calling methods on other objects.</p><pre class="literallayout">TCL set pool [solv::new_Pool]
TCL set repo [$pool add_repo "my_first_repo"]</pre><p>Swig provides a “cget” method to read object attributes, and a
“configure” method to write them:</p><pre class="literallayout">TCL $pool configure -appdata 42
TCL puts "appdata is [$pool cget -appdata]"</pre><p>The tcl bindings provide a little helper to work with iterators in
a foreach style:</p><pre class="literallayout">TCL set iter [$pool solvables_iter]
TCL solv::iter s $iter { ... }</pre><p>libsolv’s arrays are mapped to tcl’s lists:</p><pre class="literallayout">TCL set jobs [list $job1 $job2]
TCL set problems [$solver solve $jobs]
TCL puts "We have [llength $problems] problems..."</pre><p>Stringification is done by calling the object’s “str” method.</p><pre class="literallayout">TCL puts [$dep str]</pre><p>There is one exception: you have to use “stringify” for Datamatch
objects, as swig reports a clash with the “str” attribute.
Some objects also support a “==” method for equality tests, and a
“!=” method.</p><p>Swig implements all constants as numeric variables, constants belonging
to a libsolv class are prefixed with the class name:</p><pre class="literallayout">TCL $pool set_flag $solv::Pool_POOL_FLAG_OBSOLETEUSESCOLORS 1
TCL puts [$solvable lookup_str $solv::SOLVABLE_SUMMARY]</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_solv_class"></a>7. The Solv Class</h2></div></div></div><p>This is the main namespace of the library, you cannot create objects of this
type but it contains some useful constants.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_constants"></a>7.1. CONSTANTS</h3></div></div></div><p>Relational flag constants, the first three can be or-ed together</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>REL_LT</strong></span>
</span></dt><dd>
the “less than” bit
</dd><dt><span class="term">
<span class="strong"><strong>REL_EQ</strong></span>
</span></dt><dd>
the “equals to” bit
</dd><dt><span class="term">
<span class="strong"><strong>REL_GT</strong></span>
</span></dt><dd>
the “greater than” bit
</dd><dt><span class="term">
<span class="strong"><strong>REL_ARCH</strong></span>
</span></dt><dd>
used for relations that describe an extra architecture filter, the
version part of the relation is interpreted as architecture.
</dd></dl></div><p>Special Solvable Ids</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVID_META</strong></span>
</span></dt><dd>
Access the meta section of a repository or repodata area. This is
like an extra Solvable that has the Id SOLVID_META.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVID_POS</strong></span>
</span></dt><dd>
Use the data position stored inside of the pool instead of accessing
some solvable by Id. The bindings have the Datapos objects as an
abstraction mechanism, so you most likely do not need this constant.
</dd></dl></div><p>Constant string Ids</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>ID_NULL</strong></span>
</span></dt><dd>
Always zero
</dd><dt><span class="term">
<span class="strong"><strong>ID_EMPTY</strong></span>
</span></dt><dd>
Always one, describes the empty string
</dd><dt><span class="term">
<span class="strong"><strong>SOLVABLE_NAME</strong></span>
</span></dt><dd>
The keyname Id of the name of the solvable.
</dd><dt><span class="term">
<span class="strong"><strong>…</strong></span>
</span></dt><dd>
see the libsolv-constantids manpage for a list of fixed Ids.
</dd></dl></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_pool_class"></a>8. The Pool Class</h2></div></div></div><p>The pool is libsolv’s central resource manager. A pool consists of Solvables,
Repositories, Dependencies, each indexed by Ids.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_class_methods"></a>8.1. CLASS METHODS</h3></div></div></div><pre class="literallayout">Pool *Pool()
my $pool = solv::Pool-&gt;new();
pool = solv.Pool()
pool = Solv::Pool.new()</pre><p>Create a new pool instance. In most cases you just need one pool.
Note that the returned object "owns" the pool, i.e. if the object is
freed, the pool is also freed. You can use the disown method to
break this ownership relation.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes"></a>8.2. ATTRIBUTES</h3></div></div></div><pre class="literallayout">void *appdata;                  /* read/write */
$pool-&gt;{appdata}
pool.appdata
pool.appdata</pre><p>Application specific data that may be used in any way by the code using the
pool.</p><pre class="literallayout">Solvable solvables[];           /* read only */
my $solvable = $pool-&gt;{solvables}-&gt;[$solvid];
solvable = pool.solvables[solvid]
solvable = pool.solvables[solvid]</pre><p>Look up a Solvable by its id.</p><pre class="literallayout">Repo repos[];                   /* read only */
my $repo = $pool-&gt;{repos}-&gt;[$repoid];
repo = pool.repos[repoid]
repo = pool.repos[repoid]</pre><p>Look up a Repository by its id.</p><pre class="literallayout">Repo *installed;                /* read/write */
$pool-&gt;{installed} = $repo;
pool.installed = repo
pool.installed = repo</pre><p>Define which repository contains all the installed packages.</p><pre class="literallayout">const char *errstr;             /* read only */
my $err = $pool-&gt;{errstr};
err = pool.errstr
err = pool.errstr</pre><p>Return the last error string that was stored in the pool.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_constants_2"></a>8.3. CONSTANTS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_PROMOTEEPOCH</strong></span>
</span></dt><dd>
Promote the epoch of the providing dependency to the requesting
dependency if it does not contain an epoch. Used at some time
in old rpm versions, modern systems should never need this.
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_FORBIDSELFCONFLICTS</strong></span>
</span></dt><dd>
Disallow the installation of packages that conflict with themselves.
Debian always allows self-conflicting packages, rpm used to forbid
them but switched to also allowing them since rpm-4.9.0.
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_OBSOLETEUSESPROVIDES</strong></span>
</span></dt><dd>
Make obsolete type dependency match against provides instead of
just the name and version of packages. Very old versions of rpm
used the name/version, then it got switched to provides and later
switched back again to just name/version.
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES</strong></span>
</span></dt><dd>
An implicit obsoletes is the internal mechanism to remove the
old package on an update. The default is to remove all packages
with the same name, rpm-5 switched to also removing packages
providing the same name.
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_OBSOLETEUSESCOLORS</strong></span>
</span></dt><dd>
Rpm’s multilib implementation distinguishes between 32bit and 64bit
packages (the terminology is that they have a different color).
If obsoleteusescolors is set, packages with different colors will
not obsolete each other.
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS</strong></span>
</span></dt><dd>
Same as POOL_FLAG_OBSOLETEUSESCOLORS, but used to find out if
packages of the same name can be installed in parallel. For
current Fedora systems, POOL_FLAG_OBSOLETEUSESCOLORS should be
false and POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS should be true
(this is the default if FEDORA is defined when libsolv is compiled).
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_NOINSTALLEDOBSOLETES</strong></span>
</span></dt><dd>
Since version 4.9.0 rpm considers the obsoletes of installed packages
when checking for dependency conflicts, thus you may not install a
package that is obsoleted by some other installed package unless you
also erase the other package.
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_HAVEDISTEPOCH</strong></span>
</span></dt><dd>
Mandriva added a new field called distepoch that gets checked in
version comparison if the epoch/version/release of two packages
are the same.
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_NOOBSOLETESMULTIVERSION</strong></span>
</span></dt><dd>
If a package is installed in multiversion mode, rpm used to ignore
both the implicit obsoletes and the obsolete dependency of a
package. This was changed to ignoring just the implicit obsoletes,
thus you may install multiple versions of the same name, but
obsoleted packages still get removed.
</dd><dt><span class="term">
<span class="strong"><strong>POOL_FLAG_ADDFILEPROVIDESFILTERED</strong></span>
</span></dt><dd>
Make the addfileprovides method only add files from the standard
locations (i.e. the “bin” and “etc” directories). This is
useful if you have only few packages that use non-standard file
dependencies, but you still want the fast speed that addfileprovides()
generates.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods"></a>8.4. METHODS</h3></div></div></div><pre class="literallayout">void free()
$pool-&gt;free();
pool.free()
pool.free()</pre><p>Force a free of the pool. After this call, you must not access any object
that still references the pool.</p><pre class="literallayout">void disown()
$pool-&gt;disown();
pool.disown()
pool.disown()</pre><p>Break the ownership relation between the binding object and the pool. After
this call, the pool will not get freed even if the object goes out of
scope. This also means that you must manually call the free method to free
the pool data.</p><pre class="literallayout">void setdebuglevel(int level)
$pool-&gt;setdebuglevel($level);
pool.setdebuglevel(level)
pool.setdebuglevel(level)</pre><p>Set the debug level. A value of zero means no debug output, the higher the
value, the more output is generated.</p><pre class="literallayout">int set_flag(int flag, int value)
my $oldvalue = $pool-&gt;set_flag($flag, $value);
oldvalue = pool.set_flag(flag, value)
oldvalue = pool.set_flag(flag, value)</pre><pre class="literallayout">int get_flag(int flag)
my $value = $pool-&gt;get_flag($flag);
value = pool.get_flag(flag)
value = pool.get_flag(flag)</pre><p>Set/get a pool specific flag. The flags define how the system works, e.g. how
the package manager treats obsoletes. The default flags should be sane for most
applications, but in some cases you may want to tweak a flag, for example if
you want to solve package dependencies for some other system.</p><pre class="literallayout">void set_rootdir(const char *rootdir)
$pool-&gt;set_rootdir(rootdir);
pool.set_rootdir(rootdir)
pool.set_rootdir(rootdir)</pre><pre class="literallayout">const char *get_rootdir()
my $rootdir = $pool-&gt;get_rootdir();
rootdir = pool.get_rootdir()
rootdir = pool.get_rootdir()</pre><p>Set/get the rootdir to use. This is useful if you want package management
to work only in some directory, for example if you want to setup a chroot
jail. Note that the rootdir will only be prepended to file paths if the
<span class="strong"><strong>REPO_USE_ROOTDIR</strong></span> flag is used.</p><pre class="literallayout">void setarch(const char *arch = 0)
$pool-&gt;setarch();
pool.setarch()
pool.setarch()</pre><p>Set the architecture for your system. The architecture is used to determine
which packages are installable. It defaults to the result of “uname -m”.</p><pre class="literallayout">Repo add_repo(const char *name)
$repo = $pool-&gt;add_repo($name);
repo = pool.add_repo(name)
repo = pool.add_repo(name)</pre><p>Add a Repository with the specified name to the pool. The repository is empty
on creation, use the repository methods to populate it with packages.</p><pre class="literallayout">Repoiterator repos_iter()
for my $repo (@{$pool-&gt;repos_iter()})
for repo in pool.repos_iter():
for repo in pool.repos_iter()</pre><p>Iterate over the existing repositories.</p><pre class="literallayout">Solvableiterator solvables_iter()
for my $solvable (@{$pool-&gt;solvables_iter()})
for solvable in pool.solvables_iter():
for solvable in pool.solvables_iter()</pre><p>Iterate over the existing solvables.</p><pre class="literallayout">Dep Dep(const char *str, bool create = 1)
my $dep = $pool-&gt;Dep($string);
dep = pool.Dep(string)
dep = pool.Dep(string)</pre><p>Create an object describing a string or dependency. If the string is currently
not in the pool and <span class="emphasis"><em>create</em></span> is false, <span class="strong"><strong>undef</strong></span>/<span class="strong"><strong>None</strong></span>/<span class="strong"><strong>nil</strong></span> is returned.</p><pre class="literallayout">void addfileprovides()
$pool-&gt;addfileprovides();
pool.addfileprovides()
pool.addfileprovides()</pre><pre class="literallayout">Id *addfileprovides_queue()
my @ids = $pool-&gt;addfileprovides_queue();
ids = pool.addfileprovides_queue()
ids = pool.addfileprovides_queue()</pre><p>Some package managers like rpm allow dependencies on files contained in other
packages. To allow libsolv to deal with those dependencies in an efficient way,
you need to call the addfileprovides method after creating and reading all
repositories. This method will scan all dependency for file names and then scan
all packages for matching files. If a filename has been matched, it will be
added to the provides list of the corresponding package. The
addfileprovides_queue variant works the same way but returns an array
containing all file dependencies. This information can be stored in the
meta section of the repositories to speed up the next time the
repository is loaded and addfileprovides is called.</p><pre class="literallayout">void createwhatprovides()
$pool-&gt;createwhatprovides();
pool.createwhatprovides()
pool.createwhatprovides()</pre><p>Create the internal “whatprovides” hash over all of the provides of all
installable packages. This method must be called before doing any lookups on
provides.
It’s encouraged to do it right after all repos are set up, usually right after
the call to addfileprovides().</p><pre class="literallayout">Solvable *whatprovides(DepId dep)
my @solvables = $pool-&gt;whatprovides($dep);
solvables = pool.whatprovides(dep)
solvables = pool.whatprovides(dep)</pre><p>Return all solvables that provide the specified dependency. You can use either
a Dep object or a simple Id as argument.</p><pre class="literallayout">Solvable *best_solvables(Solvable *solvables, int flags = 0)
my @solvables = $pool-&gt;best_solvables($solvables);
solvables = pool.best_solvables(solvables)
solvables = pool.best_solvables(solvables)</pre><p>Filter list of solvables by repo priority, architecture and version.</p><pre class="literallayout">Solvable *whatmatchessolvable(Id keyname, Solvable solvable, Id marker = -1)
my @solvables = $pool-&gt;whatmatchessolvable($keyname, $solvable)
solvables = pool.whatmatchessolvable(keyname, solvable)
solvables = pool.whatmatchessolvable(keyname, solvable)</pre><p>Return all solvables that match package dependencies against solvable’s
provides.</p><pre class="literallayout">Id *matchprovidingids(const char *match, int flags)
my @ids = $pool-&gt;matchprovidingids($match, $flags);
ids = pool.matchprovidingids(match, flags)
ids = pool.matchprovidingids(match, flags)</pre><p>Search the names of all provides and return the ones matching the specified
string. See the Dataiterator class for the allowed flags.</p><pre class="literallayout">Id towhatprovides(Id *ids)
my $offset = $pool-&gt;towhatprovides(\@ids);
offset = pool.towhatprovides(ids)
offset = pool.towhatprovides(ids)</pre><p>“Internalize” an array containing Ids. The returned value can be used to
create solver jobs working on a specific set of packages. See the Solver class
for more information.</p><pre class="literallayout">void set_namespaceproviders(DepId ns, DepId evr, bool value = 1)
$pool-&gt;set_namespaceproviders($ns, $evr, 1);
pool.set_namespaceproviders(ns, evr, True)
pool.set_namespaceproviders(ns, evr, true)</pre><p>Manually set a namespace provides entry in the whatprovides index.</p><pre class="literallayout">void flush_namespaceproviders(DepId ns, DepId evr)
$pool-&gt;flush_namespaceproviders($ns, $evr);
$pool.flush_namespaceproviders(ns, evr)
$pool.flush_namespaceproviders(ns, evr)</pre><p>Flush the cache of all namespaceprovides matching the specified namespace
dependency. You can use zero as a wildcard argument.</p><pre class="literallayout">bool isknownarch(DepId id)
my $bool = $pool-&gt;isknownarch($id);
bool = pool.isknownarch(id)
bool = pool.isknownarch?(id)</pre><p>Return true if the specified Id describes a known architecture.</p><pre class="literallayout">Solver Solver()
my $solver = $pool-&gt;Solver();
solver = pool.Solver()
solver = pool.Solver()</pre><p>Create a new solver object.</p><pre class="literallayout">Job Job(int how, Id what)
my $job = $pool-&gt;Job($how, $what);
job = pool.Job(how, what)
job = pool.Job(how, what)</pre><p>Create a new Job object. Kind of low level, in most cases you would
instead use a Selection or Dep job constructor.</p><pre class="literallayout">Selection Selection()
my $sel = $pool-&gt;Selection();
sel = pool.Selection()
sel = pool.Selection()</pre><p>Create an empty selection. Useful as a starting point for merging other
selections.</p><pre class="literallayout">Selection Selection_all()
my $sel = $pool-&gt;Selection_all();
sel = pool.Selection_all()
sel = pool.Selection_all()</pre><p>Create a selection containing all packages. Useful as starting point for
intersecting other selections or for update/distupgrade jobs.</p><pre class="literallayout">Selection select(const char *name, int flags)
my $sel = $pool-&gt;select($name, $flags);
sel = pool.select(name, flags)
sel = pool.select(name, flags)</pre><p>Create a selection by matching packages against the specified string. See the
Selection class for a list of flags and how to create solver jobs from a
selection.</p><pre class="literallayout">Selection matchdeps(const char *name, int flags, Id keyname, Id marker = -1)
my $sel = $pool-&gt;matchdeps($name, $flags, $keyname);
sel = pool.matchdeps(name, flags, keyname)
sel = pool.matchdeps(name, flags, keyname)</pre><p>Create a selection by matching package dependencies against the specified string.
This can be used if you want to match other dependency types than “provides”.</p><pre class="literallayout">Selection matchdepid(DepId dep, int flags, Id keyname, Id marker = -1)
my $sel = $pool-&gt;matchdepid($dep, $flags, $keyname);
sel = pool.matchdepid(dep, flags, keyname)
sel = pool.matchdepid(dep, flags, keyname)</pre><p>Create a selection by matching package dependencies against the specified
dependency. This may be faster than matchdeps and also works with complex
dependencies. The downside is that you cannot use globs or case insensitive
matching.</p><pre class="literallayout">Selection matchsolvable(Solvable solvable, int flags, Id keyname, Id marker = -1)
my $sel = $pool-&gt;matchsolvable($solvable, $flags, $keyname);
sel = pool.matchsolvable(solvable, flags, keyname)
sel = pool.matchsolvable(solvable, flags, keyname)</pre><p>Create a selection by matching package dependencies against the specified
solvable’s provides.</p><pre class="literallayout">void setpooljobs(Jobs *jobs)
$pool-&gt;setpooljobs(\@jobs);
pool.setpooljobs(jobs)
pool.setpooljobs(jobs)</pre><pre class="literallayout">Job *getpooljobs()
@jobs = $pool-&gt;getpooljobs();
jobs = pool.getpooljobs()
jobs = pool.getpooljobs()</pre><p>Get/Set fixed jobs stored in the pool. Those jobs are automatically appended to
all solver jobs, they are meant for fixed configurations like which packages
can be multiversion installed, which packages were userinstalled, or which
packages must not be erased.</p><pre class="literallayout">void set_loadcallback(Callable *callback)
$pool-&gt;setloadcallback(\&amp;callbackfunction);
pool.setloadcallback(callbackfunction)
pool.setloadcallback { |repodata| ... }</pre><p>Set the callback function called when repository metadata needs to be loaded on
demand. To make use of this feature, you need to create repodata stubs that
tell the library which data is available but not loaded. If later on the data
needs to be accessed, the callback function is called with a repodata argument.
You can then load the data (maybe fetching it first from a remote server).
The callback should return true if the data has been made available.</p><pre class="literallayout">/* bindings only */
$pool-&gt;appdata_disown()
pool.appdata_disown()
pool.appdata_disown()</pre><p>Decrement the reference count of the appdata object. This can be used to break
circular references (e.g. if the pool’s appdata value points to some meta data
structure that contains a pool handle). If used incorrectly, this method can
lead to application crashes, so beware. (This method is a no-op for ruby and tcl.)</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_data_retrieval_methods"></a>8.5. DATA RETRIEVAL METHODS</h3></div></div></div><p>In the following functions, the <span class="emphasis"><em>keyname</em></span> argument describes what to retrieve.
For the standard cases you can use the available Id constants. For example,</p><pre class="literallayout">$solv::SOLVABLE_SUMMARY
solv.SOLVABLE_SUMMARY
Solv::SOLVABLE_SUMMARY</pre><p>selects the “Summary” entry of a solvable. The <span class="emphasis"><em>solvid</em></span> argument selects the
desired solvable by Id.</p><pre class="literallayout">const char *lookup_str(Id solvid, Id keyname)
my $string = $pool-&gt;lookup_str($solvid, $keyname);
string = pool.lookup_str(solvid, keyname)
string = pool.lookup_str(solvid, keyname)</pre><pre class="literallayout">Id lookup_id(Id solvid, Id keyname)
my $id = $pool-&gt;lookup_id($solvid, $keyname);
id = pool.lookup_id(solvid, keyname)
id = pool.lookup_id(solvid, keyname)</pre><pre class="literallayout">unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
my $num = $pool-&gt;lookup_num($solvid, $keyname);
num = pool.lookup_num(solvid, keyname)
num = pool.lookup_num(solvid, keyname)</pre><pre class="literallayout">bool lookup_void(Id solvid, Id keyname)
my $bool = $pool-&gt;lookup_void($solvid, $keyname);
bool = pool.lookup_void(solvid, keyname)
bool = pool.lookup_void(solvid, keyname)</pre><pre class="literallayout">Id *lookup_idarray(Id solvid, Id keyname)
my @ids = $pool-&gt;lookup_idarray($solvid, $keyname);
ids = pool.lookup_idarray(solvid, keyname)
ids = pool.lookup_idarray(solvid, keyname)</pre><pre class="literallayout">Chksum lookup_checksum(Id solvid, Id keyname)
my $chksum = $pool-&gt;lookup_checksum($solvid, $keyname);
chksum = pool.lookup_checksum(solvid, keyname)
chksum = pool.lookup_checksum(solvid, keyname)</pre><p>Lookup functions. Return the data element stored in the specified solvable.
You should probably use the methods of the Solvable class instead.</p><pre class="literallayout">Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
my $di = $pool-&gt;Dataiterator($keyname, $match, $flags);
di = pool.Dataiterator(keyname, match, flags)
di = pool.Dataiterator(keyname, match, flags)</pre><pre class="literallayout">Dataiterator Dataiterator_solvid(Id solvid, Id keyname, const char *match = 0, int flags = 0)
my $di = $pool-&gt;Dataiterator($solvid, $keyname, $match, $flags);
di = pool.Dataiterator(solvid, keyname, match, flags)
di = pool.Dataiterator(solvid, keyname, match, flags)</pre><pre class="literallayout">for my $d (@$di)
for d in di:
for d in di</pre><p>Iterate over the matching data elements. See the Dataiterator class for more
information. The Dataiterator method iterates over all solvables in the pool,
whereas the Dataiterator_solvid only iterates over the specified solvable.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_id_methods"></a>8.6. ID METHODS</h3></div></div></div><p>The following methods deal with Ids, i.e. integers representing objects in the
pool. They are considered “low level”, in most cases you would not use them
but instead the object orientated methods.</p><pre class="literallayout">Repo id2repo(Id id)
$repo = $pool-&gt;id2repo($id);
repo = pool.id2repo(id)
repo = pool.id2repo(id)</pre><p>Lookup an existing Repository by id. You can also do this by using the <span class="strong"><strong>repos</strong></span>
attribute.</p><pre class="literallayout">Solvable id2solvable(Id id)
$solvable = $pool-&gt;id2solvable($id);
solvable = pool.id2solvable(id)
solvable = pool.id2solvable(id)</pre><p>Lookup an existing Repository by id. You can also do this by using the
<span class="strong"><strong>solvables</strong></span> attribute.</p><pre class="literallayout">const char *solvid2str(Id id)
my $str = $pool-&gt;solvid2str($id);
str = pool.solvid2str(id)
str = pool.solvid2str(id)</pre><p>Return a string describing the Solvable with the specified id. The string
consists of the name, version, and architecture of the Solvable.</p><pre class="literallayout">Id str2id(const char *str, bool create = 1)
my $id = pool-&gt;str2id($string);
id = pool.str2id(string)
id = pool.str2id(string)</pre><pre class="literallayout">const char *id2str(Id id)
$string = pool-&gt;id2str($id);
string = pool.id2str(id)
string = pool.id2str(id)</pre><p>Convert a string into an Id and back. If the string is currently not in the
pool and <span class="emphasis"><em>create</em></span> is false, zero is returned.</p><pre class="literallayout">Id rel2id(Id name, Id evr, int flags, bool create = 1)
my $id = pool-&gt;rel2id($nameid, $evrid, $flags);
id = pool.rel2id(nameid, evrid, flags)
id = pool.rel2id(nameid, evrid, flags)</pre><p>Create a “relational” dependency. Such dependencies consist of a name part,
<span class="emphasis"><em>flags</em></span> describing the relation, and a version part. The flags are:</p><pre class="literallayout">$solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
solv.REL_EQ | solv.REL_GT | solv.REL_LT
Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT</pre><p>Thus, if you want a “&lt;=” relation, you would use <span class="strong"><strong>REL_LT | REL_EQ</strong></span>.</p><pre class="literallayout">Id id2langid(Id id, const char *lang, bool create = 1)
my $id = $pool-&gt;id2langid($id, $language);
id = pool.id2langid(id, language)
id = pool.id2langid(id, language)</pre><p>Create a language specific Id from some other id. This function simply converts
the id into a string, appends a dot and the specified language to the string
and converts the result back into an Id.</p><pre class="literallayout">const char *dep2str(Id id)
$string = pool-&gt;dep2str($id);
string = pool.dep2str(id)
string = pool.dep2str(id)</pre><p>Convert a dependency id into a string. If the id is just a string, this
function has the same effect as id2str(). For relational dependencies, the
result is the correct “name relation evr” string.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_dependency_class"></a>9. The Dependency Class</h2></div></div></div><p>The dependency class is an object orientated way to work with strings and
dependencies. Internally, dependencies are represented as Ids, i.e. simple
numbers. Dependency objects can be constructed by using the Pool’s Dep()
method.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_2"></a>9.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Pool *pool;             /* read only */
$dep-&gt;{pool}
dep.pool
dep.pool</pre><p>Back reference to the pool this dependency belongs to.</p><pre class="literallayout">Id id;          /* read only */
$dep-&gt;{id}
dep.id
dep.id</pre><p>The id of this dependency.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_methods_2"></a>10. Methods</h2></div></div></div><pre class="literallayout">Dep Rel(int flags, DepId evrid, bool create = 1)
my $reldep = $dep-&gt;Rel($flags, $evrdep);
reldep = dep.Rel(flags, evrdep)
reldep = dep.Rel(flags, evrdep)</pre><p>Create a relational dependency from the caller dependency, the flags,
and a dependency describing the “version” part.
See the pool’s rel2id method for a description of the flags.</p><pre class="literallayout">Selection Selection_name(int setflags = 0)
my $sel = $dep-&gt;Selection_name();
sel = dep.Selection_name()
sel = dep.Selection_name()</pre><p>Create a Selection from a dependency. The selection consists of all packages
that have a name equal to the dependency. If the dependency is of a relational
type, the packages version must also fulfill the dependency.</p><pre class="literallayout">Selection Selection_provides(int setflags = 0)
my $sel = $dep-&gt;Selection_provides();
sel = dep.Selection_provides()
sel = dep.Selection_provides()</pre><p>Create a Selection from a dependency. The selection consists of all packages
that have at least one provides matching the dependency.</p><pre class="literallayout">const char *str()
my $str = $dep-&gt;str();
str = $dep.str()
str = $dep.str()</pre><p>Return a string describing the dependency.</p><pre class="literallayout">&lt;stringification&gt;
my $str = $dep-&gt;str;
str = str(dep)
str = dep.to_s</pre><p>Same as calling the str() method.</p><pre class="literallayout">&lt;equality&gt;
if ($dep1 == $dep2)
if dep1 == dep2:
if dep1 == dep2</pre><p>Two dependencies are equal if they are part of the same pool and have the same
ids.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_repository_class"></a>11. The Repository Class</h2></div></div></div><p>A Repository describes a group of packages, normally coming from the same
source. Repositories are created by the Pool’s add_repo() method.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_3"></a>11.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Pool *pool;                     /* read only */
$repo-&gt;{pool}
repo.pool
repo.pool</pre><p>Back reference to the pool this dependency belongs to.</p><pre class="literallayout">Id id;                          /* read only */
$repo-&gt;{id}
repo.id
repo.id</pre><p>The id of the repository.</p><pre class="literallayout">const char *name;               /* read/write */
$repo-&gt;{name}
repo.name
repo.name</pre><p>The repositories name. To libsolv, the name is just a string with no specific
meaning.</p><pre class="literallayout">int priority;                   /* read/write */
$repo-&gt;{priority}
repo.priority
repo.priority</pre><p>The priority of the repository. A higher number means that packages of this
repository will be chosen over other repositories, even if they have a greater
package version.</p><pre class="literallayout">int subpriority;                /* read/write */
$repo-&gt;{subpriority}
repo.subpriority
repo.subpriority</pre><p>The sub-priority of the repository. This value is compared when the priorities
of two repositories are the same. It is useful to make the library prefer
on-disk repositories to remote ones.</p><pre class="literallayout">int nsolvables;                 /* read only */
$repo-&gt;{nsolvables}
repo.nsolvables
repo.nsolvables</pre><p>The number of solvables in this repository.</p><pre class="literallayout">void *appdata;                  /* read/write */
$repo-&gt;{appdata}
repo.appdata
repo.appdata</pre><p>Application specific data that may be used in any way by the code using the
repository.</p><pre class="literallayout">Datapos *meta;                  /* read only */
$repo-&gt;{meta}
repo.meta
repo.meta</pre><p>Return a Datapos object of the repodata’s metadata. You can use the lookup
methods of the Datapos class to lookup metadata attributes, like the repository
timestamp.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_constants_3"></a>11.2. CONSTANTS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>REPO_REUSE_REPODATA</strong></span>
</span></dt><dd>
Reuse the last repository data area (“repodata”) instead of creating a
new area.
</dd><dt><span class="term">
<span class="strong"><strong>REPO_NO_INTERNALIZE</strong></span>
</span></dt><dd>
Do not internalize the added repository data. This is useful if
you plan to add more data because internalization is a costly
operation.
</dd><dt><span class="term">
<span class="strong"><strong>REPO_LOCALPOOL</strong></span>
</span></dt><dd>
Use the repodata’s pool for Id storage instead of the global pool. Useful
if you don’t want to pollute the global pool with many unneeded ids, like
when storing the filelist.
</dd><dt><span class="term">
<span class="strong"><strong>REPO_USE_LOADING</strong></span>
</span></dt><dd>
Use the repodata that is currently being loaded instead of creating a new
one. This only makes sense if used in a load callback.
</dd><dt><span class="term">
<span class="strong"><strong>REPO_EXTEND_SOLVABLES</strong></span>
</span></dt><dd>
Do not create new solvables for the new data, but match existing solvables
and add the data to them. Repository metadata is often split into multiple
parts, with one primary file describing all packages and other parts
holding information that is normally not needed, like the changelog.
</dd><dt><span class="term">
<span class="strong"><strong>REPO_USE_ROOTDIR</strong></span>
</span></dt><dd>
Prepend the pool’s rootdir to the path when doing file operations.
</dd><dt><span class="term">
<span class="strong"><strong>REPO_NO_LOCATION</strong></span>
</span></dt><dd>
Do not add a location element to the solvables. Useful if the solvables
are not in the final position, so you can add the correct location later
in your code.
</dd><dt><span class="term">
<span class="strong"><strong>SOLV_ADD_NO_STUBS</strong></span>
</span></dt><dd>
Do not create stubs for repository parts that can be downloaded on demand.
</dd><dt><span class="term">
<span class="strong"><strong>SUSETAGS_RECORD_SHARES</strong></span>
</span></dt><dd>
This is specific to the add_susetags() method. Susetags allows one to refer to
already read packages to save disk space. If this data sharing needs to
work over multiple calls to add_susetags, you need to specify this flag so
that the share information is made available to subsequent calls.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_3"></a>11.3. METHODS</h3></div></div></div><pre class="literallayout">void free(bool reuseids = 0)
$repo-&gt;free();
repo.free()
repo.free()</pre><p>Free the repository and all solvables it contains. If <span class="emphasis"><em>reuseids</em></span> is set to
true, the solvable ids and the repository id may be reused by the library when
added new solvables. Thus you should leave it false if you are not sure that
somebody holds a reference.</p><pre class="literallayout">void empty(bool reuseids = 0)
$repo-&gt;empty();
repo.empty()
repo.empty()</pre><p>Free all the solvables in a repository. The repository will be empty after this
call. See the free() method for the meaning of <span class="emphasis"><em>reuseids</em></span>.</p><pre class="literallayout">bool isempty()
$repo-&gt;isempty()
repo.empty()
repo.empty?</pre><p>Return true if there are no solvables in this repository.</p><pre class="literallayout">void internalize()
$repo-&gt;internalize();
repo.internalize()
repo.internalize()</pre><p>Internalize added data. Data must be internalized before it is available to the
lookup and data iterator functions.</p><pre class="literallayout">bool write(FILE *fp)
$repo-&gt;write($fp)
repo.write(fp)
repo.write(fp)</pre><p>Write a repo as a “solv” file. These files can be read very fast and thus are
a good way to cache repository data. Returns false if there was some error
writing the file.</p><pre class="literallayout">Solvableiterator solvables_iter()
for my $solvable (@{$repo-&gt;solvables_iter()})
for solvable in repo.solvables_iter():
for solvable in repo.solvables_iter()</pre><p>Iterate over all solvables in a repository.</p><pre class="literallayout">Repodata add_repodata(int flags = 0)
my $repodata = $repo-&gt;add_repodata();
repodata = repo.add_repodata()
repodata = repo.add_repodata()</pre><p>Add a new repodata area to the repository. This is normally automatically
done by the repo_add methods, so you need this method only in very
rare circumstances.</p><pre class="literallayout">void create_stubs()
$repo-&gt;create_stubs();
repo.create_stubs()
repo.create_stubs()</pre><p>Calls the create_stubs() repodata method for the last repodata of the
repository.</p><pre class="literallayout">bool iscontiguous()
$repo-&gt;iscontiguous()
repo.iscontiguous()
repo.iscontiguous?</pre><p>Return true if the solvables of this repository are all in a single block with
no holes, i.e. they have consecutive ids.</p><pre class="literallayout">Repodata first_repodata()
my $repodata = $repo-&gt;first_repodata();
repodata = repo.first_repodata()
repodata = repo.first_repodata()</pre><p>Checks if all repodatas but the first repodata are extensions, and return the
first repodata if this is the case. Useful if you want to do a store/retrieve
sequence on the repository to reduce the memory using and enable paging, as
this does not work if the repository contains multiple non-extension repodata
areas.</p><pre class="literallayout">Selection Selection(int setflags = 0)
my $sel = $repo-&gt;Selection();
sel = repo.Selection()
sel = repo.Selection()</pre><p>Create a Selection consisting of all packages in the repository.</p><pre class="literallayout">Dataiterator Dataiterator(Id key, const char *match = 0, int flags = 0)
my $di = $repo-&gt;Dataiterator($keyname, $match, $flags);
di = repo.Dataiterator(keyname, match, flags)
di = repo.Dataiterator(keyname, match, flags)</pre><pre class="literallayout">Dataiterator Dataiterator_meta(Id key, const char *match = 0, int flags = 0)
my $di = $repo-&gt;Dataiterator_meta($keyname, $match, $flags);
di = repo.Dataiterator_meta(keyname, match, flags)
di = repo.Dataiterator_meta(keyname, match, flags)</pre><pre class="literallayout">for my $d (@$di)
for d in di:
for d in di</pre><p>Iterate over the matching data elements in this repository. See the
Dataiterator class for more information. The Dataiterator() method
iterates over all solvables in a repository, whereas the Dataiterator_meta
method only iterates over the repository’s meta data.</p><pre class="literallayout">&lt;stringification&gt;
my $str = $repo-&gt;str;
str = str(repo)
str = repo.to_s</pre><p>Return the name of the repository, or "Repo#&lt;id&gt;" if no name is set.</p><pre class="literallayout">&lt;equality&gt;
if ($repo1 == $repo2)
if repo1 == repo2:
if repo1 == repo2</pre><p>Two repositories are equal if they belong to the same pool and have the same id.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_data_add_methods"></a>11.4. DATA ADD METHODS</h3></div></div></div><pre class="literallayout">Solvable add_solvable()
$repo-&gt;add_solvable();
repo.add_solvable()
repo.add_solvable()</pre><p>Add a single empty solvable to the repository. Returns a Solvable object, see
the Solvable class for more information.</p><pre class="literallayout">bool add_solv(const char *name, int flags = 0)
$repo-&gt;add_solv($name);
repo.add_solv(name)
repo.add_solv(name)</pre><pre class="literallayout">bool add_solv(FILE *fp, int flags = 0)
$repo-&gt;add_solv($fp);
repo.add_solv(fp)
repo.add_solv(fp)</pre><p>Read a “solv” file and add its contents to the repository. These files can be
written with the write() method and are normally used as fast cache for
repository metadata.</p><pre class="literallayout">bool add_rpmdb(int flags = 0)
$repo-&gt;add_rpmdb();
repo.add_rpmdb()
repo.add_rpmdb()</pre><pre class="literallayout">bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
$repo-&gt;add_rpmdb_reffp($reffp);
repo.add_rpmdb_reffp(reffp)
repo.add_rpmdb_reffp(reffp)</pre><p>Add the contents of the rpm database to the repository. If a solv file
containing an old version of the database is available, it can be passed as
reffp to speed up reading.</p><pre class="literallayout">Solvable add_rpm(const char *filename, int flags = 0)
my $solvable = $repo-&gt;add_rpm($filename);
solvable = repo.add_rpm(filename)
solvable = repo.add_rpm(filename)</pre><p>Add the metadata of a single rpm package to the repository.</p><pre class="literallayout">bool add_rpmdb_pubkeys(int flags = 0)
$repo-&gt;add_rpmdb_pubkeys();
repo.add_rpmdb_pubkeys()
repo.add_rpmdb_pubkeys()</pre><p>Add all pubkeys contained in the rpm database to the repository. Note that
newer rpm versions also allow to store the pubkeys in some directory instead
of the rpm database.</p><pre class="literallayout">Solvable add_pubkey(const char *keyfile, int flags = 0)
my $solvable = $repo-&gt;add_pubkey($keyfile);
solvable = repo.add_pubkey(keyfile)
solvable = repo.add_pubkey(keyfile)</pre><p>Add a pubkey from a file to the repository.</p><pre class="literallayout">bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
$repo-&gt;add_rpmmd($fp, undef);
repo.add_rpmmd(fp, None)
repo.add_rpmmd(fp, nil)</pre><p>Add metadata stored in the "rpm-md" format (i.e. from files in the “repodata”
directory) to a repository. Supported files are "primary", "filelists",
"other", "suseinfo". Do not forget to specify the <span class="strong"><strong>REPO_EXTEND_SOLVABLES</strong></span> for
extension files like "filelists" and "other". Use the <span class="emphasis"><em>language</em></span> parameter if
you have language extension files, otherwise simply use a <span class="strong"><strong>undef</strong></span>/<span class="strong"><strong>None</strong></span>/<span class="strong"><strong>nil</strong></span>
parameter.</p><pre class="literallayout">bool add_repomdxml(FILE *fp, int flags = 0)
$repo-&gt;add_repomdxml($fp);
repo.add_repomdxml(fp)
repo.add_repomdxml(fp)</pre><p>Add the repomd.xml meta description from the "rpm-md" format to the repository.
This file contains information about the repository like keywords, and also a
list of all database files with checksums. The data is added to the "meta"
section of the repository, i.e. no package gets created.</p><pre class="literallayout">bool add_updateinfoxml(FILE *fp, int flags = 0)
$repo-&gt;add_updateinfoxml($fp);
repo.add_updateinfoxml(fp)
repo.add_updateinfoxml(fp)</pre><p>Add the updateinfo.xml file containing available maintenance updates to the
repository. All updates are created as special packages that have a "patch:"
prefix in their name.</p><pre class="literallayout">bool add_deltainfoxml(FILE *fp, int flags = 0)
$repo-&gt;add_deltainfoxml($fp);
repo.add_deltainfoxml(fp)
repo.add_deltainfoxml(fp)</pre><p>Add the deltainfo.xml file (also called prestodelta.xml) containing available
delta-rpms to the repository. The data is added to the "meta" section, i.e. no
package gets created.</p><pre class="literallayout">bool add_debdb(int flags = 0)
$repo-&gt;add_debdb();
repo.add_debdb()
repo.add_debdb()</pre><p>Add the contents of the debian installed package database to the repository.</p><pre class="literallayout">bool add_debpackages(FILE *fp, int flags = 0)
$repo-&gt;add_debpackages($fp);
repo.add_debpackages($fp)
repo.add_debpackages($fp)</pre><p>Add the contents of the debian repository metadata (the "packages" file)
to the repository.</p><pre class="literallayout">Solvable add_deb(const char *filename, int flags = 0)
my $solvable = $repo-&gt;add_deb($filename);
solvable = repo.add_deb(filename)
solvable = repo.add_deb(filename)</pre><p>Add the metadata of a single deb package to the repository.</p><pre class="literallayout">bool add_mdk(FILE *fp, int flags = 0)
$repo-&gt;add_mdk($fp);
repo.add_mdk(fp)
repo.add_mdk(fp)</pre><p>Add the contents of the mageia/mandriva repository metadata (the
"synthesis.hdlist" file) to the repository.</p><pre class="literallayout">bool add_mdk_info(FILE *fp, int flags = 0)
$repo-&gt;add_mdk_info($fp);
repo.add_mdk_info(fp)
repo.add_mdk_info(fp)</pre><p>Extend the packages from the synthesis file with the info.xml and files.xml
data. Do not forget to specify <span class="strong"><strong>REPO_EXTEND_SOLVABLES</strong></span>.</p><pre class="literallayout">bool add_arch_repo(FILE *fp, int flags = 0)
$repo-&gt;add_arch_repo($fp);
repo.add_arch_repo(fp)
repo.add_arch_repo(fp)</pre><p>Add the contents of the archlinux repository metadata (the ".db.tar" file) to
the repository.</p><pre class="literallayout">bool add_arch_local(const char *dir, int flags = 0)
$repo-&gt;add_arch_local($dir);
repo.add_arch_local(dir)
repo.add_arch_local(dir)</pre><p>Add the contents of the archlinux installed package database to the repository.
The <span class="emphasis"><em>dir</em></span> parameter is usually set to "/var/lib/pacman/local".</p><pre class="literallayout">bool add_content(FILE *fp, int flags = 0)
$repo-&gt;add_content($fp);
repo.add_content(fp)
repo.add_content(fp)</pre><p>Add the “content” meta description from the susetags format to the repository.
This file contains information about the repository like keywords, and also
a list of all database files with checksums. The data is added to the "meta"
section of the repository, i.e. no package gets created.</p><pre class="literallayout">bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
$repo-&gt;add_susetags($fp, $defvendor, $language);
repo.add_susetags(fp, defvendor, language)
repo.add_susetags(fp, defvendor, language)</pre><p>Add repository metadata in the susetags format to the repository. Like with
add_rpmmd, you can specify a language if you have language extension files. The
<span class="emphasis"><em>defvendor</em></span> parameter provides a default vendor for packages with missing
vendors, it is usually provided in the content file.</p><pre class="literallayout">bool add_products(const char *dir, int flags = 0)
$repo-&gt;add_products($dir);
repo.add_products(dir)
repo.add_products(dir)</pre><p>Add the installed SUSE products database to the repository. The <span class="emphasis"><em>dir</em></span> parameter
is usually "/etc/products.d".</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_solvable_class"></a>12. The Solvable Class</h2></div></div></div><p>A solvable describes all the information of one package. Each solvable
belongs to one repository, it can be added and filled manually but in
most cases solvables will get created by the repo_add methods.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_4"></a>12.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Repo *repo;                     /* read only */
$solvable-&gt;{repo}
solvable.repo
solvable.repo</pre><p>The repository this solvable belongs to.</p><pre class="literallayout">Pool *pool;                     /* read only */
$solvable-&gt;{pool}
solvable.pool
solvable.pool</pre><p>The pool this solvable belongs to, same as the pool of the repo.</p><pre class="literallayout">Id id;                          /* read only */
$solvable-&gt;{id}
solvable.id
solvable.id</pre><p>The specific id of the solvable.</p><pre class="literallayout">char *name;                     /* read/write */
$solvable-&gt;{name}
solvable.name
solvable.name</pre><pre class="literallayout">char *evr;                      /* read/write */
$solvable-&gt;{evr}
solvable.evr
solvable.evr</pre><pre class="literallayout">char *arch;                     /* read/write */
$solvable-&gt;{arch}
solvable.arch
solvable.arch</pre><pre class="literallayout">char *vendor;                   /* read/write */
$solvable-&gt;{vendor}
solvable.vendor
solvable.vendor</pre><p>Easy access to often used attributes of solvables. They are
internally stored as Ids.</p><pre class="literallayout">Id nameid;                      /* read/write */
$solvable-&gt;{nameid}
solvable.nameid
solvable.nameid</pre><pre class="literallayout">Id evrid;                       /* read/write */
$solvable-&gt;{evrid}
solvable.evrid
solvable.evrid</pre><pre class="literallayout">Id archid;                      /* read/write */
$solvable-&gt;{archid}
solvable.archid
solvable.archid</pre><pre class="literallayout">Id vendorid;                    /* read/write */
$solvable-&gt;{vendorid}
solvable.vendorid
solvable.vendorid</pre><p>Raw interface to the ids. Useful if you want to search for
a specific id and want to avoid the string compare overhead.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_4"></a>12.2. METHODS</h3></div></div></div><pre class="literallayout">const char *lookup_str(Id keyname)
my $string = $solvable-&gt;lookup_str($keyname);
string = solvable.lookup_str(keyname)
string = solvable.lookup_str(keyname)</pre><pre class="literallayout">Id lookup_id(Id keyname)
my $id = $solvable-&gt;lookup_id($keyname);
id = solvable.lookup_id(keyname)
id = solvable.lookup_id(keyname)</pre><pre class="literallayout">unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
my $num = $solvable-&gt;lookup_num($keyname);
num = solvable.lookup_num(keyname)
num = solvable.lookup_num(keyname)</pre><pre class="literallayout">bool lookup_void(Id keyname)
my $bool = $solvable-&gt;lookup_void($keyname);
bool = solvable.lookup_void(keyname)
bool = solvable.lookup_void(keyname)</pre><pre class="literallayout">Chksum lookup_checksum(Id keyname)
my $chksum = $solvable-&gt;lookup_checksum($keyname);
chksum = solvable.lookup_checksum(keyname)
chksum = solvable.lookup_checksum(keyname)</pre><pre class="literallayout">Id *lookup_idarray(Id keyname, Id marker = -1)
my @ids = $solvable-&gt;lookup_idarray($keyname);
ids = solvable.lookup_idarray(keyname)
ids = solvable.lookup_idarray(keyname)</pre><pre class="literallayout">Dep *lookup_deparray(Id keyname, Id marker = -1)
my @deps = $solvable-&gt;lookup_deparray($keyname);
deps = solvable.lookup_deparray(keyname)
deps = solvable.lookup_deparray(keyname)</pre><p>Generic lookup methods. Retrieve data stored for the specific keyname.
The lookup_idarray() method will return an array of Ids, use
lookup_deparray if you want an array of Dependency objects instead.
Some Id arrays contain two parts of data divided by a specific marker,
for example the provides array uses the SOLVABLE_FILEMARKER id to
store both the ids provided by the package and the ids added by
the addfileprovides method. The default, -1, translates to the
correct marker for the keyname and returns the first part of the
array, use 1 to select the second part or 0 to retrieve all ids
including the marker.</p><pre class="literallayout">const char *lookup_location(unsigned int *OUTPUT);
my ($location, $mediano) = $solvable-&gt;lookup_location();
location, mediano = solvable.lookup_location()
location, mediano = solvable.lookup_location()</pre><p>Return a tuple containing the on-media location and an optional
media number for multi-part repositories (e.g. repositories
spawning multiple DVDs).</p><pre class="literallayout">const char *lookup_sourcepkg();
my $sourcepkg = $solvable-&gt;lookup_sourcepkg();
sourcepkg = solvable.lookup_sourcepkg()
sourcepkg = solvable.lookup_sourcepkg()</pre><p>Return a sourcepkg name associated with solvable.</p><pre class="literallayout">Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
my $di = $solvable-&gt;Dataiterator($keyname, $match, $flags);
di = solvable.Dataiterator(keyname, match, flags)
di = solvable.Dataiterator(keyname, match, flags)</pre><pre class="literallayout">for my $d (@$di)
for d in di:
for d in di</pre><p>Iterate over the matching data elements. See the Dataiterator class for more
information.</p><pre class="literallayout">void add_deparray(Id keyname, DepId dep, Id marker = -1);
$solvable-&gt;add_deparray($keyname, $dep);
solvable.add_deparray(keyname, dep)
solvable.add_deparray(keyname, dep)</pre><p>Add a new dependency to the attributes stored in keyname.</p><pre class="literallayout">void unset(Id keyname);
$solvable-&gt;unset($keyname);
solvable.unset(keyname)
solvable.unset(keyname)</pre><p>Delete data stored for the specific keyname.</p><pre class="literallayout">bool installable();
$solvable-&gt;installable()
solvable.installable()
solvable.installable?</pre><p>Return true if the solvable is installable on the system. Solvables
are not installable if the system does not support their architecture.</p><pre class="literallayout">bool isinstalled();
$solvable-&gt;isinstalled()
solvable.isinstalled()
solvable.isinstalled?</pre><p>Return true if the solvable is installed on the system.</p><pre class="literallayout">bool identical(Solvable *other)
$solvable-&gt;identical($other)
solvable.identical(other)
solvable.identical?(other)</pre><p>Return true if the two solvables are identical.</p><pre class="literallayout">int evrcmp(Solvable *other)
$solvable-&gt;evrcmp($other)
solvable.evrcmp(other)
solvable.evrcmp(other)</pre><p>Returns -1 if the epoch/version/release of the solvable is less than the
one from the other solvable, 1 if it is greater, and 0 if they are equal.
Note that "equal" does not mean that the evr is identical.</p><pre class="literallayout">int matchesdep(Id keyname, DepId id, Id marker = -1)
$solvable-&gt;matchesdep($keyname, $dep)
solvable.matchesdep(keyname, dep)
solvable.matchesdep?(keyname, dep)</pre><p>Return true if the dependencies stored in keyname match the specified dependency.</p><pre class="literallayout">Selection Selection(int setflags = 0)
my $sel = $solvable-&gt;Selection();
sel = solvable.Selection()
sel = solvable.Selection()</pre><p>Create a Selection containing just the single solvable.</p><pre class="literallayout">const char *str()
my $str = $solvable-&gt;str();
str = $solvable.str()
str = $solvable.str()</pre><p>Return a string describing the solvable. The string consists of the name,
version, and architecture of the Solvable.</p><pre class="literallayout">&lt;stringification&gt;
my $str = $solvable-&gt;str;
str = str(solvable)
str = solvable.to_s</pre><p>Same as calling the str() method.</p><pre class="literallayout">&lt;equality&gt;
if ($solvable1 == $solvable2)
if solvable1 == solvable2:
if solvable1 == solvable2</pre><p>Two solvables are equal if they are part of the same pool and have the same
ids.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_dataiterator_class"></a>13. The Dataiterator Class</h2></div></div></div><p>Dataiterators can be used to do complex string searches or
to iterate over arrays. They can be created via the
constructors in the Pool, Repo, and Solvable classes. The
Repo and Solvable constructors will limit the search to
the repository or the specific package.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_constants_4"></a>13.1. CONSTANTS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SEARCH_STRING</strong></span>
</span></dt><dd>
Return a match if the search string matches the value.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_STRINGSTART</strong></span>
</span></dt><dd>
Return a match if the value starts with the search string.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_STRINGEND</strong></span>
</span></dt><dd>
Return a match if the value ends with the search string.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_SUBSTRING</strong></span>
</span></dt><dd>
Return a match if the search string can be matched somewhere in the value.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_GLOB</strong></span>
</span></dt><dd>
Do a glob match of the search string against the value.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_REGEX</strong></span>
</span></dt><dd>
Do a regular expression match of the search string against the value.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_NOCASE</strong></span>
</span></dt><dd>
Ignore case when matching strings. Works for all the above match types.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_FILES</strong></span>
</span></dt><dd>
Match the complete filenames of the file list, not just the base name.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_COMPLETE_FILELIST</strong></span>
</span></dt><dd>
When matching the file list, check every file of the package not just the
subset from the primary metadata.
</dd><dt><span class="term">
<span class="strong"><strong>SEARCH_CHECKSUMS</strong></span>
</span></dt><dd>
Allow the matching of checksum entries.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_5"></a>13.2. METHODS</h3></div></div></div><pre class="literallayout">void prepend_keyname(Id keyname);
$di-&gt;prepend_keyname($keyname);
di.prepend_keyname(keyname)
di.prepend_keyname(keyname)</pre><p>Do a sub-search in the array stored in keyname.</p><pre class="literallayout">void skip_solvable();
$di-&gt;skip_solvable();
di.skip_solvable()
di.skip_solvable()</pre><p>Stop matching the current solvable and advance to the next
one.</p><pre class="literallayout">&lt;iteration&gt;
for my $d (@$di)
for d in di:
for d in di</pre><p>Iterate through the matches. If there is a match, the object
in d will be of type Datamatch.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_datamatch_class"></a>14. The Datamatch Class</h2></div></div></div><p>Objects of this type will be created for every value matched
by a dataiterator.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_5"></a>14.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Pool *pool;                             /* read only */
$d-&gt;{pool}
d.pool
d.pool</pre><p>Back pointer to pool.</p><pre class="literallayout">Repo *repo;                             /* read only */
$d-&gt;{repo}
d.repo
d.repo</pre><p>The repository containing the matched object.</p><pre class="literallayout">Solvable *solvable;                     /* read only */
$d-&gt;{solvable}
d.solvable
d.solvable</pre><p>The solvable containing the value that was matched.</p><pre class="literallayout">Id solvid;                              /* read only */
$d-&gt;{solvid}
d.solvid
d.solvid</pre><p>The id of the solvable that matched.</p><pre class="literallayout">Id key_id;
$d-&gt;{key_id}
d.key_id
d.key_id</pre><pre class="literallayout">const char *key_idstr;
$d-&gt;{key_idstr}
d.key_idstr
d.key_idstr</pre><p>The keyname that matched, either as id or string.</p><pre class="literallayout">Id type_id;
$d-&gt;{type_id}
d.type_id
d.type_id</pre><pre class="literallayout">const char *type_idstr;
$d-&gt;{type_idstr};
d.type_idstr
d.type_idstr</pre><p>The key type of the value that was matched, either as id or string.</p><pre class="literallayout">Id id;
$d-&gt;{id}
d.id
d.id</pre><pre class="literallayout">Id idstr;
$d-&gt;{idstr}
d.idstr
d.idstr</pre><p>The Id of the value that was matched (only valid for id types),
either as id or string.</p><pre class="literallayout">const char *str;
$d-&gt;{str}
d.str
d.str</pre><p>The string value that was matched (only valid for string types).</p><pre class="literallayout">unsigned long long num;
$d-&gt;{num}
d.num
d.num</pre><p>The numeric value that was matched (only valid for numeric types).</p><pre class="literallayout">unsigned int num2;
$d-&gt;{num2}
d.num2
d.num2</pre><p>The secondary numeric value that was matched (only valid for types
containing two values).</p><pre class="literallayout">unsigned int binary;
$d-&gt;{binary}
d.binary
d.binary</pre><p>The value in binary form, useful for checksums and other data
that cannot be represented as a string.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_6"></a>14.2. METHODS</h3></div></div></div><pre class="literallayout">Datapos pos();
my $pos = $d-&gt;pos();
pos = d.pos()
pos = d.pos()</pre><p>The position object of the current match. It can be used to do
sub-searches starting at the match (if it is of an array type).
See the Datapos class for more information.</p><pre class="literallayout">Datapos parentpos();
my $pos = $d-&gt;parentpos();
pos = d.parentpos()
pos = d.parentpos()</pre><p>The position object of the array containing the current match.
It can be used to do sub-searches, see the Datapos class for more
information.</p><pre class="literallayout">&lt;stringification&gt;
my $str = $d-&gt;str;
str = str(d)
str = d.to_s</pre><p>Return the stringification of the matched value. Stringification
depends on the search flags, for file list entries it will return
just the base name unless SEARCH_FILES is used, for checksums
it will return an empty string unless SEARCH_CHECKSUMS is used.
Numeric values are currently stringified to an empty string.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_selection_class"></a>15. The Selection Class</h2></div></div></div><p>Selections are a way to easily deal with sets of packages.
There are multiple constructors to create them, the most useful
is probably the select() method in the Pool class.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_constants_5"></a>15.1. CONSTANTS</h3></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SELECTION_NAME</strong></span>
</span></dt><dd>
Create the selection by matching package names.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_PROVIDES</strong></span>
</span></dt><dd>
Create the selection by matching package provides.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_FILELIST</strong></span>
</span></dt><dd>
Create the selection by matching package files.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_CANON</strong></span>
</span></dt><dd>
Create the selection by matching the canonical representation
of the package. This is normally a combination of the name,
the version, and the architecture of a package.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_DOTARCH</strong></span>
</span></dt><dd>
Allow an ".&lt;architecture&gt;" suffix when matching names or
provides.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_REL</strong></span>
</span></dt><dd>
Allow the specification of a relation when matching names
or dependencies, e.g. "name &gt;= 1.2".
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_GLOB</strong></span>
</span></dt><dd>
Allow glob matching for package names, package provides, and file names.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_NOCASE</strong></span>
</span></dt><dd>
Ignore case when matching package names, package provides, and file names.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_FLAT</strong></span>
</span></dt><dd>
Return only one selection element describing the selected packages.
The default is to create multiple elements for all globbed packages.
Multiple elements are useful if you want to turn the selection into
an install job, in that case you want an install job for every
globbed package.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_SKIP_KIND</strong></span>
</span></dt><dd>
Remove a "packagekind:" prefix from the package names.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_MATCH_DEPSTR</strong></span>
</span></dt><dd>
When matching dependencies, do a string match on the result of dep2str
instead of using the normal dependency intersect algorithm.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_INSTALLED_ONLY</strong></span>
</span></dt><dd>
Limit the package search to installed packages.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_SOURCE_ONLY</strong></span>
</span></dt><dd>
Limit the package search to source packages only.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_WITH_SOURCE</strong></span>
</span></dt><dd>
Extend the package search to also match source packages. The default is
only to match binary packages.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_WITH_DISABLED</strong></span>
</span></dt><dd>
Extend the package search to also include disabled packages.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_WITH_BADARCH</strong></span>
</span></dt><dd>
Extend the package search to also include packages that are not installable
on the configured architecture.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_WITH_ALL</strong></span>
</span></dt><dd>
Shortcut for selecting the three modifiers above.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_ADD</strong></span>
</span></dt><dd>
Add the result of the match to the current selection instead of replacing it.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_SUBTRACT</strong></span>
</span></dt><dd>
Remove the result of the match to the current selection instead of replacing it.
</dd><dt><span class="term">
<span class="strong"><strong>SELECTION_FILTER</strong></span>
</span></dt><dd>
Intersect the result of the match to the current selection instead of replacing it.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_6"></a>15.2. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Pool *pool;                             /* read only */
$d-&gt;{pool}
d.pool
d.pool</pre><p>Back pointer to pool.</p><pre class="literallayout">int flags;                              /* read only */
$sel-&gt;{flags}
flags = sel.flags
flags = sel.flags</pre><p>The result flags of the selection. The flags are a subset
of the ones used when creating the selection, they describe which
method was used to get the result. For example, if you create the
selection with “SELECTION_NAME | SELECTION_PROVIDES”, the resulting
flags will either be SELECTION_NAME or SELECTION_PROVIDES depending
if there was a package that matched the name or not. If there was
no match at all, the flags will be zero.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_7"></a>15.3. METHODS</h3></div></div></div><pre class="literallayout">bool isempty()
$sel-&gt;isempty()
sel.isempty()
sel.isempty?</pre><p>Return true if the selection is empty, i.e. no package could be matched.</p><pre class="literallayout">Selection clone(int flags = 0)
my $cloned = $sel-&gt;clone();
cloned = sel.clone()
cloned = sel.clone()</pre><p>Return a copy of a selection.</p><pre class="literallayout">void filter(Selection *other)
$sel-&gt;filter($other);
sel.filter(other)
sel.filter(other)</pre><p>Intersect two selections. Packages will only stay in the selection if there
are also included in the other selecting. Does an in-place modification.</p><pre class="literallayout">void add(Selection *other)
$sel-&gt;add($other);
sel.add(other)
sel.add(other)</pre><p>Build the union of two selections. All packages of the other selection will
be added to the set of packages of the selection object. Does an in-place
modification. Note that the selection flags are no longer meaningful after the
add operation.</p><pre class="literallayout">void subtract(Selection *other)
$sel-&gt;subtract($other);
sel.subtract(other)
sel.subtract(other)</pre><p>Remove the packages of the other selection from the packages of the selection
object. Does an in-place modification.</p><pre class="literallayout">void add_raw(Id how, Id what)
$sel-&gt;add_raw($how, $what);
sel.add_raw(how, what)
sel.add_raw(how, what)</pre><p>Add a raw element to the selection. Check the Job class for information about
the how and what parameters. Note that the selection flags are no longer meaningful
after the add_raw operation.</p><pre class="literallayout">Job *jobs(int action)
my @jobs = $sel-&gt;jobs($action);
jobs = sel.jobs(action)
jobs = sel.jobs(action)</pre><p>Convert a selection into an array of Job objects. The action parameter is or-ed
to the “how” part of the job, it describes the type of job (e.g. install,
erase). See the Job class for the action and action modifier constants.</p><pre class="literallayout">Solvable *solvables()
my @solvables = $sel-&gt;solvables();
solvables = sel.solvables()
solvables = sel.solvables()</pre><p>Convert a selection into an array of Solvable objects.</p><pre class="literallayout">void select(const char *name, int flags)
$sel-&gt;select($name, $flags);
sel.select(name, flags)
sel.select(name, flags)</pre><p>Do a select operation and combine the result with the current selection. You
can choose the desired combination method by using either the SELECTION_ADD,
SELECTION_SUBTRACT, or SELECTION_FILTER flag. If none of the flags are
used, SELECTION_FILTER|SELECTION_WITH_ALL is assumed.</p><pre class="literallayout">void matchdeps(const char *name, int flags, Id keyname, Id marker = -1)
$sel-&gt;matchdeps($name, $flags, $keyname);
sel.matchdeps(name, flags, keyname)
sel.matchdeps(name, flags, keyname)</pre><p>Do a matchdeps operation and combine the result with the current selection.</p><pre class="literallayout">void matchdepid(DepId dep, int flags, Id keyname, Id marker = -1)
$sel-&gt;matchdepid($dep, $flags, $keyname);
sel.matchdepid(dep, flags, keyname)
sel.matchdepid(dep, flags, keyname)</pre><p>Do a matchdepid operation and combine the result with the current selection.</p><pre class="literallayout">void matchsolvable(Solvable solvable, int flags, Id keyname, Id marker = -1)
$sel-&gt;matchsolvable($solvable, $flags, $keyname);
sel.matchsolvable(solvable, flags, keyname)
sel.matchsolvable(solvable, flags, keyname)</pre><p>Do a matchsolvable operation and combine the result with the current selection.</p><pre class="literallayout">&lt;stringification&gt;
my $str = $sel-&gt;str;
str = str(sel)
str = sel.to_s</pre><p>Return a string describing the selection.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_job_class"></a>16. The Job Class</h2></div></div></div><p>Jobs are the way to specify to the dependency solver what to do.
Most of the times jobs will get created by calling the jobs() method
on a Selection object, but there is also a Job() constructor in the
Pool class.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_constants_6"></a>16.1. CONSTANTS</h3></div></div></div><p>Selection constants:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLVABLE</strong></span>
</span></dt><dd>
The “what” part is the id of a solvable.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLVABLE_NAME</strong></span>
</span></dt><dd>
The “what” part is the id of a package name.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLVABLE_PROVIDES</strong></span>
</span></dt><dd>
The “what” part is the id of a package provides.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLVABLE_ONE_OF</strong></span>
</span></dt><dd>
The “what” part is an offset into the “whatprovides” data, created
by calling the towhatprovides() pool method.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLVABLE_REPO</strong></span>
</span></dt><dd>
The “what” part is the id of a repository.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLVABLE_ALL</strong></span>
</span></dt><dd>
The “what” part is ignored, all packages are selected.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLVABLE_SELECTMASK</strong></span>
</span></dt><dd>
A mask containing all the above selection bits.
</dd></dl></div><p>Action constants:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_NOOP</strong></span>
</span></dt><dd>
Do nothing.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_INSTALL</strong></span>
</span></dt><dd>
Install a package of the specified set of packages. It tries to install
the best matching package (i.e. the highest version of the packages from
the repositories with the highest priority).
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_ERASE</strong></span>
</span></dt><dd>
Erase all of the packages from the specified set. If a package is not
installed, erasing it will keep it from getting installed.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_UPDATE</strong></span>
</span></dt><dd>
Update the matching installed packages to their best version. If none
of the specified packages are installed, try to update the installed
packages to the specified versions. See the section about targeted
updates about more information.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_WEAKENDEPS</strong></span>
</span></dt><dd>
Allow to break the dependencies of the matching packages. Handle with care.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_MULTIVERSION</strong></span>
</span></dt><dd>
Mark the matched packages for multiversion install. If they get to be
installed because of some other job, the installation will keep the old
version of the package installed (for rpm this is done by using “-i”
instead of “-U”).
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_LOCK</strong></span>
</span></dt><dd>
Do not change the state of the matched packages, i.e. when they are
installed they stay installed, if not they are not selected for
installation.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_DISTUPGRADE</strong></span>
</span></dt><dd>
Update the matching installed packages to the best version included in one
of the repositories. After this operation, all come from one of the available
repositories except orphaned packages. Orphaned packages are packages that
have no relation to the packages in the repositories, i.e. no package in the
repositories have the same name or obsolete the orphaned package.
This action brings the installed packages in sync with the ones in the
repository. By default it also turns of arch/vendor/version locking for the
affected packages to simulate a fresh installation. This means that distupgrade can
actually downgrade packages if only lower versions of a package are available
in the repositories. You can tweak this behavior with the SOLVER_FLAG_DUP_
solver flags.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_DROP_ORPHANED</strong></span>
</span></dt><dd>
Erase all the matching installed packages if they are orphaned. This only makes
sense if there is a “distupgrade all packages” job. The default is to erase
orphaned packages only if they block the installation of other packages.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_VERIFY</strong></span>
</span></dt><dd>
Fix dependency problems of matching installed packages. The default is to ignore
dependency problems for installed packages.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_USERINSTALLED</strong></span>
</span></dt><dd>
The matching installed packages are considered to be installed by a user,
thus not installed to fulfill some dependency. This is needed input for
the calculation of unneeded packages for jobs that have the
SOLVER_CLEANDEPS flag set.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_ALLOWUNINSTALL</strong></span>
</span></dt><dd>
Allow the solver to deinstall the matching installed packages if they get
into the way of resolving a dependency. This is like the
SOLVER_FLAG_ALLOW_UNINSTALL flag, but limited to a specific set of packages.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FAVOR</strong></span>
</span></dt><dd>
Prefer the specified packages if the solver encounters an alternative. If
a job contains multiple matching favor/disfavor elements, the last one takes
precedence.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_DISFAVOR</strong></span>
</span></dt><dd>
Avoid the specified packages if the solver encounters an alternative. This
can also be used to block recommended or supplemented packages from being
installed.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_JOBMASK</strong></span>
</span></dt><dd>
A mask containing all the above action bits.
</dd></dl></div><p>Action modifier constants:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_WEAK</strong></span>
</span></dt><dd>
Makes the job a weak job. The solver tries to fulfill weak jobs, but does
not report a problem if it is not possible to do so.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_ESSENTIAL</strong></span>
</span></dt><dd>
Makes the job an essential job. If there is a problem with the job, the
solver will not propose to remove the job as one solution (unless all
other solutions are also to remove essential jobs).
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_CLEANDEPS</strong></span>
</span></dt><dd>
The solver will try to also erase all packages dragged in through
dependencies when erasing the package. This needs SOLVER_USERINSTALLED
jobs to maximize user satisfaction.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FORCEBEST</strong></span>
</span></dt><dd>
Insist on the best package for install, update, and distupgrade jobs. If
this flag is not used, the solver will use the second-best package if the
best package cannot be installed for some reason. When this flag is used,
the solver will generate a problem instead.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TARGETED</strong></span>
</span></dt><dd>
Forces targeted operation update and distupgrade jobs. See the section
about targeted updates about more information.
</dd></dl></div><p>Set constants.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_SETEV</strong></span>
</span></dt><dd>
The job specified the exact epoch and version of the package set.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SETEVR</strong></span>
</span></dt><dd>
The job specified the exact epoch, version, and release of the package set.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SETARCH</strong></span>
</span></dt><dd>
The job specified the exact architecture of the packages from the set.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SETVENDOR</strong></span>
</span></dt><dd>
The job specified the exact vendor of the packages from the set.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SETREPO</strong></span>
</span></dt><dd>
The job specified the exact repository of the packages from the set.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SETNAME</strong></span>
</span></dt><dd>
The job specified the exact name of the packages from the set.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_NOAUTOSET</strong></span>
</span></dt><dd>
Turn of automatic set flag generation for SOLVER_SOLVABLE jobs.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SETMASK</strong></span>
</span></dt><dd>
A mask containing all the above set bits.
</dd></dl></div><p>See the section about set bits for more information.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_7"></a>16.2. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Pool *pool;                             /* read only */
$job-&gt;{pool}
d.pool
d.pool</pre><p>Back pointer to pool.</p><pre class="literallayout">Id how;                                 /* read/write */
$job-&gt;{how}
d.how
d.how</pre><p>Union of the selection, action, action modifier, and set flags.
The selection part describes the semantics of the “what” Id.</p><pre class="literallayout">Id what;                                /* read/write */
$job-&gt;{what}
d.what
d.what</pre><p>Id describing the set of packages, the meaning depends on the
selection part of the “how” attribute.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_8"></a>16.3. METHODS</h3></div></div></div><pre class="literallayout">Solvable *solvables()
my @solvables = $job-&gt;solvables();
solvables = job.solvables()
solvables = job.solvables()</pre><p>Return the set of solvables of the job as an array of Solvable
objects.</p><pre class="literallayout">bool isemptyupdate();
$job-&gt;isemptyupdate()
job.isemptyupdate()
job.isemptyupdate?</pre><p>Convenience function to find out if the job describes an update
job with no matching packages, i.e. a job that does nothing.
Some package managers like “zypper” like to turn those jobs
into install jobs, i.e. an update of a not-installed package
will result into the installation of the package.</p><pre class="literallayout">&lt;stringification&gt;
my $str = $job-&gt;str;
str = str(job)
str = job.to_s</pre><p>Return a string describing the job.</p><pre class="literallayout">&lt;equality&gt;
if ($job1 == $job2)
if job1 == job2:
if job1 == job2</pre><p>Two jobs are equal if they belong to the same pool and both the
“how” and the “what” attributes are the same.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_targeted_updates"></a>16.4. TARGETED UPDATES</h3></div></div></div><p>Libsolv has two modes for upgrades and distupgrade: targeted and
untargeted. Untargeted mode means that the installed packages from
the specified set will be updated to the best version. Targeted means
that packages that can be updated to a package in the specified set
will be updated to the best package of the set.</p><p>Here’s an example to explain the subtle difference. Suppose that
you have package A installed in version "1.1", "A-1.2" is available
in one of the repositories and there is also package "B" that
obsoletes package A.</p><p>An untargeted update of "A" will update the installed "A-1.1" to
package "B", because that is the newest version (B obsoletes A and
is thus newer).</p><p>A targeted update of "A" will update "A-1.1" to "A-1.2", as the
set of packages contains both "A-1.1" and "A-1.2", and "A-1.2" is
the newer one.</p><p>An untargeted update of "B" will do nothing, as "B" is not installed.</p><p>An targeted update of "B" will update "A-1.1" to "B".</p><p>Note that the default is to do "auto-targeting", thus if the specified
set of packages does not include an installed package, the solver
will assume targeted operation even if SOLVER_TARGETED is not used.</p><p>This mostly matches the intent of the user, with one exception: In
the example above, an update of "A-1.2" will update "A-1.1" to
"A-1.2" (targeted mode), but a second update of "A-1.2" will suddenly
update to "B", as untargeted mode is chosen because "A-1.2" is now
installed.</p><p>If you want to have full control over when targeting mode is chosen,
turn off auto-targeting with the SOLVER_FLAG_NO_AUTOTARGET solver option.
In that case, all updates are considered to be untargeted unless they
include the SOLVER_TARGETED flag.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_set_bits"></a>16.5. SET BITS</h3></div></div></div><p>Set bits specify which parts of the specified packages where specified
by the user. It is used by the solver when checking if an operation is
allowed or not. For example, the solver will normally not allow the
downgrade of an installed package. But it will not report a problem if
the SOLVER_SETEVR flag is used, as it then assumes that the user specified
the exact version and thus knows what he is doing.</p><p>So if a package "screen-1-1" is installed for the x86_64 architecture and
version "2-1" is only available for the i586 architecture, installing
package "screen-2.1" will ask the user for confirmation because of the
different architecture. When using the Selection class to create jobs
the set bits are automatically added, e.g. selecting “screen.i586” will
automatically add SOLVER_SETARCH, and thus no problem will be reported.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_solver_class"></a>17. The Solver Class</h2></div></div></div><p>Dependency solving is what this library is about. A solver object is needed
for solving to store the result of the solver run. The solver object can be
used multiple times for different jobs, reusing it allows the solver to
re-use the dependency rules it already computed.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_constants_7"></a>17.1. CONSTANTS</h3></div></div></div><p>Flags to modify some of the solver’s behavior:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_ALLOW_DOWNGRADE</strong></span>
</span></dt><dd>
Allow the solver to downgrade packages without asking for confirmation
(i.e. reporting a problem).
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_ALLOW_ARCHCHANGE</strong></span>
</span></dt><dd>
Allow the solver to change the architecture of an installed package
without asking for confirmation. Note that changes to/from noarch
are always considered to be allowed.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_ALLOW_VENDORCHANGE</strong></span>
</span></dt><dd>
Allow the solver to change the vendor of an installed package
without asking for confirmation. Each vendor is part of one or more
vendor equivalence classes, normally installed packages may only
change their vendor if the new vendor shares at least one equivalence
class.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_ALLOW_NAMECHANGE</strong></span>
</span></dt><dd>
Allow the solver to change the name of an installed package, i.e.
install a package with a different name that obsoletes the installed
package. This option is on by default.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_ALLOW_UNINSTALL</strong></span>
</span></dt><dd>
Allow the solver to erase installed packages to fulfill the jobs.
This flag also includes the above flags. You may want to set this
flag if you only have SOLVER_ERASE jobs, as in that case it’s
better for the user to check the transaction overview instead of
approving every single package that needs to be erased.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_DUP_ALLOW_DOWNGRADE</strong></span>
</span></dt><dd>
Like SOLVER_FLAG_ALLOW_DOWNGRADE, but used in distupgrade mode.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE</strong></span>
</span></dt><dd>
Like SOLVER_FLAG_ALLOW_ARCHCHANGE, but used in distupgrade mode.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE</strong></span>
</span></dt><dd>
Like SOLVER_FLAG_ALLOW_VENDORCHANGE, but used in distupgrade mode.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_DUP_ALLOW_NAMECHANGE</strong></span>
</span></dt><dd>
Like SOLVER_FLAG_ALLOW_NAMECHANGE, but used in distupgrade mode.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_NO_UPDATEPROVIDE</strong></span>
</span></dt><dd>
If multiple packages obsolete an installed package, the solver checks
the provides of every such package and ignores all packages that
do not provide the installed package name. Thus, you can have an
official update candidate that provides the old name, and other
packages that also obsolete the package but are not considered for
updating. If you cannot use this feature, you can turn it off
by setting this flag.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_NEED_UPDATEPROVIDE</strong></span>
</span></dt><dd>
This is somewhat the opposite of SOLVER_FLAG_NO_UPDATEPROVIDE: Only
packages that provide the installed package names are considered
for updating.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_SPLITPROVIDES</strong></span>
</span></dt><dd>
Make the solver aware of special provides of the form
“&lt;packagename&gt;:&lt;path&gt;” used in SUSE systems to support package
splits.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_IGNORE_RECOMMENDED</strong></span>
</span></dt><dd>
Do not process optional (aka weak) dependencies.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_ADD_ALREADY_RECOMMENDED</strong></span>
</span></dt><dd>
Install recommended or supplemented packages even if they have no
connection to the current transaction. You can use this feature
to implement a simple way for the user to install new recommended
packages that were not available in the past.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_NO_INFARCHCHECK</strong></span>
</span></dt><dd>
Turn off the inferior architecture checking that is normally done
by the solver. Normally, the solver allows only the installation
of packages from the "best" architecture if a package is available
for multiple architectures.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_BEST_OBEY_POLICY</strong></span>
</span></dt><dd>
Make the SOLVER_FORCEBEST job option consider only packages that
meet the policies for installed packages, i.e. no downgrades,
no architecture change, no vendor change (see the first flags
of this section). If the flag is not specified, the solver will
enforce the installation of the best package ignoring the
installed packages, which may conflict with the set policy.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_NO_AUTOTARGET</strong></span>
</span></dt><dd>
Do not enable auto-targeting up update and distupgrade jobs. See
the section on targeted updates for more information.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_KEEP_ORPHANS</strong></span>
</span></dt><dd>
Do not allow orphaned packages to be deinstalled if they get
in the way of resolving other packages.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_BREAK_ORPHANS</strong></span>
</span></dt><dd>
Ignore dependencies of orphaned packages that get in the way
of resolving non-orphaned ones. Setting the flag might result
in no longer working packages in case they are orphaned.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_FOCUS_INSTALLED</strong></span>
</span></dt><dd>
Resolve installed packages before resolving the given jobs.
Setting this flag means that the solver will prefer picking
a package version that fits the other installed packages
over updating installed packages.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_FOCUS_BEST</strong></span>
</span></dt><dd>
First resolve the given jobs, then the dependencies of the
resulting packages, then resolve all already installed
packages. This will result in more packages being updated
as when the flag is not used.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_INSTALL_ALSO_UPDATES</strong></span>
</span></dt><dd>
Update the package if a job is already fulfilled by an installed
package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_YUM_OBSOLETES</strong></span>
</span></dt><dd>
Turn on yum-like package split handling. See the yum documentation
for more details.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_FLAG_URPM_REORDER</strong></span>
</span></dt><dd>
Turn on urpm like package reordering for kernel packages. See
the urpm documentation for more details.
</dd></dl></div><p>Basic rule types:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_UNKNOWN</strong></span>
</span></dt><dd>
A rule of an unknown class. You should never encounter those.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG</strong></span>
</span></dt><dd>
A package dependency rule.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_UPDATE</strong></span>
</span></dt><dd>
A rule to implement the update policy of installed packages. Every
installed package has an update rule that consists of the packages
that may replace the installed package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_FEATURE</strong></span>
</span></dt><dd>
Feature rules are fallback rules used when an update rule is disabled. They
include all packages that may replace the installed package ignoring the
update policy, i.e. they contain downgrades, arch changes and so on.
Without them, the solver would simply erase installed packages if their
update rule gets disabled.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_JOB</strong></span>
</span></dt><dd>
Job rules implement the job given to the solver.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_DISTUPGRADE</strong></span>
</span></dt><dd>
These are simple negative assertions that make sure that only packages
are kept that are also available in one of the repositories.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_INFARCH</strong></span>
</span></dt><dd>
Infarch rules are also negative assertions, they disallow the installation
of packages when there are packages of the same name but with a better
architecture.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_CHOICE</strong></span>
</span></dt><dd>
Choice rules are used to make sure that the solver prefers updating to
installing different packages when some dependency is provided by
multiple packages with different names. The solver may always break
choice rules, so you will not see them when a problem is found.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_LEARNT</strong></span>
</span></dt><dd>
These rules are generated by the solver to keep it from running into
the same problem multiple times when it has to backtrack. They are
the main reason why a sat solver is faster than other dependency solver
implementations.
</dd></dl></div><p>Special dependency rule types:</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_NOT_INSTALLABLE</strong></span>
</span></dt><dd>
This rule was added to prevent the installation of a package of an
architecture that does not work on the system.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP</strong></span>
</span></dt><dd>
The package contains a required dependency which was not provided by
any package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_REQUIRES</strong></span>
</span></dt><dd>
Similar to SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP, but in this case
some packages provided the dependency but none of them could be
installed due to other dependency issues.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_SELF_CONFLICT</strong></span>
</span></dt><dd>
The package conflicts with itself. This is not allowed by older rpm
versions.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_CONFLICTS</strong></span>
</span></dt><dd>
To fulfill the dependencies two packages need to be installed, but
one of the packages contains a conflict with the other one.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_SAME_NAME</strong></span>
</span></dt><dd>
The dependencies can only be fulfilled by multiple versions of
a package, but installing multiple versions of the same package
is not allowed.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_OBSOLETES</strong></span>
</span></dt><dd>
To fulfill the dependencies two packages need to be installed, but
one of the packages obsoletes the other one.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_IMPLICIT_OBSOLETES</strong></span>
</span></dt><dd>
To fulfill the dependencies two packages need to be installed, but
one of the packages has provides a dependency that is obsoleted
by the other one. See the POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES
flag.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_PKG_INSTALLED_OBSOLETES</strong></span>
</span></dt><dd>
To fulfill the dependencies a package needs to be installed that is
obsoleted by an installed package. See the POOL_FLAG_NOINSTALLEDOBSOLETES
flag.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP</strong></span>
</span></dt><dd>
The user asked for installation of a package providing a specific
dependency, but no available package provides it.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_JOB_UNKNOWN_PACKAGE</strong></span>
</span></dt><dd>
The user asked for installation of a package with a specific name,
but no available package has that name.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM</strong></span>
</span></dt><dd>
The user asked for the erasure of a dependency that is provided by the
system (i.e. for special hardware or language dependencies), this
cannot be done with a job.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_RULE_JOB_UNSUPPORTED</strong></span>
</span></dt><dd>
The user asked for something that is not yet implemented, e.g. the
installation of all packages at once.
</dd></dl></div><p>Policy error constants</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>POLICY_ILLEGAL_DOWNGRADE</strong></span>
</span></dt><dd>
The solver ask for permission before downgrading packages.
</dd><dt><span class="term">
<span class="strong"><strong>POLICY_ILLEGAL_ARCHCHANGE</strong></span>
</span></dt><dd>
The solver ask for permission before changing the architecture of installed
packages.
</dd><dt><span class="term">
<span class="strong"><strong>POLICY_ILLEGAL_VENDORCHANGE</strong></span>
</span></dt><dd>
The solver ask for permission before changing the vendor of installed
packages.
</dd><dt><span class="term">
<span class="strong"><strong>POLICY_ILLEGAL_NAMECHANGE</strong></span>
</span></dt><dd>
The solver ask for permission before replacing an installed packages with
a package that has a different name.
</dd></dl></div><p>Solution element type constants</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_JOB</strong></span>
</span></dt><dd>
The problem can be solved by removing the specified job.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_POOLJOB</strong></span>
</span></dt><dd>
The problem can be solved by removing the specified job that is defined
in the pool.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_INFARCH</strong></span>
</span></dt><dd>
The problem can be solved by allowing the installation of the specified
package with an inferior architecture.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_DISTUPGRADE</strong></span>
</span></dt><dd>
The problem can be solved by allowing to keep the specified package
installed.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_BEST</strong></span>
</span></dt><dd>
The problem can be solved by allowing to install the specified package
that is not the best available package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_ERASE</strong></span>
</span></dt><dd>
The problem can be solved by allowing to erase the specified package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_REPLACE</strong></span>
</span></dt><dd>
The problem can be solved by allowing to replace the package with some
other package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_REPLACE_DOWNGRADE</strong></span>
</span></dt><dd>
The problem can be solved by allowing to replace the package with some
other package that has a lower version.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_REPLACE_ARCHCHANGE</strong></span>
</span></dt><dd>
The problem can be solved by allowing to replace the package with some
other package that has a different architecture.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_REPLACE_VENDORCHANGE</strong></span>
</span></dt><dd>
The problem can be solved by allowing to replace the package with some
other package that has a different vendor.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_SOLUTION_REPLACE_NAMECHANGE</strong></span>
</span></dt><dd>
The problem can be solved by allowing to replace the package with some
other package that has a different name.
</dd></dl></div><p>Reason constants</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_UNRELATED</strong></span>
</span></dt><dd>
The package status did not change as it was not related to any job.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_UNIT_RULE</strong></span>
</span></dt><dd>
The package was installed/erased/kept because of a unit rule, i.e. a rule
where all literals but one were false.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_KEEP_INSTALLED</strong></span>
</span></dt><dd>
The package was chosen when trying to keep as many packages installed as
possible.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_RESOLVE_JOB</strong></span>
</span></dt><dd>
The decision happened to fulfill a job rule.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_UPDATE_INSTALLED</strong></span>
</span></dt><dd>
The decision happened to fulfill a package update request.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_CLEANDEPS_ERASE</strong></span>
</span></dt><dd>
The package was erased when cleaning up dependencies from other erased
packages.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_RESOLVE</strong></span>
</span></dt><dd>
The package was installed to fulfill package dependencies.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_WEAKDEP</strong></span>
</span></dt><dd>
The package was installed because of a weak dependency (Recommends or
Supplements).
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_RESOLVE_ORPHAN</strong></span>
</span></dt><dd>
The decision about the package was made when deciding the fate of orphaned
packages.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_RECOMMENDED</strong></span>
</span></dt><dd>
This is a special case of SOLVER_REASON_WEAKDEP.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_REASON_SUPPLEMENTED</strong></span>
</span></dt><dd>
This is a special case of SOLVER_REASON_WEAKDEP.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_8"></a>17.2. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Pool *pool;                             /* read only */
$job-&gt;{pool}
d.pool
d.pool</pre><p>Back pointer to pool.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_9"></a>17.3. METHODS</h3></div></div></div><pre class="literallayout">int set_flag(int flag, int value)
my $oldvalue = $solver-&gt;set_flag($flag, $value);
oldvalue = solver.set_flag(flag, value)
oldvalue = solver.set_flag(flag, value)</pre><pre class="literallayout">int get_flag(int flag)
my $value = $solver-&gt;get_flag($flag);
value = solver.get_flag(flag)
value = solver.get_flag(flag)</pre><p>Set/get a solver specific flag. The flags define the policies the solver has
to obey. The flags are explained in the CONSTANTS section of this class.</p><pre class="literallayout">Problem *solve(Job *jobs)
my @problems = $solver-&gt;solve(\@jobs);
problems = solver.solve(jobs)
problems = solver.solve(jobs)</pre><p>Solve a problem specified in the job list (plus the jobs defined in the pool).
Returns an array of problems that need user interaction, or an empty array
if no problems were encountered. See the Problem class on how to deal with
problems.</p><pre class="literallayout">Transaction transaction()
my $trans = $solver-&gt;transaction();
trans = solver.transaction()
trans = solver.transaction()</pre><p>Return the transaction to implement the calculated package changes. A transaction
is available even if problems were found, this is useful for interactive user
interfaces that show both the job result and the problems.</p><pre class="literallayout">int reason = describe_decision(Solvable *s, Rule *OUTPUT)
my ($reason, $rule) = $solver-&gt;describe_decision($solvable);
(reason, rule) = solver.describe_decision(solvable)
(reason, rule) = solver.describe_decision(solvable)</pre><p>Return the reason why a specific solvable was installed or erased. For most of
the reasons the rule that triggered the decision is also returned.</p><pre class="literallayout">Solvable *get_recommended(bool noselected=0);
my @solvables = $solver-&gt;get_recommended();
solvables = solver.get_recommended()
solvables = solver.get_recommended()</pre><p>Return all solvables that are recommended by the solver run result. This includes
solvables included in the result, set noselected if you want to filter those.</p><pre class="literallayout">Solvable *get_suggested(bool noselected=0);
my @solvables = $solver-&gt;get_suggested();
solvables = solver.get_suggested()
solvables = solver.get_suggested()</pre><p>Return all solvables that are suggested by the solver run result. This includes
solvables included in the result, set noselected if you want to filter those.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_problem_class"></a>18. The Problem Class</h2></div></div></div><p>Problems are the way of the solver to interact with the user. You can simply list
all problems and terminate your program, but a better way is to present solutions to
the user and let him pick the ones he likes.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_9"></a>18.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Solver *solv;                           /* read only */
$problem-&gt;{solv}
problem.solv
problem.solv</pre><p>Back pointer to solver object.</p><pre class="literallayout">Id id;                                  /* read only */
$problem-&gt;{id}
problem.id
problem.id</pre><p>Id of the problem. The first problem has Id 1, they are numbered consecutively.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_10"></a>18.2. METHODS</h3></div></div></div><pre class="literallayout">Rule findproblemrule()
my $probrule = $problem-&gt;findproblemrule();
probrule = problem.findproblemrule()
probrule = problem.findproblemrule()</pre><p>Return the rule that caused the problem. Of course in most situations there is no
single responsible rule, but many rules that interconnect with each created the
problem. Nevertheless, the solver uses some heuristic approach to find a rule
that somewhat describes the problem best to the user.</p><pre class="literallayout">Rule *findallproblemrules(bool unfiltered = 0)
my @probrules = $problem-&gt;findallproblemrules();
probrules = problem.findallproblemrules()
probrules = problem.findallproblemrules()</pre><p>Return all rules responsible for the problem. The returned set of rules contains
all the needed information why there was a problem, but it’s hard to present
them to the user in a sensible way. The default is to filter out all update and
job rules (unless the returned rules only consist of those types).</p><pre class="literallayout">Solution *solutions()
my @solutions = $problem-&gt;solutions();
solutions = problem.solutions()
solutions = problem.solutions()</pre><p>Return an array containing multiple possible solutions to fix the problem. See
the solution class for more information.</p><pre class="literallayout">int solution_count()
my $cnt = $problem-&gt;solution_count();
cnt = problem.solution_count()
cnt = problem.solution_count()</pre><p>Return the number of solutions without creating solution objects.</p><pre class="literallayout">&lt;stringification&gt;
my $str = $problem-&gt;str;
str = str(problem)
str = problem.to_s</pre><p>Return a string describing the problem. This is a convenience function, it is
a shorthand for calling findproblemrule(), then ruleinfo() on the problem
rule and problemstr() on the ruleinfo object.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_rule_class"></a>19. The Rule Class</h2></div></div></div><p>Rules are the basic block of sat solving. Each package dependency gets translated
into one or multiple rules.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_10"></a>19.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Solver *solv;                           /* read only */
$rule-&gt;{solv}
rule.solv
rule.solv</pre><p>Back pointer to solver object.</p><pre class="literallayout">Id id;                                  /* read only */
$rule-&gt;{id}
rule.id
rule.id</pre><p>The id of the rule.</p><pre class="literallayout">int type;                               /* read only */
$rule-&gt;{type}
rule.type
rule.type</pre><p>The basic type of the rule. See the constant section of the solver class for the type list.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_11"></a>19.2. METHODS</h3></div></div></div><pre class="literallayout">Ruleinfo info()
my $ruleinfo = $rule-&gt;info();
ruleinfo = rule.info()
ruleinfo = rule.info()</pre><p>Return a Ruleinfo object that contains information about why the rule was created. But
see the allinfos() method below.</p><pre class="literallayout">Ruleinfo *allinfos()
my @ruleinfos = $rule-&gt;allinfos();
ruleinfos = rule.allinfos()
ruleinfos = rule.allinfos()</pre><p>As the same dependency rule can get created because of multiple dependencies, one
Ruleinfo is not enough to describe the reason. Thus the allinfos() method returns
an array of all infos about a rule.</p><pre class="literallayout">&lt;equality&gt;
if ($rule1 == $rule2)
if rule1 == rule2:
if rule1 == rule2</pre><p>Two rules are equal if they belong to the same solver and have the same id.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_ruleinfo_class"></a>20. The Ruleinfo Class</h2></div></div></div><p>A Ruleinfo describes one reason why a rule was created.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_11"></a>20.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Solver *solv;                           /* read only */
$ruleinfo-&gt;{solv}
ruleinfo.solv
ruleinfo.solv</pre><p>Back pointer to solver object.</p><pre class="literallayout">int type;                               /* read only */
$ruleinfo-&gt;{type}
ruleinfo.type
ruleinfo.type</pre><p>The type of the ruleinfo. See the constant section of the solver class for the
rule type list and the special type list.</p><pre class="literallayout">Dep *dep;                               /* read only */
$ruleinfo-&gt;{dep}
ruleinfo.dep
ruleinfo.dep</pre><p>The dependency leading to the creation of the rule.</p><pre class="literallayout">Dep *dep_id;                            /* read only */
$ruleinfo-&gt;{'dep_id'}
ruleinfo.dep_id
ruleinfo.dep_id</pre><p>The Id of the dependency leading to the creation of the rule, or zero.</p><pre class="literallayout">Solvable *solvable;                     /* read only */
$ruleinfo-&gt;{solvable}
ruleinfo.solvable
ruleinfo.solvable</pre><p>The involved Solvable, e.g. the one containing the dependency.</p><pre class="literallayout">Solvable *othersolvable;                /* read only */
$ruleinfo-&gt;{othersolvable}
ruleinfo.othersolvable
ruleinfo.othersolvable</pre><p>The other involved Solvable (if any), e.g. the one containing providing
the dependency for conflicts.</p><pre class="literallayout">const char *problemstr();
my $str = $ruleinfo-&gt;problemstr();
str = ruleinfo.problemstr()
str = ruleinfo.problemstr()</pre><p>A string describing the ruleinfo from a problem perspective. This probably
only makes sense if the rule is part of a problem.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_solution_class"></a>21. The Solution Class</h2></div></div></div><p>A solution solves one specific problem. It consists of multiple solution elements
that all need to be executed.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_12"></a>21.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Solver *solv;                           /* read only */
$solution-&gt;{solv}
solution.solv
solution.solv</pre><p>Back pointer to solver object.</p><pre class="literallayout">Id problemid;                           /* read only */
$solution-&gt;{problemid}
solution.problemid
solution.problemid</pre><p>Id of the problem the solution solves.</p><pre class="literallayout">Id id;                                  /* read only */
$solution-&gt;{id}
solution.id
solution.id</pre><p>Id of the solution. The first solution has Id 1, they are numbered consecutively.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_12"></a>21.2. METHODS</h3></div></div></div><pre class="literallayout">Solutionelement *elements(bool expandreplaces = 0)
my @solutionelements = $solution-&gt;elements();
solutionelements = solution.elements()
solutionelements = solution.elements()</pre><p>Return an array containing the elements describing what needs to be done to
implement the specific solution. If expandreplaces is true, elements of type
SOLVER_SOLUTION_REPLACE will be replaced by one or more elements replace
elements describing the policy mismatches.</p><pre class="literallayout">int element_count()
my $cnt = $solution-&gt;solution_count();
cnt = solution.element_count()
cnt = solution.element_count()</pre><p>Return the number of solution elements without creating objects. Note that the
count does not match the number of objects returned by the elements() method
of expandreplaces is set to true.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_solutionelement_class"></a>22. The Solutionelement Class</h2></div></div></div><p>A solution element describes a single action of a solution. The action is always
either to remove one specific job or to add a new job that installs or erases
a single specific package.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_13"></a>22.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Solver *solv;                           /* read only */
$solutionelement-&gt;{solv}
solutionelement.solv
solutionelement.solv</pre><p>Back pointer to solver object.</p><pre class="literallayout">Id problemid;                           /* read only */
$solutionelement-&gt;{problemid}
solutionelement.problemid
solutionelement.problemid</pre><p>Id of the problem the element (partly) solves.</p><pre class="literallayout">Id solutionid;                          /* read only */
$solutionelement-&gt;{solutionid}
solutionelement.solutionid
solutionelement.solutionid</pre><p>Id of the solution the element is a part of.</p><pre class="literallayout">Id id;                                  /* read only */
$solutionelement-&gt;{id}
solutionelement.id
solutionelement.id</pre><p>Id of the solution element. The first element has Id 1, they are numbered consecutively.</p><pre class="literallayout">Id type;                                /* read only */
$solutionelement-&gt;{type}
solutionelement.type
solutionelement.type</pre><p>Type of the solution element. See the constant section of the solver class for the
existing types.</p><pre class="literallayout">Solvable *solvable;                     /* read only */
$solutionelement-&gt;{solvable}
solutionelement.solvable
solutionelement.solvable</pre><p>The installed solvable that needs to be replaced for replacement elements.</p><pre class="literallayout">Solvable *replacement;                  /* read only */
$solutionelement-&gt;{replacement}
solutionelement.replacement
solutionelement.replacement</pre><p>The solvable that needs to be installed to fix the problem.</p><pre class="literallayout">int jobidx;                             /* read only */
$solutionelement-&gt;{jobidx}
solutionelement.jobidx
solutionelement.jobidx</pre><p>The index of the job that needs to be removed to fix the problem, or -1 if the
element is of another type. Note that it’s better to change the job to SOLVER_NOOP
type so that the numbering of other elements does not get disturbed. This
method works both for types SOLVER_SOLUTION_JOB and SOLVER_SOLUTION_POOLJOB.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_13"></a>22.2. METHODS</h3></div></div></div><pre class="literallayout">Solutionelement *replaceelements()
my @solutionelements = $solutionelement-&gt;replaceelements();
solutionelements = solutionelement.replaceelements()
solutionelements = solutionelement.replaceelements()</pre><p>If the solution element is of type SOLVER_SOLUTION_REPLACE, return an array of
elements describing the policy mismatches, otherwise return a copy of the
element. See also the “expandreplaces” option in the solution’s elements()
method.</p><pre class="literallayout">int illegalreplace()
my $illegal = $solutionelement-&gt;illegalreplace();
illegal = solutionelement.illegalreplace()
illegal = solutionelement.illegalreplace()</pre><p>Return an integer that contains the policy mismatch bits or-ed together, or
zero if there was no policy mismatch. See the policy error constants in
the solver class.</p><pre class="literallayout">Job Job()
my $job = $solutionelement-&gt;Job();
illegal = solutionelement.Job()
illegal = solutionelement.Job()</pre><p>Create a job that implements the solution element. Add this job to the array
of jobs for all elements of type different to SOLVER_SOLUTION_JOB and
SOLVER_SOLUTION_POOLJOB. For the latter two, a SOLVER_NOOB Job is created,
you should replace the old job with the new one.</p><pre class="literallayout">const char *str()
my $str = $solutionelement-&gt;str();
str = solutionelement.str()
str = solutionelement.str()</pre><p>A string describing the change the solution element consists of.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_transaction_class"></a>23. The Transaction Class</h2></div></div></div><p>Transactions describe the output of a solver run. A transaction contains
a number of transaction elements, each either the installation of a new
package or the removal of an already installed package. The Transaction
class supports a classify() method that puts the elements into different
groups so that a transaction can be presented to the user in a meaningful
way.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_constants_8"></a>23.1. CONSTANTS</h3></div></div></div><p>Transaction element types, both active and passive</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_IGNORE</strong></span>
</span></dt><dd>
This element does nothing. Used to map element types that do not match
the view mode.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_INSTALL</strong></span>
</span></dt><dd>
This element installs a package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_ERASE</strong></span>
</span></dt><dd>
This element erases a package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_MULTIINSTALL</strong></span>
</span></dt><dd>
This element installs a package with a different version keeping the other
versions installed.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_MULTIREINSTALL</strong></span>
</span></dt><dd>
This element reinstalls an installed package keeping the other versions
installed.
</dd></dl></div><p>Transaction element types, active view</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_REINSTALL</strong></span>
</span></dt><dd>
This element re-installs a package, i.e. installs the same package again.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_CHANGE</strong></span>
</span></dt><dd>
This element installs a package with same name, version, architecture but
different content.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_UPGRADE</strong></span>
</span></dt><dd>
This element installs a newer version of an installed package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_DOWNGRADE</strong></span>
</span></dt><dd>
This element installs an older version of an installed package.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_OBSOLETES</strong></span>
</span></dt><dd>
This element installs a package that obsoletes an installed package.
</dd></dl></div><p>Transaction element types, passive view</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_REINSTALLED</strong></span>
</span></dt><dd>
This element re-installs a package, i.e. installs the same package again.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_CHANGED</strong></span>
</span></dt><dd>
This element replaces an installed package with one of the same name,
version, architecture but different content.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_UPGRADED</strong></span>
</span></dt><dd>
This element replaces an installed package with a new version.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_DOWNGRADED</strong></span>
</span></dt><dd>
This element replaces an installed package with an old version.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_OBSOLETED</strong></span>
</span></dt><dd>
This element replaces an installed package with a package that obsoletes
it.
</dd></dl></div><p>Pseudo element types for showing extra information used by classify()</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_ARCHCHANGE</strong></span>
</span></dt><dd>
This element replaces an installed package with a package of a different
architecture.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_VENDORCHANGE</strong></span>
</span></dt><dd>
This element replaces an installed package with a package of a different
vendor.
</dd></dl></div><p>Transaction mode flags</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_SHOW_ACTIVE</strong></span>
</span></dt><dd>
Filter for active view types. The default is to return passive view type,
i.e. to show how the installed packages get changed.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_SHOW_OBSOLETES</strong></span>
</span></dt><dd>
Do not map the obsolete view type into INSTALL/ERASE elements.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_SHOW_ALL</strong></span>
</span></dt><dd>
If multiple packages replace an installed package, only the best of them
is kept as OBSOLETE element, the other ones are mapped to INSTALL/ERASE
elements. This is because most applications want to show just one package
replacing the installed one. The SOLVER_TRANSACTION_SHOW_ALL makes the
library keep all OBSOLETE elements.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_SHOW_MULTIINSTALL</strong></span>
</span></dt><dd>
The library maps MULTIINSTALL elements to simple INSTALL elements. This
flag can be used to disable the mapping.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_CHANGE_IS_REINSTALL</strong></span>
</span></dt><dd>
Use this flag if you want to map CHANGE elements to the REINSTALL type.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE</strong></span>
</span></dt><dd>
Use this flag if you want to map OBSOLETE elements to the UPGRADE type.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_MERGE_ARCHCHANGES</strong></span>
</span></dt><dd>
Do not add extra categories for every architecture change, instead cumulate
them in one category.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_MERGE_VENDORCHANGES</strong></span>
</span></dt><dd>
Do not add extra categories for every vendor change, instead cumulate
them in one category.
</dd><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_RPM_ONLY</strong></span>
</span></dt><dd>
Special view mode that just returns IGNORE, ERASE, INSTALL, MULTIINSTALL
elements. Useful if you want to find out what to feed to the underlying
package manager.
</dd></dl></div><p>Transaction order flags</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<span class="strong"><strong>SOLVER_TRANSACTION_KEEP_ORDERDATA</strong></span>
</span></dt><dd>
Do not throw away the dependency graph used for ordering the transaction.
This flag is needed if you want to do manual ordering.
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_14"></a>23.2. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Pool *pool;                             /* read only */
$trans-&gt;{pool}
trans.pool
trans.pool</pre><p>Back pointer to pool.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_14"></a>23.3. METHODS</h3></div></div></div><pre class="literallayout">bool isempty();
$trans-&gt;isempty()
trans.isempty()
trans.isempty?</pre><p>Returns true if the transaction does not do anything, i.e. has no elements.</p><pre class="literallayout">Solvable *newsolvables();
my @newsolvables = $trans-&gt;newsolvables();
newsolvables = trans.newsolvables()
newsolvables = trans.newsolvables()</pre><p>Return all packages that are to be installed by the transaction. These are
the packages that need to be downloaded from the repositories.</p><pre class="literallayout">Solvable *keptsolvables();
my @keptsolvables = $trans-&gt;keptsolvables();
keptsolvables = trans.keptsolvables()
keptsolvables = trans.keptsolvables()</pre><p>Return all installed packages that the transaction will keep installed.</p><pre class="literallayout">Solvable *steps();
my @steps = $trans-&gt;steps();
steps = trans.steps()
steps = trans.steps()</pre><p>Return all solvables that need to be installed (if the returned solvable
is not already installed) or erased (if the returned solvable is installed).
A step is also called a transaction element.</p><pre class="literallayout">int steptype(Solvable *solvable, int mode)
my $type = $trans-&gt;steptype($solvable, $mode);
type = trans.steptype(solvable, mode)
type = trans.steptype(solvable, mode)</pre><p>Return the transaction type of the specified solvable. See the CONSTANTS
sections for the mode argument flags and the list of returned types.</p><pre class="literallayout">TransactionClass *classify(int mode = 0)
my @classes = $trans-&gt;classify();
classes = trans.classify()
classes = trans.classify()</pre><p>Group the transaction elements into classes so that they can be displayed
in a structured way. You can use various mapping mode flags to tweak
the result to match your preferences, see the mode argument flag in
the CONSTANTS section. See the TransactionClass class for how to deal
with the returned objects.</p><pre class="literallayout">Solvable othersolvable(Solvable *solvable);
my $other = $trans-&gt;othersolvable($solvable);
other = trans.othersolvable(solvable)
other = trans.othersolvable(solvable)</pre><p>Return the “other” solvable for a given solvable. For installed packages
the other solvable is the best package with the same name that replaces
the installed package, or the best package of the obsoleting packages if
the package does not get replaced by one with the same name.</p><p>For to be installed packages, the “other” solvable is the best installed
package with the same name that will be replaced, or the best packages
of all the packages that are obsoleted if the new package does not replace
a package with the same name.</p><p>Thus, the “other” solvable is normally the package that is also shown
for a given package.</p><pre class="literallayout">Solvable *allothersolvables(Solvable *solvable);
my @others = $trans-&gt;allothersolvables($solvable);
others = trans.allothersolvables(solvable)
others = trans.allothersolvables(solvable)</pre><p>For installed packages, returns all of the packages that replace us. For to
be installed packages, returns all of the packages that the new package
replaces. The special “other” solvable is always the first entry of the
returned array.</p><pre class="literallayout">long long calc_installsizechange();
my $change = $trans-&gt;calc_installsizechange();
change = trans.calc_installsizechange()
change = trans.calc_installsizechange()</pre><p>Return the size change of the installed system in kilobytes (kibibytes).</p><pre class="literallayout">void order(int flags = 0);
$trans-&gt;order();
trans.order()
trans.order()</pre><p>Order the steps in the transactions so that dependent packages are updated
before packages that depend on them. For rpm, you can also use rpmlib’s
ordering functionality, debian’s dpkg does not provide a way to order a
transaction.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_active_passive_view"></a>23.4. ACTIVE/PASSIVE VIEW</h3></div></div></div><p>Active view lists what new packages get installed, while passive view shows
what happens to the installed packages. Most often there’s not much
difference between the two modes, but things get interesting if multiple
packages get replaced by one new package. Say you have installed packages
A-1-1 and B-1-1, and now install A-2-1 which has a new dependency that
obsoletes B. The transaction elements will be</p><pre class="literallayout">updated   A-1-1 (other: A-2-1)
obsoleted B-1-1 (other: A-2-1)</pre><p>in passive mode, but</p><pre class="literallayout">update A-2-1 (other: A-1-1)
erase  B</pre><p>in active mode. If the mode contains SOLVER_TRANSACTION_SHOW_ALL, the
passive mode list will be unchanged but the active mode list will just
contain A-2-1.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_transactionclass_class"></a>24. The Transactionclass Class</h2></div></div></div><p>Objects of this type are returned by the classify() Transaction method.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_15"></a>24.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Transaction *transaction;               /* read only */
$class-&gt;{transaction}
class.transaction
class.transaction</pre><p>Back pointer to transaction object.</p><pre class="literallayout">int type;                               /* read only */
$class-&gt;{type}
class.type
class.type</pre><p>The type of the transaction elements in the class.</p><pre class="literallayout">int count;                              /* read only */
$class-&gt;{count}
class.count
class.count</pre><p>The number of elements in the class.</p><pre class="literallayout">const char *fromstr;
$class-&gt;{fromstr}
class.fromstr
class.fromstr</pre><p>The old vendor or architecture.</p><pre class="literallayout">const char *tostr;
$class-&gt;{tostr}
class.tostr
class.tostr</pre><p>The new vendor or architecture.</p><pre class="literallayout">Id fromid;
$class-&gt;{fromid}
class.fromid
class.fromid</pre><p>The id of the old vendor or architecture.</p><pre class="literallayout">Id toid;
$class-&gt;{toid}
class.toid
class.toid</pre><p>The id of the new vendor or architecture.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_15"></a>24.2. METHODS</h3></div></div></div><pre class="literallayout">void solvables();
my @solvables = $class-&gt;solvables();
solvables = class.solvables()
solvables = class.solvables()</pre><p>Return the solvables for all transaction elements in the class.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_checksums"></a>25. Checksums</h2></div></div></div><p>Checksums (also called hashes) are used to make sure that downloaded data is
not corrupt and also as a fingerprint mechanism to check if data has changed.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_class_methods_2"></a>25.1. CLASS METHODS</h3></div></div></div><pre class="literallayout">Chksum Chksum(Id type)
my $chksum = solv::Chksum-&gt;new($type);
chksum = solv.Chksum(type)
chksum = Solv::Chksum.new(type)</pre><p>Create a checksum object. Currently the following types are supported:</p><pre class="literallayout">REPOKEY_TYPE_MD5
REPOKEY_TYPE_SHA1
REPOKEY_TYPE_SHA256</pre><p>These keys are constants in the <span class="strong"><strong>solv</strong></span> class.</p><pre class="literallayout">Chksum Chksum(Id type, const char *hex)
my $chksum = solv::Chksum-&gt;new($type, $hex);
chksum = solv.Chksum(type, hex)
chksum = Solv::Chksum.new(type, hex)</pre><p>Create an already finalized checksum object from a hex string.</p><pre class="literallayout">Chksum Chksum_from_bin(Id type, char *bin)
my $chksum = solv::Chksum-&gt;from_bin($type, $bin);
chksum = solv.Chksum.from_bin(type, bin)
chksum = Solv::Chksum.from_bin(type, bin)</pre><p>Create an already finalized checksum object from a binary checksum.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_16"></a>25.2. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Id type;                        /* read only */
$chksum-&gt;{type}
chksum.type
chksum.type</pre><p>Return the type of the checksum object.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_16"></a>25.3. METHODS</h3></div></div></div><pre class="literallayout">void add(const char *str)
$chksum-&gt;add($str);
chksum.add(str)
chksum.add(str)</pre><p>Add a (binary) string to the checksum.</p><pre class="literallayout">void add_fp(FILE *fp)
$chksum-&gt;add_fp($file);
chksum.add_fp(file)
chksum.add_fp(file)</pre><p>Add the contents of a file to the checksum.</p><pre class="literallayout">void add_stat(const char *filename)
$chksum-&gt;add_stat($filename);
chksum.add_stat(filename)
chksum.add_stat(filename)</pre><p>Stat the file and add the dev/ino/size/mtime member to the checksum. If the
stat fails, the members are zeroed.</p><pre class="literallayout">void add_fstat(int fd)
$chksum-&gt;add_fstat($fd);
chksum.add_fstat(fd)
chksum.add_fstat(fd)</pre><p>Same as add_stat, but instead of the filename a file descriptor is used.</p><pre class="literallayout">unsigned char *raw()
my $raw = $chksum-&gt;raw();
raw = chksum.raw()
raw = chksum.raw()</pre><p>Finalize the checksum and return the result as raw bytes. This means that the
result can contain NUL bytes or unprintable characters.</p><pre class="literallayout">const char *hex()
my $raw = $chksum-&gt;hex();
raw = chksum.hex()
raw = chksum.hex()</pre><p>Finalize the checksum and return the result as hex string.</p><pre class="literallayout">const char *typestr()
my $typestr = $chksum-&gt;typestr();
typestr = chksum.typestr
typestr = chksum.typestr</pre><p>Return the type of the checksum as a string, e.g. "sha256".</p><pre class="literallayout">&lt;equality&gt;
if ($chksum1 == $chksum2)
if chksum1 == chksum2:
if chksum1 == chksum2</pre><p>Checksums are equal if they are of the same type and the finalized results are
the same.</p><pre class="literallayout">&lt;stringification&gt;
my $str = $chksum-&gt;str;
str = str(chksum)
str = chksum.to_s</pre><p>If the checksum is finished, the checksum is returned as "&lt;type&gt;:&lt;hex&gt;" string.
Otherwise "&lt;type&gt;:unfinished" is returned.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_file_management"></a>26. File Management</h2></div></div></div><p>This functions were added because libsolv uses standard <span class="strong"><strong>FILE</strong></span> pointers to
read/write files, but languages like perl have their own implementation of
files. The libsolv functions also support decompression and compression, the
algorithm is selected by looking at the file name extension.</p><pre class="literallayout">FILE *xfopen(char *fn, char *mode = "r")
my $file = solv::xfopen($path);
file = solv.xfopen(path)
file = Solv::xfopen(path)</pre><p>Open a file at the specified path. The <code class="literal">mode</code> argument is passed on to the
stdio library.</p><pre class="literallayout">FILE *xfopen_fd(char *fn, int fileno)
my $file = solv::xfopen_fd($path, $fileno);
file = solv.xfopen_fd(path, fileno)
file = Solv::xfopen_fd(path, fileno)</pre><p>Create a file handle from the specified file descriptor. The path argument is
only used to select the correct (de-)compression algorithm, use an empty path
if you want to make sure to read/write raw data. The file descriptor is dup()ed
before the file handle is created.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_17"></a>26.1. METHODS</h3></div></div></div><pre class="literallayout">int fileno()
my $fileno = $file-&gt;fileno();
fileno = file.fileno()
fileno = file.fileno()</pre><p>Return file file descriptor of the file. If the file is not open, <code class="literal">-1</code> is
returned.</p><pre class="literallayout">void cloexec(bool state)
$file-&gt;cloexec($state)
file.cloexec(state)
file.cloexec(state)</pre><p>Set the close-on-exec flag of the file descriptor. The xfopen function
returns files with close-on-exec turned on, so if you want to pass
a file to some other process you need to call cloexec(0) before calling
exec.</p><pre class="literallayout">int dup()
my $fileno = $file-&gt;dup();
fileno = file.dup()
fileno = file.dup()</pre><p>Return a copy of the descriptor of the file. If the file is not open, <code class="literal">-1</code> is
returned.</p><pre class="literallayout">bool flush()
$file-&gt;flush();
file.flush()
file.flush()</pre><p>Flush the file. Returns false if there was an error. Flushing a closed file
always returns true.</p><pre class="literallayout">bool close()
$file-&gt;close();
file.close()
file.close()</pre><p>Close the file. This is needed for languages like Ruby that do not destruct
objects right after they are no longer referenced. In that case, it is good
style to close open files so that the file descriptors are freed right away.
Returns false if there was an error.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_repodata_class"></a>27. The Repodata Class</h2></div></div></div><p>The Repodata stores attributes for packages and the repository itself, each
repository can have multiple repodata areas. You normally only need to
directly access them if you implement lazy downloading of repository data.
Repodata areas are created by calling the repository’s add_repodata() method
or by using repo_add methods without the REPO_REUSE_REPODATA or REPO_USE_LOADING
flag.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_17"></a>27.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Repo *repo;                     /* read only */
$data-&gt;{repo}
data.repo
data.repo</pre><p>Back pointer to repository object.</p><pre class="literallayout">Id id;                                  /* read only */
$data-&gt;{id}
data.id
data.id</pre><p>The id of the repodata area. Repodata ids of different repositories overlap.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_18"></a>27.2. METHODS</h3></div></div></div><pre class="literallayout">internalize();
$data-&gt;internalize();
data.internalize()
data.internalize()</pre><p>Internalize newly added data. The lookup functions will only see the new data
after it has been internalized.</p><pre class="literallayout">bool write(FILE *fp);
$data-&gt;write($fp);
data.write(fp)
data.write(fp)</pre><p>Write the contents of the repodata area as solv file.</p><pre class="literallayout">Id str2dir(const char *dir, bool create = 1)
my $did = data-&gt;str2dir($dir);
did = data.str2dir(dir)
did = data.str2dir(dir)</pre><pre class="literallayout">const char *dir2str(Id did, const char *suffix = 0)
$dir = pool-&gt;dir2str($did);
dir = pool.dir2str(did)
dir = pool.dir2str(did)</pre><p>Convert a string (directory) into an Id and back. If the string is currently not in the
pool and <span class="emphasis"><em>create</em></span> is false, zero is returned.</p><pre class="literallayout">void add_dirstr(Id solvid, Id keyname, Id dir, const char *str)
$data-&gt;add_dirstr($solvid, $keyname, $dir, $string)
data.add_dirstr(solvid, keyname, dir, string)
data.add_dirstr(solvid, keyname, dir, string)</pre><p>Add a file path consisting of a dirname Id and a basename string.</p><pre class="literallayout">bool add_solv(FILE *fp, int flags = 0);
$data-&gt;add_solv($fp);
data.add_solv(fp)
data.add_solv(fp)</pre><p>Replace a stub repodata object with the data from a solv file. This method
automatically adds the REPO_USE_LOADING flag. It should only be used from
a load callback.</p><pre class="literallayout">void create_stubs();
$data-&gt;create_stubs()
data.create_stubs()
data.create_stubs()</pre><p>Create stub repodatas from the information stored in the repodata meta
area.</p><pre class="literallayout">void extend_to_repo();
$data-&gt;extend_to_repo();
data.extend_to_repo()
data.extend_to_repo()</pre><p>Extend the repodata so that it has the same size as the repo it belongs to.
This method is needed when setting up a new extension repodata so that it
matches the repository size. It is also needed when switching to a just written
repodata extension to make the repodata match the written extension (which is
always of the size of the repo).</p><pre class="literallayout">&lt;equality&gt;
if ($data1 == $data2)
if data1 == data2:
if data1 == data2</pre><p>Two repodata objects are equal if they belong to the same repository and have
the same id.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_data_retrieval_methods_2"></a>27.3. DATA RETRIEVAL METHODS</h3></div></div></div><pre class="literallayout">const char *lookup_str(Id solvid, Id keyname)
my $string = $data-&gt;lookup_str($solvid, $keyname);
string = data.lookup_str(solvid, keyname)
string = data.lookup_str(solvid, keyname)</pre><pre class="literallayout">const char *lookup_id(Id solvid, Id keyname)
my $string = $data-&gt;lookup_id($solvid, $keyname);
string = data.lookup_id(solvid, keyname)
string = data.lookup_id(solvid, keyname)</pre><pre class="literallayout">unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
my $num = $data-&gt;lookup_num($solvid, $keyname);
num = data.lookup_num(solvid, keyname)
num = data.lookup_num(solvid, keyname)</pre><pre class="literallayout">bool lookup_void(Id solvid, Id keyname)
my $bool = $data-&gt;lookup_void($solvid, $keyname);
bool = data.lookup_void(solvid, keyname)
bool = data.lookup_void(solvid, keyname)</pre><pre class="literallayout">Id *lookup_idarray(Id solvid, Id keyname)
my @ids = $data-&gt;lookup_idarray($solvid, $keyname);
ids = data.lookup_idarray(solvid, keyname)
ids = data.lookup_idarray(solvid, keyname)</pre><pre class="literallayout">Chksum lookup_checksum(Id solvid, Id keyname)
my $chksum = $data-&gt;lookup_checksum($solvid, $keyname);
chksum = data.lookup_checksum(solvid, keyname)
chksum = data.lookup_checksum(solvid, keyname)</pre><p>Lookup functions. Return the data element stored in the specified solvable.
The methods probably only make sense to retrieve data from the special
SOLVID_META solvid that stores repodata meta information.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_data_storage_methods"></a>27.4. DATA STORAGE METHODS</h3></div></div></div><pre class="literallayout">void set_str(Id solvid, Id keyname, const char *str);
$data-&gt;set_str($solvid, $keyname, $str);
data.set_str(solvid, keyname, str)
data.set_str(solvid, keyname, str)</pre><pre class="literallayout">void set_id(Id solvid, Id keyname, DepId id);
$data-&gt;set_id($solvid, $keyname, $id);
data.set_id(solvid, keyname, id)
data.set_id(solvid, keyname, id)</pre><pre class="literallayout">void set_num(Id solvid, Id keyname, unsigned long long num);
$data-&gt;set_num($solvid, $keyname, $num);
data.set_num(solvid, keyname, num)
data.set_num(solvid, keyname, num)</pre><pre class="literallayout">void set_void(Id solvid, Id keyname);
$data-&gt;set_void($solvid, $keyname);
data.set_void(solvid, keyname)
data.set_void(solvid, keyname)</pre><pre class="literallayout">void set_poolstr(Id solvid, Id keyname, const char *str);
$data-&gt;set_poolstr($solvid, $keyname, $str);
data.set_poolstr(solvid, keyname, str)
data.set_poolstr(solvid, keyname, str)</pre><pre class="literallayout">void set_checksum(Id solvid, Id keyname, Chksum *chksum);
$data-&gt;set_checksum($solvid, $keyname, $chksum);
data.set_checksum(solvid, keyname, chksum)
data.set_checksum(solvid, keyname, chksum)</pre><pre class="literallayout">void set_sourcepkg(Id solvid, const char *sourcepkg);
$data.set_sourcepkg($solvid, $sourcepkg);
data.set_sourcepkg(solvid, sourcepkg)
data.set_sourcepkg(solvid, sourcepkg)</pre><pre class="literallayout">void set_location(Id solvid, unsigned int mediano, const char *location);
$data.set_location($solvid, $mediano, $location);
data.set_location(solvid, mediano, location)
data.set_location(solvid, mediano, location)</pre><pre class="literallayout">void add_idarray(Id solvid, Id keyname, DepId id);
$data-&gt;add_idarray($solvid, $keyname, $id);
data.add_idarray(solvid, keyname, id)
data.add_idarray(solvid, keyname, id)</pre><pre class="literallayout">Id new_handle();
my $handle = $data-&gt;new_handle();
handle = data.new_handle()
handle = data.new_handle()</pre><pre class="literallayout">void add_flexarray(Id solvid, Id keyname, Id handle);
$data-&gt;add_flexarray($solvid, $keyname, $handle);
data.add_flexarray(solvid, keyname, handle)
data.add_flexarray(solvid, keyname, handle)</pre><pre class="literallayout">void unset(Id solvid, Id keyname);
$data-&gt;unset($solvid, $keyname);
data.unset(solvid, keyname)
data.unset(solvid, keyname)</pre><p>Data storage methods. Probably only useful to store data in the special
SOLVID_META solvid that stores repodata meta information. Note that
repodata areas can have their own Id pool (see the REPO_LOCALPOOL flag),
so be careful if you need to store ids. Arrays are created by calling
the add function for every element. A flexarray is an array of
sub-structures, call new_handle to create a new structure, use the
handle as solvid to fill the structure with data and call add_flexarray
to put the structure in an array.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_the_datapos_class"></a>28. The Datapos Class</h2></div></div></div><p>Datapos objects describe a specific position in the repository data area.
Thus they are only valid until the repository is modified in some way.
Datapos objects can be created by the pos() and parentpos() methods of
a Datamatch object or by accessing the “meta” attribute of a repository.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_attributes_18"></a>28.1. ATTRIBUTES</h3></div></div></div><pre class="literallayout">Repo *repo;                     /* read only */
$data-&gt;{repo}
data.repo
data.repo</pre><p>Back pointer to repository object.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_methods_19"></a>28.2. METHODS</h3></div></div></div><pre class="literallayout">Dataiterator(Id keyname, const char *match, int flags)
my $di = $datapos-&gt;Dataiterator($keyname, $match, $flags);
di = datapos.Dataiterator(keyname, match, flags)
di = datapos.Dataiterator(keyname, match, flags)</pre><p>Create a Dataiterator at the position of the datapos object.</p><pre class="literallayout">const char *lookup_deltalocation(unsigned int *OUTPUT);
my ($location, $mediano) = $datapos-&gt;lookup_deltalocation();
location, mediano = datapos.lookup_deltalocation()
location, mediano = datapos.lookup_deltalocation()</pre><p>Return a tuple containing the on-media location and an optional media number
for a delta rpm. This obviously only works if the data position points to
structure describing a delta rpm.</p><pre class="literallayout">const char *lookup_deltaseq();
my $seq = $datapos-&gt;lookup_deltaseq();
seq = datapos.lookup_deltaseq();
seq = datapos.lookup_deltaseq();</pre><p>Return the delta rpm sequence from the structure describing a delta rpm.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="_data_retrieval_methods_3"></a>28.3. DATA RETRIEVAL METHODS</h3></div></div></div><pre class="literallayout">const char *lookup_str(Id keyname)
my $string = $datapos-&gt;lookup_str($keyname);
string = datapos.lookup_str(keyname)
string = datapos.lookup_str(keyname)</pre><pre class="literallayout">Id lookup_id(Id solvid, Id keyname)
my $id = $datapos-&gt;lookup_id($keyname);
id = datapos.lookup_id(keyname)
id = datapos.lookup_id(keyname)</pre><pre class="literallayout">unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
my $num = $datapos-&gt;lookup_num($keyname);
num = datapos.lookup_num(keyname)
num = datapos.lookup_num(keyname)</pre><pre class="literallayout">bool lookup_void(Id keyname)
my $bool = $datapos-&gt;lookup_void($keyname);
bool = datapos.lookup_void(keyname)
bool = datapos.lookup_void(keyname)</pre><pre class="literallayout">Id *lookup_idarray(Id keyname)
my @ids = $datapos-&gt;lookup_idarray($keyname);
ids = datapos.lookup_idarray(keyname)
ids = datapos.lookup_idarray(keyname)</pre><pre class="literallayout">Chksum lookup_checksum(Id keyname)
my $chksum = $datapos-&gt;lookup_checksum($keyname);
chksum = datapos.lookup_checksum(keyname)
chksum = datapos.lookup_checksum(keyname)</pre><p>Lookup functions. Note that the returned Ids are always translated into
the Ids of the global pool even if the repodata area contains its own pool.</p><pre class="literallayout">Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
my $di = $datapos-&gt;Dataiterator($keyname, $match, $flags);
di = datapos.Dataiterator(keyname, match, flags)
di = datapos.Dataiterator(keyname, match, flags)</pre><pre class="literallayout">for my $d (@$di)
for d in di:
for d in di</pre><p>Iterate over the matching data elements. See the Dataiterator class for more
information.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_author"></a>29. Author</h2></div></div></div><p>Michael Schroeder &lt;<a class="ulink" href="mailto:mls@suse.de" target="_top">mls@suse.de</a>&gt;</p></div></div></body></html>