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