8d726c445b75517b80b37762ba2501d110c9bbb6
[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 === METHODS ===
63
64         void free()
65         $pool->free();
66         pool.free()
67         pool.free()
68
69 Free a pool. This is currently done with a method instead of relying on
70 reference counting or garbage collection because it's hard to track every
71 reference to a pool.
72
73         void setdebuglevel(int level)
74         $pool->setdebuglevel($level);
75         pool.setdebuglevel(level)
76         pool.setdebuglevel(level)
77
78 Set the debug level. A value of zero means no debug output, the higher the
79 value, the more output is generated.
80
81         int set_flag(int flag, int value)
82         my $oldvalue = $pool->set_flag($flag, $value);
83         oldvalue = pool.set_flag(flag, value)
84         oldvalue = pool.set_flag(flag, value)
85
86         int get_flag(int flag)
87         my $value = $pool->get_flag($flag);
88         value = pool.get_flag(flag)
89         value = pool.get_flag(flag)
90
91 Set/get a pool specific flag. The flags define how the system works, e.g. how
92 the package manager treats obsoletes. The default flags should be sane for most
93 applications, but in some cases you may want to tweak a flag, for example if
94 you want to solv package dependencies for some other system than yours.
95
96         void set_rootdir(const char *rootdir)
97         $pool->set_rootdir(rootdir);
98         pool.set_rootdir(rootdir)
99         pool.set_rootdir(rootdir)
100
101         const char *get_rootdir()
102         my $rootdir = $pool->get_rootdir();
103         rootdir = pool.get_rootdir()
104         rootdir = pool.get_rootdir()
105
106 Set/get the rootdir to use. This is useful if you want package management
107 to work only in some directory, for example if you want to setup a chroot
108 jail. Note that the rootdir will only be prepended to file paths if the
109 *REPO_USE_ROOTDIR* flag is used.
110
111         void setarch(const char *arch = 0)
112         $pool->setarch();
113         pool.setarch()
114         pool.setarch()
115
116 Set the architecture for your system. The architecture is used to determine
117 which packages are installable. It defaults to the result of ``uname -m''.
118
119         Repo *add_repo(const char *name)
120         $repo = $pool->add_repo($name);
121         repo = pool.add_repo(name)
122         repo = pool.add_repo(name)
123
124 Add a Repository with the specified name to the pool. The reposiory is empty
125 on creation, use the repository methods to populate it with packages.
126
127         Repoiterator *repos_iter()
128         for my $repo (@{$pool->repos_iter()})
129         for repo in pool.repos_iter():
130         for repo in pool.repos_iter()
131
132 Iterate over the existing repositories.
133
134         Solvableiterator *solvables_iter()
135         for my $solvable (@{$pool->solvables_iter()})
136         for solvable in pool.solvables_iter():
137         for solvable in pool.solvables_iter()
138
139 Iterate over the existing solvables.
140
141         Dep *Dep(const char *str, bool create=1)
142         my $dep = $pool->Dep($string);
143         dep = pool.Dep(string)
144         dep = pool.Dep(string)
145
146 Create an object describing a string or dependency. If the string is currently
147 not in the pool and _create_ is false, *undef*/*None*/*nil* is returned.
148
149         void addfileprovides()
150         $pool->addfileprovides();
151         pool.addfileprovides()
152         pool.addfileprovides()
153
154         Queue addfileprovides_queue()
155         my @ids = $pool->addfileprovides_queue();
156         ids = pool.addfileprovides_queue()
157         ids = pool.addfileprovides_queue()
158
159 Some package managers like rpm allow dependencies on files contained in other
160 packages. To allow libsolv to deal with those dependencies in an efficient way,
161 you need to call the addfileprovides method after creating and reading all
162 repositories. This method will scan all dependency for file names and than scan
163 all packages for matching files. If a filename has been matched, it will be
164 added to the provides list of the corresponding package. The
165 addfileprovides_queue variant works the same way but returns an array
166 containing all file dependencies. This information can be stored with the
167 repository to speed up the next usage of the repository.
168
169         void createwhatprovides()
170         $pool->createwhatprovides();
171         pool.createwhatprovides()
172         pool.createwhatprovides()
173
174 Create the internal ``whatprovides'' hash over all of the provides of all
175 packages. This method must be called before doing any lookups on provides.
176 It's encuraged to do it right after all repos are set up, usually right after
177 the call to addfileprovides().
178
179         Queue whatprovides(DepId dep)
180         my @solvables = $pool->whatprovides($dep);
181         solvables = pool.whatprovides(dep)
182         solvables = pool.whatprovides(dep)
183
184 Return all solvables that provide the specified dependency. You can use either
185 a Dep object or an simple Id as argument.
186
187         Queue matchprovidingids(const char *match, int flags)
188         my @ids = $pool->matchprovidingids($match, $flags);
189         ids = pool.matchprovidingids(match, flags)
190         ids = pool.matchprovidingids(match, flags)
191
192 Search the names of all provides and return the ones matching the specified
193 string. See the Dataiterator class for the allowed flags.
194
195         Id towhatprovides(Queue ids)
196         my $offset = $pool->towhatprovides(\@ids);
197         offset = pool.towhatprovides(ids)
198         offset = pool.towhatprovides(ids)
199
200 ``Internalize'' an array containing Ids. The returned value can be used to
201 create solver jobs working on a specific set of packages. See the Solver class
202 for more information.
203
204         bool isknownarch(DepId id)
205         my $bool = $pool->isknownarch($id);
206         bool = pool.isknownarch(id)
207         bool = pool.isknownarch?(id)
208
209 Return true if the specified Id describs a known architecture.
210
211         Solver *Solver()
212         my $solver = $pool->Solver();
213         solver = pool.Solver()
214         solver = pool.Solver()
215
216 Create a new solver object.
217
218         Solver *Job(int how, Id what)
219         my $job = $pool->Job($how, $what);
220         job = pool.Job(how, what)
221         job = pool.Job(how, what)
222
223 Create a new Job object. Kind of low level, in most cases you would use a
224 Selection or Dep job constructor instead.
225
226         Selection *Selection()
227         my $sel = $pool->Selection();
228         sel = pool.Selection()
229         sel = pool.Selection()
230
231 Create an empty selection. Useful as a starting point for merging other
232 selections.
233
234         Selection *Selection_all()
235         my $sel = $pool->Selection_all();
236         sel = pool.Selection_all()
237         sel = pool.Selection_all()
238         
239 Create a selection containing all packages. Useful as starting point for
240 intersecting other selections or for update/distupgrade jobs.
241
242         Selection *select(const char *name, int flags)
243         my $sel = $pool->select($name, $flags);
244         sel = pool.select(name, flags)
245         sel = pool.select(name, flags)
246
247 Create a selection by matching packages against the specified string. See the
248 Selection class for a list of flags and how to create solver jobs from a
249 selection.
250
251         void setpooljobs(Jobs *jobs)
252         $pool->setpooljobs(\@jobs);
253         pool.setpooljobs(jobs)
254         pool.setpooljobs(jobs)
255
256         Jobs *getpooljobs()
257         @jobs = $pool->getpooljobs();
258         jobs = pool.getpooljobs()
259         jobs = pool.getpooljobs()
260
261 Get/Set fixed jobs stored in the pool. Those jobs are automatically appended to
262 all solver jobs, they are meant for fixed configurations like which packages
263 can be multiversion installed, which packages were userinstalled or must not be
264 erased.
265
266         void set_loadcallback(Callable *callback)
267         $pool->setloadcallback(\&callbackfunction);
268         pool.setloadcallback(callbackfunction)
269         pool.setloadcallback { |repodata| ... }
270
271 Set the callback function called when repository metadata needs to be loaded on
272 demand. To make use of this feature, you need to create repodata stubs that
273 tell the library which data is available but not loaded. If later on the data
274 needs to be accessed, the callback function is called with a repodata argument.
275 You can then load the data (maybe fetching it first from an remote server).
276 The callback should return true if the data has been made available.
277
278 === DATA RETRIEVAL METHODS ===
279
280 In the following functions, the _keyname_ argument describes what to retrive.
281 For the standard cases you can use the available Id constants. For example,
282
283         $solv::SOLVABLE_SUMMARY
284         solv.SOLVABLE_SUMMARY
285         Solv::SOLVABLE_SUMMARY
286
287 selects the ``Summary'' entry of a solvable. The _solvid_ argument selects the
288 desired solvable by Id.
289
290         const char *lookup_str(Id solvid, Id keyname)
291         my $string = $pool->lookup_str($solvid, $keyname);
292         string = pool.lookup_str(solvid, keyname)
293         string = pool.lookup_str(solvid, keyname)
294
295         Id lookup_id(Id solvid, Id keyname)
296         my $id = $pool->lookup_id($solvid, $keyname);
297         id = pool.lookup_id(solvid, keyname)
298         id = pool.lookup_id(solvid, keyname)
299
300         unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
301         my $num = $pool->lookup_num($solvid, $keyname);
302         num = pool.lookup_num(solvid, keyname)
303         num = pool.lookup_num(solvid, keyname)
304
305         bool lookup_void(Id solvid, Id keyname)
306         my $bool = $pool->lookup_void($solvid, $keyname);
307         bool = pool.lookup_void(solvid, keyname)
308         bool = pool.lookup_void(solvid, keyname)
309
310         Queue lookup_idarray(Id solvid, Id keyname)
311         my @ids = $pool->lookup_idarray($solvid, $keyname);
312         ids = pool.lookup_idarray(solvid, keyname)
313         ids = pool.lookup_idarray(solvid, keyname)
314
315         Chksum *lookup_checksum(Id solvid, Id keyname)
316         my $chksum = $pool->lookup_checksum($solvid, $keyname);
317         chksum = pool.lookup_checksum(solvid, keyname)
318         chksum = pool.lookup_checksum(solvid, keyname)
319
320 Lookup functions. Return the data element stored in the specified solvable.
321 You should probably use the methods of the Solvable class instead.
322
323         Dataiterator *Dataiterator(Id solvid, Id keyname, const char *match, int flags)
324         my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
325         di = pool.Dataiterator(solvid, keyname, match, flags)
326         di = pool.Dataiterator(solvid, keyname, match, flags)
327
328         for my $d (@$di)
329         for d in di:
330         for d in di
331
332 Iterate over the matching data elements. See the Dataiterator class for more
333 information.
334
335 === ID METHODS ===
336
337 The following methods deal with Ids, i.e. integers representing objects in the
338 pool. They are considered ``low level'', in most cases you would not use them
339 but instead the object orientated methods.
340
341         Repo *id2repo(Id id)
342         $repo = $pool->id2repo($id);
343         repo = pool.id2repo(id)
344         repo = pool.id2repo(id)
345
346 Lookup an existing Repository by id. You can also do this by using the *repos*
347 attribute.
348
349         Solvable *id2solvable(Id id)
350         $solvable = $pool->id2solvable($id);
351         solvable = pool.id2solvable(id)
352         solvable = pool.id2solvable(id)
353
354 Lookup an existing Repository by id. You can also do this by using the
355 *solvables* attribute.
356
357         const char *solvid2str(Id id)
358         my $str = $pool->solvid2str($id);
359         str = pool.solvid2str(id)
360         str = pool.solvid2str(id)
361
362 Return a string describing the Solvable with the specified id. The string
363 consists of the name, version, and architecture of the Solvable.
364
365         Id str2id(const char *str, bool create=1)
366         my $id = pool->str2id($string);
367         id = pool.str2id(string)
368         id = pool.str2id(string)
369
370         const char *id2str(Id id)
371         $string = pool->id2str($id);
372         string = pool.id2str(id)
373         string = pool.id2str(id)
374
375 Convert a string into an Id and back. If the string is currently not in the
376 pool and _create_ is false, zero is returned.
377
378         Id rel2id(Id name, Id evr, int flags, bool create=1)
379         my $id = pool->rel2id($nameid, $evrid, $flags);
380         id = pool.rel2id(nameid, evrid, flags)
381         id = pool.rel2id(nameid, evrid, flags)
382
383 Create a ``relational'' dependency. Such dependencies consist of a name part,
384 the _flags_ describing the relation, and a version part. The flags are:
385
386         $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
387         solv.REL_EQ | solv.REL_GT | solv.REL_LT
388         Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
389
390 Thus, if you want a ``\<='' relation, you would use *REL_LT | REL_EQ*.
391
392         Id id2langid(Id id, const char *lang, bool create=1)
393         my $id = $pool->id2langid($id, $language);
394         id = pool.id2langid(id, language)
395         id = pool.id2langid(id, language)
396
397 Create a language specific Id from some other id. This function simply converts
398 the id into a string, appends a dot and the specified language to the string
399 and converts the result back into an Id.
400
401         const char *dep2str(Id id)
402         $string = pool->dep2str($id);
403         string = pool.dep2str(id)
404         string = pool.dep2str(id)
405
406 Convert a dependency id into a string. If the id is just a string, this
407 function has the same effect as id2str(). For relational dependencies, the
408 result is the correct ``name relation evr'' string.
409
410
411 THE DEPENDENCY CLASS
412 --------------------
413 The dependency class is an object orientated way to work with strings and
414 dependencies. Internally, dependencies are represented as Ids, i.e. simple
415 numbers. Dependency objects can be constructed by using the Pool's Dep()
416 method.
417
418 === ATTRIBUTES ===
419
420         Pool *pool;             /* read only */
421         $dep->{'pool'}
422         dep.pool
423         dep.pool
424
425 Back reference to the pool this dependency belongs to.
426
427         Id id;          /* read only */
428         $dep->{'id'}
429         dep.id
430         dep.id
431
432 The id of this dependency.
433
434 == Methods ==
435
436         Dep *Rel(int flags, DepId evrid, bool create=1)
437         my $reldep = $dep->Rel($flags, $evrdep);
438         reldep = dep.Rel(flags, evrdep)
439         reldep = dep.Rel(flags, evrdep)
440
441 Create a relational dependency from to string dependencies and a flags
442 argument. See the pool's rel2id method for a description of the flags.
443
444         Selection *Selection_name(int setflags = 0)
445         my $sel = $dep->Selection_name();
446         sel = dep.Selection_name()
447         sel = dep.Selection_name()
448
449 Create a Selection from a dependency. The selection consists of all packages
450 that have a name equal to the dependency. If the dependency is of a relational
451 type, the packages version must also fulfill the dependency.
452
453         Selection *Selection_provides(int setflags = 0)
454         my $sel = $dep->Selection_provides();
455         sel = dep.Selection_provides()
456         sel = dep.Selection_provides()
457
458 Create a Selection from a dependency. The selection consists of all packages
459 that have at least one provides matching the dependency.
460
461         const char *str()
462         my $str = $dep->str();
463         str = $dep.str()
464         str = $dep.str()
465
466 Return a string describing the dependency.
467
468         <stringification>
469         my $str = "$dep";
470         str = str(dep)
471         str = dep.to_s
472
473 Same as calling the str() method.
474
475         <equality>
476         if ($dep1 == $dep2)
477         if dep1 == dep2:
478         if dep1 == dep2
479
480 The dependencies are equal if they are part of the same pool and have the same
481 ids.
482
483 THE REPOSITORY CLASS
484 --------------------
485 A Repository describes a group of packages, normally comming from the same
486 source. Repositories are created by the Pool's add_repo() method.
487
488 === ATTRIBUTES ===
489
490         Pool *pool;                     /* read only */
491         $repo->{'pool'}
492         repo.pool
493         repo.pool
494
495 Back reference to the pool this dependency belongs to.
496
497         Id id;                          /* read only */
498         $repo->{'id'}
499         repo.id
500         repo.id
501
502 Return the id of the repository.
503
504         const char *name;               /* read/write */
505         $repo->{'name'}
506         repo.name
507         repo.name
508         
509 The repositories name. To libsolv, the name is just a string with no specific
510 meaning.
511
512         int prioprity;                  /* read/write */
513         $repo->{'priority'}
514         repo.priority
515         repo.priority
516
517 The priority of the repository. A higher number means that packages of this
518 repository will be chosen over other repositories, even if they have a greater
519 package version.
520
521         int subprioprity;               /* read/write */
522         $repo->{'subpriority'}
523         repo.subpriority
524         repo.subpriority
525
526 The sub-priority of the repository. This value is compared when the priorities
527 of two repositories are the same. It is useful to make the library prefer
528 on-disk repositories to remote ones.
529
530         int nsolvables;                 /* read only */
531         $repo->{'nsolvables'}
532         repo.nsolvables
533         repo.nsolvables
534
535 The number of solvables in this repository.
536
537         void *appdata;                  /* read/write */
538         $repo->{'appdata'}
539         repo.appdata
540         repo.appdata
541
542 Application specific data that may be used in any way by the code using the
543 repository.
544
545         Datapos *meta;                  /* read only */
546         $repo->{'meta'}
547         repo.meta
548         repo.meta
549
550 Return a Datapos object of the repodata's metadata. You can use the lookup
551 methods of the Datapos class to lookup metadata attributes, like the repository
552 timestamp.
553
554 === CONSTANTS ===
555
556 *REPO_REUSE_REPODATA*::
557   Reuse the last repository data aera (``repodata'') instead of creating a new
558   one.
559
560 *REPO_NO_INTERNALIZE*::
561   Do not internalize the added repository data. This is useful if
562   you plan to add more data because internalization is a costly
563   operation.
564
565 *REPO_LOCALPOOL*::
566   Use the repodata's pool for Id storage instead of the global pool. Useful
567   if you don't want to pollute the global pool with many unneeded ids, like
568   when storing the filelist.
569
570 *REPO_USE_LOADING*::
571   Use the repodata that is currently being loaded instead of creating a new one.
572   This only makes sense if used in a load callback.
573
574 *REPO_EXTEND_SOLVABLES*::
575   Do not create new solvables for the new data, but match existing solvables and
576   add the data to them. Repository metadata is often split into multiple parts,
577   with one primary file describing all packages and other parts holding
578   information that is normally not needed, like the changelog.
579
580 *REPO_USE_ROOTDIR*::
581   Prepend the pool's rootdir to the path when doing file operations.
582
583 *REPO_NO_LOCATION*::
584   Do not add a location element to the solvables. Useful if the solvables are
585   not in the final position, so you can add the correct location later in your code.
586
587 *SOLV_ADD_NO_STUBS*::
588   Do not create stubs for repository parts that can be downloaded on demand.
589
590 *SUSETAGS_RECORD_SHARES*::
591   This is specific to the add_susetags() method. Susetags allows to refer to already
592   read packages to save disk space. If this data sharing needs to work over multiple
593   calls to add_susetags, you need to specify this flag so that the share information
594   is made available to subsequent calls.
595
596 === METHODS ===
597
598         void free(bool reuseids = 0)
599         $repo->free();
600         repo.free()
601         repo.free()
602
603 Free the repository and all solvables it contains. If _reuseids_ is set to
604 true, the solvable ids and the repository id may be reused by the library when
605 added new solvables. Thus you should leave it false if you are not sure that
606 somebody holds a reference.
607
608         void empty(bool reuseids = 0)
609         $repo->empty();
610         repo.empty()
611         repo.empty()
612
613 Free all the solvables in a repository. The repository will be empty after this
614 call. See the free() method for the meaning of _reuseids_.
615
616         bool isempty()
617         $repo->isempty()
618         repo.empty()
619         repo.empty?
620
621 Return true if there are no solvables in this repository.
622
623         void internalize()
624         $repo->internalize();
625         repo.internalize()
626         repo.internalize()
627
628 Internalize added data. Data must be internalized before it is available to the
629 lookup and data iterator functions.
630
631         bool write(FILE *fp)
632         $repo->write($fp)
633         repo.write(fp)
634         repo.write(fp)
635
636 Write a repo as a ``solv'' file. These files can be read very fast and thus are
637 a good way to cache repository data. Returns false if there was some error
638 writing the file.
639
640         Solvableiterator *solvables_iter()
641         for my $solvable (@{$repo->solvables_iter()})
642         for solvable in repo.solvables_iter():
643         for solvable in repo.solvables_iter()
644
645 Iterate over all solvables in a repository.
646
647         Repodata *add_repodata(int flags = 0)
648         my $repodata = $repo->add_repodata();
649         repodata = repo.add_repodata()
650         repodata = repo.add_repodata()
651
652 Add a new repodata area to the repository. This is normally automatically
653 done by the repo_add methods, so you need this method only in very
654 rare circumstances.
655
656         void create_stubs()
657         $repo->create_stubs();
658         repo.create_stubs()
659         repo.create_stubs()
660
661 Calls the create_stubs() repodata method for the last repodata of the
662 repository.
663
664         bool iscontiguous()
665         $repo->iscontiguous()
666         repo.iscontiguous()
667         repo.iscontiguous?
668
669 Return true if the solvables of this repository are all in a single block with
670 no holes, i.e. they have consecutive ids.
671
672         Repodata *first_repodata()
673         my $repodata = $repo->first_repodata();
674         repodata = repo.first_repodata()
675         repodata = repo.first_repodata()
676
677 Checks if all repodatas but the first repodata are extensions, and return the
678 first repodata if this is the case. Useful if you want to do a store/retrive
679 sequence on the repository to reduce the memory using and enable paging, as
680 this does not work if the rpository contains multiple non-extension repodata
681 areas.
682
683         Selection *Selection(int setflags = 0)
684         my $sel = $repo->Selection();
685         sel = repo.Selection()
686         sel = repo.Selection()
687
688 Create a Selection consisting of all packages in the repository.
689
690         Dataiterator *Dataiterator(Id p, Id key, const char *match, int flags)
691         my $di = $repo->Dataiterator($solvid, $keyname, $match, $flags);
692         di = repo.Dataiterator(solvid, keyname, match, flags)
693         di = repo.Dataiterator(solvid, keyname, match, flags)
694
695         for my $d (@$di)
696         for d in di:
697         for d in di
698
699 Iterate over the matching data elements in this repository. See the
700 Dataiterator class for more information.
701
702         <stringification>
703         my $str = "$repo";
704         str = str(repo)
705         str = repo.to_s
706
707 Return the name of the repository, or "Repo#<id>" if no name is set.
708
709         <equality>
710         if ($repo1 == $repo2)
711         if repo1 == repo2:
712         if repo1 == repo2
713
714 Two repositories are equal if they belong to the same pool and have the same id.
715
716 === DATA ADD METHODS ===
717
718         Solvable *add_solvable()
719         $repo->add_solvable();
720         repo.add_solvable()
721         repo.add_solvable()
722
723 Add a single empty solvable to the repository. Returns a Solvable object, see
724 the Solvable class for more information.
725
726         bool add_solv(const char *name, int flags = 0)
727         $repo->add_solv($name, $flags);
728         repo.add_solv(name, flags)
729         repo.add_solv(name, flags)
730
731         bool add_solv(FILE *fp, int flags = 0)
732         $repo->add_solv($fp, $flags);
733         repo.add_solv(fp, flags)
734         repo.add_solv(fp, flags)
735
736 Read a ``solv'' file and add its contents to the repository. These files can be
737 written with the write() method and are normally used as fast cache for
738 repository metadata.
739
740         bool add_rpmdb(int flags = 0)
741         $repo->add_rpmdb($flags);
742         repo.add_rpmdb(flags)
743         repo.add_rpmdb(flags)
744
745         bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
746         $repo->add_rpmdb_reffp($reffp, $flags);
747         repo.add_rpmdb_reffp($reffp, flags)
748         repo.add_rpmdb_reffp($reffp, flags)
749
750 Add the contents of the rpm database to the repository. If a solv file
751 containing an old version of the database is available, it can be passed as
752 reffp to speed up reading.
753
754         bool add_rpm(const char *name, int flags = 0)
755         $repo->add_rpm($name, $flags);
756         repo.add_rpm(name, flags)
757         repo.add_rpm(name, flags)
758
759 Add the metadata of a single rpm package to the repository.
760
761         bool add_rpmdb_pubkeys(int flags = 0)
762         $repo->add_rpmdb_pubkeys();
763         repo.add_rpmdb_pubkeys()
764         repo.add_rpmdb_pubkeys()
765
766 Add all pubkeys contained in the rpm database to the repository. Note that
767 newer rpm versions also allow to store the pubkeys in some directory instead
768 of the rpm database.
769
770         bool add_pubkey(const char *keyfile, int flags = 0)
771         $repo->add_pubkey($keyfile);
772         repo.add_pubkey($keyfile)
773         repo.add_pubkey($keyfile)
774
775 Add a pubkey from a file to the repository.
776
777         bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
778         $repo->add_rpmmd($fp, $language);
779         repo.add_rpmmd(fp, language)
780         repo.add_rpmmd(fp, language)
781
782 Add metadata stored in the "rpm-md" format (i.e. from files in the ``repodata''
783 directory) to a repository. Supported files are "primary", "filelists",
784 "other", "suseinfo". Do not forget to specify the *REPO_EXTEND_SOLVABLES* for
785 extension files like "filelists" and "other". Use the _language_ parameter if
786 you have language extension files, otherwise simply use a *undef*/*None*/*nil*
787 parameter.
788
789         bool add_repomdxml(FILE *fp, int flags = 0)
790         $repo->add_repomdxml($fp);
791         repo.add_repomdxml(fp)
792         repo.add_repomdxml(fp)
793
794 Add the repomd.xml meta description from the "rpm-md" format to the repository.
795 This file contains information about the repository like keywords, and also a
796 list of all database files with checksums. The data is added the the "meta"
797 section of the repository, i.e. no package gets created.
798
799         bool add_updateinfoxml(FILE *fp, int flags = 0)
800         $repo->add_updateinfoxml($fp);
801         repo.add_updateinfoxml(fp)
802         repo.add_updateinfoxml(fp)
803
804 Add the updateinfo.xml file containing available maintenance updates to the
805 repository. All updates are created as special packages that have a "patch:"
806 prefix in their name.
807
808         bool add_deltainfoxml(FILE *fp, int flags = 0)
809         $repo->add_deltainfoxml($fp);
810         repo.add_deltainfoxml(fp)
811         repo.add_deltainfoxml(fp)
812
813 Add the deltainfo.xml file (also called prestodelta.xml) containing available
814 delta-rpms to the repository. The data is added to the "meta" section, i.e. no
815 package gets created.
816
817         bool add_debdb(int flags = 0)
818         $repo->add_debdb();
819         repo.add_debdb()
820         repo.add_debdb()
821
822 Add the contents of the debian installed package database to the repository.
823
824         bool add_debpackages(FILE *fp, int flags = 0)
825         $repo->add_debpackages($fp);
826         repo.add_debpackages($fp)
827         repo.add_debpackages($fp)
828
829 Add the contents of the debian repository metadata (the "packages" file)
830 to the repository.
831
832         bool add_deb(const char *filename, int flags = 0)
833         $repo->add_deb($filename);
834         repo.add_deb(filename)
835         repo.add_deb(filename)
836
837 Add the metadata of a single deb package to the repository.
838
839         bool add_mdk(FILE *fp, int flags = 0)
840         $repo->add_mdk($fp);
841         repo.add_mdk($fp)
842         repo.add_mdk($fp)
843
844 Add the contents of the mageia/mandriva repository metadata (the
845 "synthesis.hdlist" file) to the repository.
846
847         bool add_mdk_info(FILE *fp, int flags = 0)
848         $repo->add_mdk($fp);
849         repo.add_mdk($fp)
850         repo.add_mdk($fp)
851
852 Extend the packages from the synthesis file with the info.xml and files.xml
853 data. Do not forget to specify *REPO_EXTEND_SOLVABLES*.
854
855         bool add_arch_repo(FILE *fp, int flags = 0)
856         $repo->add_arch_repo($fp);
857         repo.add_arch_repo($fp)
858         repo.add_arch_repo($fp)
859
860 Add the contents of the archlinux repository metadata (the ".db.tar" file) to
861 the repository.
862
863         bool add_arch_local(const char *dir, int flags = 0)
864         $repo->add_arch_local($dir);
865         repo.add_arch_local($dir)
866         repo.add_arch_local($dir)
867
868 Add the contents of the archlinux installed package database to the repository.
869 The _dir_ parameter is usually set to "/var/lib/pacman/local".
870
871         bool add_content(FILE *fp, int flags = 0)
872         $repo->add_content($fp);
873         repo.add_content(fp)
874         repo.add_content(fp)
875
876 Add the ``content'' meta description from the susetags format to the repository.
877 This file contains information about the repository like keywords, and also
878 a list of all database files with checksums. The data is added the the "meta"
879 section of the repository, i.e. no package gets created.
880
881         bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
882         $repo->add_susetags($fp, $defvendor, $language);
883         repo.add_susetags(fp, defvendor, language)
884         repo.add_susetags(fp, defvendor, language)
885
886 Add repository metadata in the susetags format to the repository. Like with
887 add_rpmmd, you can specify a language if you have language extension files. The
888 _defvendor_ parameter provides a default vendor for packages with missing
889 vendors, it is usually provided in the content file.
890
891         bool add_products(const char *dir, int flags = 0)
892         $repo->add_products($dir);
893         repo.add_products(dir)
894         repo.add_products(dir)
895
896 Add the installed SUSE products database to the repository. The _dir_ parameter
897 is usually "/etc/products.d".
898
899
900 THE SOLVABLE CLASS
901 ------------------
902 A solvable describes all the information of one package. Each solvable belongs to
903 one repository, it can be added and filled manually but in most cases solvables
904 will get created by the repo_add methods.
905
906 === ATTRIBUTES ===
907
908         Repo *repo;                     /* read only */
909         $solvable->{'repo'}
910         solvable.repo
911         solvable.repo
912
913 The repository this solvable belongs to.
914
915         Pool *pool;                     /* read only */
916         $solvable->{'pool'}
917         solvable.pool
918         solvable.pool
919
920 The pool this solvable belongs to, same as the pool of the repo.
921
922         Id id;                          /* read only */
923         $solvable->{'id'}
924         solvable.id
925         solvable.id
926
927 The specific id of the solvable.
928
929         char *name;                     /* read/write */
930         $solvable->{'name'}
931         solvable.name
932         solvable.name
933
934         char *evr;                      /* read/write */
935         $solvable->{'evr'}
936         solvable.evr
937         solvable.evr
938
939         char *arch;                     /* read/write */
940         $solvable->{'arch'}
941         solvable.arch
942         solvable.arch
943
944         char *vendor;                   /* read/write */
945         $solvable->{'vendor'}
946         solvable.vendor
947         solvable.vendor
948
949 Easy access to often used attributes of solvables. They are
950 internally stored as Ids.
951
952         Id nameid;                      /* read/write */
953         $solvable->{'nameid'}
954         solvable.nameid
955         solvable.nameid
956
957         Id evrid;                       /* read/write */
958         $solvable->{'evrid'}
959         solvable.evrid
960         solvable.evrid
961
962         Id archid;                      /* read/write */
963         $solvable->{'archid'}
964         solvable.archid
965         solvable.archid
966
967         Id vendorid;                    /* read/write */
968         $solvable->{'vendorid'}
969         solvable.vendorid
970         solvable.vendorid
971
972 Raw interface to the ids. Useful if you want to search for
973 a specific id and want to avoid the string compare overhead.
974
975 === METHODS ===
976
977         const char *lookup_str(Id keyname)
978         my $string = $solvable->lookup_str($keyname);
979         string = solvable.lookup_str(keyname)
980         string = solvable.lookup_str(keyname)
981
982         Id lookup_id(Id keyname)
983         my $id = $solvable->lookup_id($keyname);
984         id = solvable.lookup_id(solvid)
985         id = solvable.lookup_id(solvid)
986
987         unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
988         my $num = $solvable->lookup_num($keyname);
989         num = solvable.lookup_num(keyname)
990         num = solvable.lookup_num(keyname)
991
992         bool lookup_void(Id keyname)
993         my $bool = $solvable->lookup_void($keyname);
994         bool = solvable.lookup_void(keyname)
995         bool = solvable.lookup_void(keyname)
996
997         Chksum *lookup_checksum(Id keyname)
998         my $chksum = $solvable->lookup_checksum($keyname);
999         chksum = solvable.lookup_checksum(keyname)
1000         chksum = solvable.lookup_checksum(keyname)
1001
1002         Queue lookup_idarray(Id keyname, Id marker = -1)
1003         my @ids = $solvable->lookup_idarray($keyname);
1004         ids = solvable.lookup_idarray(keyname)
1005         ids = solvable.lookup_idarray(keyname)
1006
1007         Queue lookup_deparray(Id keyname, Id marker = -1)
1008         my @deps = $solvable->lookup_deparray($keyname);
1009         ids = solvable.lookup_deparray(keyname)
1010         ids = solvable.lookup_deparray(keyname)
1011         
1012 Generic lookup methods. Retrieve data stored for the specific keyname.
1013 The lookup_idarray() method will return an array of Ids, use
1014 lookup_deparray if you want an array of Dependency objects instead.
1015 Some Id arrays contain two parts of data divided by a specific marker,
1016 for example the provides array uses the SOLVABLE_FILEMARKER id to
1017 store both the ids provided by the package and the ids added by
1018 the addfileprovides method. The default, -1, translates to the
1019 correct marker for the keyname and returns the first part of the
1020 array, use 1 to select the second part or 0 to retrive all ids
1021 including the marker.
1022
1023         const char *lookup_location(unsigned int *OUTPUT);
1024         my ($location, $medianr) = $solvable->lookup_location();
1025         location, medianr = solvable.lookup_location()
1026         location, medianr = solvable.lookup_location()
1027
1028 Return a tuple containing the on-media location and an optional
1029 media number for multi-part repositories (e.g. repositories
1030 spawning multiple DVDs).
1031
1032         void add_deparray(Id keyname, DepId id, Id marker = -1);
1033         $solvable->add_deparray($keyname, $depid);
1034         solvable.add_deparray(keyname, depid)
1035         solvable.add_deparray(keyname, depid)
1036
1037 Add a new dependency to the attributes stored in keyname.
1038
1039         bool installable();
1040         $solvable->installable()
1041         solvable.installable()
1042         solvable.installable?
1043
1044 Return true if the solvable is installable on the system. Solvables
1045 are not installable if the system does not support their architecture.
1046
1047         bool isinstalled();
1048         $solvable->isinstalled()
1049         solvable.isinstalled()
1050         solvable.isinstalled?
1051
1052 Return true if the solvable is installed on the system.
1053
1054         Selection *Selection(int setflags = 0)
1055         my $sel = $solvable->Selection();
1056         sel = solvable.Selection()
1057         sel = solvable.Selection()
1058
1059 Create a Selection containing just the single solvable.
1060
1061         const char *str()
1062         my $str = $solvable->str();
1063         str = $solvable.str()
1064         str = $solvable.str()
1065
1066 Return a string describing the solvable. The string consists of the name,
1067 version, and architecture of the Solvable.
1068
1069         <stringification>
1070         my $str = "$solvable";
1071         str = str(solvable)
1072         str = solvable.to_s
1073
1074 Same as calling the str() method.
1075
1076         <equality>
1077         if ($solvable1 == $solvable2)
1078         if solvable1 == solvable2:
1079         if solvable1 == solvable2
1080
1081 Two solvables are equal if they are part of the same pool and have the same
1082 ids.
1083
1084 THE DATAITERATOR CLASS
1085 ----------------------
1086 xxx
1087
1088 THE SELECTION CLASS
1089 -------------------
1090 xxx
1091
1092 THE JOB CLASS
1093 -------------
1094 xxx
1095
1096 THE SOLVER CLASS
1097 ----------------
1098 xxx
1099
1100 THE TRANSACTION CLASS
1101 ---------------------
1102 xxx
1103
1104 CHECKSUMS
1105 ---------
1106 Checksums (also called hashes) are used to make sure that downloaded data is
1107 not corrupt and also as a fingerprint mechanism to check if data has changed.
1108
1109 === CLASS METHODS ===
1110
1111         Chksum *Chksum(Id type)
1112         my $chksum = solv::Chksum->new($type);
1113         chksum = solv.Chksum(type)
1114         chksum = Solv::Chksum.new(type)
1115
1116 Create a checksum object. Currently the following types are supported:
1117
1118         REPOKEY_TYPE_MD5
1119         REPOKEY_TYPE_SHA1
1120         REPOKEY_TYPE_SHA256
1121
1122 These keys are constants in the *solv* class.
1123
1124         Chksum *Chksum(Id type, const char *hex)
1125         my $chksum = solv::Chksum->new($type, $hex);
1126         chksum = solv.Chksum(type, hex)
1127         chksum = Solv::Chksum.new(type, hex)
1128
1129 Create an already finalized checksum object.
1130
1131 === ATTRIBUTES ===
1132
1133         Id type;                        /* read only */
1134         $chksum->{'type'}
1135         chksum.type
1136         chksum.type
1137
1138 Return the type of the checksum object.
1139
1140 === METHODS ===
1141
1142         void add(const char *str)
1143         $chksum->add($str);
1144         chksum.add(str)
1145         chksum.add(str)
1146
1147 Add a string to the checksum.
1148
1149         void add_fp(FILE *fp)
1150         $chksum->add_fp($file);
1151         chksum.add_fp(file)
1152         chksum.add_fp(file)
1153
1154 Add the contents of a file to the checksum.
1155         
1156         void add_stat(const char *filename)
1157         $chksum->add_stat($filename);
1158         chksum.add_stat(filename)
1159         chksum.add_stat(filename)
1160
1161 Stat the file and add the dev/ino/size/mtime member to the checksum. If the
1162 stat fails, the members are zeroed.
1163
1164         void add_fstat(int fd)
1165         $chksum->add_fstat($fd);
1166         chksum.add_fstat(fd)
1167         chksum.add_fstat(fd)
1168
1169 Same as add_stat, but instead of the filename a file descriptor is used.
1170
1171         unsigned char *raw()
1172         my $raw = $chksum->raw();
1173         raw = chksum.raw()
1174         raw = chksum.raw()
1175
1176 Finalize the checksum and return the result as raw bytes. This means that the
1177 result can contain zero bytes or unprintable characters.
1178
1179         unsigned char *hex()
1180         my $raw = $chksum->hex();
1181         raw = chksum.hex()
1182         raw = chksum.hex()
1183
1184 Finalize the checksum and return the result as hex string.
1185
1186         <equality>
1187         if ($chksum1 == $chksum2)
1188         if chksum1 == chksum2:
1189         if chksum1 == chksum2
1190
1191 Checksums are equal if they are of the same type and the finalized results are
1192 the same.
1193
1194         <stringification>
1195         my $str = "$chksum";
1196         str = str(chksum)
1197         str = chksum.to_s
1198
1199 If the checksum is finished, the checksum is returned as "<type>:<hex>" string.
1200 Otherwise "<type>:unfinished" is returned.
1201
1202
1203 FILE MANAGEMENT
1204 ---------------
1205 This functions were added because libsolv uses standard *FILE* pointers to
1206 read/write files, but languages like perl have their own implementation of
1207 files. The libsolv functions also support decompression and compression, the
1208 algorithm is selected by looking at the file name extension.
1209
1210         FILE *xfopen(char *fn, char *mode = "r")
1211         my $file = solv::xfopen($path);
1212         file = solv.xfopen(path)
1213         file = Solv::xfopen(path)
1214
1215 Open a file at the specified path. The `mode` argument is passed on to the
1216 stdio library.
1217
1218         FILE *xfopen_fd(char *fn, int fileno)
1219         my $file = solv::xfopen_fd($path, $fileno);
1220         file = solv.xfopen_fd(path, fileno)
1221         file = Solv::xfopen_fd(path, fileno)
1222
1223 Create a file handle from the specified file descriptor. The path argument is
1224 only used to select the correct (de-)compression algorithm, use an empty path
1225 if you want to make sure to read/write raw data.
1226
1227 === METHODS ===
1228
1229         int fileno()
1230         my $fileno = $file->fileno();
1231         fileno = file.fileno()
1232         fileno = file.fileno()
1233
1234 Return file file descriptor of the file. If the file is not open, `-1` is
1235 returned.
1236
1237         int dup()
1238         my $fileno = $file->dup();
1239         fileno = file.dup()
1240         fileno = file.dup()
1241
1242 Return a copy of the descriptor of the file. If the file is not open, `-1` is
1243 returned.
1244
1245         bool flush()
1246         $file->flush();
1247         file.flush()
1248         file.flush()
1249
1250 Flush the file. Returns false if there was an error. Flushing a closed file
1251 always returns true.
1252
1253         bool close()
1254         $file->close();
1255         file.close()
1256         file.close()
1257
1258 Close the file. This is needed for languages like Ruby, that do not destruct
1259 objects right after they are no longer referenced. In that case, it is good
1260 style to close open files so that the file descriptors are freed right away.
1261 Returns false if there was an error.
1262
1263 THE REPODATACLASS
1264 -----------------
1265 xxx
1266
1267 Author
1268 ------
1269 Michael Schroeder <mls@suse.de>
1270