9 libsolv-bindings - access libsolv from perl/python/ruby
18 The pool is libsolv's central resource manager. A pool consists of Solvables,
19 Repositories, Dependencies, each indexed by Ids.
24 my $pool = solv::Pool->new();
26 pool = Solv::Pool.new()
28 Create a new pool instance. In most cases you just need
33 void *appdata; /* read/write */
38 Application specific data that may be used in any way by the code using the
41 Solvable solvables[]; /* read only */
42 my $solvable = $pool->{solvables}->[$solvid];
43 solvable = pool.solvables[solvid]
44 solvable = pool.solvables[solvid]
46 Look up a Solvable by its id.
48 Repo repos[]; /* read only */
49 my $repo = $pool->{repos}->[$repoid];
50 repo = pool.repos[repoid]
51 repo = pool.repos[repoid]
53 Look up a Repository by its id.
55 Repo *installed; /* read/write */
56 $pool->{installed} = $repo;
60 Define which repository contains all the installed packages.
64 *POOL_FLAG_PROMOTEEPOCH*::
65 Promote the epoch of the providing dependency to the requesting
66 dependency if it does not contain an epoch. Used at some time
67 in old rpm versions, modern systems should never need this.
69 *POOL_FLAG_FORBIDSELFCONFLICTS*::
70 Disallow the installation of packages that conflict with themselfs.
71 Debian always allowd self-conflicting packages, rpm used to forbid
72 them but switched to also allowing them recently.
74 *POOL_FLAG_OBSOLETEUSESPROVIDES*::
75 Make obsolete type dependency match against provides instead of
76 just the name and version of packages. Very old versions of rpm
77 used the name/version, then it got switched to provides and later
78 switched back again to just name/version.
80 *POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES*::
81 An implicit obsoletes is the internal mechanism to remove the
82 old package on an update. The default is to remove all packages
83 with the same name, rpm-5 switched to also removing packages
84 providing the same name.
86 *POOL_FLAG_OBSOLETEUSESCOLORS*::
87 Rpm's multilib implementation (used in RedHat and Fedora)
88 distinguishes between 32bit and 64bit packages (the terminology
89 is that they have a different color). If obsolteusescolors is
90 set, packages with different colors will not obsolete each other.
92 *POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS*::
93 Same as POOL_FLAG_OBSOLETEUSESCOLORS, but used to find out if
94 packages of the same name can be installed in parallel. For
95 current Fedora systems, POOL_FLAG_OBSOLETEUSESCOLORS should be
96 false and POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS should be true
97 (this is the default if FEDORA is defined when libsolv is
100 *POOL_FLAG_NOINSTALLEDOBSOLETES*::
101 New versions of rpm consider the obsoletes of installed packages
102 when checking for dependency, thus you may not install a package
103 that is obsoleted by some other installed package, unless you
104 also deinstall the other package.
106 *POOL_FLAG_HAVEDISTEPOCH*::
107 Mandriva added a new field called distepoch that gets checked in
108 version comparison if the epoch/version/release of two packages
111 *POOL_FLAG_NOOBSOLETESMULTIVERSION*::
112 If a package is installed in multiversionmode, rpm used to ignore
113 both the implicit obsoletes and the obsolete dependency of a
114 package. This was changed to ignoring just the implicit obsoletes,
115 thus you may install multiple versions of the same name, but
116 obsoleted packages still get removed.
118 *POOL_FLAG_ADDFILEPROVIDESFILTERED*::
119 Make the addfileprovides method only add files from the standard
120 locations (i.e. the ``bin'' and ``etc'' directories). This is
121 useful if you have only few packages that use non-standard file
122 dependencies, but you still wand the fast speed that addfileprovides()
132 Free a pool. This is currently done with a method instead of relying on
133 reference counting or garbage collection because it's hard to track every
136 void setdebuglevel(int level)
137 $pool->setdebuglevel($level);
138 pool.setdebuglevel(level)
139 pool.setdebuglevel(level)
141 Set the debug level. A value of zero means no debug output, the higher the
142 value, the more output is generated.
144 int set_flag(int flag, int value)
145 my $oldvalue = $pool->set_flag($flag, $value);
146 oldvalue = pool.set_flag(flag, value)
147 oldvalue = pool.set_flag(flag, value)
149 int get_flag(int flag)
150 my $value = $pool->get_flag($flag);
151 value = pool.get_flag(flag)
152 value = pool.get_flag(flag)
154 Set/get a pool specific flag. The flags define how the system works, e.g. how
155 the package manager treats obsoletes. The default flags should be sane for most
156 applications, but in some cases you may want to tweak a flag, for example if
157 you want to solv package dependencies for some other system than yours.
159 void set_rootdir(const char *rootdir)
160 $pool->set_rootdir(rootdir);
161 pool.set_rootdir(rootdir)
162 pool.set_rootdir(rootdir)
164 const char *get_rootdir()
165 my $rootdir = $pool->get_rootdir();
166 rootdir = pool.get_rootdir()
167 rootdir = pool.get_rootdir()
169 Set/get the rootdir to use. This is useful if you want package management
170 to work only in some directory, for example if you want to setup a chroot
171 jail. Note that the rootdir will only be prepended to file paths if the
172 *REPO_USE_ROOTDIR* flag is used.
174 void setarch(const char *arch = 0)
179 Set the architecture for your system. The architecture is used to determine
180 which packages are installable. It defaults to the result of ``uname -m''.
182 Repo *add_repo(const char *name)
183 $repo = $pool->add_repo($name);
184 repo = pool.add_repo(name)
185 repo = pool.add_repo(name)
187 Add a Repository with the specified name to the pool. The reposiory is empty
188 on creation, use the repository methods to populate it with packages.
190 Repoiterator *repos_iter()
191 for my $repo (@{$pool->repos_iter()})
192 for repo in pool.repos_iter():
193 for repo in pool.repos_iter()
195 Iterate over the existing repositories.
197 Solvableiterator *solvables_iter()
198 for my $solvable (@{$pool->solvables_iter()})
199 for solvable in pool.solvables_iter():
200 for solvable in pool.solvables_iter()
202 Iterate over the existing solvables.
204 Dep *Dep(const char *str, bool create=1)
205 my $dep = $pool->Dep($string);
206 dep = pool.Dep(string)
207 dep = pool.Dep(string)
209 Create an object describing a string or dependency. If the string is currently
210 not in the pool and _create_ is false, *undef*/*None*/*nil* is returned.
212 void addfileprovides()
213 $pool->addfileprovides();
214 pool.addfileprovides()
215 pool.addfileprovides()
217 Queue addfileprovides_queue()
218 my @ids = $pool->addfileprovides_queue();
219 ids = pool.addfileprovides_queue()
220 ids = pool.addfileprovides_queue()
222 Some package managers like rpm allow dependencies on files contained in other
223 packages. To allow libsolv to deal with those dependencies in an efficient way,
224 you need to call the addfileprovides method after creating and reading all
225 repositories. This method will scan all dependency for file names and than scan
226 all packages for matching files. If a filename has been matched, it will be
227 added to the provides list of the corresponding package. The
228 addfileprovides_queue variant works the same way but returns an array
229 containing all file dependencies. This information can be stored with the
230 repository to speed up the next usage of the repository.
232 void createwhatprovides()
233 $pool->createwhatprovides();
234 pool.createwhatprovides()
235 pool.createwhatprovides()
237 Create the internal ``whatprovides'' hash over all of the provides of all
238 packages. This method must be called before doing any lookups on provides.
239 It's encuraged to do it right after all repos are set up, usually right after
240 the call to addfileprovides().
242 Queue whatprovides(DepId dep)
243 my @solvables = $pool->whatprovides($dep);
244 solvables = pool.whatprovides(dep)
245 solvables = pool.whatprovides(dep)
247 Return all solvables that provide the specified dependency. You can use either
248 a Dep object or an simple Id as argument.
250 Queue matchprovidingids(const char *match, int flags)
251 my @ids = $pool->matchprovidingids($match, $flags);
252 ids = pool.matchprovidingids(match, flags)
253 ids = pool.matchprovidingids(match, flags)
255 Search the names of all provides and return the ones matching the specified
256 string. See the Dataiterator class for the allowed flags.
258 Id towhatprovides(Queue ids)
259 my $offset = $pool->towhatprovides(\@ids);
260 offset = pool.towhatprovides(ids)
261 offset = pool.towhatprovides(ids)
263 ``Internalize'' an array containing Ids. The returned value can be used to
264 create solver jobs working on a specific set of packages. See the Solver class
265 for more information.
267 bool isknownarch(DepId id)
268 my $bool = $pool->isknownarch($id);
269 bool = pool.isknownarch(id)
270 bool = pool.isknownarch?(id)
272 Return true if the specified Id describs a known architecture.
275 my $solver = $pool->Solver();
276 solver = pool.Solver()
277 solver = pool.Solver()
279 Create a new solver object.
281 Solver *Job(int how, Id what)
282 my $job = $pool->Job($how, $what);
283 job = pool.Job(how, what)
284 job = pool.Job(how, what)
286 Create a new Job object. Kind of low level, in most cases you would use a
287 Selection or Dep job constructor instead.
289 Selection *Selection()
290 my $sel = $pool->Selection();
291 sel = pool.Selection()
292 sel = pool.Selection()
294 Create an empty selection. Useful as a starting point for merging other
297 Selection *Selection_all()
298 my $sel = $pool->Selection_all();
299 sel = pool.Selection_all()
300 sel = pool.Selection_all()
302 Create a selection containing all packages. Useful as starting point for
303 intersecting other selections or for update/distupgrade jobs.
305 Selection *select(const char *name, int flags)
306 my $sel = $pool->select($name, $flags);
307 sel = pool.select(name, flags)
308 sel = pool.select(name, flags)
310 Create a selection by matching packages against the specified string. See the
311 Selection class for a list of flags and how to create solver jobs from a
314 void setpooljobs(Jobs *jobs)
315 $pool->setpooljobs(\@jobs);
316 pool.setpooljobs(jobs)
317 pool.setpooljobs(jobs)
320 @jobs = $pool->getpooljobs();
321 jobs = pool.getpooljobs()
322 jobs = pool.getpooljobs()
324 Get/Set fixed jobs stored in the pool. Those jobs are automatically appended to
325 all solver jobs, they are meant for fixed configurations like which packages
326 can be multiversion installed, which packages were userinstalled or must not be
329 void set_loadcallback(Callable *callback)
330 $pool->setloadcallback(\&callbackfunction);
331 pool.setloadcallback(callbackfunction)
332 pool.setloadcallback { |repodata| ... }
334 Set the callback function called when repository metadata needs to be loaded on
335 demand. To make use of this feature, you need to create repodata stubs that
336 tell the library which data is available but not loaded. If later on the data
337 needs to be accessed, the callback function is called with a repodata argument.
338 You can then load the data (maybe fetching it first from an remote server).
339 The callback should return true if the data has been made available.
341 === DATA RETRIEVAL METHODS ===
343 In the following functions, the _keyname_ argument describes what to retrive.
344 For the standard cases you can use the available Id constants. For example,
346 $solv::SOLVABLE_SUMMARY
347 solv.SOLVABLE_SUMMARY
348 Solv::SOLVABLE_SUMMARY
350 selects the ``Summary'' entry of a solvable. The _solvid_ argument selects the
351 desired solvable by Id.
353 const char *lookup_str(Id solvid, Id keyname)
354 my $string = $pool->lookup_str($solvid, $keyname);
355 string = pool.lookup_str(solvid, keyname)
356 string = pool.lookup_str(solvid, keyname)
358 Id lookup_id(Id solvid, Id keyname)
359 my $id = $pool->lookup_id($solvid, $keyname);
360 id = pool.lookup_id(solvid, keyname)
361 id = pool.lookup_id(solvid, keyname)
363 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
364 my $num = $pool->lookup_num($solvid, $keyname);
365 num = pool.lookup_num(solvid, keyname)
366 num = pool.lookup_num(solvid, keyname)
368 bool lookup_void(Id solvid, Id keyname)
369 my $bool = $pool->lookup_void($solvid, $keyname);
370 bool = pool.lookup_void(solvid, keyname)
371 bool = pool.lookup_void(solvid, keyname)
373 Queue lookup_idarray(Id solvid, Id keyname)
374 my @ids = $pool->lookup_idarray($solvid, $keyname);
375 ids = pool.lookup_idarray(solvid, keyname)
376 ids = pool.lookup_idarray(solvid, keyname)
378 Chksum *lookup_checksum(Id solvid, Id keyname)
379 my $chksum = $pool->lookup_checksum($solvid, $keyname);
380 chksum = pool.lookup_checksum(solvid, keyname)
381 chksum = pool.lookup_checksum(solvid, keyname)
383 Lookup functions. Return the data element stored in the specified solvable.
384 You should probably use the methods of the Solvable class instead.
386 Dataiterator *Dataiterator(Id solvid, Id keyname, const char *match, int flags)
387 my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
388 di = pool.Dataiterator(solvid, keyname, match, flags)
389 di = pool.Dataiterator(solvid, keyname, match, flags)
395 Iterate over the matching data elements. See the Dataiterator class for more
400 The following methods deal with Ids, i.e. integers representing objects in the
401 pool. They are considered ``low level'', in most cases you would not use them
402 but instead the object orientated methods.
405 $repo = $pool->id2repo($id);
406 repo = pool.id2repo(id)
407 repo = pool.id2repo(id)
409 Lookup an existing Repository by id. You can also do this by using the *repos*
412 Solvable *id2solvable(Id id)
413 $solvable = $pool->id2solvable($id);
414 solvable = pool.id2solvable(id)
415 solvable = pool.id2solvable(id)
417 Lookup an existing Repository by id. You can also do this by using the
418 *solvables* attribute.
420 const char *solvid2str(Id id)
421 my $str = $pool->solvid2str($id);
422 str = pool.solvid2str(id)
423 str = pool.solvid2str(id)
425 Return a string describing the Solvable with the specified id. The string
426 consists of the name, version, and architecture of the Solvable.
428 Id str2id(const char *str, bool create=1)
429 my $id = pool->str2id($string);
430 id = pool.str2id(string)
431 id = pool.str2id(string)
433 const char *id2str(Id id)
434 $string = pool->id2str($id);
435 string = pool.id2str(id)
436 string = pool.id2str(id)
438 Convert a string into an Id and back. If the string is currently not in the
439 pool and _create_ is false, zero is returned.
441 Id rel2id(Id name, Id evr, int flags, bool create=1)
442 my $id = pool->rel2id($nameid, $evrid, $flags);
443 id = pool.rel2id(nameid, evrid, flags)
444 id = pool.rel2id(nameid, evrid, flags)
446 Create a ``relational'' dependency. Such dependencies consist of a name part,
447 the _flags_ describing the relation, and a version part. The flags are:
449 $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
450 solv.REL_EQ | solv.REL_GT | solv.REL_LT
451 Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
453 Thus, if you want a ``\<='' relation, you would use *REL_LT | REL_EQ*.
455 Id id2langid(Id id, const char *lang, bool create=1)
456 my $id = $pool->id2langid($id, $language);
457 id = pool.id2langid(id, language)
458 id = pool.id2langid(id, language)
460 Create a language specific Id from some other id. This function simply converts
461 the id into a string, appends a dot and the specified language to the string
462 and converts the result back into an Id.
464 const char *dep2str(Id id)
465 $string = pool->dep2str($id);
466 string = pool.dep2str(id)
467 string = pool.dep2str(id)
469 Convert a dependency id into a string. If the id is just a string, this
470 function has the same effect as id2str(). For relational dependencies, the
471 result is the correct ``name relation evr'' string.
476 The dependency class is an object orientated way to work with strings and
477 dependencies. Internally, dependencies are represented as Ids, i.e. simple
478 numbers. Dependency objects can be constructed by using the Pool's Dep()
483 Pool *pool; /* read only */
488 Back reference to the pool this dependency belongs to.
490 Id id; /* read only */
495 The id of this dependency.
499 Dep *Rel(int flags, DepId evrid, bool create=1)
500 my $reldep = $dep->Rel($flags, $evrdep);
501 reldep = dep.Rel(flags, evrdep)
502 reldep = dep.Rel(flags, evrdep)
504 Create a relational dependency from to string dependencies and a flags
505 argument. See the pool's rel2id method for a description of the flags.
507 Selection *Selection_name(int setflags = 0)
508 my $sel = $dep->Selection_name();
509 sel = dep.Selection_name()
510 sel = dep.Selection_name()
512 Create a Selection from a dependency. The selection consists of all packages
513 that have a name equal to the dependency. If the dependency is of a relational
514 type, the packages version must also fulfill the dependency.
516 Selection *Selection_provides(int setflags = 0)
517 my $sel = $dep->Selection_provides();
518 sel = dep.Selection_provides()
519 sel = dep.Selection_provides()
521 Create a Selection from a dependency. The selection consists of all packages
522 that have at least one provides matching the dependency.
525 my $str = $dep->str();
529 Return a string describing the dependency.
536 Same as calling the str() method.
543 The dependencies are equal if they are part of the same pool and have the same
548 A Repository describes a group of packages, normally comming from the same
549 source. Repositories are created by the Pool's add_repo() method.
553 Pool *pool; /* read only */
558 Back reference to the pool this dependency belongs to.
560 Id id; /* read only */
565 The id of the repository.
567 const char *name; /* read/write */
572 The repositories name. To libsolv, the name is just a string with no specific
575 int prioprity; /* read/write */
580 The priority of the repository. A higher number means that packages of this
581 repository will be chosen over other repositories, even if they have a greater
584 int subprioprity; /* read/write */
589 The sub-priority of the repository. This value is compared when the priorities
590 of two repositories are the same. It is useful to make the library prefer
591 on-disk repositories to remote ones.
593 int nsolvables; /* read only */
598 The number of solvables in this repository.
600 void *appdata; /* read/write */
605 Application specific data that may be used in any way by the code using the
608 Datapos *meta; /* read only */
613 Return a Datapos object of the repodata's metadata. You can use the lookup
614 methods of the Datapos class to lookup metadata attributes, like the repository
619 *REPO_REUSE_REPODATA*::
620 Reuse the last repository data aera (``repodata'') instead of creating a new
623 *REPO_NO_INTERNALIZE*::
624 Do not internalize the added repository data. This is useful if
625 you plan to add more data because internalization is a costly
629 Use the repodata's pool for Id storage instead of the global pool. Useful
630 if you don't want to pollute the global pool with many unneeded ids, like
631 when storing the filelist.
634 Use the repodata that is currently being loaded instead of creating a new one.
635 This only makes sense if used in a load callback.
637 *REPO_EXTEND_SOLVABLES*::
638 Do not create new solvables for the new data, but match existing solvables and
639 add the data to them. Repository metadata is often split into multiple parts,
640 with one primary file describing all packages and other parts holding
641 information that is normally not needed, like the changelog.
644 Prepend the pool's rootdir to the path when doing file operations.
647 Do not add a location element to the solvables. Useful if the solvables are
648 not in the final position, so you can add the correct location later in your code.
650 *SOLV_ADD_NO_STUBS*::
651 Do not create stubs for repository parts that can be downloaded on demand.
653 *SUSETAGS_RECORD_SHARES*::
654 This is specific to the add_susetags() method. Susetags allows to refer to already
655 read packages to save disk space. If this data sharing needs to work over multiple
656 calls to add_susetags, you need to specify this flag so that the share information
657 is made available to subsequent calls.
661 void free(bool reuseids = 0)
666 Free the repository and all solvables it contains. If _reuseids_ is set to
667 true, the solvable ids and the repository id may be reused by the library when
668 added new solvables. Thus you should leave it false if you are not sure that
669 somebody holds a reference.
671 void empty(bool reuseids = 0)
676 Free all the solvables in a repository. The repository will be empty after this
677 call. See the free() method for the meaning of _reuseids_.
684 Return true if there are no solvables in this repository.
687 $repo->internalize();
691 Internalize added data. Data must be internalized before it is available to the
692 lookup and data iterator functions.
699 Write a repo as a ``solv'' file. These files can be read very fast and thus are
700 a good way to cache repository data. Returns false if there was some error
703 Solvableiterator *solvables_iter()
704 for my $solvable (@{$repo->solvables_iter()})
705 for solvable in repo.solvables_iter():
706 for solvable in repo.solvables_iter()
708 Iterate over all solvables in a repository.
710 Repodata *add_repodata(int flags = 0)
711 my $repodata = $repo->add_repodata();
712 repodata = repo.add_repodata()
713 repodata = repo.add_repodata()
715 Add a new repodata area to the repository. This is normally automatically
716 done by the repo_add methods, so you need this method only in very
720 $repo->create_stubs();
724 Calls the create_stubs() repodata method for the last repodata of the
728 $repo->iscontiguous()
732 Return true if the solvables of this repository are all in a single block with
733 no holes, i.e. they have consecutive ids.
735 Repodata *first_repodata()
736 my $repodata = $repo->first_repodata();
737 repodata = repo.first_repodata()
738 repodata = repo.first_repodata()
740 Checks if all repodatas but the first repodata are extensions, and return the
741 first repodata if this is the case. Useful if you want to do a store/retrive
742 sequence on the repository to reduce the memory using and enable paging, as
743 this does not work if the rpository contains multiple non-extension repodata
746 Selection *Selection(int setflags = 0)
747 my $sel = $repo->Selection();
748 sel = repo.Selection()
749 sel = repo.Selection()
751 Create a Selection consisting of all packages in the repository.
753 Dataiterator *Dataiterator(Id p, Id key, const char *match, int flags)
754 my $di = $repo->Dataiterator($solvid, $keyname, $match, $flags);
755 di = repo.Dataiterator(solvid, keyname, match, flags)
756 di = repo.Dataiterator(solvid, keyname, match, flags)
762 Iterate over the matching data elements in this repository. See the
763 Dataiterator class for more information.
766 my $str = $repo->str;
770 Return the name of the repository, or "Repo#<id>" if no name is set.
773 if ($repo1 == $repo2)
777 Two repositories are equal if they belong to the same pool and have the same id.
779 === DATA ADD METHODS ===
781 Solvable *add_solvable()
782 $repo->add_solvable();
786 Add a single empty solvable to the repository. Returns a Solvable object, see
787 the Solvable class for more information.
789 bool add_solv(const char *name, int flags = 0)
790 $repo->add_solv($name, $flags);
791 repo.add_solv(name, flags)
792 repo.add_solv(name, flags)
794 bool add_solv(FILE *fp, int flags = 0)
795 $repo->add_solv($fp, $flags);
796 repo.add_solv(fp, flags)
797 repo.add_solv(fp, flags)
799 Read a ``solv'' file and add its contents to the repository. These files can be
800 written with the write() method and are normally used as fast cache for
803 bool add_rpmdb(int flags = 0)
804 $repo->add_rpmdb($flags);
805 repo.add_rpmdb(flags)
806 repo.add_rpmdb(flags)
808 bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
809 $repo->add_rpmdb_reffp($reffp, $flags);
810 repo.add_rpmdb_reffp($reffp, flags)
811 repo.add_rpmdb_reffp($reffp, flags)
813 Add the contents of the rpm database to the repository. If a solv file
814 containing an old version of the database is available, it can be passed as
815 reffp to speed up reading.
817 bool add_rpm(const char *name, int flags = 0)
818 $repo->add_rpm($name, $flags);
819 repo.add_rpm(name, flags)
820 repo.add_rpm(name, flags)
822 Add the metadata of a single rpm package to the repository.
824 bool add_rpmdb_pubkeys(int flags = 0)
825 $repo->add_rpmdb_pubkeys();
826 repo.add_rpmdb_pubkeys()
827 repo.add_rpmdb_pubkeys()
829 Add all pubkeys contained in the rpm database to the repository. Note that
830 newer rpm versions also allow to store the pubkeys in some directory instead
833 bool add_pubkey(const char *keyfile, int flags = 0)
834 $repo->add_pubkey($keyfile);
835 repo.add_pubkey($keyfile)
836 repo.add_pubkey($keyfile)
838 Add a pubkey from a file to the repository.
840 bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
841 $repo->add_rpmmd($fp, $language);
842 repo.add_rpmmd(fp, language)
843 repo.add_rpmmd(fp, language)
845 Add metadata stored in the "rpm-md" format (i.e. from files in the ``repodata''
846 directory) to a repository. Supported files are "primary", "filelists",
847 "other", "suseinfo". Do not forget to specify the *REPO_EXTEND_SOLVABLES* for
848 extension files like "filelists" and "other". Use the _language_ parameter if
849 you have language extension files, otherwise simply use a *undef*/*None*/*nil*
852 bool add_repomdxml(FILE *fp, int flags = 0)
853 $repo->add_repomdxml($fp);
854 repo.add_repomdxml(fp)
855 repo.add_repomdxml(fp)
857 Add the repomd.xml meta description from the "rpm-md" format to the repository.
858 This file contains information about the repository like keywords, and also a
859 list of all database files with checksums. The data is added the the "meta"
860 section of the repository, i.e. no package gets created.
862 bool add_updateinfoxml(FILE *fp, int flags = 0)
863 $repo->add_updateinfoxml($fp);
864 repo.add_updateinfoxml(fp)
865 repo.add_updateinfoxml(fp)
867 Add the updateinfo.xml file containing available maintenance updates to the
868 repository. All updates are created as special packages that have a "patch:"
869 prefix in their name.
871 bool add_deltainfoxml(FILE *fp, int flags = 0)
872 $repo->add_deltainfoxml($fp);
873 repo.add_deltainfoxml(fp)
874 repo.add_deltainfoxml(fp)
876 Add the deltainfo.xml file (also called prestodelta.xml) containing available
877 delta-rpms to the repository. The data is added to the "meta" section, i.e. no
878 package gets created.
880 bool add_debdb(int flags = 0)
885 Add the contents of the debian installed package database to the repository.
887 bool add_debpackages(FILE *fp, int flags = 0)
888 $repo->add_debpackages($fp);
889 repo.add_debpackages($fp)
890 repo.add_debpackages($fp)
892 Add the contents of the debian repository metadata (the "packages" file)
895 bool add_deb(const char *filename, int flags = 0)
896 $repo->add_deb($filename);
897 repo.add_deb(filename)
898 repo.add_deb(filename)
900 Add the metadata of a single deb package to the repository.
902 bool add_mdk(FILE *fp, int flags = 0)
907 Add the contents of the mageia/mandriva repository metadata (the
908 "synthesis.hdlist" file) to the repository.
910 bool add_mdk_info(FILE *fp, int flags = 0)
915 Extend the packages from the synthesis file with the info.xml and files.xml
916 data. Do not forget to specify *REPO_EXTEND_SOLVABLES*.
918 bool add_arch_repo(FILE *fp, int flags = 0)
919 $repo->add_arch_repo($fp);
920 repo.add_arch_repo($fp)
921 repo.add_arch_repo($fp)
923 Add the contents of the archlinux repository metadata (the ".db.tar" file) to
926 bool add_arch_local(const char *dir, int flags = 0)
927 $repo->add_arch_local($dir);
928 repo.add_arch_local($dir)
929 repo.add_arch_local($dir)
931 Add the contents of the archlinux installed package database to the repository.
932 The _dir_ parameter is usually set to "/var/lib/pacman/local".
934 bool add_content(FILE *fp, int flags = 0)
935 $repo->add_content($fp);
939 Add the ``content'' meta description from the susetags format to the repository.
940 This file contains information about the repository like keywords, and also
941 a list of all database files with checksums. The data is added the the "meta"
942 section of the repository, i.e. no package gets created.
944 bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
945 $repo->add_susetags($fp, $defvendor, $language);
946 repo.add_susetags(fp, defvendor, language)
947 repo.add_susetags(fp, defvendor, language)
949 Add repository metadata in the susetags format to the repository. Like with
950 add_rpmmd, you can specify a language if you have language extension files. The
951 _defvendor_ parameter provides a default vendor for packages with missing
952 vendors, it is usually provided in the content file.
954 bool add_products(const char *dir, int flags = 0)
955 $repo->add_products($dir);
956 repo.add_products(dir)
957 repo.add_products(dir)
959 Add the installed SUSE products database to the repository. The _dir_ parameter
960 is usually "/etc/products.d".
965 A solvable describes all the information of one package. Each solvable belongs to
966 one repository, it can be added and filled manually but in most cases solvables
967 will get created by the repo_add methods.
971 Repo *repo; /* read only */
976 The repository this solvable belongs to.
978 Pool *pool; /* read only */
983 The pool this solvable belongs to, same as the pool of the repo.
985 Id id; /* read only */
990 The specific id of the solvable.
992 char *name; /* read/write */
997 char *evr; /* read/write */
1002 char *arch; /* read/write */
1007 char *vendor; /* read/write */
1012 Easy access to often used attributes of solvables. They are
1013 internally stored as Ids.
1015 Id nameid; /* read/write */
1020 Id evrid; /* read/write */
1025 Id archid; /* read/write */
1030 Id vendorid; /* read/write */
1031 $solvable->{vendorid}
1035 Raw interface to the ids. Useful if you want to search for
1036 a specific id and want to avoid the string compare overhead.
1040 const char *lookup_str(Id keyname)
1041 my $string = $solvable->lookup_str($keyname);
1042 string = solvable.lookup_str(keyname)
1043 string = solvable.lookup_str(keyname)
1045 Id lookup_id(Id keyname)
1046 my $id = $solvable->lookup_id($keyname);
1047 id = solvable.lookup_id(solvid)
1048 id = solvable.lookup_id(solvid)
1050 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
1051 my $num = $solvable->lookup_num($keyname);
1052 num = solvable.lookup_num(keyname)
1053 num = solvable.lookup_num(keyname)
1055 bool lookup_void(Id keyname)
1056 my $bool = $solvable->lookup_void($keyname);
1057 bool = solvable.lookup_void(keyname)
1058 bool = solvable.lookup_void(keyname)
1060 Chksum *lookup_checksum(Id keyname)
1061 my $chksum = $solvable->lookup_checksum($keyname);
1062 chksum = solvable.lookup_checksum(keyname)
1063 chksum = solvable.lookup_checksum(keyname)
1065 Queue lookup_idarray(Id keyname, Id marker = -1)
1066 my @ids = $solvable->lookup_idarray($keyname);
1067 ids = solvable.lookup_idarray(keyname)
1068 ids = solvable.lookup_idarray(keyname)
1070 Queue lookup_deparray(Id keyname, Id marker = -1)
1071 my @deps = $solvable->lookup_deparray($keyname);
1072 deps = solvable.lookup_deparray(keyname)
1073 deps = solvable.lookup_deparray(keyname)
1075 Generic lookup methods. Retrieve data stored for the specific keyname.
1076 The lookup_idarray() method will return an array of Ids, use
1077 lookup_deparray if you want an array of Dependency objects instead.
1078 Some Id arrays contain two parts of data divided by a specific marker,
1079 for example the provides array uses the SOLVABLE_FILEMARKER id to
1080 store both the ids provided by the package and the ids added by
1081 the addfileprovides method. The default, -1, translates to the
1082 correct marker for the keyname and returns the first part of the
1083 array, use 1 to select the second part or 0 to retrive all ids
1084 including the marker.
1086 const char *lookup_location(unsigned int *OUTPUT);
1087 my ($location, $medianr) = $solvable->lookup_location();
1088 location, medianr = solvable.lookup_location()
1089 location, medianr = solvable.lookup_location()
1091 Return a tuple containing the on-media location and an optional
1092 media number for multi-part repositories (e.g. repositories
1093 spawning multiple DVDs).
1095 void add_deparray(Id keyname, DepId dep, Id marker = -1);
1096 $solvable->add_deparray($keyname, $dep);
1097 solvable.add_deparray(keyname, dep)
1098 solvable.add_deparray(keyname, dep)
1100 Add a new dependency to the attributes stored in keyname.
1103 $solvable->installable()
1104 solvable.installable()
1105 solvable.installable?
1107 Return true if the solvable is installable on the system. Solvables
1108 are not installable if the system does not support their architecture.
1111 $solvable->isinstalled()
1112 solvable.isinstalled()
1113 solvable.isinstalled?
1115 Return true if the solvable is installed on the system.
1117 Selection *Selection(int setflags = 0)
1118 my $sel = $solvable->Selection();
1119 sel = solvable.Selection()
1120 sel = solvable.Selection()
1122 Create a Selection containing just the single solvable.
1125 my $str = $solvable->str();
1126 str = $solvable.str()
1127 str = $solvable.str()
1129 Return a string describing the solvable. The string consists of the name,
1130 version, and architecture of the Solvable.
1133 my $str = $solvable->str;
1137 Same as calling the str() method.
1140 if ($solvable1 == $solvable2)
1141 if solvable1 == solvable2:
1142 if solvable1 == solvable2
1144 Two solvables are equal if they are part of the same pool and have the same
1147 THE DATAITERATOR CLASS
1148 ----------------------
1150 Dataiterators can be used to do complex string searches or
1151 to iterate over arrays. They can be created via the
1152 constructors in the Pool, Repo, and Solvable classes. The
1153 Repo and Solvable constructors will limit the search to
1154 the repository or the specific package.
1159 Return a match if the search string matches the value.
1161 *SEARCH_STRINGSTART*::
1162 Return a match if the value starts with the search string.
1164 *SEARCH_STRINGEND*::
1165 Return a match if the value ends with the search string.
1167 *SEARCH_SUBSTRING*::
1168 Return a match if the search string can be matched somewhere
1172 Do a glob match of the search string against the value.
1175 Do a regular expression match of the search string against
1179 Ignore case when matching strings. Works for all the above
1183 Match the complete filenames of the file list, not just the
1186 *SEARCH_COMPLETE_FILELIST*::
1187 When matching the file list, check every file of the package
1188 not just the subset from the primary metadata.
1190 *SEARCH_CHECKSUMS*::
1191 Allow the matching of checksum entries.
1195 void prepend_keyname(Id keyname);
1196 $di->prepend_keyname($keyname);
1197 di.prepend_keyname(keyname)
1198 di.prepend_keyname(keyname)
1200 Do a sub-search in the array stored in keyname.
1202 void skip_solvable();
1203 $di->kip_solvable();
1207 Stop matching the current solvable and advance to the next
1215 Iterate through the matches. If there is a match, the object
1216 in d will be of type Datamatch.
1220 Objects of this type will be created for every value matched
1225 Pool *pool; /* read only */
1230 Back pointer to pool.
1232 Repo *repo; /* read only */
1237 The repository containing the matched object.
1239 Solvable *solvable; /* read only */
1244 The solvable containing the value that was matched.
1246 Id solvid; /* read only */
1251 The id of the solvable that matched.
1260 const char *key_idstr();
1265 The keyname that matched, either as id or string.
1272 const char *type_idstr();
1277 The key type of the value that was matched, either as id or string.
1289 The Id of the value that was matched (only valid for id types),
1290 either as id or string.
1297 The string value that was matched (only valid for string types).
1299 unsigned long long num();
1304 The numeric value that was matched (only valid for numeric types).
1306 unsigned int num2();
1311 The secondary numeric value that was matched (only valid for types
1312 containing two values).
1315 my $pos = $d->pos();
1319 The position object of the current match. It can be used to do
1320 sub-searches starting at the match (if it is of an array type).
1321 See the Datapos class for more information.
1323 Datapos *parentpos();
1324 my $pos = $d->parentpos();
1328 The position object of the array containing the current match.
1329 It can be used to do sub-searches, see the Datapos class for more
1337 Return the stringification of the matched value. Stringification
1338 depends on the search flags, for file list entries it will return
1339 just the base name unless SEARCH_FILES is used, for checksums
1340 it will return an empty string unless SEARCH_CHECKSUMS is used.
1341 Numeric values are currently stringified to an empty string.
1346 Selections are a way to easily deal with sets of packages.
1347 There are multiple constructors to create them, the most useful
1348 is probably the select() method in the Pool class.
1353 Create the selection by matching package names
1355 *SELECTION_PROVIDES*::
1356 Create the selection by matching package provides
1358 *SELECTION_FILELIST*::
1359 Create the selection by matching package files
1362 Create the selection by matching the canonical representation
1363 of the package. This is normally a combination of the name,
1364 the version, and the architecture of a package.
1366 *SELECTION_DOTARCH*::
1367 Allow an ``.<architecture>'' suffix when matching names or
1371 Allow the specification of a relation when matching names
1372 or provides, e.g. "name >= 1.2".
1374 *SELECTION_INSTALLED_ONLY*::
1375 Limit the package search to installed packages.
1377 *SELECTION_SOURCE_ONLY*::
1378 Limit the package search to source packages only.
1380 *SELECTION_WITH_SOURCE*::
1381 Extend the package search to also match source packages. The
1382 default is only to match binary packages.
1385 Allow glob matching for package names, package provides, and
1388 *SELECTION_NOCASE*::
1389 Ignore case when matching package names, package provides,
1393 Return only one selection element describing the selected packages.
1394 The default is to create multiple elements for all globbed packages.
1395 Multiple elements are useful if you want to turn the selection into
1396 an install job, in that case you want an install job for every
1401 Pool *pool; /* read only */
1406 Back pointer to pool.
1411 my $flags = $sel->flags();
1415 Return the result flags of the selection. The flags are a subset
1416 of the ones used when creating the selection, they describe which
1417 method was used to get the result. For example, if you create the
1418 selection with ``SELECTION_NAME | SELECTION_PROVIDES'', the resulting
1419 flags will either be SELECTION_NAME or SELECTION_PROVIDES depending
1420 if there was a package that matched the name or not. If there was
1421 no match at all, the flags will be zero.
1428 Return true if the selection is empty, i.e. no package could be matched.
1430 void filter(Selection *other)
1431 $sel->filter($other);
1435 Intersect two selections. Packages will only stay in the selection if there
1436 are also included in the other selecting. Does an in-place modification.
1438 void add(Selection *other)
1443 Build the union of two selections. All packages of the other selection will
1444 be added to the set of packages of the selection object. Does an in-place
1445 modification. Note that the selection flags are no longer meaningful after the
1448 void add_raw(Id how, Id what)
1449 $sel->add_raw($how, $what);
1450 sel.add_raw(how, what)
1451 sel.add_raw(how, what)
1453 Add a raw element to the selection. Check the Job class for information about
1454 the how and what parameters.
1456 Job **jobs(int action)
1457 my @jobs = $sel->jobs($action);
1458 jobs = sel.jobs(action)
1459 jobs = sel.jobs(action)
1461 Convert a selection into an array of Job objects. The action parameter is or-ed
1462 to the ``how'' part of the job, it describes the type of job (e.g. install,
1463 erase). See the Job class for the action and action modifier constants.
1465 Solvable **solvables()
1466 my @solvables = $sel->solvables();
1467 solvables = sel.solvables()
1468 solvables = sel.solvables()
1470 Convert a selection into an array of Solvable objects.
1473 my $str = $sel->str;
1477 Return a string describing the selection.
1481 Jobs are the way to specify to the dependency solver what to do.
1482 Most of the times jobs will get created by calling the jobs() method
1483 on a Selection object, but there is also a Job() constructor in the
1488 Selection constants:
1491 The ``what'' part is the id of a solvable.
1493 *SOLVER_SOLVABLE_NAME*::
1494 The ``what'' part is the id of a package name.
1496 *SOLVER_SOLVABLE_PROVIDES*::
1497 The ``what'' part is the id of a package provides.
1499 *SOLVER_SOLVABLE_ONE_OF*::
1500 The ``what'' part is an offset into the ``whatprovides'' data, created
1501 by calling the towhatprovides() pool method.
1503 *SOLVER_SOLVABLE_REPO*::
1504 The ``what'' part is the id of a repository.
1506 *SOLVER_SOLVABLE_ALL*::
1507 The ``what'' part is ignored, all packages are selected.
1509 *SOLVER_SOLVABLE_SELECTMASK*::
1510 A mask containing all the above selection bits.
1518 Install a package of the specified set of packages. It tries to install
1519 the best matching package (i.e. the highest version of the packages from
1520 the repositories with the highest priority).
1523 Erase all of the packages from the specified set. If a package is not
1524 installed, erasing it will keep it from getting installed.
1527 Update the matching installed packages to their best version. If none
1528 of the specified packages are installed, try to update the installed
1529 packages to the specified versions. See the section about targeted
1530 updates about more information.
1532 *SOLVER_WEAKENDEPS*::
1533 Allow to break the dependencies of the matching packages. Handle with care.
1535 *SOLVER_MULTIVERSION*::
1536 Mark the matched packages for multiversion install. If they get to be installed
1537 because of some other job, the installation will keep the old version of the
1538 package installed (for rpm by using ``-i'' instead of ``-U'').
1541 Do not change the state of the matched packages, i.e. when they are installed
1542 they stay installed, if not they are not selected for installation.
1544 *SOLVER_DISTUPGRADE*::
1545 Update the matching installed packages to the best version included in one
1546 of the repositories. After this operation, all come from one of the available
1547 repositories except orphaned packages. Orphaned packages are packages that
1548 have no relation to the packages in the repositories, i.e. no package in the
1549 repositories have the same name or obsolete the orphaned package.
1550 This action brings the installed packages in sync with the ones in the
1551 repository. It also turns of arch/vendor/version locking for the affected
1552 packages to simulate a fresh installation. This means that distupgrade can
1553 actually downgrade packages if only lower versions of a package are available
1554 in the repositories.
1556 *SOLVER_DROP_ORPHANED*::
1557 Erase all the matching installed packages if they are orphaned. This only makes
1558 sense if there is a ``distupgrade all packages'' job. The default is to erase
1559 orphaned packages only if they block the installation of other packages.
1562 Fix dependency problems of matching installed packages. The default is to ignore
1563 dependency problems for installed packages.
1565 *SOLVER_USERINSTALLED*::
1566 The matching installed packages are considered to be installed by a user, thus
1567 not installed to fulfil some dependency. This is needed input for the calculation
1568 of unneeded packages for jobs that have the SOLVER_CLEANDEPS flag set.
1571 A mask containing all the above action bits.
1573 Action modifier constants:
1576 Makes the job a weak job. The solver tries to fulfil weak jobs, but does not
1577 report a problem if it is not possible to do so.
1579 *SOLVER_ESSENTIAL*::
1580 Makes the job an essential job. If there is a problem with the job, the solver
1581 will not propose to remove the job as one solution (unless all other solutions
1582 are also to remove essential jobs).
1584 *SOLVER_CLEANDEPS*::
1585 The solver will try to also erase all packages dragged in through dependencies
1586 when erasing the package. This needs SOLVER_USERINSTALLED jobs to maximize user
1589 *SOLVER_FORCEBEST*::
1590 Insist on the best package for install, update, and distupgrade jobs. If this
1591 flag is not used, the solver will use the second-best package if the best
1592 package cannot be installed for some reason. When this flag is used, the solver
1593 will generate a problem instead.
1596 Forces targeted operation update and distupgrade jobs. See the section about
1597 targeted updates about more information.
1602 The job specified the exact epoch and version of the package set.
1605 The job specified the exact epoch, version, and release of the package set.
1608 The job specified the exact architecture of the packages from the set.
1610 *SOLVER_SETVENDOR*::
1611 The job specified the exact vendor of the packages from the set.
1614 The job specified the exact repository of the packages from the set.
1617 The job specified the exact name of the packages from the set.
1619 *SOLVER_NOAUTOSET*::
1620 Turn of automatic set flag generation for SOLVER_SOLVABLE jobs.
1623 A mask containing all the above set bits.
1625 See the section about set bits for more information.
1629 Pool *pool; /* read only */
1634 Back pointer to pool.
1636 Id how; /* read/write */
1641 Union of the selection, action, action modifier, and set flags.
1642 The selection part describes the semantics of the ``what'' Id.
1644 Id what; /* read/write */
1649 Id describing the set of packages, the meaning depends on the
1650 selection part of the ``how'' attribute.
1654 Solvable **solvables()
1655 my @solvables = $job->solvables();
1656 solvables = job.solvables()
1657 solvables = job.solvables()
1659 Return the set of solvables of the job as an array of Solvable
1662 bool isemptyupdate();
1663 $job->isemptyupdate()
1667 Convenience function to find out if the job describes an update
1668 job with no matching packages, i.e. a job that does nothing.
1669 Some package managers like ``zypper'' like to turn those jobs
1670 into install jobs, i.e. an update of a not-installed package
1671 will result into the installation of the package.
1674 my $str = $job->str;
1678 Return a string describing the job.
1685 Two jobs are equal if they belong to the same pool and both the
1686 ``how'' and the ``what'' attributes are the same.
1688 === TARGETED UPDATES ===
1689 Libsolv has two modes for upgrades and distupgrade: targeted and
1690 untargeted. Untargeted mode means that the installed packages from
1691 the specified set will be updated to the best version. Targeted means
1692 that packages that can be updated to a package in the specified set
1693 will be updated to the best package of the set.
1695 Here's an example to explain the subtle difference. Suppose that
1696 you have package A installed in version "1.1", "A-1.2" is available
1697 in one of the repositories and there is also package "B" that
1698 obsoletes package A.
1700 An untargeted update of "A" will update the installed "A-1.1" to
1701 package "B", because that is the newest version (B obsoletes A and
1704 A targeted update of "A" will update "A-1.1" to "A-1.2", as the
1705 set of packages contains both "A-1.1" and "A-1.2", and "A-1.2" is
1708 An untargeted update of "B" will do nothing, as "B" is not installed.
1710 An targeted update of "B" will update "A-1.1" to "B".
1712 Note that the default is to do "auto-targeting", thus if the specified
1713 set of packages does not include an installed package, the solver
1714 will assume targeted operation even if SOLVER_TARGETED is not used.
1716 This mostly matches the intent of the user, with one exception: In
1717 the example above, an update of "A-1.2" will update "A-1.1" to
1718 "A-1.2" (targeted mode), but a second update of "A-1.2" will suddenly
1719 update to "B", as untargeted mode is chosen because "A-1.2" is now
1722 If you want to have full control over when targeting mode is chosen,
1723 turn off auto-targeting with the SOLVER_FLAG_NO_AUTOTARGET solver option.
1724 In that case, all updates are considered to be untargeted unless they
1725 include the SOLVER_TARGETED flag.
1728 Set bits specify which parts of the specified packages where specified
1729 by the user. It is used by the solver when checking if an operation is
1730 allowed or not. For example, the solver will normally not allow the
1731 downgrade of an installed package. But it will not report a problem if
1732 the SOLVER_SETEVR flag is used, as it then assumes that the user specified
1733 the exact version and thus knows what he is doing.
1735 So if a package "screen-1-1" is installed for the x86_64 architecture and
1736 version "2-1" is only available for the i586 architecture, installing
1737 package "screen-2.1" will ask the user for confirmation because of the
1738 different architecture. When using the Selection class to create jobs
1739 the set bits are automatically added, e.g. selecting ``screen.i586'' will
1740 automatically add SOLVER_SETARCH, and thus no problem will be reported.
1747 Flags to modify some of the solver's behaviour:
1749 *SOLVER_FLAG_ALLOW_DOWNGRADE*::
1750 Allow the solver to downgrade packages without asking for confirmation
1751 (i.e. reporting a problem).
1753 *SOLVER_FLAG_ALLOW_ARCHCHANGE*::
1754 Allow the solver to change the architecture of an installed package
1755 without asking for confirmation. Note that changes to/from noarch
1756 are always considered to be allowed.
1758 *SOLVER_FLAG_ALLOW_VENDORCHANGE*::
1759 Allow the solver to change the vendor of an installed package
1760 without asking for confirmation. Each vendor is part of one or more
1761 vendor equivalence classes, normally installed packages may only
1762 change their vendor if the new vendor shares at least one equivalence
1765 *SOLVER_FLAG_ALLOW_NAMECHANGE*::
1766 Allow the solver to change the name of an installed package, i.e.
1767 install a package with a different name that obsoletes the installed
1768 package. This option is on by default.
1770 *SOLVER_FLAG_ALLOW_UNINSTALL*::
1771 Allow the solver to deinstall installed packages to fulfil the jobs.
1772 This flag also includes the above flags. You may want to set this
1773 flag if you only have SOLVER_ERASE jobs, as in that case it's
1774 better for the user to check the transaction overview instead of
1775 approving every single package that needs to be deinstalled.
1777 *SOLVER_FLAG_NO_UPDATEPROVIDE*::
1778 If multiple packages obsolete an installed package, the solver checks
1779 the provides of every such package and ignores all packages that
1780 do not provide the installed package name. Thus, you can have an
1781 official update candidate that provides the old name, and other
1782 packages that also obsolete the package but are not considered for
1783 updating. If you cannot use this feature, you can turn it off
1784 by setting this flag.
1786 *SOLVER_FLAG_SPLITPROVIDES*::
1787 Make the solver aware of special provides of the form
1788 ``<packagename>:<path>'' used in SUSE systems to support package
1791 *SOLVER_FLAG_IGNORE_RECOMMENDED*::
1792 Do not process optional (aka weak) dependencies.
1794 *SOLVER_FLAG_ADD_ALREADY_RECOMMENDED*::
1795 Install recommened or supplemented packages even if they have no
1796 connection to the current transaction. You can use this feature
1797 to implement a simple way for the user to install new recommended
1798 packages that were not available in the past.
1800 *SOLVER_FLAG_NO_INFARCHCHECK*::
1801 Turn off the inferior architecture checking that is normally done
1802 by the solver. Normally, the solver allows only the installation
1803 of packages from the "best" architecture if a package is available
1804 for multiple architectures.
1806 *SOLVER_FLAG_BEST_OBEY_POLICY*::
1807 Make the SOLVER_FORCEBEST job option consider only packages that
1808 meet the policies for installed packages, i.e. no downgrades,
1809 no architecture change, no vendor change (see the first flags
1810 of this section). If the flag is not specified, the solver will
1811 enforce the installation of the best package ignoring the
1812 installed packages, which may conflict with the set policy.
1814 *SOLVER_FLAG_NO_AUTOTARGET*::
1815 Do not enable auto-targeting up update and distupgrade jobs. See
1816 the section on targeted updates for more information.
1820 *SOLVER_RULE_UNKNOWN*::
1821 A rule of an unknown class. You should never encounter those.
1824 A package dependency rule, called rpm rule for historical reasons.
1826 *SOLVER_RULE_UPDATE*::
1827 A rule to implement the update policy of installed packages. Every
1828 installed package has an update rule that consists of the packages
1829 that may replace the installed package.
1831 *SOLVER_RULE_FEATURE*::
1832 Feature rules are fallback rules used when a update rule is disabled.
1833 They include all packages that may replace the installed package
1834 ignoring the update policy, i.e. they contain downgrades, arch
1835 changes and so on. Without them, the solver would simply deinstall
1836 installed packages if their update rule gets disabled.
1839 Job rules implement the job given to the solver.
1841 *SOLVER_RULE_DISTUPGRADE*::
1842 This are simple negative assertions that make sure that only packages
1843 are kept that are also available in one of the repositories.
1845 *SOLVER_RULE_INFARCH*::
1846 Infarch rules are also negative assertions, they disallow the installation
1847 of packages when there are packages of the same name but with a better
1850 *SOLVER_RULE_CHOICE*::
1851 Choice rules are used to make sure that the solver preferes updating to
1852 installing different packages when some dependency is provided by
1853 multiple packages with different names. The solver may always break
1854 choice rules, so you will not see them when a problem is found.
1856 *SOLVER_RULE_LEARNT*::
1857 These rules are generated by the solver to keep it from running into
1858 the same problem multiple times when it has to backtrack. They are
1859 the main reason why a sat solver is faster then other dependency solver
1862 Special dependency rule types:
1864 *SOLVER_RULE_RPM_NOT_INSTALLABLE*::
1865 This rule was added to prevent the installation of a package of an
1866 architecture that does not work on the system.
1868 *SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP*::
1869 The package contanis a required dependency which was not provided by
1872 *SOLVER_RULE_RPM_PACKAGE_REQUIRES*::
1873 Similar to SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP, but in this case
1874 some packages provided the dependency but none of them could be
1875 installed due to other dependency issues.
1877 *SOLVER_RULE_RPM_SELF_CONFLICT*::
1878 The package conflicts with itself. This is not allowed by older rpm
1881 *SOLVER_RULE_RPM_PACKAGE_CONFLICT*::
1882 To fulfill the dependencies two packages need to be installed, but
1883 one of the packages contains a conflict with the other one.
1885 *SOLVER_RULE_RPM_SAME_NAME*::
1886 The dependencies can only be fulfilled by multiple versions of
1887 a package, but installing multiple versions of the same package
1890 *SOLVER_RULE_RPM_PACKAGE_OBSOLETES*::
1891 To fulfill the dependencies two packages need to be installed, but
1892 one of the packages obsoletes the other one.
1894 *SOLVER_RULE_RPM_IMPLICIT_OBSOLETES*::
1895 To fulfill the dependencies two packages need to be installed, but
1896 one of the packages has provides a dependency that is obsoleted
1897 by the other one. See the POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES
1900 *SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES*::
1901 To fulfill the dependencies a package needs to be installed that is
1902 obsoleted by an installed package. See the POOL_FLAG_NOINSTALLEDOBSOLETES
1905 *SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP*::
1906 The user asked for installation of a package providing a specific
1907 dependency, but no available package provides it.
1909 *SOLVER_RULE_JOB_UNKNOWN_PACKAGE*::
1910 The user asked for installation of a package with a specific name,
1911 but no available package has that name.
1913 *SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM*::
1914 The user asked for the erasure of a dependency that is provided by the
1915 system (i.e. for special hardware or language dependencies), this
1916 cannot be done with a job.
1918 *SOLVER_RULE_JOB_UNSUPPORTED*::
1919 The user asked for something that is not yet implemented, e.g. the
1920 installation of all packages at once.
1922 Policy error constants
1924 *POLICY_ILLEGAL_DOWNGRADE*::
1925 The solver ask for permission before downgrading packages.
1927 *POLICY_ILLEGAL_ARCHCHANGE*::
1928 The solver ask for permission before changing the architecture of installed
1931 *POLICY_ILLEGAL_VENDORCHANGE*::
1932 The solver ask for permission before changing the vendor of installed
1935 *POLICY_ILLEGAL_NAMECHANGE*::
1936 The solver ask for permission before replacing an installed packages with
1937 a packge that has a different name.
1939 Solution element type constants
1941 *SOLVER_SOLUTION_JOB*::
1942 The problem can be solved by removing the specified job.
1944 *SOLVER_SOLUTION_POOLJOB*::
1945 The problem can be solved by removing the specified job that is defined in the pool.
1947 *SOLVER_SOLUTION_INFARCH*::
1948 The problem can be solved by allowing the installation of the specified package
1949 with an inferior architecture.
1951 *SOLVER_SOLUTION_DISTUPGRADE*::
1952 The problem can be solved by allowing to keep the specified package installed.
1954 *SOLVER_SOLUTION_BEST*::
1955 The problem can be solved by allowing to install the specified package that is
1956 not the best available package.
1958 *SOLVER_SOLUTION_ERASE*::
1959 The problem can be solved by allowing to erase the specified package.
1961 *SOLVER_SOLUTION_REPLACE*::
1962 The problem can be solved by allowing to replace the package with some other
1965 *SOLVER_SOLUTION_REPLACE_DOWNGRADE*::
1966 The problem can be solved by allowing to replace the package with some other
1967 package that has a lower version.
1969 *SOLVER_SOLUTION_REPLACE_ARCHCHANGE*::
1970 The problem can be solved by allowing to replace the package with some other
1971 package that has a different architecture.
1973 *SOLVER_SOLUTION_REPLACE_VENDORCHANGE*::
1974 The problem can be solved by allowing to replace the package with some other
1975 package that has a different vendor.
1977 *SOLVER_SOLUTION_REPLACE_NAMECHANGE*::
1978 The problem can be solved by allowing to replace the package with some other
1979 package that has a different name.
1984 Pool *pool; /* read only */
1989 Back pointer to pool.
1993 int set_flag(int flag, int value)
1994 my $oldvalue = $pool->set_flag($flag, $value);
1995 oldvalue = pool.set_flag(flag, value)
1996 oldvalue = pool.set_flag(flag, value)
1998 int get_flag(int flag)
1999 my $value = $pool->get_flag($flag);
2000 value = pool.get_flag(flag)
2001 value = pool.get_flag(flag)
2003 Set/get a solver specific flag. The flags define the policies the solver has
2004 to obey. The flags are explained in the CONSTANTS section of this class.
2006 Problem **solve(Job *jobs)
2007 my @problems = $solver->solve(\@jobs);
2008 problems = solver.solve(jobs)
2009 problems = solver.solve(jobs)
2011 Solve a problem specified in the job list (plus the jobs defined in the pool).
2012 Returns an array of problems that need user interaction, or an empty array
2013 if no problems were encountered. See the Problem class on how to deal with
2016 Transaction *transaction()
2017 my $trans = $solver->transaction();
2018 trans = solver.transaction()
2019 trans = solver.transaction()
2021 Return the transaction to implement the calculated package changes. A transaction
2022 is available even if problems were found, this is useful for interactive user
2023 interfaces that show both the job result and the problems.
2028 Problems are the way of the solver to interact with the user. You can simply list
2029 all problems and terminate your program, but a better way is to present solutions to
2030 the user and let him pick the ones he likes.
2034 Solver *solv; /* read only */
2039 Back pointer to solver object.
2041 Id id; /* read only */
2046 Id of the problem. The first problem has Id 1, they are numbered consecutively.
2050 Rule *findproblemrule()
2051 my $probrule = $problem->findproblemrule();
2052 probrule = problem.findproblemrule()
2053 probrule = problem.findproblemrule()
2055 Return the rule that caused the problem. Of cource in most situations there is no
2056 single responsible rule, but many rules that interconnect with each created the
2057 problem. Nevertheless, the solver uses some heuristic approch to find a rule
2058 that somewhat describes the problem best to the user.
2060 Rule **findallproblemrules(bool unfiltered = 0)
2061 my @probrules = $problem->findallproblemrules();
2062 probrules = problem.findallproblemrule()
2063 probrules = problem.findallproblemrule()
2065 Return all rules responsible for the problem. The returned set of rules contains
2066 all the needed information why there was a problem, but it's hard to present
2067 them to the user in a sensible way. The default is to filter out all update and
2068 job rules (unless the returned rules only consist of those types).
2070 Solutions **solutions()
2071 my @solutions = $problem->solutions();
2072 solutions = problem.solutions()
2073 solutions = problem.solutions()
2075 Return an array containing multiple possible solutions to fix the problem. See
2076 the solution class for more information.
2078 int solution_count()
2079 my $cnt = $problem->solution_count();
2080 cnt = problem.solution_count()
2081 cnt = problem.solution_count()
2083 Return the number of solutions without creating solution objects.
2088 Rules are the basic block of sat solving. Each package dependency gets translated
2089 into one or multiple rules.
2093 Solver *solv; /* read only */
2098 Back pointer to solver object.
2100 Id id; /* read only */
2107 int type; /* read only */
2112 The basic type of the rule. See the constant section of the solver class for the type list.
2117 my $ruleinfo = $rule->info();
2118 ruleinfo = rule.info()
2119 ruleinfo = rule.info()
2121 Return a Ruleinfo object that contains information about why the rule was created. But
2122 see the allinfos() method below.
2124 Ruleinfo **allinfos()
2125 my @ruleinfos = $rule->allinfos();
2126 ruleinfos = rule.allinfos()
2127 ruleinfos = rule.allinfos()
2129 As the same dependency rule can get created because of multiple dependencies, one
2130 Ruleinfo is not enough to describe the reason. Thus the allinfos() method returns
2131 an array of all infos about a rule.
2134 if ($rule1 == $rule2)
2138 Two rules are equal if they belong to the same solver and have the same id.
2143 A Ruleinfo describes one reason why a rule was created.
2147 Solver *solv; /* read only */
2152 Back pointer to solver object.
2154 int type; /* read only */
2159 The type of the ruleinfo. See the constant section of the solver class for the
2160 rule type list and the special type list.
2162 Dep *dep; /* read only */
2167 The dependency leading to the creation of the rule.
2169 Dep *dep_id; /* read only */
2170 $ruleinfo->{'dep_id'}
2174 The Id of the dependency leading to the creation of the rule, or zero.
2176 Solvable *solvable; /* read only */
2177 $ruleinfo->{solvable}
2181 The involved Solvable, e.g. the one containing the dependency.
2183 Solvable *othersolvable; /* read only */
2184 $ruleinfo->{othersolvable}
2185 ruleinfo.othersolvable
2186 ruleinfo.othersolvable
2188 The other involved Solvable (if any), e.g. the one containing providing
2189 the dependency for conflicts.
2191 const char *problemstr();
2192 my $str = $ruleinfo->problemstr();
2193 str = ruleinfo.problemstr()
2194 str = ruleinfo.problemstr()
2196 A string describing the ruleinfo from a problem perspective. This probably
2197 only makes sense if the rule is part of a problem.
2202 A solution solves one specific problem. It consists of multiple solution elements
2203 that all need to be executed.
2207 Solver *solv; /* read only */
2212 Back pointer to solver object.
2214 Id problemid; /* read only */
2215 $solution->{problemid}
2219 Id of the problem the solution solves.
2221 Id id; /* read only */
2226 Id of the solution. The first solution has Id 1, they are numbered consecutively.
2230 Solutionelement **elements(bool expandreplaces = 0)
2231 my @solutionelements = $solution->elements();
2232 solutionelements = solution.elements()
2233 solutionelements = solution.elements()
2235 Return an array containing the elements describing what neeeds to be done to
2236 implement the specific solution. If expandreplaces is true, elements of type
2237 SOLVER_SOLUTION_REPLACE will be replaced by one or more elements replace
2238 elements describing the policy mismatches.
2241 my $cnt = $solution->solution_count();
2242 cnt = solution.element_count()
2243 cnt = solution.element_count()
2245 Return the number of solution elements without creating objects. Note that the
2246 count does not match the number of objects returned by the elements() method
2247 of expandreplaces is set to true.
2250 THE SOLUTIONELEMENT CLASS
2251 -------------------------
2253 A solution element describes a single action of a solution. The action is always
2254 either to remove one specific job or to add a new job that installs or erases
2255 a single specific package.
2259 Solver *solv; /* read only */
2260 $solutionelement->{solv}
2261 solutionelement.solv
2262 solutionelement.solv
2264 Back pointer to solver object.
2266 Id problemid; /* read only */
2267 $solutionelement->{problemid}
2268 solutionelement.problemid
2269 solutionelement.problemid
2271 Id of the problem the element (partly) solves.
2273 Id solutionid; /* read only */
2274 $solutionelement->{solutionid}
2275 solutionelement.solutionid
2276 solutionelement.solutionid
2278 Id of the solution the element is a part of.
2280 Id id; /* read only */
2281 $solutionelement->{id}
2285 Id of the solution element. The first element has Id 1, they are numbered consecutively.
2287 Id type; /* read only */
2288 $solutionelement->{type}
2289 solutionelement.type
2290 solutionelement.type
2292 Type of the solution element. See the constant section of the solver class for the
2295 Solvable *solvable; /* read only */
2296 $solutionelement->{solvable}
2297 solutionelement.solvable
2298 solutionelement.solvable
2300 The installed solvable that needs to be replaced for replacement elements.
2302 Solvable *replacement; /* read only */
2303 $solutionelement->{replacement}
2304 solutionelement.replacement
2305 solutionelement.replacement
2307 The solvable that needs to be installed to fix the problem.
2309 int jobidx; /* read only */
2310 $solutionelement->{jobidx}
2311 solutionelement.jobidx
2312 solutionelement.jobidx
2314 The index of the job that needs to be removed to fix the problem, or -1 if the
2315 element is of another type. Note that it's better to change the job to SOLVER_NOOP
2316 type so that the numbering of other elements does not get disturbed. This
2317 method works both for types SOLVER_SOLUTION_JOB and SOLVER_SOLUTION_POOLJOB.
2321 Solutionelement **replaceelements()
2322 my @solutionelements = $solutionelement->replaceelements();
2323 solutionelements = solutionelement.replaceelements()
2324 solutionelements = solutionelement.replaceelements()
2326 If the solution element is of type SOLVER_SOLUTION_REPLACE, return an array of
2327 elements describing the policy mismatches, otherwise return a copy of the
2328 element. See also the ``expandreplaces'' option in the solution's elements()
2331 int illegalreplace()
2332 my $illegal = $solutionelement->illegalreplace();
2333 illegal = solutionelement.illegalreplace()
2334 illegal = solutionelement.illegalreplace()
2336 Return an integer that contains the policy mismatch bits or-ed together, or
2337 zero if there was no policy mismatch. See the policy error constants in
2341 my $job = $solutionelement->Job();
2342 illegal = solutionelement.Job()
2343 illegal = solutionelement.Job()
2345 Create a job that implements the solution element. Add this job to the array
2346 of jobs for all elements of type different to SOLVER_SOLUTION_JOB and
2347 SOLVER_SOLUTION_POOLJOB. For the later two, a SOLVER_NOOB Job is created,
2348 you should replace the old job with the new one.
2351 my $str = $solutionelement->str();
2352 str = solutionelement.str()
2353 str = solutionelement.str()
2355 A string describing the change the solution element consists of.
2357 THE TRANSACTION CLASS
2358 ---------------------
2362 Transaction element types, both active and passive
2364 *SOLVER_TRANSACTION_IGNORE*::
2365 This element does nothing. Used to map element types that do not
2366 match the view mode.
2368 *SOLVER_TRANSACTION_INSTALL*::
2369 This element installes a package.
2371 *SOLVER_TRANSACTION_ERASE*::
2372 This element erases a package.
2374 *SOLVER_TRANSACTION_MULTIINSTALL*::
2375 This element installs a package with a different version keeping the
2376 other versions installed.
2378 *SOLVER_TRANSACTION_MULTIREINSTALL*::
2379 This element reinstalls a installed package keeping the other versions
2382 Transaction element types, active view
2384 *SOLVER_TRANSACTION_REINSTALL*::
2385 This element re-installs a package, i.e. installs the same package again.
2387 *SOLVER_TRANSACTION_CHANGE*::
2388 This element installs a package with same name, version, architecture but
2391 *SOLVER_TRANSACTION_UPGRADE*::
2392 This element installs a newer version of an installed package.
2394 *SOLVER_TRANSACTION_DOWNGRADE*::
2395 This element installs a older version of an installed package.
2397 *SOLVER_TRANSACTION_OBSOLETES*::
2398 This element installs a package that obsoletes an installed package.
2400 Transaction element types, passive view
2402 *SOLVER_TRANSACTION_REINSTALLED*::
2403 This element re-installs a package, i.e. installs the same package again.
2405 *SOLVER_TRANSACTION_CHANGED*::
2406 This element replaces an installed package with one of the same name,
2407 version, architecture but different content.
2409 *SOLVER_TRANSACTION_UPGRADED*::
2410 This element replaces an installed package with a new version.
2412 *SOLVER_TRANSACTION_DOWNGRADED*::
2413 This element replaces an installed package with an old version.
2415 *SOLVER_TRANSACTION_OBSOLETED*::
2416 This element replaces an installed package with a package that obsoletes
2419 Pseudo element types for showing extra information used by classify()
2421 *SOLVER_TRANSACTION_ARCHCHANGE*::
2422 This element replaces an installed package with a package of a different
2425 *SOLVER_TRANSACTION_VENDORCHANGE*::
2426 This element replaces an installed package with a package of a different
2429 Transaction mode flags
2431 *SOLVER_TRANSACTION_SHOW_ACTIVE*::
2432 Filter for active view types. The default is to return passive view type,
2433 i.e. to show how the installed packages get changed.
2435 *SOLVER_TRANSACTION_SHOW_OBSOLETES*::
2436 Do not map the obsolete view type into INSTALL/ERASE elements.
2438 *SOLVER_TRANSACTION_SHOW_ALL*::
2439 If multiple packages replace an installed package, only the best of them
2440 is kept as OBSOLETE element, the other ones are mapped to INSTALL/ERASE
2441 elements. This is because most applications want to show just one package
2442 replacing the installed one. The SOLVER_TRANSACTION_SHOW_ALL makes the
2443 library keep all OBSOLETE elements.
2445 *SOLVER_TRANSACTION_SHOW_MULTIINSTALL*::
2446 The library maps MULTIINSTALL elements to simple INSTALL elements. This
2447 flag can be used to disable the mapping.
2449 *SOLVER_TRANSACTION_CHANGE_IS_REINSTALL*::
2450 Use this flag if you want to map CHANGE elements to the REINSTALL type.
2452 *SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE*::
2453 Use this flag if you want to map OBSOLETE elements to the UPGRADE type.
2455 *SOLVER_TRANSACTION_MERGE_ARCHCHANGES*::
2456 Do not add extra categories for every architecture change, instead cumulate
2457 them in one category.
2459 *SOLVER_TRANSACTION_MERGE_VENDORCHANGES*::
2460 Do not add extra categories for every vendor change, instead cumulate
2461 them in one category.
2463 *SOLVER_TRANSACTION_RPM_ONLY*::
2464 Special view mode that just returns IGNORE, ERASE, INSTALL, MULTIINSTALL
2465 elements. Useful if you want to find out what to feed to the underlying
2468 Transaction order flags
2470 *SOLVER_TRANSACTION_KEEP_ORDERDATA*::
2471 Do not throw away the dependency graph used for ordering the transaction.
2472 This flag is needed if you want to do manual ordering.
2476 Pool *pool; /* read only */
2481 Back pointer to pool.
2490 Returns true if the transaction does not do anything, i.e. has no elements.
2492 Solvable **newpackages();
2493 my @newsolvables = $trans->newpackages();
2494 newsolvables = trans.newpackages()
2495 newsolvables = trans.newpackages()
2497 Return all packages that are to be installed by the transaction. This are
2498 the packages that need to be downloaded from the repositories.
2500 Solvable **keptpackages();
2501 my @keptsolvables = $trans->keptpackages();
2502 keptsolvables = trans.keptpackages()
2503 keptsolvables = trans.keptpackages()
2505 Return all installed packages that the transaction will keep installed.
2508 my @steps = $trans->steps();
2509 steps = trans.steps()
2510 steps = trans.steps()
2512 Return all solvables that need to be installed (if the returned solvable
2513 is not already installed) or erased (if the returned solvable is installed).
2514 A step is also called a transaction element.
2516 int steptype(Solvable *solvable, int mode)
2517 my $type = $trans->steptype($solvable, $mode);
2518 type = trans.steptype(solvable, mode)
2519 type = trans.steptype(solvable, mode)
2521 Return the transaction type of the specified solvable. See the CONSTANTS
2522 sections for the mode argument flags and the list of returned types.
2524 TransactionClass **classify(int mode = 0)
2525 my @classes = $trans->classify();
2526 classes = trans.classify()
2527 classes = trans.classify()
2529 Group the transaction elements into classes so that they can be displayed
2530 in a structured way. You can use various mapping mode flags to tweak
2531 the result to match your preferences, see the mode argument flag in
2532 the CONSTANTS section. See the TransactionClass class for how to deal
2533 with the returned objects.
2535 Solvable *othersolvable(Solvable *solvable);
2536 my $other = $trans->othersolvable($solvable);
2537 other = trans.othersolvable(solvable)
2538 other = trans.othersolvable(solvable)
2540 Return the ``other'' solvable for a given solvable. For installed packages
2541 the other solvable is the best package with the same name that replaces
2542 the installed package, or the best package of the obsoleting packages if
2543 the package does not get replaced by one with the same name.
2545 For to be installed packages, the ``other'' solvable is the best installed
2546 package with the same name that will be replaced, or the best packages
2547 of all the packages that are obsoleted if the new package does not replace
2548 a package with the same name.
2550 Thus, the ``other'' solvable is normally the package that is also shown
2551 for a given package.
2553 Solvable **allothersolvables(Solvable *solvable);
2554 my @others = $trans->allothersolvables($solvable);
2555 others = trans.allothersolvables(solvable)
2556 others = trans.allothersolvables(solvable)
2558 For installed packages, returns all of the packages that replace us. For to
2559 be installed packages, returns all of the packages that the new package
2560 replaces. The special ``other'' solvable is always the first entry of the
2563 int calc_installsizechange();
2564 my $change = $trans->calc_installsizechange();
2565 change = trans.calc_installsizechange()
2566 change = trans.calc_installsizechange()
2568 Return the size change of the installed system in kilobytes (kibibytes).
2570 void order(int flags = 0);
2575 Order the steps in the transactions so that dependant packages are updated
2576 before packages that depend on them. For rpm, you can also use rpmlib's
2577 ordering functionality, debian's dpkg does not provide a way to order a
2580 === ACTIVE/PASSIVE VIEW ===
2582 Active view list what new packages get installed, while passive view shows
2583 what happens to the installed packages. Most often there's not much
2584 difference between the two modes, but things get interesting of multiple
2585 package get replaced by one new package. Say you have installed package
2586 A-1-1 and B-1-1, and now install A-2-1 with has a new dependency that
2587 obsoletes B. The transaction elements will be
2589 updated A-1-1 (other: A-2-1)
2590 obsoleted B-1-1 (other: A-2-1)
2592 in passive mode, but
2594 update A-2-1 (other: A-1-1)
2597 in active mode. If the mode containes SOLVER_TRANSACTION_SHOW_ALL, the
2598 passive mode list will be unchanged but the active mode list will just
2601 THE TRANSACTIONCLASS CLASS
2602 --------------------------
2604 Objects of this type are returned by the classify() Transaction method.
2608 Transaction *transaction; /* read only */
2609 $class->{transaction}
2613 Back pointer to transaction object.
2615 int type; /* read only */
2620 The type of the transaction elements in the class.
2622 int count; /* read only */
2627 The number of elements in the class.
2629 const char *fromstr;
2634 The old vendor or architecture.
2641 The new vendor or architecture.
2648 The id of the old vendor or architecture.
2655 The id of the new vendor or architecture.
2660 my @solvables = $class->solvables();
2661 solvables = class.solvables()
2662 solvables = class.solvables()
2664 Return the solvables for all transaction elements in the class.
2668 Checksums (also called hashes) are used to make sure that downloaded data is
2669 not corrupt and also as a fingerprint mechanism to check if data has changed.
2671 === CLASS METHODS ===
2673 Chksum *Chksum(Id type)
2674 my $chksum = solv::Chksum->new($type);
2675 chksum = solv.Chksum(type)
2676 chksum = Solv::Chksum.new(type)
2678 Create a checksum object. Currently the following types are supported:
2684 These keys are constants in the *solv* class.
2686 Chksum *Chksum(Id type, const char *hex)
2687 my $chksum = solv::Chksum->new($type, $hex);
2688 chksum = solv.Chksum(type, hex)
2689 chksum = Solv::Chksum.new(type, hex)
2691 Create an already finalized checksum object.
2695 Id type; /* read only */
2700 Return the type of the checksum object.
2704 void add(const char *str)
2709 Add a string to the checksum.
2711 void add_fp(FILE *fp)
2712 $chksum->add_fp($file);
2716 Add the contents of a file to the checksum.
2718 void add_stat(const char *filename)
2719 $chksum->add_stat($filename);
2720 chksum.add_stat(filename)
2721 chksum.add_stat(filename)
2723 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
2724 stat fails, the members are zeroed.
2726 void add_fstat(int fd)
2727 $chksum->add_fstat($fd);
2728 chksum.add_fstat(fd)
2729 chksum.add_fstat(fd)
2731 Same as add_stat, but instead of the filename a file descriptor is used.
2733 unsigned char *raw()
2734 my $raw = $chksum->raw();
2738 Finalize the checksum and return the result as raw bytes. This means that the
2739 result can contain NUL bytes or unprintable characters.
2742 my $raw = $chksum->hex();
2746 Finalize the checksum and return the result as hex string.
2749 if ($chksum1 == $chksum2)
2750 if chksum1 == chksum2:
2751 if chksum1 == chksum2
2753 Checksums are equal if they are of the same type and the finalized results are
2757 my $str = $chksum->str;
2761 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
2762 Otherwise "<type>:unfinished" is returned.
2767 This functions were added because libsolv uses standard *FILE* pointers to
2768 read/write files, but languages like perl have their own implementation of
2769 files. The libsolv functions also support decompression and compression, the
2770 algorithm is selected by looking at the file name extension.
2772 FILE *xfopen(char *fn, char *mode = "r")
2773 my $file = solv::xfopen($path);
2774 file = solv.xfopen(path)
2775 file = Solv::xfopen(path)
2777 Open a file at the specified path. The `mode` argument is passed on to the
2780 FILE *xfopen_fd(char *fn, int fileno)
2781 my $file = solv::xfopen_fd($path, $fileno);
2782 file = solv.xfopen_fd(path, fileno)
2783 file = Solv::xfopen_fd(path, fileno)
2785 Create a file handle from the specified file descriptor. The path argument is
2786 only used to select the correct (de-)compression algorithm, use an empty path
2787 if you want to make sure to read/write raw data.
2792 my $fileno = $file->fileno();
2793 fileno = file.fileno()
2794 fileno = file.fileno()
2796 Return file file descriptor of the file. If the file is not open, `-1` is
2800 my $fileno = $file->dup();
2804 Return a copy of the descriptor of the file. If the file is not open, `-1` is
2812 Flush the file. Returns false if there was an error. Flushing a closed file
2813 always returns true.
2820 Close the file. This is needed for languages like Ruby, that do not destruct
2821 objects right after they are no longer referenced. In that case, it is good
2822 style to close open files so that the file descriptors are freed right away.
2823 Returns false if there was an error.
2828 The Repodata stores attrinbutes for packages and the repository itself, each
2829 repository can have multiple repodata areas. You normally only need to
2830 directly access them if you implement lazy downloading of repository data.
2831 Repodata areas are created by calling the repository's add_repodata() method
2832 or by using repo_add methods without the REPO_REUSE_REPODATA or REPO_USE_LOADING
2837 Repo *repo; /* read only */
2842 Back pointer to repository object.
2844 Id id; /* read only */
2849 The id of the repodata area. Repodata ids of different repositories overlap.
2854 $data->internalize();
2858 Internalize newly added data. The lookup functions will only see the new data
2859 after it has been internalized.
2861 bool write(FILE *fp);
2866 Write the contents of the repodata area as solv file.
2868 bool add_solv(FILE *fp, int flags = 0);
2869 $data->add_solv($fp);
2873 Replace a stub repodata object with the data from a solv file. This method
2874 automatically adds the REPO_USE_LOADING flag. It should only be used from
2877 void create_stubs();
2878 $data->create_stubs()
2882 Create stub repodatas from the information stored in the repodata meta
2885 void extend_to_repo();
2886 $data->extend_to_repo();
2887 data.extend_to_repo()
2888 data.extend_to_repo()
2890 Extend the repodata so that it has the same size as the repo it belongs to.
2891 This method is only needed when switching to a just written repodata extension
2892 to make the repodata match the written extension (which is always of the
2896 if ($data1 == $data2)
2900 Two repodata objects are equal if they belong to the same repository and have
2903 === DATA RETRIEVAL METHODS ===
2905 const char *lookup_str(Id solvid, Id keyname)
2906 my $string = $data->lookup_str($solvid, $keyname);
2907 string = data.lookup_str(solvid, keyname)
2908 string = data.lookup_str(solvid, keyname)
2910 Id *lookup_idarray(Id solvid, Id keyname)
2911 my @ids = $data->lookup_idarray($solvid, $keyname);
2912 ids = data.lookup_idarray(solvid, keyname)
2913 ids = data.lookup_idarray(solvid, keyname)
2915 Chksum *lookup_checksum(Id solvid, Id keyname)
2916 my $chksum = $data->lookup_checksum($solvid, $keyname);
2917 chksum = data.lookup_checksum(solvid, keyname)
2918 chksum = data.lookup_checksum(solvid, keyname)
2920 Lookup functions. Return the data element stored in the specified solvable.
2921 The methods probably only make sense to retrive data from the special
2922 SOLVID_META solvid that stores repodata meta information.
2924 === DATA STORAGE METHODS ===
2926 void set_id(Id solvid, Id keyname, DepId id);
2927 $data->set_id($solvid, $keyname, $id);
2928 data.set_id(solvid, keyname, id)
2929 data.set_id(solvid, keyname, id)
2931 void set_str(Id solvid, Id keyname, const char *str);
2932 $data->set_str($solvid, $keyname, $str);
2933 data.set_str(solvid, keyname, str)
2934 data.set_str(solvid, keyname, str)
2936 void set_poolstr(Id solvid, Id keyname, const char *str);
2937 $data->set_poolstr($solvid, $keyname, $str);
2938 data.set_poolstr(solvid, keyname, str)
2939 data.set_poolstr(solvid, keyname, str)
2941 void set_checksum(Id solvid, Id keyname, Chksum *chksum);
2942 $data->set_checksum($solvid, $keyname, $chksum);
2943 data.set_checksum(solvid, keyname, chksum)
2944 data.set_checksum(solvid, keyname, chksum)
2946 void add_idarray(Id solvid, Id keyname, DepId id);
2947 $data->add_idarray($solvid, $keyname, $id);
2948 data.add_idarray(solvid, keyname, id)
2949 data.add_idarray(solvid, keyname, id)
2952 my $handle = $data->new_handle();
2953 handle = data.new_handle()
2954 handle = data.new_handle()
2956 void add_flexarray(Id solvid, Id keyname, Id handle);
2957 $data->add_flexarray($solvid, $keyname, $handle);
2958 data.add_flexarray(solvid, keyname, handle)
2959 data.add_flexarray(solvid, keyname, handle)
2961 Data storage methods. Probably only useful to store data in the special
2962 SOLVID_META solvid that stores repodata meta information. Note that
2963 repodata areas can have their own Id pool (see the REPO_LOCALPOOL flag),
2964 so be careful if you need to store ids. Arrays are created by calling
2965 the add function for every element. A flexarray is an array of
2966 sub-structures, call new_handle to create a new structure, use the
2967 handle as solvid to fill the structure with data and call add_flexarray
2968 to put the structure in an array.
2974 Datapos objects describe a specific position in the repository data area.
2975 Thus they are only valid until the repository is modified in some way.
2976 Datapos objects can be created by the pos() and parentpos() methods of
2977 a Datamatch object or by accesing the ``meta'' attribute of a repository.
2981 Repo *repo; /* read only */
2986 Back pointer to repository object.
2990 Dataiterator(Id keyname, const char *match, int flags)
2991 my $di = $datapos->Dataiterator($keyname, $match, $flags);
2992 di = datapos.Dataiterator(keyname, match, flags)
2993 di = datapos.Dataiterator(keyname, match, flags)
2995 Create a Dataiterator at the position of the datapos object.
2997 const char *lookup_deltalocation(unsigned int *OUTPUT);
2998 my ($location, $medianr) = $datapos->lookup_deltalocation();
2999 location, medianr = datapos.lookup_deltalocation()
3000 location, medianr = datapos.lookup_deltalocation()
3002 Return a tuple containing the on-media location and an optional media number
3003 for a delta rpm. This obviously only works if the data position points to
3004 structure describing a delta rpm.
3006 const char *lookup_deltaseq();
3007 my $seq = $datapos->lookup_deltaseq();
3008 seq = datapos.lookup_deltaseq();
3009 seq = datapos.lookup_deltaseq();
3011 Return the delta rpm sequence from the structure describing a delta rpm.
3013 === DATA RETRIEVAL METHODS ===
3015 const char *lookup_str(Id keyname)
3016 my $string = $datapos->lookup_str($keyname);
3017 string = datapos.lookup_str(keyname)
3018 string = datapos.lookup_str(keyname)
3020 Id lookup_id(Id solvid, Id keyname)
3021 my $id = $datapos->lookup_id($keyname);
3022 id = datapos.lookup_id(keyname)
3023 id = datapos.lookup_id(keyname)
3025 unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
3026 my $num = $datapos->lookup_num($keyname);
3027 num = datapos.lookup_num(keyname)
3028 num = datapos.lookup_num(keyname)
3030 bool lookup_void(Id keyname)
3031 my $bool = $datapos->lookup_void($keyname);
3032 bool = datapos.lookup_void(keyname)
3033 bool = datapos.lookup_void(keyname)
3035 Queue lookup_idarray(Id keyname)
3036 my @ids = $datapos->lookup_idarray($keyname);
3037 ids = datapos.lookup_idarray(keyname)
3038 ids = datapos.lookup_idarray(keyname)
3040 Chksum *lookup_checksum(Id keyname)
3041 my $chksum = $datapos->lookup_checksum($keyname);
3042 chksum = datapos.lookup_checksum(keyname)
3043 chksum = datapos.lookup_checksum(keyname)
3045 Lookup functions. Note that the returned Ids are always translated into
3046 the Ids of the global pool even if the repodata area contains its own pool.
3050 Michael Schroeder <mls@suse.de>