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.
91 This is also true for implicit obsoletes, thus you can install
92 both the 32bit and the 64bit version of a package with the
95 *POOL_FLAG_NOINSTALLEDOBSOLETES*::
96 New versions of rpm consider the obsoletes of installed packages
97 when checking for dependency, thus you may not install a package
98 that is obsoleted by some other installed package, unless you
99 also deinstall the other package.
101 *POOL_FLAG_HAVEDISTEPOCH*::
102 Mandriva added a new field called distepoch that gets checked in
103 version comparison if the epoch/version/release of two packages
106 *POOL_FLAG_NOOBSOLETESMULTIVERSION*::
107 If a package is installed in multiversionmode, rpm used to ignore
108 both the implicit obsoletes and the obsolete dependency of a
109 package. This was changed to ignoring just the implicit obsoletes,
110 thus you may install multiple versions of the same name, but
111 obsoleted packages still get removed.
120 Free a pool. This is currently done with a method instead of relying on
121 reference counting or garbage collection because it's hard to track every
124 void setdebuglevel(int level)
125 $pool->setdebuglevel($level);
126 pool.setdebuglevel(level)
127 pool.setdebuglevel(level)
129 Set the debug level. A value of zero means no debug output, the higher the
130 value, the more output is generated.
132 int set_flag(int flag, int value)
133 my $oldvalue = $pool->set_flag($flag, $value);
134 oldvalue = pool.set_flag(flag, value)
135 oldvalue = pool.set_flag(flag, value)
137 int get_flag(int flag)
138 my $value = $pool->get_flag($flag);
139 value = pool.get_flag(flag)
140 value = pool.get_flag(flag)
142 Set/get a pool specific flag. The flags define how the system works, e.g. how
143 the package manager treats obsoletes. The default flags should be sane for most
144 applications, but in some cases you may want to tweak a flag, for example if
145 you want to solv package dependencies for some other system than yours.
147 void set_rootdir(const char *rootdir)
148 $pool->set_rootdir(rootdir);
149 pool.set_rootdir(rootdir)
150 pool.set_rootdir(rootdir)
152 const char *get_rootdir()
153 my $rootdir = $pool->get_rootdir();
154 rootdir = pool.get_rootdir()
155 rootdir = pool.get_rootdir()
157 Set/get the rootdir to use. This is useful if you want package management
158 to work only in some directory, for example if you want to setup a chroot
159 jail. Note that the rootdir will only be prepended to file paths if the
160 *REPO_USE_ROOTDIR* flag is used.
162 void setarch(const char *arch = 0)
167 Set the architecture for your system. The architecture is used to determine
168 which packages are installable. It defaults to the result of ``uname -m''.
170 Repo *add_repo(const char *name)
171 $repo = $pool->add_repo($name);
172 repo = pool.add_repo(name)
173 repo = pool.add_repo(name)
175 Add a Repository with the specified name to the pool. The reposiory is empty
176 on creation, use the repository methods to populate it with packages.
178 Repoiterator *repos_iter()
179 for my $repo (@{$pool->repos_iter()})
180 for repo in pool.repos_iter():
181 for repo in pool.repos_iter()
183 Iterate over the existing repositories.
185 Solvableiterator *solvables_iter()
186 for my $solvable (@{$pool->solvables_iter()})
187 for solvable in pool.solvables_iter():
188 for solvable in pool.solvables_iter()
190 Iterate over the existing solvables.
192 Dep *Dep(const char *str, bool create=1)
193 my $dep = $pool->Dep($string);
194 dep = pool.Dep(string)
195 dep = pool.Dep(string)
197 Create an object describing a string or dependency. If the string is currently
198 not in the pool and _create_ is false, *undef*/*None*/*nil* is returned.
200 void addfileprovides()
201 $pool->addfileprovides();
202 pool.addfileprovides()
203 pool.addfileprovides()
205 Queue addfileprovides_queue()
206 my @ids = $pool->addfileprovides_queue();
207 ids = pool.addfileprovides_queue()
208 ids = pool.addfileprovides_queue()
210 Some package managers like rpm allow dependencies on files contained in other
211 packages. To allow libsolv to deal with those dependencies in an efficient way,
212 you need to call the addfileprovides method after creating and reading all
213 repositories. This method will scan all dependency for file names and than scan
214 all packages for matching files. If a filename has been matched, it will be
215 added to the provides list of the corresponding package. The
216 addfileprovides_queue variant works the same way but returns an array
217 containing all file dependencies. This information can be stored with the
218 repository to speed up the next usage of the repository.
220 void createwhatprovides()
221 $pool->createwhatprovides();
222 pool.createwhatprovides()
223 pool.createwhatprovides()
225 Create the internal ``whatprovides'' hash over all of the provides of all
226 packages. This method must be called before doing any lookups on provides.
227 It's encuraged to do it right after all repos are set up, usually right after
228 the call to addfileprovides().
230 Queue whatprovides(DepId dep)
231 my @solvables = $pool->whatprovides($dep);
232 solvables = pool.whatprovides(dep)
233 solvables = pool.whatprovides(dep)
235 Return all solvables that provide the specified dependency. You can use either
236 a Dep object or an simple Id as argument.
238 Queue matchprovidingids(const char *match, int flags)
239 my @ids = $pool->matchprovidingids($match, $flags);
240 ids = pool.matchprovidingids(match, flags)
241 ids = pool.matchprovidingids(match, flags)
243 Search the names of all provides and return the ones matching the specified
244 string. See the Dataiterator class for the allowed flags.
246 Id towhatprovides(Queue ids)
247 my $offset = $pool->towhatprovides(\@ids);
248 offset = pool.towhatprovides(ids)
249 offset = pool.towhatprovides(ids)
251 ``Internalize'' an array containing Ids. The returned value can be used to
252 create solver jobs working on a specific set of packages. See the Solver class
253 for more information.
255 bool isknownarch(DepId id)
256 my $bool = $pool->isknownarch($id);
257 bool = pool.isknownarch(id)
258 bool = pool.isknownarch?(id)
260 Return true if the specified Id describs a known architecture.
263 my $solver = $pool->Solver();
264 solver = pool.Solver()
265 solver = pool.Solver()
267 Create a new solver object.
269 Solver *Job(int how, Id what)
270 my $job = $pool->Job($how, $what);
271 job = pool.Job(how, what)
272 job = pool.Job(how, what)
274 Create a new Job object. Kind of low level, in most cases you would use a
275 Selection or Dep job constructor instead.
277 Selection *Selection()
278 my $sel = $pool->Selection();
279 sel = pool.Selection()
280 sel = pool.Selection()
282 Create an empty selection. Useful as a starting point for merging other
285 Selection *Selection_all()
286 my $sel = $pool->Selection_all();
287 sel = pool.Selection_all()
288 sel = pool.Selection_all()
290 Create a selection containing all packages. Useful as starting point for
291 intersecting other selections or for update/distupgrade jobs.
293 Selection *select(const char *name, int flags)
294 my $sel = $pool->select($name, $flags);
295 sel = pool.select(name, flags)
296 sel = pool.select(name, flags)
298 Create a selection by matching packages against the specified string. See the
299 Selection class for a list of flags and how to create solver jobs from a
302 void setpooljobs(Jobs *jobs)
303 $pool->setpooljobs(\@jobs);
304 pool.setpooljobs(jobs)
305 pool.setpooljobs(jobs)
308 @jobs = $pool->getpooljobs();
309 jobs = pool.getpooljobs()
310 jobs = pool.getpooljobs()
312 Get/Set fixed jobs stored in the pool. Those jobs are automatically appended to
313 all solver jobs, they are meant for fixed configurations like which packages
314 can be multiversion installed, which packages were userinstalled or must not be
317 void set_loadcallback(Callable *callback)
318 $pool->setloadcallback(\&callbackfunction);
319 pool.setloadcallback(callbackfunction)
320 pool.setloadcallback { |repodata| ... }
322 Set the callback function called when repository metadata needs to be loaded on
323 demand. To make use of this feature, you need to create repodata stubs that
324 tell the library which data is available but not loaded. If later on the data
325 needs to be accessed, the callback function is called with a repodata argument.
326 You can then load the data (maybe fetching it first from an remote server).
327 The callback should return true if the data has been made available.
329 === DATA RETRIEVAL METHODS ===
331 In the following functions, the _keyname_ argument describes what to retrive.
332 For the standard cases you can use the available Id constants. For example,
334 $solv::SOLVABLE_SUMMARY
335 solv.SOLVABLE_SUMMARY
336 Solv::SOLVABLE_SUMMARY
338 selects the ``Summary'' entry of a solvable. The _solvid_ argument selects the
339 desired solvable by Id.
341 const char *lookup_str(Id solvid, Id keyname)
342 my $string = $pool->lookup_str($solvid, $keyname);
343 string = pool.lookup_str(solvid, keyname)
344 string = pool.lookup_str(solvid, keyname)
346 Id lookup_id(Id solvid, Id keyname)
347 my $id = $pool->lookup_id($solvid, $keyname);
348 id = pool.lookup_id(solvid, keyname)
349 id = pool.lookup_id(solvid, keyname)
351 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
352 my $num = $pool->lookup_num($solvid, $keyname);
353 num = pool.lookup_num(solvid, keyname)
354 num = pool.lookup_num(solvid, keyname)
356 bool lookup_void(Id solvid, Id keyname)
357 my $bool = $pool->lookup_void($solvid, $keyname);
358 bool = pool.lookup_void(solvid, keyname)
359 bool = pool.lookup_void(solvid, keyname)
361 Queue lookup_idarray(Id solvid, Id keyname)
362 my @ids = $pool->lookup_idarray($solvid, $keyname);
363 ids = pool.lookup_idarray(solvid, keyname)
364 ids = pool.lookup_idarray(solvid, keyname)
366 Chksum *lookup_checksum(Id solvid, Id keyname)
367 my $chksum = $pool->lookup_checksum($solvid, $keyname);
368 chksum = pool.lookup_checksum(solvid, keyname)
369 chksum = pool.lookup_checksum(solvid, keyname)
371 Lookup functions. Return the data element stored in the specified solvable.
372 You should probably use the methods of the Solvable class instead.
374 Dataiterator *Dataiterator(Id solvid, Id keyname, const char *match, int flags)
375 my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
376 di = pool.Dataiterator(solvid, keyname, match, flags)
377 di = pool.Dataiterator(solvid, keyname, match, flags)
383 Iterate over the matching data elements. See the Dataiterator class for more
388 The following methods deal with Ids, i.e. integers representing objects in the
389 pool. They are considered ``low level'', in most cases you would not use them
390 but instead the object orientated methods.
393 $repo = $pool->id2repo($id);
394 repo = pool.id2repo(id)
395 repo = pool.id2repo(id)
397 Lookup an existing Repository by id. You can also do this by using the *repos*
400 Solvable *id2solvable(Id id)
401 $solvable = $pool->id2solvable($id);
402 solvable = pool.id2solvable(id)
403 solvable = pool.id2solvable(id)
405 Lookup an existing Repository by id. You can also do this by using the
406 *solvables* attribute.
408 const char *solvid2str(Id id)
409 my $str = $pool->solvid2str($id);
410 str = pool.solvid2str(id)
411 str = pool.solvid2str(id)
413 Return a string describing the Solvable with the specified id. The string
414 consists of the name, version, and architecture of the Solvable.
416 Id str2id(const char *str, bool create=1)
417 my $id = pool->str2id($string);
418 id = pool.str2id(string)
419 id = pool.str2id(string)
421 const char *id2str(Id id)
422 $string = pool->id2str($id);
423 string = pool.id2str(id)
424 string = pool.id2str(id)
426 Convert a string into an Id and back. If the string is currently not in the
427 pool and _create_ is false, zero is returned.
429 Id rel2id(Id name, Id evr, int flags, bool create=1)
430 my $id = pool->rel2id($nameid, $evrid, $flags);
431 id = pool.rel2id(nameid, evrid, flags)
432 id = pool.rel2id(nameid, evrid, flags)
434 Create a ``relational'' dependency. Such dependencies consist of a name part,
435 the _flags_ describing the relation, and a version part. The flags are:
437 $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
438 solv.REL_EQ | solv.REL_GT | solv.REL_LT
439 Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
441 Thus, if you want a ``\<='' relation, you would use *REL_LT | REL_EQ*.
443 Id id2langid(Id id, const char *lang, bool create=1)
444 my $id = $pool->id2langid($id, $language);
445 id = pool.id2langid(id, language)
446 id = pool.id2langid(id, language)
448 Create a language specific Id from some other id. This function simply converts
449 the id into a string, appends a dot and the specified language to the string
450 and converts the result back into an Id.
452 const char *dep2str(Id id)
453 $string = pool->dep2str($id);
454 string = pool.dep2str(id)
455 string = pool.dep2str(id)
457 Convert a dependency id into a string. If the id is just a string, this
458 function has the same effect as id2str(). For relational dependencies, the
459 result is the correct ``name relation evr'' string.
464 The dependency class is an object orientated way to work with strings and
465 dependencies. Internally, dependencies are represented as Ids, i.e. simple
466 numbers. Dependency objects can be constructed by using the Pool's Dep()
471 Pool *pool; /* read only */
476 Back reference to the pool this dependency belongs to.
478 Id id; /* read only */
483 The id of this dependency.
487 Dep *Rel(int flags, DepId evrid, bool create=1)
488 my $reldep = $dep->Rel($flags, $evrdep);
489 reldep = dep.Rel(flags, evrdep)
490 reldep = dep.Rel(flags, evrdep)
492 Create a relational dependency from to string dependencies and a flags
493 argument. See the pool's rel2id method for a description of the flags.
495 Selection *Selection_name(int setflags = 0)
496 my $sel = $dep->Selection_name();
497 sel = dep.Selection_name()
498 sel = dep.Selection_name()
500 Create a Selection from a dependency. The selection consists of all packages
501 that have a name equal to the dependency. If the dependency is of a relational
502 type, the packages version must also fulfill the dependency.
504 Selection *Selection_provides(int setflags = 0)
505 my $sel = $dep->Selection_provides();
506 sel = dep.Selection_provides()
507 sel = dep.Selection_provides()
509 Create a Selection from a dependency. The selection consists of all packages
510 that have at least one provides matching the dependency.
513 my $str = $dep->str();
517 Return a string describing the dependency.
524 Same as calling the str() method.
531 The dependencies are equal if they are part of the same pool and have the same
536 A Repository describes a group of packages, normally comming from the same
537 source. Repositories are created by the Pool's add_repo() method.
541 Pool *pool; /* read only */
546 Back reference to the pool this dependency belongs to.
548 Id id; /* read only */
553 Return the id of the repository.
555 const char *name; /* read/write */
560 The repositories name. To libsolv, the name is just a string with no specific
563 int prioprity; /* read/write */
568 The priority of the repository. A higher number means that packages of this
569 repository will be chosen over other repositories, even if they have a greater
572 int subprioprity; /* read/write */
573 $repo->{'subpriority'}
577 The sub-priority of the repository. This value is compared when the priorities
578 of two repositories are the same. It is useful to make the library prefer
579 on-disk repositories to remote ones.
581 int nsolvables; /* read only */
582 $repo->{'nsolvables'}
586 The number of solvables in this repository.
588 void *appdata; /* read/write */
593 Application specific data that may be used in any way by the code using the
596 Datapos *meta; /* read only */
601 Return a Datapos object of the repodata's metadata. You can use the lookup
602 methods of the Datapos class to lookup metadata attributes, like the repository
607 *REPO_REUSE_REPODATA*::
608 Reuse the last repository data aera (``repodata'') instead of creating a new
611 *REPO_NO_INTERNALIZE*::
612 Do not internalize the added repository data. This is useful if
613 you plan to add more data because internalization is a costly
617 Use the repodata's pool for Id storage instead of the global pool. Useful
618 if you don't want to pollute the global pool with many unneeded ids, like
619 when storing the filelist.
622 Use the repodata that is currently being loaded instead of creating a new one.
623 This only makes sense if used in a load callback.
625 *REPO_EXTEND_SOLVABLES*::
626 Do not create new solvables for the new data, but match existing solvables and
627 add the data to them. Repository metadata is often split into multiple parts,
628 with one primary file describing all packages and other parts holding
629 information that is normally not needed, like the changelog.
632 Prepend the pool's rootdir to the path when doing file operations.
635 Do not add a location element to the solvables. Useful if the solvables are
636 not in the final position, so you can add the correct location later in your code.
638 *SOLV_ADD_NO_STUBS*::
639 Do not create stubs for repository parts that can be downloaded on demand.
641 *SUSETAGS_RECORD_SHARES*::
642 This is specific to the add_susetags() method. Susetags allows to refer to already
643 read packages to save disk space. If this data sharing needs to work over multiple
644 calls to add_susetags, you need to specify this flag so that the share information
645 is made available to subsequent calls.
649 void free(bool reuseids = 0)
654 Free the repository and all solvables it contains. If _reuseids_ is set to
655 true, the solvable ids and the repository id may be reused by the library when
656 added new solvables. Thus you should leave it false if you are not sure that
657 somebody holds a reference.
659 void empty(bool reuseids = 0)
664 Free all the solvables in a repository. The repository will be empty after this
665 call. See the free() method for the meaning of _reuseids_.
672 Return true if there are no solvables in this repository.
675 $repo->internalize();
679 Internalize added data. Data must be internalized before it is available to the
680 lookup and data iterator functions.
687 Write a repo as a ``solv'' file. These files can be read very fast and thus are
688 a good way to cache repository data. Returns false if there was some error
691 Solvableiterator *solvables_iter()
692 for my $solvable (@{$repo->solvables_iter()})
693 for solvable in repo.solvables_iter():
694 for solvable in repo.solvables_iter()
696 Iterate over all solvables in a repository.
698 Repodata *add_repodata(int flags = 0)
699 my $repodata = $repo->add_repodata();
700 repodata = repo.add_repodata()
701 repodata = repo.add_repodata()
703 Add a new repodata area to the repository. This is normally automatically
704 done by the repo_add methods, so you need this method only in very
708 $repo->create_stubs();
712 Calls the create_stubs() repodata method for the last repodata of the
716 $repo->iscontiguous()
720 Return true if the solvables of this repository are all in a single block with
721 no holes, i.e. they have consecutive ids.
723 Repodata *first_repodata()
724 my $repodata = $repo->first_repodata();
725 repodata = repo.first_repodata()
726 repodata = repo.first_repodata()
728 Checks if all repodatas but the first repodata are extensions, and return the
729 first repodata if this is the case. Useful if you want to do a store/retrive
730 sequence on the repository to reduce the memory using and enable paging, as
731 this does not work if the rpository contains multiple non-extension repodata
734 Selection *Selection(int setflags = 0)
735 my $sel = $repo->Selection();
736 sel = repo.Selection()
737 sel = repo.Selection()
739 Create a Selection consisting of all packages in the repository.
741 Dataiterator *Dataiterator(Id p, Id key, const char *match, int flags)
742 my $di = $repo->Dataiterator($solvid, $keyname, $match, $flags);
743 di = repo.Dataiterator(solvid, keyname, match, flags)
744 di = repo.Dataiterator(solvid, keyname, match, flags)
750 Iterate over the matching data elements in this repository. See the
751 Dataiterator class for more information.
758 Return the name of the repository, or "Repo#<id>" if no name is set.
761 if ($repo1 == $repo2)
765 Two repositories are equal if they belong to the same pool and have the same id.
767 === DATA ADD METHODS ===
769 Solvable *add_solvable()
770 $repo->add_solvable();
774 Add a single empty solvable to the repository. Returns a Solvable object, see
775 the Solvable class for more information.
777 bool add_solv(const char *name, int flags = 0)
778 $repo->add_solv($name, $flags);
779 repo.add_solv(name, flags)
780 repo.add_solv(name, flags)
782 bool add_solv(FILE *fp, int flags = 0)
783 $repo->add_solv($fp, $flags);
784 repo.add_solv(fp, flags)
785 repo.add_solv(fp, flags)
787 Read a ``solv'' file and add its contents to the repository. These files can be
788 written with the write() method and are normally used as fast cache for
791 bool add_rpmdb(int flags = 0)
792 $repo->add_rpmdb($flags);
793 repo.add_rpmdb(flags)
794 repo.add_rpmdb(flags)
796 bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
797 $repo->add_rpmdb_reffp($reffp, $flags);
798 repo.add_rpmdb_reffp($reffp, flags)
799 repo.add_rpmdb_reffp($reffp, flags)
801 Add the contents of the rpm database to the repository. If a solv file
802 containing an old version of the database is available, it can be passed as
803 reffp to speed up reading.
805 bool add_rpm(const char *name, int flags = 0)
806 $repo->add_rpm($name, $flags);
807 repo.add_rpm(name, flags)
808 repo.add_rpm(name, flags)
810 Add the metadata of a single rpm package to the repository.
812 bool add_rpmdb_pubkeys(int flags = 0)
813 $repo->add_rpmdb_pubkeys();
814 repo.add_rpmdb_pubkeys()
815 repo.add_rpmdb_pubkeys()
817 Add all pubkeys contained in the rpm database to the repository. Note that
818 newer rpm versions also allow to store the pubkeys in some directory instead
821 bool add_pubkey(const char *keyfile, int flags = 0)
822 $repo->add_pubkey($keyfile);
823 repo.add_pubkey($keyfile)
824 repo.add_pubkey($keyfile)
826 Add a pubkey from a file to the repository.
828 bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
829 $repo->add_rpmmd($fp, $language);
830 repo.add_rpmmd(fp, language)
831 repo.add_rpmmd(fp, language)
833 Add metadata stored in the "rpm-md" format (i.e. from files in the ``repodata''
834 directory) to a repository. Supported files are "primary", "filelists",
835 "other", "suseinfo". Do not forget to specify the *REPO_EXTEND_SOLVABLES* for
836 extension files like "filelists" and "other". Use the _language_ parameter if
837 you have language extension files, otherwise simply use a *undef*/*None*/*nil*
840 bool add_repomdxml(FILE *fp, int flags = 0)
841 $repo->add_repomdxml($fp);
842 repo.add_repomdxml(fp)
843 repo.add_repomdxml(fp)
845 Add the repomd.xml meta description from the "rpm-md" format to the repository.
846 This file contains information about the repository like keywords, and also a
847 list of all database files with checksums. The data is added the the "meta"
848 section of the repository, i.e. no package gets created.
850 bool add_updateinfoxml(FILE *fp, int flags = 0)
851 $repo->add_updateinfoxml($fp);
852 repo.add_updateinfoxml(fp)
853 repo.add_updateinfoxml(fp)
855 Add the updateinfo.xml file containing available maintenance updates to the
856 repository. All updates are created as special packages that have a "patch:"
857 prefix in their name.
859 bool add_deltainfoxml(FILE *fp, int flags = 0)
860 $repo->add_deltainfoxml($fp);
861 repo.add_deltainfoxml(fp)
862 repo.add_deltainfoxml(fp)
864 Add the deltainfo.xml file (also called prestodelta.xml) containing available
865 delta-rpms to the repository. The data is added to the "meta" section, i.e. no
866 package gets created.
868 bool add_debdb(int flags = 0)
873 Add the contents of the debian installed package database to the repository.
875 bool add_debpackages(FILE *fp, int flags = 0)
876 $repo->add_debpackages($fp);
877 repo.add_debpackages($fp)
878 repo.add_debpackages($fp)
880 Add the contents of the debian repository metadata (the "packages" file)
883 bool add_deb(const char *filename, int flags = 0)
884 $repo->add_deb($filename);
885 repo.add_deb(filename)
886 repo.add_deb(filename)
888 Add the metadata of a single deb package to the repository.
890 bool add_mdk(FILE *fp, int flags = 0)
895 Add the contents of the mageia/mandriva repository metadata (the
896 "synthesis.hdlist" file) to the repository.
898 bool add_mdk_info(FILE *fp, int flags = 0)
903 Extend the packages from the synthesis file with the info.xml and files.xml
904 data. Do not forget to specify *REPO_EXTEND_SOLVABLES*.
906 bool add_arch_repo(FILE *fp, int flags = 0)
907 $repo->add_arch_repo($fp);
908 repo.add_arch_repo($fp)
909 repo.add_arch_repo($fp)
911 Add the contents of the archlinux repository metadata (the ".db.tar" file) to
914 bool add_arch_local(const char *dir, int flags = 0)
915 $repo->add_arch_local($dir);
916 repo.add_arch_local($dir)
917 repo.add_arch_local($dir)
919 Add the contents of the archlinux installed package database to the repository.
920 The _dir_ parameter is usually set to "/var/lib/pacman/local".
922 bool add_content(FILE *fp, int flags = 0)
923 $repo->add_content($fp);
927 Add the ``content'' meta description from the susetags format to the repository.
928 This file contains information about the repository like keywords, and also
929 a list of all database files with checksums. The data is added the the "meta"
930 section of the repository, i.e. no package gets created.
932 bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
933 $repo->add_susetags($fp, $defvendor, $language);
934 repo.add_susetags(fp, defvendor, language)
935 repo.add_susetags(fp, defvendor, language)
937 Add repository metadata in the susetags format to the repository. Like with
938 add_rpmmd, you can specify a language if you have language extension files. The
939 _defvendor_ parameter provides a default vendor for packages with missing
940 vendors, it is usually provided in the content file.
942 bool add_products(const char *dir, int flags = 0)
943 $repo->add_products($dir);
944 repo.add_products(dir)
945 repo.add_products(dir)
947 Add the installed SUSE products database to the repository. The _dir_ parameter
948 is usually "/etc/products.d".
953 A solvable describes all the information of one package. Each solvable belongs to
954 one repository, it can be added and filled manually but in most cases solvables
955 will get created by the repo_add methods.
959 Repo *repo; /* read only */
964 The repository this solvable belongs to.
966 Pool *pool; /* read only */
971 The pool this solvable belongs to, same as the pool of the repo.
973 Id id; /* read only */
978 The specific id of the solvable.
980 char *name; /* read/write */
985 char *evr; /* read/write */
990 char *arch; /* read/write */
995 char *vendor; /* read/write */
996 $solvable->{'vendor'}
1000 Easy access to often used attributes of solvables. They are
1001 internally stored as Ids.
1003 Id nameid; /* read/write */
1004 $solvable->{'nameid'}
1008 Id evrid; /* read/write */
1009 $solvable->{'evrid'}
1013 Id archid; /* read/write */
1014 $solvable->{'archid'}
1018 Id vendorid; /* read/write */
1019 $solvable->{'vendorid'}
1023 Raw interface to the ids. Useful if you want to search for
1024 a specific id and want to avoid the string compare overhead.
1028 const char *lookup_str(Id keyname)
1029 my $string = $solvable->lookup_str($keyname);
1030 string = solvable.lookup_str(keyname)
1031 string = solvable.lookup_str(keyname)
1033 Id lookup_id(Id keyname)
1034 my $id = $solvable->lookup_id($keyname);
1035 id = solvable.lookup_id(solvid)
1036 id = solvable.lookup_id(solvid)
1038 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
1039 my $num = $solvable->lookup_num($keyname);
1040 num = solvable.lookup_num(keyname)
1041 num = solvable.lookup_num(keyname)
1043 bool lookup_void(Id keyname)
1044 my $bool = $solvable->lookup_void($keyname);
1045 bool = solvable.lookup_void(keyname)
1046 bool = solvable.lookup_void(keyname)
1048 Chksum *lookup_checksum(Id keyname)
1049 my $chksum = $solvable->lookup_checksum($keyname);
1050 chksum = solvable.lookup_checksum(keyname)
1051 chksum = solvable.lookup_checksum(keyname)
1053 Queue lookup_idarray(Id keyname, Id marker = -1)
1054 my @ids = $solvable->lookup_idarray($keyname);
1055 ids = solvable.lookup_idarray(keyname)
1056 ids = solvable.lookup_idarray(keyname)
1058 Queue lookup_deparray(Id keyname, Id marker = -1)
1059 my @deps = $solvable->lookup_deparray($keyname);
1060 ids = solvable.lookup_deparray(keyname)
1061 ids = solvable.lookup_deparray(keyname)
1063 Generic lookup methods. Retrieve data stored for the specific keyname.
1064 The lookup_idarray() method will return an array of Ids, use
1065 lookup_deparray if you want an array of Dependency objects instead.
1066 Some Id arrays contain two parts of data divided by a specific marker,
1067 for example the provides array uses the SOLVABLE_FILEMARKER id to
1068 store both the ids provided by the package and the ids added by
1069 the addfileprovides method. The default, -1, translates to the
1070 correct marker for the keyname and returns the first part of the
1071 array, use 1 to select the second part or 0 to retrive all ids
1072 including the marker.
1074 const char *lookup_location(unsigned int *OUTPUT);
1075 my ($location, $medianr) = $solvable->lookup_location();
1076 location, medianr = solvable.lookup_location()
1077 location, medianr = solvable.lookup_location()
1079 Return a tuple containing the on-media location and an optional
1080 media number for multi-part repositories (e.g. repositories
1081 spawning multiple DVDs).
1083 void add_deparray(Id keyname, DepId id, Id marker = -1);
1084 $solvable->add_deparray($keyname, $depid);
1085 solvable.add_deparray(keyname, depid)
1086 solvable.add_deparray(keyname, depid)
1088 Add a new dependency to the attributes stored in keyname.
1091 $solvable->installable()
1092 solvable.installable()
1093 solvable.installable?
1095 Return true if the solvable is installable on the system. Solvables
1096 are not installable if the system does not support their architecture.
1099 $solvable->isinstalled()
1100 solvable.isinstalled()
1101 solvable.isinstalled?
1103 Return true if the solvable is installed on the system.
1105 Selection *Selection(int setflags = 0)
1106 my $sel = $solvable->Selection();
1107 sel = solvable.Selection()
1108 sel = solvable.Selection()
1110 Create a Selection containing just the single solvable.
1113 my $str = $solvable->str();
1114 str = $solvable.str()
1115 str = $solvable.str()
1117 Return a string describing the solvable. The string consists of the name,
1118 version, and architecture of the Solvable.
1121 my $str = "$solvable";
1125 Same as calling the str() method.
1128 if ($solvable1 == $solvable2)
1129 if solvable1 == solvable2:
1130 if solvable1 == solvable2
1132 Two solvables are equal if they are part of the same pool and have the same
1135 THE DATAITERATOR CLASS
1136 ----------------------
1151 THE TRANSACTION CLASS
1152 ---------------------
1157 Checksums (also called hashes) are used to make sure that downloaded data is
1158 not corrupt and also as a fingerprint mechanism to check if data has changed.
1160 === CLASS METHODS ===
1162 Chksum *Chksum(Id type)
1163 my $chksum = solv::Chksum->new($type);
1164 chksum = solv.Chksum(type)
1165 chksum = Solv::Chksum.new(type)
1167 Create a checksum object. Currently the following types are supported:
1173 These keys are constants in the *solv* class.
1175 Chksum *Chksum(Id type, const char *hex)
1176 my $chksum = solv::Chksum->new($type, $hex);
1177 chksum = solv.Chksum(type, hex)
1178 chksum = Solv::Chksum.new(type, hex)
1180 Create an already finalized checksum object.
1184 Id type; /* read only */
1189 Return the type of the checksum object.
1193 void add(const char *str)
1198 Add a string to the checksum.
1200 void add_fp(FILE *fp)
1201 $chksum->add_fp($file);
1205 Add the contents of a file to the checksum.
1207 void add_stat(const char *filename)
1208 $chksum->add_stat($filename);
1209 chksum.add_stat(filename)
1210 chksum.add_stat(filename)
1212 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
1213 stat fails, the members are zeroed.
1215 void add_fstat(int fd)
1216 $chksum->add_fstat($fd);
1217 chksum.add_fstat(fd)
1218 chksum.add_fstat(fd)
1220 Same as add_stat, but instead of the filename a file descriptor is used.
1222 unsigned char *raw()
1223 my $raw = $chksum->raw();
1227 Finalize the checksum and return the result as raw bytes. This means that the
1228 result can contain zero bytes or unprintable characters.
1230 unsigned char *hex()
1231 my $raw = $chksum->hex();
1235 Finalize the checksum and return the result as hex string.
1238 if ($chksum1 == $chksum2)
1239 if chksum1 == chksum2:
1240 if chksum1 == chksum2
1242 Checksums are equal if they are of the same type and the finalized results are
1246 my $str = "$chksum";
1250 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
1251 Otherwise "<type>:unfinished" is returned.
1256 This functions were added because libsolv uses standard *FILE* pointers to
1257 read/write files, but languages like perl have their own implementation of
1258 files. The libsolv functions also support decompression and compression, the
1259 algorithm is selected by looking at the file name extension.
1261 FILE *xfopen(char *fn, char *mode = "r")
1262 my $file = solv::xfopen($path);
1263 file = solv.xfopen(path)
1264 file = Solv::xfopen(path)
1266 Open a file at the specified path. The `mode` argument is passed on to the
1269 FILE *xfopen_fd(char *fn, int fileno)
1270 my $file = solv::xfopen_fd($path, $fileno);
1271 file = solv.xfopen_fd(path, fileno)
1272 file = Solv::xfopen_fd(path, fileno)
1274 Create a file handle from the specified file descriptor. The path argument is
1275 only used to select the correct (de-)compression algorithm, use an empty path
1276 if you want to make sure to read/write raw data.
1281 my $fileno = $file->fileno();
1282 fileno = file.fileno()
1283 fileno = file.fileno()
1285 Return file file descriptor of the file. If the file is not open, `-1` is
1289 my $fileno = $file->dup();
1293 Return a copy of the descriptor of the file. If the file is not open, `-1` is
1301 Flush the file. Returns false if there was an error. Flushing a closed file
1302 always returns true.
1309 Close the file. This is needed for languages like Ruby, that do not destruct
1310 objects right after they are no longer referenced. In that case, it is good
1311 style to close open files so that the file descriptors are freed right away.
1312 Returns false if there was an error.
1320 Michael Schroeder <mls@suse.de>