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 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 deps = solvable.lookup_deparray(keyname)
1061 deps = 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 dep, Id marker = -1);
1084 $solvable->add_deparray($keyname, $dep);
1085 solvable.add_deparray(keyname, dep)
1086 solvable.add_deparray(keyname, dep)
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 ----------------------
1138 Dataiterators can be used to do complex string searches or
1139 to iterate over arrays. They can be created via the
1140 constructors in the Pool, Repo, and Solvable classes. The
1141 Repo and Solvable constructors will limit the search to
1142 the repository or the specific package.
1147 Return a match if the search string matches the value.
1149 *SEARCH_STRINGSTART*::
1150 Return a match if the value starts with the search string.
1152 *SEARCH_STRINGEND*::
1153 Return a match if the value ends with the search string.
1155 *SEARCH_SUBSTRING*::
1156 Return a match if the search string can be matched somewhere
1160 Do a glob match of the search string against the value.
1163 Do a regular expression match of the search string against
1167 Ignore case when matching strings. Works for all the above
1171 Match the complete filenames of the file list, not just the
1174 *SEARCH_COMPLETE_FILELIST*::
1175 When matching the file list, check every file of the package
1176 not just the subset from the primary metadata.
1178 *SEARCH_CHECKSUMS*::
1179 Allow the matching of checksum entries.
1183 void prepend_keyname(Id keyname);
1184 $di->prepend_keyname($keyname);
1185 di.prepend_keyname(keyname)
1186 di.prepend_keyname(keyname)
1188 Do a sub-search in the array stored in keyname.
1190 void skip_solvable();
1191 $di->kip_solvable();
1195 Stop matching the current solvable and advance to the next
1203 Iterate through the matches. If there is a match, the object
1204 in d will be of type Datamatch.
1208 Objects of this type will be created for every value matched
1213 Pool *pool; /* read only */
1218 Back pointer to pool.
1220 Repo *repo; /* read only */
1225 The repository containing the matched object.
1227 Solvable *solvable; /* read only */
1232 The solvable containing the value that was matched.
1234 Id solvid; /* read only */
1239 The id of the solvable that matched.
1248 const char *key_idstr();
1253 The keyname that matched, either as id or string.
1260 const char *type_idstr();
1265 The key type of the value that was matched, either as id or string.
1277 The Id of the value that was matched (only valid for id types),
1278 either as id or string.
1285 The string value that was matched (only valid for string types).
1287 unsigned long long num();
1292 The numeric value that was matched (only valid for numeric types).
1294 unsigned int num2();
1299 The secondary numeric value that was matched (only valid for types
1300 containing two values).
1303 my $pos = $d->pos();
1307 The position object of the current match. It can be used to do
1308 sub-searches starting at the match (if it is of an array type).
1309 See the Datapos class for more information.
1311 Datapos *parentpos();
1312 my $pos = $d->parentpos();
1316 The position object of the array containing the current match.
1317 It can be used to do sub-searches, see the Datapos class for more
1325 Return the stringification of the matched value. Stringification
1326 depends on the search flags, for file list entries it will return
1327 just the base name unless SEARCH_FILES is used, for checksums
1328 it will return an empty string unless SEARCH_CHECKSUMS is used.
1329 Numeric values are currently stringified to an empty string.
1334 Selections are a way to easily deal with sets of packages.
1335 There are multiple constructors to create them, the most useful
1336 is probably the select() method in the Pool class.
1341 Create the selection by matching package names
1343 *SELECTION_PROVIDES*::
1344 Create the selection by matching package provides
1346 *SELECTION_FILELIST*::
1347 Create the selection by matching package files
1350 Create the selection by matching the canonical representation
1351 of the package. This is normally a combination of the name,
1352 the version, and the architecture of a package.
1354 *SELECTION_DOTARCH*::
1355 Allow an ``.<architecture>'' suffix when matching names or
1359 Allow the specification of a relation when matching names
1360 or provides, e.g. "name >= 1.2".
1362 *SELECTION_INSTALLED_ONLY*::
1363 Limit the package search to installed packages.
1365 *SELECTION_SOURCE_ONLY*::
1366 Limit the package search to source packages only.
1368 *SELECTION_WITH_SOURCE*::
1369 Extend the package search to also match source packages. The
1370 default is only to match binary packages.
1373 Allow glob matching for package names, package provides, and
1376 *SELECTION_NOCASE*::
1377 Ignore case when matching package names, package provides,
1381 Return only one selection element describing the selected packages.
1382 The default is to create multiple elements for all globbed packages.
1383 Multiple elements are useful if you want to turn the selection into
1384 an install job, in that case you want an install job for every
1389 Pool *pool; /* read only */
1394 Back pointer to pool.
1399 my $flags = $sel->flags();
1403 Return the result flags of the selection. The flags are a subset
1404 of the ones used when creating the selection, they describe which
1405 method was used to get the result. For example, if you create the
1406 selection with ``SELECTION_NAME | SELECTION_PROVIDES'', the resulting
1407 flags will either be SELECTION_NAME or SELECTION_PROVIDES depending
1408 if there was a package that matched the name or not. If there was
1409 no match at all, the flags will be zero.
1416 Return true if the selection is empty, i.e. no package could be matched.
1418 void filter(Selection *other)
1419 $sel->filter($other);
1423 Intersect two selections. Packages will only stay in the selection if there
1424 are also included in the other selecting. Does an in-place modification.
1426 void add(Selection *other)
1431 Build the union of two selections. All packages of the other selection will
1432 be added to the set of packages of the selection object. Does an in-place
1433 modification. Note that the selection flags are no longer meaningful after the
1436 void add_raw(Id how, Id what)
1437 $sel->add_raw($how, $what);
1438 sel.add_raw(how, what)
1439 sel.add_raw(how, what)
1441 Add a raw element to the selection. Check the Job class for information about
1442 the how and what parameters.
1444 Job *jobs(int action)
1445 my @jobs = $sel->jobs($action);
1446 jobs = sel.jobs(action)
1447 jobs = sel.jobs(action)
1449 Convert a selection into an array of Job objects. The action parameter is or-ed
1450 to the ``how'' part of the job, it describes the type of job (e.g. install,
1451 erase). See the Job class for the action and action modifier constants.
1453 Solvable *solvables()
1454 my @solvables = $sel->solvables();
1455 solvables = sel.solvables()
1456 solvables = sel.solvables()
1458 Convert a selection into an array of Solvable objects.
1465 Return a string describing the selection.
1469 Jobs are the way to specify to the dependency solver what to do.
1470 Most of the times jobs will get created by calling the jobs() method
1471 on a Selection object, but there is also a Job() constructor in the
1476 Selection constants:
1479 The ``what'' part is the id of a solvable.
1481 *SOLVER_SOLVABLE_NAME*::
1482 The ``what'' part is the id of a package name.
1484 *SOLVER_SOLVABLE_PROVIDES*::
1485 The ``what'' part is the id of a package provides.
1487 *SOLVER_SOLVABLE_ONE_OF*::
1488 The ``what'' part is an offset into the ``whatprovides'' data, created
1489 by calling the towhatprovides() pool method.
1491 *SOLVER_SOLVABLE_REPO*::
1492 The ``what'' part is the id of a repository.
1494 *SOLVER_SOLVABLE_ALL*::
1495 The ``what'' part is ignored, all packages are selected.
1497 *SOLVER_SOLVABLE_SELECTMASK*::
1498 A mask containing all the above selection bits.
1506 Install a package of the specified set of packages. It tries to install
1507 the best matching package (i.e. the highest version of the packages from
1508 the repositories with the highest priority).
1511 Erase all of the packages from the specified set. If a package is not
1512 installed, erasing it will keep it from getting installed.
1515 Update the matching installed packages to their best version. If none
1516 of the specified packages are installed, try to update the installed
1517 packages to the specified versions. See the section about targeted
1518 updates about more information.
1520 *SOLVER_WEAKENDEPS*::
1521 Allow to break the dependencies of the matching packages. Handle with care.
1523 *SOLVER_MULTIVERSION*::
1524 Mark the matched packages for multiversion install. If they get to be installed
1525 because of some other job, the installation will keep the old version of the
1526 package installed (for rpm by using ``-i'' instead of ``-U'').
1529 Do not change the state of the matched packages, i.e. when they are installed
1530 they stay installed, if not they are not selected for installation.
1532 *SOLVER_DISTUPGRADE*::
1533 Update the matching installed packages to the best version included in one
1534 of the repositories. After this operation, all come from one of the available
1535 repositories except orphaned packages. Orphaned packages are packages that
1536 have no relation to the packages in the repositories, i.e. no package in the
1537 repositories have the same name or obsolete the orphaned package.
1538 This action brings the installed packages in sync with the ones in the
1539 repository. It also turns of arch/vendor/version locking for the affected
1540 packages to simulate a fresh installation. This means that distupgrade can
1541 actually downgrade packages if only lower versions of a package are available
1542 in the repositories.
1544 *SOLVER_DROP_ORPHANED*::
1545 Erase all the matching installed packages if they are orphaned. This only makes
1546 sense if there is a ``distupgrade all packages'' job. The default is to erase
1547 orphaned packages only if they block the installation of other packages.
1550 Fix dependency problems of matching installed packages. The default is to ignore
1551 dependency problems for installed packages.
1553 *SOLVER_USERINSTALLED*::
1554 The matching installed packages are considered to be installed by a user, thus
1555 not installed to fulfil some dependency. This is needed input for the calculation
1556 of unneeded packages for jobs that have the SOLVER_CLEANDEPS flag set.
1559 A mask containing all the above action bits.
1561 Action modifier constants:
1564 Makes the job a weak job. The solver tries to fulfil weak jobs, but does not
1565 report a problem if it is not possible to do so.
1567 *SOLVER_ESSENTIAL*::
1568 Makes the job an essential job. If there is a problem with the job, the solver
1569 will not propose to remove the job as one solution (unless all other solutions
1570 are also to remove essential jobs).
1572 *SOLVER_CLEANDEPS*::
1573 The solver will try to also erase all packages dragged in through dependencies
1574 when erasing the package. This needs SOLVER_USERINSTALLED jobs to maximize user
1577 *SOLVER_FORCEBEST*::
1578 Insist on the best package for install, update, and distupgrade jobs. If this
1579 flag is not used, the solver will use the second-best package if the best
1580 package cannot be installed for some reason. When this flag is used, the solver
1581 will generate a problem instead.
1584 Forces targeted operation update and distupgrade jobs. See the section about
1585 targeted updates about more information.
1590 The job specified the exact epoch and version of the package set.
1593 The job specified the exact epoch, version, and release of the package set.
1596 The job specified the exact architecture of the packages from the set.
1598 *SOLVER_SETVENDOR*::
1599 The job specified the exact vendor of the packages from the set.
1602 The job specified the exact repository of the packages from the set.
1605 The job specified the exact name of the packages from the set.
1607 *SOLVER_NOAUTOSET*::
1608 Turn of automatic set flag generation for SOLVER_SOLVABLE jobs.
1611 A mask containing all the above set bits.
1613 See the section about set bits for more information.
1617 Pool *pool; /* read only */
1622 Back pointer to pool.
1624 Id how; /* read/write */
1629 Union of the selection, action, action modifier, and set flags.
1630 The selection part describes the semantics of the ``what'' Id.
1632 Id what; /* read/write */
1637 Id describing the set of packages, the meaning depends on the
1638 selection part of the ``how'' attribute.
1642 Solvable *solvables()
1643 my @solvables = $job->solvables();
1644 solvables = job.solvables()
1645 solvables = job.solvables()
1647 Return the set of solvables of the job as an array of Solvable
1650 bool isemptyupdate();
1651 $job->isemptyupdate()
1655 Convenience function to find out if the job describes an update
1656 job with no matching packages, i.e. a job that does nothing.
1657 Some package managers like ``zypper'' like to turn those jobs
1658 into install jobs, i.e. an update of a not-installed package
1659 will result into the installation of the package.
1666 Return a string describing the job.
1673 Two jobs are equal if they belong to the same pool and both the
1674 ``how'' and the ``what'' attributes are the same.
1676 === TARGETED UPDATES ===
1677 Libsolv has two modes for upgrades and distupgrade: targeted and
1678 untargeted. Untargeted mode means that the installed packages from
1679 the specified set will be updated to the best version. Targeted means
1680 that packages that can be updated to a package in the specified set
1681 will be updated to the best package of the set.
1683 Here's an example to explain the subtle difference. Suppose that
1684 you have package A installed in version "1.1", "A-1.2" is available
1685 in one of the repositories and there is also package "B" that
1686 obsoletes package A.
1688 An untargeted update of "A" will update the installed "A-1.1" to
1689 package "B", because that is the newest version (B obsoletes A and
1692 A targeted update of "A" will update "A-1.1" to "A-1.2", as the
1693 set of packages contains both "A-1.1" and "A-1.2", and "A-1.2" is
1696 An untargeted update of "B" will do nothing, as "B" is not installed.
1698 An targeted update of "B" will update "A-1.1" to "B".
1700 Note that the default is to do "auto-targeting", thus if the specified
1701 set of packages does not include an installed package, the solver
1702 will assume targeted operation even if SOLVER_TARGETED is not used.
1703 You can turn off auto-targeting with the SOLVER_FLAG_NO_AUTOTARGET
1704 solver option, see the Solver class for details.
1707 Set bits specify which parts of the specified packages where specified
1708 by the user. It is used by the solver when checking if an operation is
1709 allowed or not. For example, the solver will normally not allow the
1710 downgrade of an installed package. But it will not report a problem if
1711 the SOLVER_SETEVR flag is used, as it then assumes that the user specified
1712 the exact version and thus knows what he is doing.
1714 So if a package "screen-1-1" is installed for the x86_64 architecture and
1715 version "2-1" is only available for the i586 architecture, installing
1716 package "screen-2.1" will ask the user for confirmation because of the
1717 different architecture. When using the Selection class to create jobs
1718 the set bits are automatically added, e.g. selecting ``screen.i586'' will
1719 automatically add SOLVER_SETARCH, and thus no problem will be reported.
1725 THE TRANSACTION CLASS
1726 ---------------------
1731 Checksums (also called hashes) are used to make sure that downloaded data is
1732 not corrupt and also as a fingerprint mechanism to check if data has changed.
1734 === CLASS METHODS ===
1736 Chksum *Chksum(Id type)
1737 my $chksum = solv::Chksum->new($type);
1738 chksum = solv.Chksum(type)
1739 chksum = Solv::Chksum.new(type)
1741 Create a checksum object. Currently the following types are supported:
1747 These keys are constants in the *solv* class.
1749 Chksum *Chksum(Id type, const char *hex)
1750 my $chksum = solv::Chksum->new($type, $hex);
1751 chksum = solv.Chksum(type, hex)
1752 chksum = Solv::Chksum.new(type, hex)
1754 Create an already finalized checksum object.
1758 Id type; /* read only */
1763 Return the type of the checksum object.
1767 void add(const char *str)
1772 Add a string to the checksum.
1774 void add_fp(FILE *fp)
1775 $chksum->add_fp($file);
1779 Add the contents of a file to the checksum.
1781 void add_stat(const char *filename)
1782 $chksum->add_stat($filename);
1783 chksum.add_stat(filename)
1784 chksum.add_stat(filename)
1786 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
1787 stat fails, the members are zeroed.
1789 void add_fstat(int fd)
1790 $chksum->add_fstat($fd);
1791 chksum.add_fstat(fd)
1792 chksum.add_fstat(fd)
1794 Same as add_stat, but instead of the filename a file descriptor is used.
1796 unsigned char *raw()
1797 my $raw = $chksum->raw();
1801 Finalize the checksum and return the result as raw bytes. This means that the
1802 result can contain NUL bytes or unprintable characters.
1805 my $raw = $chksum->hex();
1809 Finalize the checksum and return the result as hex string.
1812 if ($chksum1 == $chksum2)
1813 if chksum1 == chksum2:
1814 if chksum1 == chksum2
1816 Checksums are equal if they are of the same type and the finalized results are
1820 my $str = "$chksum";
1824 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
1825 Otherwise "<type>:unfinished" is returned.
1830 This functions were added because libsolv uses standard *FILE* pointers to
1831 read/write files, but languages like perl have their own implementation of
1832 files. The libsolv functions also support decompression and compression, the
1833 algorithm is selected by looking at the file name extension.
1835 FILE *xfopen(char *fn, char *mode = "r")
1836 my $file = solv::xfopen($path);
1837 file = solv.xfopen(path)
1838 file = Solv::xfopen(path)
1840 Open a file at the specified path. The `mode` argument is passed on to the
1843 FILE *xfopen_fd(char *fn, int fileno)
1844 my $file = solv::xfopen_fd($path, $fileno);
1845 file = solv.xfopen_fd(path, fileno)
1846 file = Solv::xfopen_fd(path, fileno)
1848 Create a file handle from the specified file descriptor. The path argument is
1849 only used to select the correct (de-)compression algorithm, use an empty path
1850 if you want to make sure to read/write raw data.
1855 my $fileno = $file->fileno();
1856 fileno = file.fileno()
1857 fileno = file.fileno()
1859 Return file file descriptor of the file. If the file is not open, `-1` is
1863 my $fileno = $file->dup();
1867 Return a copy of the descriptor of the file. If the file is not open, `-1` is
1875 Flush the file. Returns false if there was an error. Flushing a closed file
1876 always returns true.
1883 Close the file. This is needed for languages like Ruby, that do not destruct
1884 objects right after they are no longer referenced. In that case, it is good
1885 style to close open files so that the file descriptors are freed right away.
1886 Returns false if there was an error.
1894 Michael Schroeder <mls@suse.de>