9 libsolv-bindings - access libsolv from perl/python/ruby
18 The pool is libsolv's central resource manager. A pool
19 consists of Solvables, Repositories, Dependencies, each
25 my $pool = solv::Pool->new();
27 pool = Solv::Pool.new()
29 Create a new pool instance. In most cases you just need
34 void *appdata; /* read/write */
39 Application specific data that may be used in any way by the
42 Solvable solvables[]; /* read only */
43 my $solvable = $pool->{'solvables'}->[$solvid];
44 solvable = pool.solvables[solvid]
45 solvable = pool.solvables[solvid]
47 Look up a Solvable by its id.
49 Repo repos[]; /* read only */
50 my $repo = $pool->{'repos'}->[$repoid];
51 repo = pool.repos[repoid]
52 repo = pool.repos[repoid]
54 Look up a Repository by its id.
56 Repo *installed; /* read/write */
57 $pool->{'installed'} = $repo;
61 Define which repository contains all the installed
71 Free a pool. This is currently done with a method
72 instead of relying on reference counting or garbage
73 collection because it's hard to track every reference
76 void setdebuglevel(int level)
77 $pool->setdebuglevel($level);
78 pool.setdebuglevel(level)
79 pool.setdebuglevel(level)
81 Set the debug level. A value of zero means no debug output,
82 the higher the value, the more output is generated.
84 int set_flag(int flag, int value)
85 my $oldvalue = $pool->set_flag($flag, $value);
86 oldvalue = pool.set_flag(flag, value)
87 oldvalue = pool.set_flag(flag, value)
89 int get_flag(int flag)
90 my $value = $pool->get_flag($flag);
91 value = pool.get_flag(flag)
92 value = pool.get_flag(flag)
94 Set/get a pool specific flag. The flags define how the
95 system works, e.g. how the package manager treats
96 obsoletes. The default flags should be sane for most
97 applications, but in some cases you may want to tweak
98 a flag, for example if you want to solv package
99 dependencies for some other system than yours.
101 void set_rootdir(const char *rootdir)
102 $pool->set_rootdir(rootdir);
103 pool.set_rootdir(rootdir)
104 pool.set_rootdir(rootdir)
106 const char *get_rootdir()
107 my $rootdir = $pool->get_rootdir();
108 rootdir = pool.get_rootdir()
109 rootdir = pool.get_rootdir()
111 Set/get the rootdir to use. This is useful if you want
112 package management to work only in some directory, for
113 example if you want to setup a chroot jail. Note that
114 the rootdir will only be prepended to file paths if
115 the *REPO_USE_ROOTDIR* flag is used.
117 void setarch(const char *arch = 0)
122 Set the architecture for your system. The architecture
123 is used to determine which packages are installable. It
124 defaults to the result of ``uname -m''.
126 Repo *add_repo(const char *name)
127 $repo = $pool->add_repo($name);
128 repo = pool.add_repo(name)
129 repo = pool.add_repo(name)
131 Add a Repository with the specified name to the pool.
132 The reposiory is empty on creation, use the repository
133 methods to populate it with packages.
135 Repoiterator *repos_iter()
136 for my $repo (@{$pool->repos_iter()})
137 for repo in pool.repos_iter():
138 for repo in pool.repos_iter()
140 Iterate over the existing repositories.
142 Solvableiterator *solvables_iter()
143 for my $solvable (@{$pool->solvables_iter()})
144 for solvable in pool.solvables_iter():
145 for solvable in pool.solvables_iter()
147 Iterate over the existing solvables.
149 Dep *Dep(const char *str, bool create=1)
150 my $dep = $pool->Dep($string);
151 dep = pool.Dep(string)
152 dep = pool.Dep(string)
154 Create an object describing a string or dependency.
155 If the string is currently not in the pool and
156 _create_ is false, *undef*/*None*/*nil* is returned.
158 void addfileprovides()
159 $pool->addfileprovides();
160 pool.addfileprovides()
161 pool.addfileprovides()
163 Queue addfileprovides_queue()
164 my @ids = $pool->addfileprovides_queue();
165 ids = pool.addfileprovides_queue()
166 ids = pool.addfileprovides_queue()
168 Some package managers like rpm allow dependencies on
169 files contained in other packages. To allow libsolv
170 to deal with those dependencies in an efficient way,
171 you need to call the addfileprovides method after
172 creating and reading all repositories. This method
173 will scan all dependency for file names and than
174 scan all packages for matching files. If a filename
175 has been matched, it will be added to the provides
176 list of the corresponding package.
177 The addfileprovides_queue variant works the same
178 way but returns an array containing all file
179 dependencies. This information can be stored
180 with the repository to speed up the next usage of
183 void createwhatprovides()
184 $pool->createwhatprovides();
185 pool.createwhatprovides()
186 pool.createwhatprovides()
188 Create the internal ``whatprovides'' hash over all
189 of the provides of all packages. This method must
190 be called before doing any lookups on provides.
191 It's encuraged to do it right after all repos
192 are set up, usually right after the call to
195 Queue whatprovides(DepId dep)
196 my @solvables = $pool->whatprovides($dep);
197 solvables = pool.whatprovides(dep)
198 solvables = pool.whatprovides(dep)
200 Return all solvables that provide the specified
201 dependency. You can use either a Dep object or
202 an simple Id as argument.
204 Queue matchprovidingids(const char *match, int flags)
205 my @ids = $pool->matchprovidingids($match, $flags);
206 ids = pool.matchprovidingids(match, flags)
207 ids = pool.matchprovidingids(match, flags)
209 Search the names of all provides and return the ones
210 matching the specified string. See the Dataiterator class
211 for the allowed flags.
213 Id towhatprovides(Queue ids)
214 my $offset = $pool->towhatprovides(\@ids);
215 offset = pool.towhatprovides(ids)
216 offset = pool.towhatprovides(ids)
218 ``Internalize'' an array containing Ids. The returned
219 value can be used to create solver jobs working on
220 a specific set of packages. See the Solver class for
223 bool isknownarch(DepId id)
224 my $bool = $pool->isknownarch($id);
225 bool = pool.isknownarch(id)
226 bool = pool.isknownarch?(id)
228 Return true if the specified Id describs a known
232 my $solver = $pool->Solver();
233 solver = pool.Solver()
234 solver = pool.Solver()
236 Create a new solver object.
238 Solver *Job(int how, Id what)
239 my $job = $pool->Job($how, $what);
240 job = pool.Job(how, what)
241 job = pool.Job(how, what)
243 Create a new Job object. Kind of low level, in most cases
244 you would use a Selection or Dep job constructor instead.
246 Selection *Selection()
247 my $sel = $pool->Selection();
248 sel = pool.Selection()
249 sel = pool.Selection()
251 Create an empty selection. Useful as a starting point for
252 merging other selections.
254 Selection *Selection_all()
255 my $sel = $pool->Selection_all();
256 sel = pool.Selection_all()
257 sel = pool.Selection_all()
259 Create a selection containing all packages. Useful as
260 starting point for intersecting other selections or
261 for update/distupgrade jobs.
263 Selection *select(const char *name, int flags)
264 my $sel = $pool->select($name, $flags);
265 sel = pool.select(name, flags)
266 sel = pool.select(name, flags)
268 Create a selection by matching packages against the
269 specified string. See the Selection class for a
270 list of flags and how to create solver jobs from
273 void setpooljobs(Jobs *jobs)
274 $pool->setpooljobs(\@jobs);
275 pool.setpooljobs(jobs)
276 pool.setpooljobs(jobs)
279 @jobs = $pool->getpooljobs();
280 jobs = pool.getpooljobs()
281 jobs = pool.getpooljobs()
283 Get/Set fixed jobs stored in the pool. Those jobs
284 are automatically appended to all solver jobs, they
285 are meant for fixed configurations like which
286 packages can be multiversion installed, which packages
287 were userinstalled or must not be erased.
289 void set_loadcallback(Callable *callback)
290 $pool->setloadcallback(\&callbackfunction);
291 pool.setloadcallback(callbackfunction)
292 pool.setloadcallback { |repodata| ... }
294 Set the callback function called when repository
295 metadata needs to be loaded on demand. To make use
296 of this feature, you need to create repodata stubs
297 that tell the library which data is available but
298 not loaded. If later on the data needs to be
299 accessed, the callback function is called with a
300 repodata argument. You can then load the data
301 (maybe fetching it first from an remote server).
302 The callback should return true if the data has
305 === DATA RETRIEVAL METHODS ===
307 In the following functions, the _keyname_ argument
308 describes what to retrive. For the standard cases you
309 can use the available Id constants. For example,
311 $solv::SOLVABLE_SUMMARY
312 solv.SOLVABLE_SUMMARY
313 Solv::SOLVABLE_SUMMARY
315 selects the ``Summary'' entry of a solvable. The
316 _solvid_ argument selects the desired solvable by
319 const char *lookup_str(Id solvid, Id keyname)
320 my $string = $pool->lookup_str($solvid, $keyname);
321 string = pool.lookup_str(solvid, keyname)
322 string = pool.lookup_str(solvid, keyname)
324 Id lookup_id(Id solvid, Id keyname)
325 my $id = $pool->lookup_id($solvid, $keyname);
326 id = pool.lookup_id(solvid, keyname)
327 id = pool.lookup_id(solvid, keyname)
329 unsigned int lookup_num(Id solvid, Id keyname, unsigned int notfound = 0)
330 my $num = $pool->lookup_num($solvid, $keyname);
331 num = pool.lookup_num(solvid, keyname)
332 num = pool.lookup_num(solvid, keyname)
334 bool lookup_void(Id solvid, Id keyname)
335 my $bool = $pool->lookup_void($solvid, $keyname);
336 bool = pool.lookup_void(solvid, keyname)
337 bool = pool.lookup_void(solvid, keyname)
339 Chksum *lookup_checksum(Id solvid, Id keyname)
340 my $chksum = $pool->lookup_checksum($solvid, $keyname);
341 chksum = pool.lookup_checksum(solvid, keyname)
342 chksum = pool.lookup_checksum(solvid, keyname)
344 Lookup functions. Return the data element stored in the
347 Dataiterator *Dataiterator(Id solvid, Id keyname, const char *match, int flags)
348 my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
349 di = pool.Dataiterator(solvid, keyname, match, flags)
350 di = pool.Dataiterator(solvid, keyname, match, flags)
356 Iterate over the matching data elements. See the Dataiterator class for
361 The following methods deal with Ids, i.e. integers
362 representing objects in the pool. They are considered
363 ``low level'', in most cases you would not use them
364 but instead the object orientated methods.
367 $repo = $pool->id2repo($id);
368 repo = pool.id2repo(id)
369 repo = pool.id2repo(id)
371 Lookup an existing Repository by id. You can also do
372 this by using the *repos* attribute.
374 Solvable *id2solvable(Id id)
375 $solvable = $pool->id2solvable($id);
376 solvable = pool.id2solvable(id)
377 solvable = pool.id2solvable(id)
379 Lookup an existing Repository by id. You can also do
380 this by using the *solvables* attribute.
382 const char *solvid2str(Id id)
383 my $str = $pool->solvid2str($id);
384 str = pool.solvid2str(id)
385 str = pool.solvid2str(id)
387 Return a string describing the Solvable with the specified
388 id. The string consists of the name, version, and architecture
391 Id str2id(const char *str, bool create=1)
392 my $id = pool->str2id($string);
393 id = pool.str2id(string)
394 id = pool.str2id(string)
396 const char *id2str(Id id)
397 $string = pool->id2str($id);
398 string = pool.id2str(id)
399 string = pool.id2str(id)
401 Convert a string into an Id and back. If the string is
402 currently not in the pool and _create_ is false,
405 Id rel2id(Id name, Id evr, int flags, bool create=1)
406 my $id = pool->rel2id($nameid, $evrid, $flags);
407 id = pool.rel2id(nameid, evrid, flags)
408 id = pool.rel2id(nameid, evrid, flags)
410 Create a ``relational'' dependency. Such dependencies
411 consist of a name part, the _flags_ describing the
412 relation, and a version part. The flags are:
414 $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
415 solv.REL_EQ | solv.REL_GT | solv.REL_LT
416 Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
418 Thus, if you want a ``\<='' relation, you would use
421 Id id2langid(Id id, const char *lang, bool create=1)
422 my $id = $pool->id2langid($id, $language);
423 id = pool.id2langid(id, language)
424 id = pool.id2langid(id, language)
426 Create a language specific Id from some other id. This
427 function simply converts the id into a string, appends
428 a dot and the specified language to the string and
429 converts the result back into an Id.
431 const char *dep2str(Id id)
432 $string = pool->dep2str($id);
433 string = pool.dep2str(id)
434 string = pool.dep2str(id)
436 Convert a dependency id into a string. If the id
437 is just a string, this function has the same effect
438 as id2str(). For relational dependencies, the result
439 is the correct ``name relation evr'' string.
444 The dependency class is an object orientated way to work with
445 strings and dependencies. Internally, dependencies are
446 represented as Ids, i.e. simple numbers. Dependency
447 objects can be constructed by using the Pool's Dep()
452 Pool *pool; /* read only */
457 Back reference to the pool this dependency belongs to.
459 Id id; /* read only */
464 The id of this dependency.
468 Dep *Rel(int flags, DepId evrid, bool create=1)
469 my $reldep = $dep->Rel($flags, $evrdep);
470 reldep = dep.Rel(flags, evrdep)
471 reldep = dep.Rel(flags, evrdep)
473 Create a relational dependency from to string dependencies
474 and a flags argument. See the pool's rel2id method for a
475 description of the flags.
477 Selection *Selection_name(int setflags = 0)
478 my $sel = $dep->Selection_name();
479 sel = dep.Selection_name()
480 sel = dep.Selection_name()
482 Create a Selection from a dependency. The selection
483 consists of all packages that have a name equal to the
484 dependency. If the dependency is of a relational type,
485 the packages version must also fulfill the dependency.
487 Selection *Selection_provides(int setflags = 0)
488 my $sel = $dep->Selection_provides();
489 sel = dep.Selection_provides()
490 sel = dep.Selection_provides()
492 Create a Selection from a dependency. The selection
493 consists of all packages that have at least one provides
494 matching the dependency.
497 my $str = $dep->str();
501 Return a string describing the dependency.
508 Same as calling the str() method.
515 The dependencies are equal if they are part of the
516 same pool and have the same ids.
520 A Repository describes a group of packages, normally comming from
521 the same source. Repositories are created by the Pool's add_repo()
526 Pool *pool; /* read only */
531 Back reference to the pool this dependency belongs to.
533 Id id; /* read only */
538 Return the id of the repository.
540 const char *name; /* read/write */
545 The repositories name. To libsolv, the name is just a string
546 with no specific meaning.
548 int prioprity; /* read/write */
553 The priority of the repository. A higher number means that
554 packages of this repository will be chosen over other
555 repositories, even if they have a greater package version.
557 int subprioprity; /* read/write */
558 $repo->{'subpriority'}
562 The sub-priority of the repository. This value is compared when
563 the priorities of two repositories are the same. It is useful
564 to make the library prefer on-disk repositories to remote ones.
566 int nsolvables; /* read only */
567 $repo->{'nsolvables'}
571 The number of solvables in this repository.
573 void *appdata; /* read/write */
578 Application specific data that may be used in any way by the
579 code using the repository.
583 *REPO_REUSE_REPODATA*::
584 Reuse the last repository data aera (``repodata'') instead of creating a new
587 *REPO_NO_INTERNALIZE*::
588 Do not internalize the added repository data. This is useful if
589 you plan to add more data because internalization is a costly
593 Use the repodata's pool for Id storage instead of the global pool. Useful
594 if you don't want to pollute the global pool with many unneeded ids, like
595 when storing the filelist.
598 Use the repodata that is currently being loaded instead of creating a new one.
599 This only makes sense if used in a load callback.
601 *REPO_EXTEND_SOLVABLES*::
602 Do not create new solvables for the new data, but match existing solvables and
603 add the data to them. Repository metadata is often split into multiple parts,
604 with one primary file describing all packages and other parts holding
605 information that is normally not needed, like the changelog.
608 Prepend the pool's rootdir to the path when doing file operations.
611 Do not add a location element to the solvables. Useful if the solvables are
612 not in the final position, so you can add the correct location later in your code.
614 *SOLV_ADD_NO_STUBS*::
615 Do not create stubs for repository parts that can be downloaded on demand.
617 *SUSETAGS_RECORD_SHARES*::
618 This is specific to the add_susetags() method. Susetags allows to refer to already
619 read packages to save disk space. If this data sharing needs to work over multiple
620 calls to add_susetags, you need to specify this flag so that the share information
621 is made available to subsequent calls.
625 void free(bool reuseids = 0)
630 Free the repository and all solvables it contains. If _reuseids_ is set to true, the
631 solvable ids and the repository id may be reused by the library when added new solvables.
632 Thus you should leave it false if you are not sure that somebody holds a reference.
634 void empty(bool reuseids = 0)
639 Free all the solvables in a repository. The repository will be empty after this call.
640 See the free() method for the meaning of _reuseids_.
647 Return true if there are no solvables in this repository.
650 $repo->internalize();
654 Internalize added data. Data must be internalized before it is available to the
655 lookup and data iterator functions.
662 Write a repo as a ``solv'' file. These files can be read very fast and thus are
663 a good way to cache repository data. Returns false if there was some error
666 Solvableiterator *solvables_iter()
667 for my $solvable (@{$repo->solvables_iter()})
668 for solvable in repo.solvables_iter():
669 for solvable in repo.solvables_iter()
671 Iterate over all solvables in a repository.
673 Repodata *add_repodata(int flags = 0)
674 my $repodata = $repo->add_repodata();
675 repodata = repo.add_repodata()
676 repodata = repo.add_repodata()
678 Add a new repodata area to the repository. This is normally automatically
679 done by the repo_add methods, so you need this method only in very
683 $repo->create_stubs();
687 Calls the create_stubs() repodata method for the last repodata of the
691 $repo->iscontiguous()
695 Return true if the solvables of this repository are all in a single
696 block with no holes, i.e. they have consecutive ids.
698 Repodata *first_repodata()
699 my $repodata = $repo->first_repodata();
700 repodata = repo.first_repodata()
701 repodata = repo.first_repodata()
703 Checks if all repodatas but the first repodata are extensions, and return
704 the first repodata if this is the case. Useful if you want to do a
705 store/retrive sequence on the repository to reduce the memory using and
706 enable paging, as this does not work if the rpository contains multiple
707 non-extension repodata areas.
709 Selection *Selection(int setflags = 0)
710 my $sel = $repo->Selection();
711 sel = repo.Selection()
712 sel = repo.Selection()
714 Create a Selection consisting of all packages in the repository.
716 Dataiterator *Dataiterator(Id p, Id key, const char *match, int flags)
717 my $di = $repo->Dataiterator($solvid, $keyname, $match, $flags);
718 di = repo.Dataiterator(solvid, keyname, match, flags)
719 di = repo.Dataiterator(solvid, keyname, match, flags)
725 Iterate over the matching data elements in this repository. See the
726 Dataiterator class for more information.
733 Return the name of the repository, or "Repo#<id>" if no name is set.
736 if ($repo1 == $repo2)
740 Two repositories are equal if they belong to the same pool and have the same id.
742 === LOOKUP FUNCTIONS ===
743 Those functions can be used to retrieve information from a repository. For
744 Package data lookups the methods in the Solvable class are prefered, so
745 you probably only need this funcions to lookup repository meta information
748 const char *lookup_str(Id solvid, Id keyname)
749 my $str = $repo->lookup_str($solvid, $keyname);
750 str = repo.lookup_str(solvid, keyname)
751 str = repo.lookup_str(solvid, keyname)
753 Lookup a string from the _keyname_ entry specified with _solvid_.
755 Id lookup_id(Id solvid, Id keyname)
756 my $id = $repo->lookup_id($solvid, $keyname);
757 id = repo.lookup_id(solvid, keyname)
758 id = repo.lookup_id(solvid, keyname)
760 Lookup an Id from the _keyname_ entry specified with _solvid_.
762 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
763 my $num = $repo->lookup_num($solvid, $keyname);
764 num = repo.lookup_num(solvid, keyname)
765 num = repo.lookup_num(solvid, keyname)
767 Lookup a number from the _keyname_ entry specified with _solvid_.
769 === DATA ADD METHODS ===
771 Solvable *add_solvable()
772 $repo->add_solvable();
776 Add a single empty solvable to the repository. Returns a Solvable object, see the
777 Solvable class for more information.
779 bool add_solv(const char *name, int flags = 0)
780 $repo->add_solv($name, $flags);
781 repo.add_solv(name, flags)
782 repo.add_solv(name, flags)
784 bool add_solv(FILE *fp, int flags = 0)
785 $repo->add_solv($fp, $flags);
786 repo.add_solv(fp, flags)
787 repo.add_solv(fp, flags)
789 Read a ``solv'' file and add its contents to the repository. These
790 files can be written with the write() method and are normally
791 used as fast cache for repository metadata.
793 bool add_rpmdb(int flags = 0)
794 $repo->add_rpmdb($flags);
795 repo.add_rpmdb(flags)
796 repo.add_rpmdb(flags)
798 bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
799 $repo->add_rpmdb_reffp($reffp, $flags);
800 repo.add_rpmdb_reffp($reffp, flags)
801 repo.add_rpmdb_reffp($reffp, flags)
803 Add the contents of the rpm database to the repository. If a solv file
804 containing an old version of the database is available, it can be
805 passed as reffp to speed up reading.
807 bool add_rpm(const char *name, int flags = 0)
808 $repo->add_rpm($name, $flags);
809 repo.add_rpm(name, flags)
810 repo.add_rpm(name, flags)
812 Add the metadata of a single rpm package to the repository.
814 bool add_rpmdb_pubkeys(int flags = 0)
815 $repo->add_rpmdb_pubkeys();
816 repo.add_rpmdb_pubkeys()
817 repo.add_rpmdb_pubkeys()
819 Add all pubkeys contained in the rpm database to the repository. Note that
820 newer rpm versions also allow to store the pubkeys in some directory instead
823 bool add_pubkey(const char *keyfile, int flags = 0)
824 $repo->add_pubkey($keyfile);
825 repo.add_pubkey($keyfile)
826 repo.add_pubkey($keyfile)
828 Add a pubkey from a file to the repository.
830 bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
831 $repo->add_rpmmd($fp, $language);
832 repo.add_rpmmd(fp, language)
833 repo.add_rpmmd(fp, language)
835 Add metadata stored in the "rpm-md" format (i.e. from files in the ``repodata''
836 directory) to a repository. Supported files are "primary", "filelists", "other",
837 "suseinfo". Do not forget to specify the *REPO_EXTEND_SOLVABLES* for extension
838 files like "filelists" and "other". Use the _language_ parameter if you have
839 language extension files, otherwise simply use a *undef*/*None*/*nil* parameter.
841 bool add_repomdxml(FILE *fp, int flags = 0)
842 $repo->add_repomdxml($fp);
843 repo.add_repomdxml(fp)
844 repo.add_repomdxml(fp)
846 Add the repomd.xml meta description from the "rpm-md" format to the repository.
847 This file contains information about the repository like keywords, and also
848 a list of all database files with checksums. The data is added the the "meta"
849 section of the repository, i.e. no package gets created.
851 bool add_updateinfoxml(FILE *fp, int flags = 0)
852 $repo->add_updateinfoxml($fp);
853 repo.add_updateinfoxml(fp)
854 repo.add_updateinfoxml(fp)
856 Add the updateinfo.xml file containing available maintenance updates to the
857 repository. All updates are created as special packages that have a "patch:"
858 prefix in their name.
860 bool add_deltainfoxml(FILE *fp, int flags = 0)
861 $repo->add_deltainfoxml($fp);
862 repo.add_deltainfoxml(fp)
863 repo.add_deltainfoxml(fp)
865 Add the deltainfo.xml file (also called prestodelta.xml) containing available
866 delta-rpms to the repository. The data is added to the "meta" section, i.e. no
867 package gets created.
869 bool add_debdb(int flags = 0)
874 Add the contents of the debian installed package database to the repository.
876 bool add_debpackages(FILE *fp, int flags = 0)
877 $repo->add_debpackages($fp);
878 repo.add_debpackages($fp)
879 repo.add_debpackages($fp)
881 Add the contents of the debian repository metadata (the "packages" file)
884 bool add_deb(const char *filename, int flags = 0)
885 $repo->add_deb($filename);
886 repo.add_deb(filename)
887 repo.add_deb(filename)
889 Add the metadata of a single deb package to the repository.
891 bool add_mdk(FILE *fp, int flags = 0)
896 Add the contents of the mageia/mandriva repository metadata (the "synthesis.hdlist" file)
899 bool add_mdk_info(FILE *fp, int flags = 0)
904 Extend the packages from the synthesis file with the info.xml and files.xml data. Do
905 not forget to specify *REPO_EXTEND_SOLVABLES*.
907 bool add_arch_repo(FILE *fp, int flags = 0)
908 $repo->add_arch_repo($fp);
909 repo.add_arch_repo($fp)
910 repo.add_arch_repo($fp)
912 Add the contents of the archlinux repository metadata (the ".db.tar" file) to the
915 bool add_arch_local(const char *dir, int flags = 0)
916 $repo->add_arch_local($dir);
917 repo.add_arch_local($dir)
918 repo.add_arch_local($dir)
920 Add the contents of the archlinux installed package database to the repository.
921 The _dir_ parameter is usually set to "/var/lib/pacman/local".
923 bool add_content(FILE *fp, int flags = 0)
924 $repo->add_content($fp);
928 Add the ``content'' meta description from the susetags format to the repository.
929 This file contains information about the repository like keywords, and also
930 a list of all database files with checksums. The data is added the the "meta"
931 section of the repository, i.e. no package gets created.
933 bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
934 $repo->add_susetags($fp, $defvendor, $language);
935 repo.add_susetags(fp, defvendor, language)
936 repo.add_susetags(fp, defvendor, language)
938 Add repository metadata in the susetags format to the repository. Like with
939 add_rpmmd, you can specify a language if you have language extension files. The
940 _defvendor_ parameter provides a default vendor for packages with missing
941 vendors, it is usually provided in the content file.
943 bool add_products(const char *dir, int flags = 0)
944 $repo->add_products($dir);
945 repo.add_products(dir)
946 repo.add_products(dir)
948 Add the installed SUSE products database to the repository. The _dir_ parameter is
949 usually "/etc/products.d".
955 THE DATAITERATOR CLASS
956 ----------------------
971 THE TRANSACTION CLASS
972 ---------------------
977 Checksums (also called hashes) are used to make sure that
978 downloaded data is not corrupt and also as a fingerprint
979 mechanism to check if data has changed.
981 === CLASS METHODS ===
983 Chksum *Chksum(Id type)
984 my $chksum = solv::Chksum->new($type);
985 chksum = solv.Chksum(type)
986 chksum = Solv::Chksum.new(type)
988 Create a checksum object. Currently the following types
995 These keys are constants in the *solv* class.
997 Chksum *Chksum(Id type, const char *hex)
998 my $chksum = solv::Chksum->new($type, $hex);
999 chksum = solv.Chksum(type, hex)
1000 chksum = Solv::Chksum.new(type, hex)
1002 Create an already finalized checksum object.
1006 Id type; /* read only */
1011 Return the type of the checksum object.
1015 void add(const char *str)
1020 Add a string to the checksum.
1022 void add_fp(FILE *fp)
1023 $chksum->add_fp($file);
1027 Add the contents of a file to the checksum.
1029 void add_stat(const char *filename)
1030 $chksum->add_stat($filename);
1031 chksum.add_stat(filename)
1032 chksum.add_stat(filename)
1034 Stat the file and add the dev/ino/size/mtime member to the
1035 checksum. If the stat fails, the members are zeroed.
1037 void add_fstat(int fd)
1038 $chksum->add_fstat($fd);
1039 chksum.add_fstat(fd)
1040 chksum.add_fstat(fd)
1042 Same as add_stat, but instead of the filename a file
1045 unsigned char *raw()
1046 my $raw = $chksum->raw();
1050 Finalize the checksum and return the result as raw bytes. This
1051 means that the result can contain zero bytes or
1052 unprintable characters.
1054 unsigned char *hex()
1055 my $raw = $chksum->hex();
1059 Finalize the checksum and return the result as hex string.
1061 <comparisons ==, !=>
1062 if ($chksum1 == $chksum2)
1063 if chksum1 == chksum2:
1064 if chksum1 == chksum2
1066 Checksums are equal if they are of the same type and the
1067 finalized results are the same.
1070 my $str = "$chksum";
1074 If the checksum is finished, the checksum is returned
1075 as "<type>:<hex>" string. Otherwise "<type>:unfinished"
1081 This functions were added because libsolv uses standard
1082 *FILE* pointers to read/write files, but languages like
1083 perl have their own implementation of files. The
1084 libsolv functions also support decompression and
1085 compression, the algorithm is selected by looking at
1086 the file name extension.
1088 FILE *xfopen(char *fn, char *mode = "r")
1089 my $file = solv::xfopen($path);
1090 file = solv.xfopen(path)
1091 file = Solv::xfopen(path)
1093 Open a file at the specified path. The `mode` argument is
1094 passed on to the stdio library.
1096 FILE *xfopen_fd(char *fn, int fileno)
1097 my $file = solv::xfopen_fd($path, $fileno);
1098 file = solv.xfopen_fd(path, fileno)
1099 file = Solv::xfopen_fd(path, fileno)
1101 Create a file handle from the specified file descriptor.
1102 The path argument is only used to select the correct
1103 (de-)compression algorithm, use an empty path if you want
1104 to make sure to read/write raw data.
1109 my $fileno = $file->fileno();
1110 fileno = file.fileno()
1111 fileno = file.fileno()
1113 Return file file descriptor of the file. If the file is not
1114 open, `-1` is returned.
1117 my $fileno = $file->dup();
1121 Return a copy of the descriptor of the file. If the file is not
1122 open, `-1` is returned.
1129 Flush the file. Returns false if there was an error. Flushing a
1130 closed file always returns true.
1137 Close the file. This is needed for languages like Ruby, that do
1138 not destruct objects right after they are no longer referenced.
1139 In that case, it is good style to close open files so that
1140 the file descriptors are freed right away. Returns false if
1149 Michael Schroeder <mls@suse.de>