dddccbdc7e6e8140247ea44b90a3c09588dd6abb
[platform/upstream/libsolv.git] / doc / libsolv-bindings.txt
1 LIBSOLV-BINDINGS(3)
2 ===================
3 :man manual: LIBSOLV
4 :man source: libsolv
5
6
7 NAME
8 ----
9 libsolv-bindings - access libsolv from perl/python/ruby
10
11 DESCRIPTION
12 -----------
13 bla bla bla
14
15 THE POOL
16 --------
17
18 The pool is libsolv's central resource manager. A pool consists of Solvables,
19 Repositories, Dependencies, each indexed by Ids.
20
21 === CLASS METHODS ===
22
23         Pool *Pool()
24         my $pool = solv::Pool->new();
25         pool = solv.Pool()
26         pool = Solv::Pool.new()
27
28 Create a new pool instance. In most cases you just need
29 one pool.
30
31 === ATTRIBUTES ===
32
33         void *appdata;                  /* read/write */
34         $pool->{'appdata'}
35         pool.appdata
36         pool.appdata
37
38 Application specific data that may be used in any way by the code using the
39 pool.
40
41         Solvable solvables[];           /* read only */
42         my $solvable = $pool->{'solvables'}->[$solvid];
43         solvable = pool.solvables[solvid]
44         solvable = pool.solvables[solvid]
45
46 Look up a Solvable by its id.
47
48         Repo repos[];                   /* read only */
49         my $repo = $pool->{'repos'}->[$repoid];
50         repo = pool.repos[repoid]
51         repo = pool.repos[repoid]
52
53 Look up a Repository by its id.
54
55         Repo *installed;                /* read/write */
56         $pool->{'installed'} = $repo;
57         pool.installed = repo
58         pool.installed = repo
59
60 Define which repository contains all the installed packages.
61
62 === CONSTANTS ===
63
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.
68
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.
73
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.
79
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.
85
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
93   same name.
94
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.
100
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
104   are the same.
105
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.
112
113 === METHODS ===
114
115         void free()
116         $pool->free();
117         pool.free()
118         pool.free()
119
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
122 reference to a pool.
123
124         void setdebuglevel(int level)
125         $pool->setdebuglevel($level);
126         pool.setdebuglevel(level)
127         pool.setdebuglevel(level)
128
129 Set the debug level. A value of zero means no debug output, the higher the
130 value, the more output is generated.
131
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)
136
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)
141
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.
146
147         void set_rootdir(const char *rootdir)
148         $pool->set_rootdir(rootdir);
149         pool.set_rootdir(rootdir)
150         pool.set_rootdir(rootdir)
151
152         const char *get_rootdir()
153         my $rootdir = $pool->get_rootdir();
154         rootdir = pool.get_rootdir()
155         rootdir = pool.get_rootdir()
156
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.
161
162         void setarch(const char *arch = 0)
163         $pool->setarch();
164         pool.setarch()
165         pool.setarch()
166
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''.
169
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)
174
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.
177
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()
182
183 Iterate over the existing repositories.
184
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()
189
190 Iterate over the existing solvables.
191
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)
196
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.
199
200         void addfileprovides()
201         $pool->addfileprovides();
202         pool.addfileprovides()
203         pool.addfileprovides()
204
205         Queue addfileprovides_queue()
206         my @ids = $pool->addfileprovides_queue();
207         ids = pool.addfileprovides_queue()
208         ids = pool.addfileprovides_queue()
209
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.
219
220         void createwhatprovides()
221         $pool->createwhatprovides();
222         pool.createwhatprovides()
223         pool.createwhatprovides()
224
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().
229
230         Queue whatprovides(DepId dep)
231         my @solvables = $pool->whatprovides($dep);
232         solvables = pool.whatprovides(dep)
233         solvables = pool.whatprovides(dep)
234
235 Return all solvables that provide the specified dependency. You can use either
236 a Dep object or an simple Id as argument.
237
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)
242
243 Search the names of all provides and return the ones matching the specified
244 string. See the Dataiterator class for the allowed flags.
245
246         Id towhatprovides(Queue ids)
247         my $offset = $pool->towhatprovides(\@ids);
248         offset = pool.towhatprovides(ids)
249         offset = pool.towhatprovides(ids)
250
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.
254
255         bool isknownarch(DepId id)
256         my $bool = $pool->isknownarch($id);
257         bool = pool.isknownarch(id)
258         bool = pool.isknownarch?(id)
259
260 Return true if the specified Id describs a known architecture.
261
262         Solver *Solver()
263         my $solver = $pool->Solver();
264         solver = pool.Solver()
265         solver = pool.Solver()
266
267 Create a new solver object.
268
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)
273
274 Create a new Job object. Kind of low level, in most cases you would use a
275 Selection or Dep job constructor instead.
276
277         Selection *Selection()
278         my $sel = $pool->Selection();
279         sel = pool.Selection()
280         sel = pool.Selection()
281
282 Create an empty selection. Useful as a starting point for merging other
283 selections.
284
285         Selection *Selection_all()
286         my $sel = $pool->Selection_all();
287         sel = pool.Selection_all()
288         sel = pool.Selection_all()
289         
290 Create a selection containing all packages. Useful as starting point for
291 intersecting other selections or for update/distupgrade jobs.
292
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)
297
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
300 selection.
301
302         void setpooljobs(Jobs *jobs)
303         $pool->setpooljobs(\@jobs);
304         pool.setpooljobs(jobs)
305         pool.setpooljobs(jobs)
306
307         Jobs *getpooljobs()
308         @jobs = $pool->getpooljobs();
309         jobs = pool.getpooljobs()
310         jobs = pool.getpooljobs()
311
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
315 erased.
316
317         void set_loadcallback(Callable *callback)
318         $pool->setloadcallback(\&callbackfunction);
319         pool.setloadcallback(callbackfunction)
320         pool.setloadcallback { |repodata| ... }
321
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.
328
329 === DATA RETRIEVAL METHODS ===
330
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,
333
334         $solv::SOLVABLE_SUMMARY
335         solv.SOLVABLE_SUMMARY
336         Solv::SOLVABLE_SUMMARY
337
338 selects the ``Summary'' entry of a solvable. The _solvid_ argument selects the
339 desired solvable by Id.
340
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)
345
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)
350
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)
355
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)
360
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)
365
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)
370
371 Lookup functions. Return the data element stored in the specified solvable.
372 You should probably use the methods of the Solvable class instead.
373
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)
378
379         for my $d (@$di)
380         for d in di:
381         for d in di
382
383 Iterate over the matching data elements. See the Dataiterator class for more
384 information.
385
386 === ID METHODS ===
387
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.
391
392         Repo *id2repo(Id id)
393         $repo = $pool->id2repo($id);
394         repo = pool.id2repo(id)
395         repo = pool.id2repo(id)
396
397 Lookup an existing Repository by id. You can also do this by using the *repos*
398 attribute.
399
400         Solvable *id2solvable(Id id)
401         $solvable = $pool->id2solvable($id);
402         solvable = pool.id2solvable(id)
403         solvable = pool.id2solvable(id)
404
405 Lookup an existing Repository by id. You can also do this by using the
406 *solvables* attribute.
407
408         const char *solvid2str(Id id)
409         my $str = $pool->solvid2str($id);
410         str = pool.solvid2str(id)
411         str = pool.solvid2str(id)
412
413 Return a string describing the Solvable with the specified id. The string
414 consists of the name, version, and architecture of the Solvable.
415
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)
420
421         const char *id2str(Id id)
422         $string = pool->id2str($id);
423         string = pool.id2str(id)
424         string = pool.id2str(id)
425
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.
428
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)
433
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:
436
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
440
441 Thus, if you want a ``\<='' relation, you would use *REL_LT | REL_EQ*.
442
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)
447
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.
451
452         const char *dep2str(Id id)
453         $string = pool->dep2str($id);
454         string = pool.dep2str(id)
455         string = pool.dep2str(id)
456
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.
460
461
462 THE DEPENDENCY CLASS
463 --------------------
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()
467 method.
468
469 === ATTRIBUTES ===
470
471         Pool *pool;             /* read only */
472         $dep->{'pool'}
473         dep.pool
474         dep.pool
475
476 Back reference to the pool this dependency belongs to.
477
478         Id id;          /* read only */
479         $dep->{'id'}
480         dep.id
481         dep.id
482
483 The id of this dependency.
484
485 == Methods ==
486
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)
491
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.
494
495         Selection *Selection_name(int setflags = 0)
496         my $sel = $dep->Selection_name();
497         sel = dep.Selection_name()
498         sel = dep.Selection_name()
499
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.
503
504         Selection *Selection_provides(int setflags = 0)
505         my $sel = $dep->Selection_provides();
506         sel = dep.Selection_provides()
507         sel = dep.Selection_provides()
508
509 Create a Selection from a dependency. The selection consists of all packages
510 that have at least one provides matching the dependency.
511
512         const char *str()
513         my $str = $dep->str();
514         str = $dep.str()
515         str = $dep.str()
516
517 Return a string describing the dependency.
518
519         <stringification>
520         my $str = "$dep";
521         str = str(dep)
522         str = dep.to_s
523
524 Same as calling the str() method.
525
526         <equality>
527         if ($dep1 == $dep2)
528         if dep1 == dep2:
529         if dep1 == dep2
530
531 The dependencies are equal if they are part of the same pool and have the same
532 ids.
533
534 THE REPOSITORY CLASS
535 --------------------
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.
538
539 === ATTRIBUTES ===
540
541         Pool *pool;                     /* read only */
542         $repo->{'pool'}
543         repo.pool
544         repo.pool
545
546 Back reference to the pool this dependency belongs to.
547
548         Id id;                          /* read only */
549         $repo->{'id'}
550         repo.id
551         repo.id
552
553 Return the id of the repository.
554
555         const char *name;               /* read/write */
556         $repo->{'name'}
557         repo.name
558         repo.name
559         
560 The repositories name. To libsolv, the name is just a string with no specific
561 meaning.
562
563         int prioprity;                  /* read/write */
564         $repo->{'priority'}
565         repo.priority
566         repo.priority
567
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
570 package version.
571
572         int subprioprity;               /* read/write */
573         $repo->{'subpriority'}
574         repo.subpriority
575         repo.subpriority
576
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.
580
581         int nsolvables;                 /* read only */
582         $repo->{'nsolvables'}
583         repo.nsolvables
584         repo.nsolvables
585
586 The number of solvables in this repository.
587
588         void *appdata;                  /* read/write */
589         $repo->{'appdata'}
590         repo.appdata
591         repo.appdata
592
593 Application specific data that may be used in any way by the code using the
594 repository.
595
596         Datapos *meta;                  /* read only */
597         $repo->{'meta'}
598         repo.meta
599         repo.meta
600
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
603 timestamp.
604
605 === CONSTANTS ===
606
607 *REPO_REUSE_REPODATA*::
608   Reuse the last repository data aera (``repodata'') instead of creating a new
609   one.
610
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
614   operation.
615
616 *REPO_LOCALPOOL*::
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.
620
621 *REPO_USE_LOADING*::
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.
624
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.
630
631 *REPO_USE_ROOTDIR*::
632   Prepend the pool's rootdir to the path when doing file operations.
633
634 *REPO_NO_LOCATION*::
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.
637
638 *SOLV_ADD_NO_STUBS*::
639   Do not create stubs for repository parts that can be downloaded on demand.
640
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.
646
647 === METHODS ===
648
649         void free(bool reuseids = 0)
650         $repo->free();
651         repo.free()
652         repo.free()
653
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.
658
659         void empty(bool reuseids = 0)
660         $repo->empty();
661         repo.empty()
662         repo.empty()
663
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_.
666
667         bool isempty()
668         $repo->isempty()
669         repo.empty()
670         repo.empty?
671
672 Return true if there are no solvables in this repository.
673
674         void internalize()
675         $repo->internalize();
676         repo.internalize()
677         repo.internalize()
678
679 Internalize added data. Data must be internalized before it is available to the
680 lookup and data iterator functions.
681
682         bool write(FILE *fp)
683         $repo->write($fp)
684         repo.write(fp)
685         repo.write(fp)
686
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
689 writing the file.
690
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()
695
696 Iterate over all solvables in a repository.
697
698         Repodata *add_repodata(int flags = 0)
699         my $repodata = $repo->add_repodata();
700         repodata = repo.add_repodata()
701         repodata = repo.add_repodata()
702
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
705 rare circumstances.
706
707         void create_stubs()
708         $repo->create_stubs();
709         repo.create_stubs()
710         repo.create_stubs()
711
712 Calls the create_stubs() repodata method for the last repodata of the
713 repository.
714
715         bool iscontiguous()
716         $repo->iscontiguous()
717         repo.iscontiguous()
718         repo.iscontiguous?
719
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.
722
723         Repodata *first_repodata()
724         my $repodata = $repo->first_repodata();
725         repodata = repo.first_repodata()
726         repodata = repo.first_repodata()
727
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
732 areas.
733
734         Selection *Selection(int setflags = 0)
735         my $sel = $repo->Selection();
736         sel = repo.Selection()
737         sel = repo.Selection()
738
739 Create a Selection consisting of all packages in the repository.
740
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)
745
746         for my $d (@$di)
747         for d in di:
748         for d in di
749
750 Iterate over the matching data elements in this repository. See the
751 Dataiterator class for more information.
752
753         <stringification>
754         my $str = "$repo";
755         str = str(repo)
756         str = repo.to_s
757
758 Return the name of the repository, or "Repo#<id>" if no name is set.
759
760         <equality>
761         if ($repo1 == $repo2)
762         if repo1 == repo2:
763         if repo1 == repo2
764
765 Two repositories are equal if they belong to the same pool and have the same id.
766
767 === DATA ADD METHODS ===
768
769         Solvable *add_solvable()
770         $repo->add_solvable();
771         repo.add_solvable()
772         repo.add_solvable()
773
774 Add a single empty solvable to the repository. Returns a Solvable object, see
775 the Solvable class for more information.
776
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)
781
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)
786
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
789 repository metadata.
790
791         bool add_rpmdb(int flags = 0)
792         $repo->add_rpmdb($flags);
793         repo.add_rpmdb(flags)
794         repo.add_rpmdb(flags)
795
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)
800
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.
804
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)
809
810 Add the metadata of a single rpm package to the repository.
811
812         bool add_rpmdb_pubkeys(int flags = 0)
813         $repo->add_rpmdb_pubkeys();
814         repo.add_rpmdb_pubkeys()
815         repo.add_rpmdb_pubkeys()
816
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
819 of the rpm database.
820
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)
825
826 Add a pubkey from a file to the repository.
827
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)
832
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*
838 parameter.
839
840         bool add_repomdxml(FILE *fp, int flags = 0)
841         $repo->add_repomdxml($fp);
842         repo.add_repomdxml(fp)
843         repo.add_repomdxml(fp)
844
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.
849
850         bool add_updateinfoxml(FILE *fp, int flags = 0)
851         $repo->add_updateinfoxml($fp);
852         repo.add_updateinfoxml(fp)
853         repo.add_updateinfoxml(fp)
854
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.
858
859         bool add_deltainfoxml(FILE *fp, int flags = 0)
860         $repo->add_deltainfoxml($fp);
861         repo.add_deltainfoxml(fp)
862         repo.add_deltainfoxml(fp)
863
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.
867
868         bool add_debdb(int flags = 0)
869         $repo->add_debdb();
870         repo.add_debdb()
871         repo.add_debdb()
872
873 Add the contents of the debian installed package database to the repository.
874
875         bool add_debpackages(FILE *fp, int flags = 0)
876         $repo->add_debpackages($fp);
877         repo.add_debpackages($fp)
878         repo.add_debpackages($fp)
879
880 Add the contents of the debian repository metadata (the "packages" file)
881 to the repository.
882
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)
887
888 Add the metadata of a single deb package to the repository.
889
890         bool add_mdk(FILE *fp, int flags = 0)
891         $repo->add_mdk($fp);
892         repo.add_mdk($fp)
893         repo.add_mdk($fp)
894
895 Add the contents of the mageia/mandriva repository metadata (the
896 "synthesis.hdlist" file) to the repository.
897
898         bool add_mdk_info(FILE *fp, int flags = 0)
899         $repo->add_mdk($fp);
900         repo.add_mdk($fp)
901         repo.add_mdk($fp)
902
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*.
905
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)
910
911 Add the contents of the archlinux repository metadata (the ".db.tar" file) to
912 the repository.
913
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)
918
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".
921
922         bool add_content(FILE *fp, int flags = 0)
923         $repo->add_content($fp);
924         repo.add_content(fp)
925         repo.add_content(fp)
926
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.
931
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)
936
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.
941
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)
946
947 Add the installed SUSE products database to the repository. The _dir_ parameter
948 is usually "/etc/products.d".
949
950
951 THE SOLVABLE CLASS
952 ------------------
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.
956
957 === ATTRIBUTES ===
958
959         Repo *repo;                     /* read only */
960         $solvable->{'repo'}
961         solvable.repo
962         solvable.repo
963
964 The repository this solvable belongs to.
965
966         Pool *pool;                     /* read only */
967         $solvable->{'pool'}
968         solvable.pool
969         solvable.pool
970
971 The pool this solvable belongs to, same as the pool of the repo.
972
973         Id id;                          /* read only */
974         $solvable->{'id'}
975         solvable.id
976         solvable.id
977
978 The specific id of the solvable.
979
980         char *name;                     /* read/write */
981         $solvable->{'name'}
982         solvable.name
983         solvable.name
984
985         char *evr;                      /* read/write */
986         $solvable->{'evr'}
987         solvable.evr
988         solvable.evr
989
990         char *arch;                     /* read/write */
991         $solvable->{'arch'}
992         solvable.arch
993         solvable.arch
994
995         char *vendor;                   /* read/write */
996         $solvable->{'vendor'}
997         solvable.vendor
998         solvable.vendor
999
1000 Easy access to often used attributes of solvables. They are
1001 internally stored as Ids.
1002
1003         Id nameid;                      /* read/write */
1004         $solvable->{'nameid'}
1005         solvable.nameid
1006         solvable.nameid
1007
1008         Id evrid;                       /* read/write */
1009         $solvable->{'evrid'}
1010         solvable.evrid
1011         solvable.evrid
1012
1013         Id archid;                      /* read/write */
1014         $solvable->{'archid'}
1015         solvable.archid
1016         solvable.archid
1017
1018         Id vendorid;                    /* read/write */
1019         $solvable->{'vendorid'}
1020         solvable.vendorid
1021         solvable.vendorid
1022
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.
1025
1026 === METHODS ===
1027
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)
1032
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)
1037
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)
1042
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)
1047
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)
1052
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)
1057
1058         Queue lookup_deparray(Id keyname, Id marker = -1)
1059         my @deps = $solvable->lookup_deparray($keyname);
1060         ids = solvable.lookup_deparray(keyname)
1061         ids = solvable.lookup_deparray(keyname)
1062         
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.
1073
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()
1078
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).
1082
1083         void add_deparray(Id keyname, DepId id, Id marker = -1);
1084         $solvable->add_deparray($keyname, $depid);
1085         solvable.add_deparray(keyname, depid)
1086         solvable.add_deparray(keyname, depid)
1087
1088 Add a new dependency to the attributes stored in keyname.
1089
1090         bool installable();
1091         $solvable->installable()
1092         solvable.installable()
1093         solvable.installable?
1094
1095 Return true if the solvable is installable on the system. Solvables
1096 are not installable if the system does not support their architecture.
1097
1098         bool isinstalled();
1099         $solvable->isinstalled()
1100         solvable.isinstalled()
1101         solvable.isinstalled?
1102
1103 Return true if the solvable is installed on the system.
1104
1105         Selection *Selection(int setflags = 0)
1106         my $sel = $solvable->Selection();
1107         sel = solvable.Selection()
1108         sel = solvable.Selection()
1109
1110 Create a Selection containing just the single solvable.
1111
1112         const char *str()
1113         my $str = $solvable->str();
1114         str = $solvable.str()
1115         str = $solvable.str()
1116
1117 Return a string describing the solvable. The string consists of the name,
1118 version, and architecture of the Solvable.
1119
1120         <stringification>
1121         my $str = "$solvable";
1122         str = str(solvable)
1123         str = solvable.to_s
1124
1125 Same as calling the str() method.
1126
1127         <equality>
1128         if ($solvable1 == $solvable2)
1129         if solvable1 == solvable2:
1130         if solvable1 == solvable2
1131
1132 Two solvables are equal if they are part of the same pool and have the same
1133 ids.
1134
1135 THE DATAITERATOR CLASS
1136 ----------------------
1137 xxx
1138
1139 THE SELECTION CLASS
1140 -------------------
1141 xxx
1142
1143 THE JOB CLASS
1144 -------------
1145 xxx
1146
1147 THE SOLVER CLASS
1148 ----------------
1149 xxx
1150
1151 THE TRANSACTION CLASS
1152 ---------------------
1153 xxx
1154
1155 CHECKSUMS
1156 ---------
1157 Checksums (also called hashes) are used to make sure that downloaded data is
1158 not corrupt and also as a fingerprint mechanism to check if data has changed.
1159
1160 === CLASS METHODS ===
1161
1162         Chksum *Chksum(Id type)
1163         my $chksum = solv::Chksum->new($type);
1164         chksum = solv.Chksum(type)
1165         chksum = Solv::Chksum.new(type)
1166
1167 Create a checksum object. Currently the following types are supported:
1168
1169         REPOKEY_TYPE_MD5
1170         REPOKEY_TYPE_SHA1
1171         REPOKEY_TYPE_SHA256
1172
1173 These keys are constants in the *solv* class.
1174
1175         Chksum *Chksum(Id type, const char *hex)
1176         my $chksum = solv::Chksum->new($type, $hex);
1177         chksum = solv.Chksum(type, hex)
1178         chksum = Solv::Chksum.new(type, hex)
1179
1180 Create an already finalized checksum object.
1181
1182 === ATTRIBUTES ===
1183
1184         Id type;                        /* read only */
1185         $chksum->{'type'}
1186         chksum.type
1187         chksum.type
1188
1189 Return the type of the checksum object.
1190
1191 === METHODS ===
1192
1193         void add(const char *str)
1194         $chksum->add($str);
1195         chksum.add(str)
1196         chksum.add(str)
1197
1198 Add a string to the checksum.
1199
1200         void add_fp(FILE *fp)
1201         $chksum->add_fp($file);
1202         chksum.add_fp(file)
1203         chksum.add_fp(file)
1204
1205 Add the contents of a file to the checksum.
1206         
1207         void add_stat(const char *filename)
1208         $chksum->add_stat($filename);
1209         chksum.add_stat(filename)
1210         chksum.add_stat(filename)
1211
1212 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
1213 stat fails, the members are zeroed.
1214
1215         void add_fstat(int fd)
1216         $chksum->add_fstat($fd);
1217         chksum.add_fstat(fd)
1218         chksum.add_fstat(fd)
1219
1220 Same as add_stat, but instead of the filename a file descriptor is used.
1221
1222         unsigned char *raw()
1223         my $raw = $chksum->raw();
1224         raw = chksum.raw()
1225         raw = chksum.raw()
1226
1227 Finalize the checksum and return the result as raw bytes. This means that the
1228 result can contain zero bytes or unprintable characters.
1229
1230         unsigned char *hex()
1231         my $raw = $chksum->hex();
1232         raw = chksum.hex()
1233         raw = chksum.hex()
1234
1235 Finalize the checksum and return the result as hex string.
1236
1237         <equality>
1238         if ($chksum1 == $chksum2)
1239         if chksum1 == chksum2:
1240         if chksum1 == chksum2
1241
1242 Checksums are equal if they are of the same type and the finalized results are
1243 the same.
1244
1245         <stringification>
1246         my $str = "$chksum";
1247         str = str(chksum)
1248         str = chksum.to_s
1249
1250 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
1251 Otherwise "<type>:unfinished" is returned.
1252
1253
1254 FILE MANAGEMENT
1255 ---------------
1256 This functions were added because libsolv uses standard *FILE* pointers to
1257 read/write files, but languages like perl have their own implementation of
1258 files. The libsolv functions also support decompression and compression, the
1259 algorithm is selected by looking at the file name extension.
1260
1261         FILE *xfopen(char *fn, char *mode = "r")
1262         my $file = solv::xfopen($path);
1263         file = solv.xfopen(path)
1264         file = Solv::xfopen(path)
1265
1266 Open a file at the specified path. The `mode` argument is passed on to the
1267 stdio library.
1268
1269         FILE *xfopen_fd(char *fn, int fileno)
1270         my $file = solv::xfopen_fd($path, $fileno);
1271         file = solv.xfopen_fd(path, fileno)
1272         file = Solv::xfopen_fd(path, fileno)
1273
1274 Create a file handle from the specified file descriptor. The path argument is
1275 only used to select the correct (de-)compression algorithm, use an empty path
1276 if you want to make sure to read/write raw data.
1277
1278 === METHODS ===
1279
1280         int fileno()
1281         my $fileno = $file->fileno();
1282         fileno = file.fileno()
1283         fileno = file.fileno()
1284
1285 Return file file descriptor of the file. If the file is not open, `-1` is
1286 returned.
1287
1288         int dup()
1289         my $fileno = $file->dup();
1290         fileno = file.dup()
1291         fileno = file.dup()
1292
1293 Return a copy of the descriptor of the file. If the file is not open, `-1` is
1294 returned.
1295
1296         bool flush()
1297         $file->flush();
1298         file.flush()
1299         file.flush()
1300
1301 Flush the file. Returns false if there was an error. Flushing a closed file
1302 always returns true.
1303
1304         bool close()
1305         $file->close();
1306         file.close()
1307         file.close()
1308
1309 Close the file. This is needed for languages like Ruby, that do not destruct
1310 objects right after they are no longer referenced. In that case, it is good
1311 style to close open files so that the file descriptors are freed right away.
1312 Returns false if there was an error.
1313
1314 THE REPODATACLASS
1315 -----------------
1316 xxx
1317
1318 Author
1319 ------
1320 Michael Schroeder <mls@suse.de>
1321