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.
113 *POOL_FLAG_ADDFILEPROVIDESFILTERED*::
114 Make the addfileprovides method only add files from the standard
115 locations (i.e. the ``bin'' and ``etc'' directories). This is
116 useful if you have only few packages that use non-standard file
117 dependencies, but you still wand the fast speed that addfileprovides()
127 Free a pool. This is currently done with a method instead of relying on
128 reference counting or garbage collection because it's hard to track every
131 void setdebuglevel(int level)
132 $pool->setdebuglevel($level);
133 pool.setdebuglevel(level)
134 pool.setdebuglevel(level)
136 Set the debug level. A value of zero means no debug output, the higher the
137 value, the more output is generated.
139 int set_flag(int flag, int value)
140 my $oldvalue = $pool->set_flag($flag, $value);
141 oldvalue = pool.set_flag(flag, value)
142 oldvalue = pool.set_flag(flag, value)
144 int get_flag(int flag)
145 my $value = $pool->get_flag($flag);
146 value = pool.get_flag(flag)
147 value = pool.get_flag(flag)
149 Set/get a pool specific flag. The flags define how the system works, e.g. how
150 the package manager treats obsoletes. The default flags should be sane for most
151 applications, but in some cases you may want to tweak a flag, for example if
152 you want to solv package dependencies for some other system than yours.
154 void set_rootdir(const char *rootdir)
155 $pool->set_rootdir(rootdir);
156 pool.set_rootdir(rootdir)
157 pool.set_rootdir(rootdir)
159 const char *get_rootdir()
160 my $rootdir = $pool->get_rootdir();
161 rootdir = pool.get_rootdir()
162 rootdir = pool.get_rootdir()
164 Set/get the rootdir to use. This is useful if you want package management
165 to work only in some directory, for example if you want to setup a chroot
166 jail. Note that the rootdir will only be prepended to file paths if the
167 *REPO_USE_ROOTDIR* flag is used.
169 void setarch(const char *arch = 0)
174 Set the architecture for your system. The architecture is used to determine
175 which packages are installable. It defaults to the result of ``uname -m''.
177 Repo *add_repo(const char *name)
178 $repo = $pool->add_repo($name);
179 repo = pool.add_repo(name)
180 repo = pool.add_repo(name)
182 Add a Repository with the specified name to the pool. The reposiory is empty
183 on creation, use the repository methods to populate it with packages.
185 Repoiterator *repos_iter()
186 for my $repo (@{$pool->repos_iter()})
187 for repo in pool.repos_iter():
188 for repo in pool.repos_iter()
190 Iterate over the existing repositories.
192 Solvableiterator *solvables_iter()
193 for my $solvable (@{$pool->solvables_iter()})
194 for solvable in pool.solvables_iter():
195 for solvable in pool.solvables_iter()
197 Iterate over the existing solvables.
199 Dep *Dep(const char *str, bool create=1)
200 my $dep = $pool->Dep($string);
201 dep = pool.Dep(string)
202 dep = pool.Dep(string)
204 Create an object describing a string or dependency. If the string is currently
205 not in the pool and _create_ is false, *undef*/*None*/*nil* is returned.
207 void addfileprovides()
208 $pool->addfileprovides();
209 pool.addfileprovides()
210 pool.addfileprovides()
212 Queue addfileprovides_queue()
213 my @ids = $pool->addfileprovides_queue();
214 ids = pool.addfileprovides_queue()
215 ids = pool.addfileprovides_queue()
217 Some package managers like rpm allow dependencies on files contained in other
218 packages. To allow libsolv to deal with those dependencies in an efficient way,
219 you need to call the addfileprovides method after creating and reading all
220 repositories. This method will scan all dependency for file names and than scan
221 all packages for matching files. If a filename has been matched, it will be
222 added to the provides list of the corresponding package. The
223 addfileprovides_queue variant works the same way but returns an array
224 containing all file dependencies. This information can be stored with the
225 repository to speed up the next usage of the repository.
227 void createwhatprovides()
228 $pool->createwhatprovides();
229 pool.createwhatprovides()
230 pool.createwhatprovides()
232 Create the internal ``whatprovides'' hash over all of the provides of all
233 packages. This method must be called before doing any lookups on provides.
234 It's encuraged to do it right after all repos are set up, usually right after
235 the call to addfileprovides().
237 Queue whatprovides(DepId dep)
238 my @solvables = $pool->whatprovides($dep);
239 solvables = pool.whatprovides(dep)
240 solvables = pool.whatprovides(dep)
242 Return all solvables that provide the specified dependency. You can use either
243 a Dep object or an simple Id as argument.
245 Queue matchprovidingids(const char *match, int flags)
246 my @ids = $pool->matchprovidingids($match, $flags);
247 ids = pool.matchprovidingids(match, flags)
248 ids = pool.matchprovidingids(match, flags)
250 Search the names of all provides and return the ones matching the specified
251 string. See the Dataiterator class for the allowed flags.
253 Id towhatprovides(Queue ids)
254 my $offset = $pool->towhatprovides(\@ids);
255 offset = pool.towhatprovides(ids)
256 offset = pool.towhatprovides(ids)
258 ``Internalize'' an array containing Ids. The returned value can be used to
259 create solver jobs working on a specific set of packages. See the Solver class
260 for more information.
262 bool isknownarch(DepId id)
263 my $bool = $pool->isknownarch($id);
264 bool = pool.isknownarch(id)
265 bool = pool.isknownarch?(id)
267 Return true if the specified Id describs a known architecture.
270 my $solver = $pool->Solver();
271 solver = pool.Solver()
272 solver = pool.Solver()
274 Create a new solver object.
276 Solver *Job(int how, Id what)
277 my $job = $pool->Job($how, $what);
278 job = pool.Job(how, what)
279 job = pool.Job(how, what)
281 Create a new Job object. Kind of low level, in most cases you would use a
282 Selection or Dep job constructor instead.
284 Selection *Selection()
285 my $sel = $pool->Selection();
286 sel = pool.Selection()
287 sel = pool.Selection()
289 Create an empty selection. Useful as a starting point for merging other
292 Selection *Selection_all()
293 my $sel = $pool->Selection_all();
294 sel = pool.Selection_all()
295 sel = pool.Selection_all()
297 Create a selection containing all packages. Useful as starting point for
298 intersecting other selections or for update/distupgrade jobs.
300 Selection *select(const char *name, int flags)
301 my $sel = $pool->select($name, $flags);
302 sel = pool.select(name, flags)
303 sel = pool.select(name, flags)
305 Create a selection by matching packages against the specified string. See the
306 Selection class for a list of flags and how to create solver jobs from a
309 void setpooljobs(Jobs *jobs)
310 $pool->setpooljobs(\@jobs);
311 pool.setpooljobs(jobs)
312 pool.setpooljobs(jobs)
315 @jobs = $pool->getpooljobs();
316 jobs = pool.getpooljobs()
317 jobs = pool.getpooljobs()
319 Get/Set fixed jobs stored in the pool. Those jobs are automatically appended to
320 all solver jobs, they are meant for fixed configurations like which packages
321 can be multiversion installed, which packages were userinstalled or must not be
324 void set_loadcallback(Callable *callback)
325 $pool->setloadcallback(\&callbackfunction);
326 pool.setloadcallback(callbackfunction)
327 pool.setloadcallback { |repodata| ... }
329 Set the callback function called when repository metadata needs to be loaded on
330 demand. To make use of this feature, you need to create repodata stubs that
331 tell the library which data is available but not loaded. If later on the data
332 needs to be accessed, the callback function is called with a repodata argument.
333 You can then load the data (maybe fetching it first from an remote server).
334 The callback should return true if the data has been made available.
336 === DATA RETRIEVAL METHODS ===
338 In the following functions, the _keyname_ argument describes what to retrive.
339 For the standard cases you can use the available Id constants. For example,
341 $solv::SOLVABLE_SUMMARY
342 solv.SOLVABLE_SUMMARY
343 Solv::SOLVABLE_SUMMARY
345 selects the ``Summary'' entry of a solvable. The _solvid_ argument selects the
346 desired solvable by Id.
348 const char *lookup_str(Id solvid, Id keyname)
349 my $string = $pool->lookup_str($solvid, $keyname);
350 string = pool.lookup_str(solvid, keyname)
351 string = pool.lookup_str(solvid, keyname)
353 Id lookup_id(Id solvid, Id keyname)
354 my $id = $pool->lookup_id($solvid, $keyname);
355 id = pool.lookup_id(solvid, keyname)
356 id = pool.lookup_id(solvid, keyname)
358 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
359 my $num = $pool->lookup_num($solvid, $keyname);
360 num = pool.lookup_num(solvid, keyname)
361 num = pool.lookup_num(solvid, keyname)
363 bool lookup_void(Id solvid, Id keyname)
364 my $bool = $pool->lookup_void($solvid, $keyname);
365 bool = pool.lookup_void(solvid, keyname)
366 bool = pool.lookup_void(solvid, keyname)
368 Queue lookup_idarray(Id solvid, Id keyname)
369 my @ids = $pool->lookup_idarray($solvid, $keyname);
370 ids = pool.lookup_idarray(solvid, keyname)
371 ids = pool.lookup_idarray(solvid, keyname)
373 Chksum *lookup_checksum(Id solvid, Id keyname)
374 my $chksum = $pool->lookup_checksum($solvid, $keyname);
375 chksum = pool.lookup_checksum(solvid, keyname)
376 chksum = pool.lookup_checksum(solvid, keyname)
378 Lookup functions. Return the data element stored in the specified solvable.
379 You should probably use the methods of the Solvable class instead.
381 Dataiterator *Dataiterator(Id solvid, Id keyname, const char *match, int flags)
382 my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
383 di = pool.Dataiterator(solvid, keyname, match, flags)
384 di = pool.Dataiterator(solvid, keyname, match, flags)
390 Iterate over the matching data elements. See the Dataiterator class for more
395 The following methods deal with Ids, i.e. integers representing objects in the
396 pool. They are considered ``low level'', in most cases you would not use them
397 but instead the object orientated methods.
400 $repo = $pool->id2repo($id);
401 repo = pool.id2repo(id)
402 repo = pool.id2repo(id)
404 Lookup an existing Repository by id. You can also do this by using the *repos*
407 Solvable *id2solvable(Id id)
408 $solvable = $pool->id2solvable($id);
409 solvable = pool.id2solvable(id)
410 solvable = pool.id2solvable(id)
412 Lookup an existing Repository by id. You can also do this by using the
413 *solvables* attribute.
415 const char *solvid2str(Id id)
416 my $str = $pool->solvid2str($id);
417 str = pool.solvid2str(id)
418 str = pool.solvid2str(id)
420 Return a string describing the Solvable with the specified id. The string
421 consists of the name, version, and architecture of the Solvable.
423 Id str2id(const char *str, bool create=1)
424 my $id = pool->str2id($string);
425 id = pool.str2id(string)
426 id = pool.str2id(string)
428 const char *id2str(Id id)
429 $string = pool->id2str($id);
430 string = pool.id2str(id)
431 string = pool.id2str(id)
433 Convert a string into an Id and back. If the string is currently not in the
434 pool and _create_ is false, zero is returned.
436 Id rel2id(Id name, Id evr, int flags, bool create=1)
437 my $id = pool->rel2id($nameid, $evrid, $flags);
438 id = pool.rel2id(nameid, evrid, flags)
439 id = pool.rel2id(nameid, evrid, flags)
441 Create a ``relational'' dependency. Such dependencies consist of a name part,
442 the _flags_ describing the relation, and a version part. The flags are:
444 $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
445 solv.REL_EQ | solv.REL_GT | solv.REL_LT
446 Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
448 Thus, if you want a ``\<='' relation, you would use *REL_LT | REL_EQ*.
450 Id id2langid(Id id, const char *lang, bool create=1)
451 my $id = $pool->id2langid($id, $language);
452 id = pool.id2langid(id, language)
453 id = pool.id2langid(id, language)
455 Create a language specific Id from some other id. This function simply converts
456 the id into a string, appends a dot and the specified language to the string
457 and converts the result back into an Id.
459 const char *dep2str(Id id)
460 $string = pool->dep2str($id);
461 string = pool.dep2str(id)
462 string = pool.dep2str(id)
464 Convert a dependency id into a string. If the id is just a string, this
465 function has the same effect as id2str(). For relational dependencies, the
466 result is the correct ``name relation evr'' string.
471 The dependency class is an object orientated way to work with strings and
472 dependencies. Internally, dependencies are represented as Ids, i.e. simple
473 numbers. Dependency objects can be constructed by using the Pool's Dep()
478 Pool *pool; /* read only */
483 Back reference to the pool this dependency belongs to.
485 Id id; /* read only */
490 The id of this dependency.
494 Dep *Rel(int flags, DepId evrid, bool create=1)
495 my $reldep = $dep->Rel($flags, $evrdep);
496 reldep = dep.Rel(flags, evrdep)
497 reldep = dep.Rel(flags, evrdep)
499 Create a relational dependency from to string dependencies and a flags
500 argument. See the pool's rel2id method for a description of the flags.
502 Selection *Selection_name(int setflags = 0)
503 my $sel = $dep->Selection_name();
504 sel = dep.Selection_name()
505 sel = dep.Selection_name()
507 Create a Selection from a dependency. The selection consists of all packages
508 that have a name equal to the dependency. If the dependency is of a relational
509 type, the packages version must also fulfill the dependency.
511 Selection *Selection_provides(int setflags = 0)
512 my $sel = $dep->Selection_provides();
513 sel = dep.Selection_provides()
514 sel = dep.Selection_provides()
516 Create a Selection from a dependency. The selection consists of all packages
517 that have at least one provides matching the dependency.
520 my $str = $dep->str();
524 Return a string describing the dependency.
531 Same as calling the str() method.
538 The dependencies are equal if they are part of the same pool and have the same
543 A Repository describes a group of packages, normally comming from the same
544 source. Repositories are created by the Pool's add_repo() method.
548 Pool *pool; /* read only */
553 Back reference to the pool this dependency belongs to.
555 Id id; /* read only */
560 The id of the repository.
562 const char *name; /* read/write */
567 The repositories name. To libsolv, the name is just a string with no specific
570 int prioprity; /* read/write */
575 The priority of the repository. A higher number means that packages of this
576 repository will be chosen over other repositories, even if they have a greater
579 int subprioprity; /* read/write */
580 $repo->{'subpriority'}
584 The sub-priority of the repository. This value is compared when the priorities
585 of two repositories are the same. It is useful to make the library prefer
586 on-disk repositories to remote ones.
588 int nsolvables; /* read only */
589 $repo->{'nsolvables'}
593 The number of solvables in this repository.
595 void *appdata; /* read/write */
600 Application specific data that may be used in any way by the code using the
603 Datapos *meta; /* read only */
608 Return a Datapos object of the repodata's metadata. You can use the lookup
609 methods of the Datapos class to lookup metadata attributes, like the repository
614 *REPO_REUSE_REPODATA*::
615 Reuse the last repository data aera (``repodata'') instead of creating a new
618 *REPO_NO_INTERNALIZE*::
619 Do not internalize the added repository data. This is useful if
620 you plan to add more data because internalization is a costly
624 Use the repodata's pool for Id storage instead of the global pool. Useful
625 if you don't want to pollute the global pool with many unneeded ids, like
626 when storing the filelist.
629 Use the repodata that is currently being loaded instead of creating a new one.
630 This only makes sense if used in a load callback.
632 *REPO_EXTEND_SOLVABLES*::
633 Do not create new solvables for the new data, but match existing solvables and
634 add the data to them. Repository metadata is often split into multiple parts,
635 with one primary file describing all packages and other parts holding
636 information that is normally not needed, like the changelog.
639 Prepend the pool's rootdir to the path when doing file operations.
642 Do not add a location element to the solvables. Useful if the solvables are
643 not in the final position, so you can add the correct location later in your code.
645 *SOLV_ADD_NO_STUBS*::
646 Do not create stubs for repository parts that can be downloaded on demand.
648 *SUSETAGS_RECORD_SHARES*::
649 This is specific to the add_susetags() method. Susetags allows to refer to already
650 read packages to save disk space. If this data sharing needs to work over multiple
651 calls to add_susetags, you need to specify this flag so that the share information
652 is made available to subsequent calls.
656 void free(bool reuseids = 0)
661 Free the repository and all solvables it contains. If _reuseids_ is set to
662 true, the solvable ids and the repository id may be reused by the library when
663 added new solvables. Thus you should leave it false if you are not sure that
664 somebody holds a reference.
666 void empty(bool reuseids = 0)
671 Free all the solvables in a repository. The repository will be empty after this
672 call. See the free() method for the meaning of _reuseids_.
679 Return true if there are no solvables in this repository.
682 $repo->internalize();
686 Internalize added data. Data must be internalized before it is available to the
687 lookup and data iterator functions.
694 Write a repo as a ``solv'' file. These files can be read very fast and thus are
695 a good way to cache repository data. Returns false if there was some error
698 Solvableiterator *solvables_iter()
699 for my $solvable (@{$repo->solvables_iter()})
700 for solvable in repo.solvables_iter():
701 for solvable in repo.solvables_iter()
703 Iterate over all solvables in a repository.
705 Repodata *add_repodata(int flags = 0)
706 my $repodata = $repo->add_repodata();
707 repodata = repo.add_repodata()
708 repodata = repo.add_repodata()
710 Add a new repodata area to the repository. This is normally automatically
711 done by the repo_add methods, so you need this method only in very
715 $repo->create_stubs();
719 Calls the create_stubs() repodata method for the last repodata of the
723 $repo->iscontiguous()
727 Return true if the solvables of this repository are all in a single block with
728 no holes, i.e. they have consecutive ids.
730 Repodata *first_repodata()
731 my $repodata = $repo->first_repodata();
732 repodata = repo.first_repodata()
733 repodata = repo.first_repodata()
735 Checks if all repodatas but the first repodata are extensions, and return the
736 first repodata if this is the case. Useful if you want to do a store/retrive
737 sequence on the repository to reduce the memory using and enable paging, as
738 this does not work if the rpository contains multiple non-extension repodata
741 Selection *Selection(int setflags = 0)
742 my $sel = $repo->Selection();
743 sel = repo.Selection()
744 sel = repo.Selection()
746 Create a Selection consisting of all packages in the repository.
748 Dataiterator *Dataiterator(Id p, Id key, const char *match, int flags)
749 my $di = $repo->Dataiterator($solvid, $keyname, $match, $flags);
750 di = repo.Dataiterator(solvid, keyname, match, flags)
751 di = repo.Dataiterator(solvid, keyname, match, flags)
757 Iterate over the matching data elements in this repository. See the
758 Dataiterator class for more information.
765 Return the name of the repository, or "Repo#<id>" if no name is set.
768 if ($repo1 == $repo2)
772 Two repositories are equal if they belong to the same pool and have the same id.
774 === DATA ADD METHODS ===
776 Solvable *add_solvable()
777 $repo->add_solvable();
781 Add a single empty solvable to the repository. Returns a Solvable object, see
782 the Solvable class for more information.
784 bool add_solv(const char *name, int flags = 0)
785 $repo->add_solv($name, $flags);
786 repo.add_solv(name, flags)
787 repo.add_solv(name, flags)
789 bool add_solv(FILE *fp, int flags = 0)
790 $repo->add_solv($fp, $flags);
791 repo.add_solv(fp, flags)
792 repo.add_solv(fp, flags)
794 Read a ``solv'' file and add its contents to the repository. These files can be
795 written with the write() method and are normally used as fast cache for
798 bool add_rpmdb(int flags = 0)
799 $repo->add_rpmdb($flags);
800 repo.add_rpmdb(flags)
801 repo.add_rpmdb(flags)
803 bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
804 $repo->add_rpmdb_reffp($reffp, $flags);
805 repo.add_rpmdb_reffp($reffp, flags)
806 repo.add_rpmdb_reffp($reffp, flags)
808 Add the contents of the rpm database to the repository. If a solv file
809 containing an old version of the database is available, it can be passed as
810 reffp to speed up reading.
812 bool add_rpm(const char *name, int flags = 0)
813 $repo->add_rpm($name, $flags);
814 repo.add_rpm(name, flags)
815 repo.add_rpm(name, flags)
817 Add the metadata of a single rpm package to the repository.
819 bool add_rpmdb_pubkeys(int flags = 0)
820 $repo->add_rpmdb_pubkeys();
821 repo.add_rpmdb_pubkeys()
822 repo.add_rpmdb_pubkeys()
824 Add all pubkeys contained in the rpm database to the repository. Note that
825 newer rpm versions also allow to store the pubkeys in some directory instead
828 bool add_pubkey(const char *keyfile, int flags = 0)
829 $repo->add_pubkey($keyfile);
830 repo.add_pubkey($keyfile)
831 repo.add_pubkey($keyfile)
833 Add a pubkey from a file to the repository.
835 bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
836 $repo->add_rpmmd($fp, $language);
837 repo.add_rpmmd(fp, language)
838 repo.add_rpmmd(fp, language)
840 Add metadata stored in the "rpm-md" format (i.e. from files in the ``repodata''
841 directory) to a repository. Supported files are "primary", "filelists",
842 "other", "suseinfo". Do not forget to specify the *REPO_EXTEND_SOLVABLES* for
843 extension files like "filelists" and "other". Use the _language_ parameter if
844 you have language extension files, otherwise simply use a *undef*/*None*/*nil*
847 bool add_repomdxml(FILE *fp, int flags = 0)
848 $repo->add_repomdxml($fp);
849 repo.add_repomdxml(fp)
850 repo.add_repomdxml(fp)
852 Add the repomd.xml meta description from the "rpm-md" format to the repository.
853 This file contains information about the repository like keywords, and also a
854 list of all database files with checksums. The data is added the the "meta"
855 section of the repository, i.e. no package gets created.
857 bool add_updateinfoxml(FILE *fp, int flags = 0)
858 $repo->add_updateinfoxml($fp);
859 repo.add_updateinfoxml(fp)
860 repo.add_updateinfoxml(fp)
862 Add the updateinfo.xml file containing available maintenance updates to the
863 repository. All updates are created as special packages that have a "patch:"
864 prefix in their name.
866 bool add_deltainfoxml(FILE *fp, int flags = 0)
867 $repo->add_deltainfoxml($fp);
868 repo.add_deltainfoxml(fp)
869 repo.add_deltainfoxml(fp)
871 Add the deltainfo.xml file (also called prestodelta.xml) containing available
872 delta-rpms to the repository. The data is added to the "meta" section, i.e. no
873 package gets created.
875 bool add_debdb(int flags = 0)
880 Add the contents of the debian installed package database to the repository.
882 bool add_debpackages(FILE *fp, int flags = 0)
883 $repo->add_debpackages($fp);
884 repo.add_debpackages($fp)
885 repo.add_debpackages($fp)
887 Add the contents of the debian repository metadata (the "packages" file)
890 bool add_deb(const char *filename, int flags = 0)
891 $repo->add_deb($filename);
892 repo.add_deb(filename)
893 repo.add_deb(filename)
895 Add the metadata of a single deb package to the repository.
897 bool add_mdk(FILE *fp, int flags = 0)
902 Add the contents of the mageia/mandriva repository metadata (the
903 "synthesis.hdlist" file) to the repository.
905 bool add_mdk_info(FILE *fp, int flags = 0)
910 Extend the packages from the synthesis file with the info.xml and files.xml
911 data. Do not forget to specify *REPO_EXTEND_SOLVABLES*.
913 bool add_arch_repo(FILE *fp, int flags = 0)
914 $repo->add_arch_repo($fp);
915 repo.add_arch_repo($fp)
916 repo.add_arch_repo($fp)
918 Add the contents of the archlinux repository metadata (the ".db.tar" file) to
921 bool add_arch_local(const char *dir, int flags = 0)
922 $repo->add_arch_local($dir);
923 repo.add_arch_local($dir)
924 repo.add_arch_local($dir)
926 Add the contents of the archlinux installed package database to the repository.
927 The _dir_ parameter is usually set to "/var/lib/pacman/local".
929 bool add_content(FILE *fp, int flags = 0)
930 $repo->add_content($fp);
934 Add the ``content'' meta description from the susetags format to the repository.
935 This file contains information about the repository like keywords, and also
936 a list of all database files with checksums. The data is added the the "meta"
937 section of the repository, i.e. no package gets created.
939 bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
940 $repo->add_susetags($fp, $defvendor, $language);
941 repo.add_susetags(fp, defvendor, language)
942 repo.add_susetags(fp, defvendor, language)
944 Add repository metadata in the susetags format to the repository. Like with
945 add_rpmmd, you can specify a language if you have language extension files. The
946 _defvendor_ parameter provides a default vendor for packages with missing
947 vendors, it is usually provided in the content file.
949 bool add_products(const char *dir, int flags = 0)
950 $repo->add_products($dir);
951 repo.add_products(dir)
952 repo.add_products(dir)
954 Add the installed SUSE products database to the repository. The _dir_ parameter
955 is usually "/etc/products.d".
960 A solvable describes all the information of one package. Each solvable belongs to
961 one repository, it can be added and filled manually but in most cases solvables
962 will get created by the repo_add methods.
966 Repo *repo; /* read only */
971 The repository this solvable belongs to.
973 Pool *pool; /* read only */
978 The pool this solvable belongs to, same as the pool of the repo.
980 Id id; /* read only */
985 The specific id of the solvable.
987 char *name; /* read/write */
992 char *evr; /* read/write */
997 char *arch; /* read/write */
1002 char *vendor; /* read/write */
1003 $solvable->{'vendor'}
1007 Easy access to often used attributes of solvables. They are
1008 internally stored as Ids.
1010 Id nameid; /* read/write */
1011 $solvable->{'nameid'}
1015 Id evrid; /* read/write */
1016 $solvable->{'evrid'}
1020 Id archid; /* read/write */
1021 $solvable->{'archid'}
1025 Id vendorid; /* read/write */
1026 $solvable->{'vendorid'}
1030 Raw interface to the ids. Useful if you want to search for
1031 a specific id and want to avoid the string compare overhead.
1035 const char *lookup_str(Id keyname)
1036 my $string = $solvable->lookup_str($keyname);
1037 string = solvable.lookup_str(keyname)
1038 string = solvable.lookup_str(keyname)
1040 Id lookup_id(Id keyname)
1041 my $id = $solvable->lookup_id($keyname);
1042 id = solvable.lookup_id(solvid)
1043 id = solvable.lookup_id(solvid)
1045 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
1046 my $num = $solvable->lookup_num($keyname);
1047 num = solvable.lookup_num(keyname)
1048 num = solvable.lookup_num(keyname)
1050 bool lookup_void(Id keyname)
1051 my $bool = $solvable->lookup_void($keyname);
1052 bool = solvable.lookup_void(keyname)
1053 bool = solvable.lookup_void(keyname)
1055 Chksum *lookup_checksum(Id keyname)
1056 my $chksum = $solvable->lookup_checksum($keyname);
1057 chksum = solvable.lookup_checksum(keyname)
1058 chksum = solvable.lookup_checksum(keyname)
1060 Queue lookup_idarray(Id keyname, Id marker = -1)
1061 my @ids = $solvable->lookup_idarray($keyname);
1062 ids = solvable.lookup_idarray(keyname)
1063 ids = solvable.lookup_idarray(keyname)
1065 Queue lookup_deparray(Id keyname, Id marker = -1)
1066 my @deps = $solvable->lookup_deparray($keyname);
1067 deps = solvable.lookup_deparray(keyname)
1068 deps = solvable.lookup_deparray(keyname)
1070 Generic lookup methods. Retrieve data stored for the specific keyname.
1071 The lookup_idarray() method will return an array of Ids, use
1072 lookup_deparray if you want an array of Dependency objects instead.
1073 Some Id arrays contain two parts of data divided by a specific marker,
1074 for example the provides array uses the SOLVABLE_FILEMARKER id to
1075 store both the ids provided by the package and the ids added by
1076 the addfileprovides method. The default, -1, translates to the
1077 correct marker for the keyname and returns the first part of the
1078 array, use 1 to select the second part or 0 to retrive all ids
1079 including the marker.
1081 const char *lookup_location(unsigned int *OUTPUT);
1082 my ($location, $medianr) = $solvable->lookup_location();
1083 location, medianr = solvable.lookup_location()
1084 location, medianr = solvable.lookup_location()
1086 Return a tuple containing the on-media location and an optional
1087 media number for multi-part repositories (e.g. repositories
1088 spawning multiple DVDs).
1090 void add_deparray(Id keyname, DepId dep, Id marker = -1);
1091 $solvable->add_deparray($keyname, $dep);
1092 solvable.add_deparray(keyname, dep)
1093 solvable.add_deparray(keyname, dep)
1095 Add a new dependency to the attributes stored in keyname.
1098 $solvable->installable()
1099 solvable.installable()
1100 solvable.installable?
1102 Return true if the solvable is installable on the system. Solvables
1103 are not installable if the system does not support their architecture.
1106 $solvable->isinstalled()
1107 solvable.isinstalled()
1108 solvable.isinstalled?
1110 Return true if the solvable is installed on the system.
1112 Selection *Selection(int setflags = 0)
1113 my $sel = $solvable->Selection();
1114 sel = solvable.Selection()
1115 sel = solvable.Selection()
1117 Create a Selection containing just the single solvable.
1120 my $str = $solvable->str();
1121 str = $solvable.str()
1122 str = $solvable.str()
1124 Return a string describing the solvable. The string consists of the name,
1125 version, and architecture of the Solvable.
1128 my $str = "$solvable";
1132 Same as calling the str() method.
1135 if ($solvable1 == $solvable2)
1136 if solvable1 == solvable2:
1137 if solvable1 == solvable2
1139 Two solvables are equal if they are part of the same pool and have the same
1142 THE DATAITERATOR CLASS
1143 ----------------------
1145 Dataiterators can be used to do complex string searches or
1146 to iterate over arrays. They can be created via the
1147 constructors in the Pool, Repo, and Solvable classes. The
1148 Repo and Solvable constructors will limit the search to
1149 the repository or the specific package.
1154 Return a match if the search string matches the value.
1156 *SEARCH_STRINGSTART*::
1157 Return a match if the value starts with the search string.
1159 *SEARCH_STRINGEND*::
1160 Return a match if the value ends with the search string.
1162 *SEARCH_SUBSTRING*::
1163 Return a match if the search string can be matched somewhere
1167 Do a glob match of the search string against the value.
1170 Do a regular expression match of the search string against
1174 Ignore case when matching strings. Works for all the above
1178 Match the complete filenames of the file list, not just the
1181 *SEARCH_COMPLETE_FILELIST*::
1182 When matching the file list, check every file of the package
1183 not just the subset from the primary metadata.
1185 *SEARCH_CHECKSUMS*::
1186 Allow the matching of checksum entries.
1190 void prepend_keyname(Id keyname);
1191 $di->prepend_keyname($keyname);
1192 di.prepend_keyname(keyname)
1193 di.prepend_keyname(keyname)
1195 Do a sub-search in the array stored in keyname.
1197 void skip_solvable();
1198 $di->kip_solvable();
1202 Stop matching the current solvable and advance to the next
1210 Iterate through the matches. If there is a match, the object
1211 in d will be of type Datamatch.
1215 Objects of this type will be created for every value matched
1220 Pool *pool; /* read only */
1225 Back pointer to pool.
1227 Repo *repo; /* read only */
1232 The repository containing the matched object.
1234 Solvable *solvable; /* read only */
1239 The solvable containing the value that was matched.
1241 Id solvid; /* read only */
1246 The id of the solvable that matched.
1255 const char *key_idstr();
1260 The keyname that matched, either as id or string.
1267 const char *type_idstr();
1272 The key type of the value that was matched, either as id or string.
1284 The Id of the value that was matched (only valid for id types),
1285 either as id or string.
1292 The string value that was matched (only valid for string types).
1294 unsigned long long num();
1299 The numeric value that was matched (only valid for numeric types).
1301 unsigned int num2();
1306 The secondary numeric value that was matched (only valid for types
1307 containing two values).
1310 my $pos = $d->pos();
1314 The position object of the current match. It can be used to do
1315 sub-searches starting at the match (if it is of an array type).
1316 See the Datapos class for more information.
1318 Datapos *parentpos();
1319 my $pos = $d->parentpos();
1323 The position object of the array containing the current match.
1324 It can be used to do sub-searches, see the Datapos class for more
1332 Return the stringification of the matched value. Stringification
1333 depends on the search flags, for file list entries it will return
1334 just the base name unless SEARCH_FILES is used, for checksums
1335 it will return an empty string unless SEARCH_CHECKSUMS is used.
1336 Numeric values are currently stringified to an empty string.
1341 Selections are a way to easily deal with sets of packages.
1342 There are multiple constructors to create them, the most useful
1343 is probably the select() method in the Pool class.
1348 Create the selection by matching package names
1350 *SELECTION_PROVIDES*::
1351 Create the selection by matching package provides
1353 *SELECTION_FILELIST*::
1354 Create the selection by matching package files
1357 Create the selection by matching the canonical representation
1358 of the package. This is normally a combination of the name,
1359 the version, and the architecture of a package.
1361 *SELECTION_DOTARCH*::
1362 Allow an ``.<architecture>'' suffix when matching names or
1366 Allow the specification of a relation when matching names
1367 or provides, e.g. "name >= 1.2".
1369 *SELECTION_INSTALLED_ONLY*::
1370 Limit the package search to installed packages.
1372 *SELECTION_SOURCE_ONLY*::
1373 Limit the package search to source packages only.
1375 *SELECTION_WITH_SOURCE*::
1376 Extend the package search to also match source packages. The
1377 default is only to match binary packages.
1380 Allow glob matching for package names, package provides, and
1383 *SELECTION_NOCASE*::
1384 Ignore case when matching package names, package provides,
1388 Return only one selection element describing the selected packages.
1389 The default is to create multiple elements for all globbed packages.
1390 Multiple elements are useful if you want to turn the selection into
1391 an install job, in that case you want an install job for every
1396 Pool *pool; /* read only */
1401 Back pointer to pool.
1406 my $flags = $sel->flags();
1410 Return the result flags of the selection. The flags are a subset
1411 of the ones used when creating the selection, they describe which
1412 method was used to get the result. For example, if you create the
1413 selection with ``SELECTION_NAME | SELECTION_PROVIDES'', the resulting
1414 flags will either be SELECTION_NAME or SELECTION_PROVIDES depending
1415 if there was a package that matched the name or not. If there was
1416 no match at all, the flags will be zero.
1423 Return true if the selection is empty, i.e. no package could be matched.
1425 void filter(Selection *other)
1426 $sel->filter($other);
1430 Intersect two selections. Packages will only stay in the selection if there
1431 are also included in the other selecting. Does an in-place modification.
1433 void add(Selection *other)
1438 Build the union of two selections. All packages of the other selection will
1439 be added to the set of packages of the selection object. Does an in-place
1440 modification. Note that the selection flags are no longer meaningful after the
1443 void add_raw(Id how, Id what)
1444 $sel->add_raw($how, $what);
1445 sel.add_raw(how, what)
1446 sel.add_raw(how, what)
1448 Add a raw element to the selection. Check the Job class for information about
1449 the how and what parameters.
1451 Job *jobs(int action)
1452 my @jobs = $sel->jobs($action);
1453 jobs = sel.jobs(action)
1454 jobs = sel.jobs(action)
1456 Convert a selection into an array of Job objects. The action parameter is or-ed
1457 to the ``how'' part of the job, it describes the type of job (e.g. install,
1458 erase). See the Job class for the action and action modifier constants.
1460 Solvable *solvables()
1461 my @solvables = $sel->solvables();
1462 solvables = sel.solvables()
1463 solvables = sel.solvables()
1465 Convert a selection into an array of Solvable objects.
1472 Return a string describing the selection.
1476 Jobs are the way to specify to the dependency solver what to do.
1477 Most of the times jobs will get created by calling the jobs() method
1478 on a Selection object, but there is also a Job() constructor in the
1483 Selection constants:
1486 The ``what'' part is the id of a solvable.
1488 *SOLVER_SOLVABLE_NAME*::
1489 The ``what'' part is the id of a package name.
1491 *SOLVER_SOLVABLE_PROVIDES*::
1492 The ``what'' part is the id of a package provides.
1494 *SOLVER_SOLVABLE_ONE_OF*::
1495 The ``what'' part is an offset into the ``whatprovides'' data, created
1496 by calling the towhatprovides() pool method.
1498 *SOLVER_SOLVABLE_REPO*::
1499 The ``what'' part is the id of a repository.
1501 *SOLVER_SOLVABLE_ALL*::
1502 The ``what'' part is ignored, all packages are selected.
1504 *SOLVER_SOLVABLE_SELECTMASK*::
1505 A mask containing all the above selection bits.
1513 Install a package of the specified set of packages. It tries to install
1514 the best matching package (i.e. the highest version of the packages from
1515 the repositories with the highest priority).
1518 Erase all of the packages from the specified set. If a package is not
1519 installed, erasing it will keep it from getting installed.
1522 Update the matching installed packages to their best version. If none
1523 of the specified packages are installed, try to update the installed
1524 packages to the specified versions. See the section about targeted
1525 updates about more information.
1527 *SOLVER_WEAKENDEPS*::
1528 Allow to break the dependencies of the matching packages. Handle with care.
1530 *SOLVER_MULTIVERSION*::
1531 Mark the matched packages for multiversion install. If they get to be installed
1532 because of some other job, the installation will keep the old version of the
1533 package installed (for rpm by using ``-i'' instead of ``-U'').
1536 Do not change the state of the matched packages, i.e. when they are installed
1537 they stay installed, if not they are not selected for installation.
1539 *SOLVER_DISTUPGRADE*::
1540 Update the matching installed packages to the best version included in one
1541 of the repositories. After this operation, all come from one of the available
1542 repositories except orphaned packages. Orphaned packages are packages that
1543 have no relation to the packages in the repositories, i.e. no package in the
1544 repositories have the same name or obsolete the orphaned package.
1545 This action brings the installed packages in sync with the ones in the
1546 repository. It also turns of arch/vendor/version locking for the affected
1547 packages to simulate a fresh installation. This means that distupgrade can
1548 actually downgrade packages if only lower versions of a package are available
1549 in the repositories.
1551 *SOLVER_DROP_ORPHANED*::
1552 Erase all the matching installed packages if they are orphaned. This only makes
1553 sense if there is a ``distupgrade all packages'' job. The default is to erase
1554 orphaned packages only if they block the installation of other packages.
1557 Fix dependency problems of matching installed packages. The default is to ignore
1558 dependency problems for installed packages.
1560 *SOLVER_USERINSTALLED*::
1561 The matching installed packages are considered to be installed by a user, thus
1562 not installed to fulfil some dependency. This is needed input for the calculation
1563 of unneeded packages for jobs that have the SOLVER_CLEANDEPS flag set.
1566 A mask containing all the above action bits.
1568 Action modifier constants:
1571 Makes the job a weak job. The solver tries to fulfil weak jobs, but does not
1572 report a problem if it is not possible to do so.
1574 *SOLVER_ESSENTIAL*::
1575 Makes the job an essential job. If there is a problem with the job, the solver
1576 will not propose to remove the job as one solution (unless all other solutions
1577 are also to remove essential jobs).
1579 *SOLVER_CLEANDEPS*::
1580 The solver will try to also erase all packages dragged in through dependencies
1581 when erasing the package. This needs SOLVER_USERINSTALLED jobs to maximize user
1584 *SOLVER_FORCEBEST*::
1585 Insist on the best package for install, update, and distupgrade jobs. If this
1586 flag is not used, the solver will use the second-best package if the best
1587 package cannot be installed for some reason. When this flag is used, the solver
1588 will generate a problem instead.
1591 Forces targeted operation update and distupgrade jobs. See the section about
1592 targeted updates about more information.
1597 The job specified the exact epoch and version of the package set.
1600 The job specified the exact epoch, version, and release of the package set.
1603 The job specified the exact architecture of the packages from the set.
1605 *SOLVER_SETVENDOR*::
1606 The job specified the exact vendor of the packages from the set.
1609 The job specified the exact repository of the packages from the set.
1612 The job specified the exact name of the packages from the set.
1614 *SOLVER_NOAUTOSET*::
1615 Turn of automatic set flag generation for SOLVER_SOLVABLE jobs.
1618 A mask containing all the above set bits.
1620 See the section about set bits for more information.
1624 Pool *pool; /* read only */
1629 Back pointer to pool.
1631 Id how; /* read/write */
1636 Union of the selection, action, action modifier, and set flags.
1637 The selection part describes the semantics of the ``what'' Id.
1639 Id what; /* read/write */
1644 Id describing the set of packages, the meaning depends on the
1645 selection part of the ``how'' attribute.
1649 Solvable *solvables()
1650 my @solvables = $job->solvables();
1651 solvables = job.solvables()
1652 solvables = job.solvables()
1654 Return the set of solvables of the job as an array of Solvable
1657 bool isemptyupdate();
1658 $job->isemptyupdate()
1662 Convenience function to find out if the job describes an update
1663 job with no matching packages, i.e. a job that does nothing.
1664 Some package managers like ``zypper'' like to turn those jobs
1665 into install jobs, i.e. an update of a not-installed package
1666 will result into the installation of the package.
1673 Return a string describing the job.
1680 Two jobs are equal if they belong to the same pool and both the
1681 ``how'' and the ``what'' attributes are the same.
1683 === TARGETED UPDATES ===
1684 Libsolv has two modes for upgrades and distupgrade: targeted and
1685 untargeted. Untargeted mode means that the installed packages from
1686 the specified set will be updated to the best version. Targeted means
1687 that packages that can be updated to a package in the specified set
1688 will be updated to the best package of the set.
1690 Here's an example to explain the subtle difference. Suppose that
1691 you have package A installed in version "1.1", "A-1.2" is available
1692 in one of the repositories and there is also package "B" that
1693 obsoletes package A.
1695 An untargeted update of "A" will update the installed "A-1.1" to
1696 package "B", because that is the newest version (B obsoletes A and
1699 A targeted update of "A" will update "A-1.1" to "A-1.2", as the
1700 set of packages contains both "A-1.1" and "A-1.2", and "A-1.2" is
1703 An untargeted update of "B" will do nothing, as "B" is not installed.
1705 An targeted update of "B" will update "A-1.1" to "B".
1707 Note that the default is to do "auto-targeting", thus if the specified
1708 set of packages does not include an installed package, the solver
1709 will assume targeted operation even if SOLVER_TARGETED is not used.
1711 This mostly matches the intent of the user, with one exception: In
1712 the example above, an update of "A-1.2" will update "A-1.1" to
1713 "A-1.2" (targeted mode), but a second update of "A-1.2" will suddenly
1714 update to "B", as untargeted mode is chosen because "A-1.2" is now
1717 If you want to have full control over when targeting mode is chosen,
1718 turn off auto-targeting with the SOLVER_FLAG_NO_AUTOTARGET solver option.
1719 In that case, all updates are considered to be untargeted unless they
1720 include the SOLVER_TARGETED flag.
1723 Set bits specify which parts of the specified packages where specified
1724 by the user. It is used by the solver when checking if an operation is
1725 allowed or not. For example, the solver will normally not allow the
1726 downgrade of an installed package. But it will not report a problem if
1727 the SOLVER_SETEVR flag is used, as it then assumes that the user specified
1728 the exact version and thus knows what he is doing.
1730 So if a package "screen-1-1" is installed for the x86_64 architecture and
1731 version "2-1" is only available for the i586 architecture, installing
1732 package "screen-2.1" will ask the user for confirmation because of the
1733 different architecture. When using the Selection class to create jobs
1734 the set bits are automatically added, e.g. selecting ``screen.i586'' will
1735 automatically add SOLVER_SETARCH, and thus no problem will be reported.
1741 THE TRANSACTION CLASS
1742 ---------------------
1747 Checksums (also called hashes) are used to make sure that downloaded data is
1748 not corrupt and also as a fingerprint mechanism to check if data has changed.
1750 === CLASS METHODS ===
1752 Chksum *Chksum(Id type)
1753 my $chksum = solv::Chksum->new($type);
1754 chksum = solv.Chksum(type)
1755 chksum = Solv::Chksum.new(type)
1757 Create a checksum object. Currently the following types are supported:
1763 These keys are constants in the *solv* class.
1765 Chksum *Chksum(Id type, const char *hex)
1766 my $chksum = solv::Chksum->new($type, $hex);
1767 chksum = solv.Chksum(type, hex)
1768 chksum = Solv::Chksum.new(type, hex)
1770 Create an already finalized checksum object.
1774 Id type; /* read only */
1779 Return the type of the checksum object.
1783 void add(const char *str)
1788 Add a string to the checksum.
1790 void add_fp(FILE *fp)
1791 $chksum->add_fp($file);
1795 Add the contents of a file to the checksum.
1797 void add_stat(const char *filename)
1798 $chksum->add_stat($filename);
1799 chksum.add_stat(filename)
1800 chksum.add_stat(filename)
1802 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
1803 stat fails, the members are zeroed.
1805 void add_fstat(int fd)
1806 $chksum->add_fstat($fd);
1807 chksum.add_fstat(fd)
1808 chksum.add_fstat(fd)
1810 Same as add_stat, but instead of the filename a file descriptor is used.
1812 unsigned char *raw()
1813 my $raw = $chksum->raw();
1817 Finalize the checksum and return the result as raw bytes. This means that the
1818 result can contain NUL bytes or unprintable characters.
1821 my $raw = $chksum->hex();
1825 Finalize the checksum and return the result as hex string.
1828 if ($chksum1 == $chksum2)
1829 if chksum1 == chksum2:
1830 if chksum1 == chksum2
1832 Checksums are equal if they are of the same type and the finalized results are
1836 my $str = "$chksum";
1840 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
1841 Otherwise "<type>:unfinished" is returned.
1846 This functions were added because libsolv uses standard *FILE* pointers to
1847 read/write files, but languages like perl have their own implementation of
1848 files. The libsolv functions also support decompression and compression, the
1849 algorithm is selected by looking at the file name extension.
1851 FILE *xfopen(char *fn, char *mode = "r")
1852 my $file = solv::xfopen($path);
1853 file = solv.xfopen(path)
1854 file = Solv::xfopen(path)
1856 Open a file at the specified path. The `mode` argument is passed on to the
1859 FILE *xfopen_fd(char *fn, int fileno)
1860 my $file = solv::xfopen_fd($path, $fileno);
1861 file = solv.xfopen_fd(path, fileno)
1862 file = Solv::xfopen_fd(path, fileno)
1864 Create a file handle from the specified file descriptor. The path argument is
1865 only used to select the correct (de-)compression algorithm, use an empty path
1866 if you want to make sure to read/write raw data.
1871 my $fileno = $file->fileno();
1872 fileno = file.fileno()
1873 fileno = file.fileno()
1875 Return file file descriptor of the file. If the file is not open, `-1` is
1879 my $fileno = $file->dup();
1883 Return a copy of the descriptor of the file. If the file is not open, `-1` is
1891 Flush the file. Returns false if there was an error. Flushing a closed file
1892 always returns true.
1899 Close the file. This is needed for languages like Ruby, that do not destruct
1900 objects right after they are no longer referenced. In that case, it is good
1901 style to close open files so that the file descriptors are freed right away.
1902 Returns false if there was an error.
1910 Michael Schroeder <mls@suse.de>