1LIBSOLV-BINDINGS(3) LIBSOLV LIBSOLV-BINDINGS(3)
2
3
4
6 libsolv-bindings - access libsolv from perl/python/ruby
7
9 Libsolv’s language bindings offer an abstract, object orientated
10 interface to the library. The supported languages are currently perl,
11 python, and ruby. All example code (except in the specifics sections,
12 of course) lists first the “C-ish” interface, then the syntax for perl,
13 python, and ruby (in that order).
14
16 Libsolv’s perl bindings can be loaded with the following statement:
17
18 use solv;
19
20 Objects are either created by calling the new() method on a class or
21 they are returned by calling methods on other objects.
22
23 my $pool = solv::Pool->new();
24 my $repo = $pool->add_repo("my_first_repo");
25
26 Swig encapsulates all objects as tied hashes, thus the attributes can
27 be accessed by treating the object as standard hash reference:
28
29 $pool->{appdata} = 42;
30 printf "appdata is %d\n", $pool->{appdata};
31
32 A special exception to this are iterator objects, they are encapsulated
33 as tied arrays so that it is possible to iterate with a for()
34 statement:
35
36 my $iter = $pool->solvables_iter();
37 for my $solvable (@$iter) { ... };
38
39 As a downside of this approach, iterator objects cannot have
40 attributes.
41
42 If an array needs to be passed to a method it is usually done by
43 reference, if a method returns an array it returns it on the perl
44 stack:
45
46 my @problems = $solver->solve(\@jobs);
47
48 Due to a bug in swig, stringification does not work for libsolv’s
49 objects. Instead, you have to call the object’s str() method.
50
51 print $dep->str() . "\n";
52
53 Swig implements all constants as numeric variables (instead of the more
54 natural constant subs), so don’t forget the leading “$” when accessing
55 a constant. Also do not forget to prepend the namespace of the
56 constant:
57
58 $pool->set_flag($solv::Pool::POOL_FLAG_OBSOLETEUSESCOLORS, 1);
59
61 The python bindings can be loaded with:
62
63 import solv
64
65 Objects are either created by calling the constructor method for a
66 class or they are returned by calling methods on other objects.
67
68 pool = solv.Pool()
69 repo = pool.add_repo("my_first_repo")
70
71 Attributes can be accessed as usual:
72
73 pool.appdata = 42
74 print "appdata is %d" % (pool.appdata)
75
76 Iterators also work as expected:
77
78 for solvable in pool.solvables_iter():
79
80 Arrays are passed and returned as list objects:
81
82 jobs = []
83 problems = solver.solve(jobs)
84
85 The bindings define stringification for many classes, some also have a
86 repr method to ease debugging.
87
88 print dep
89 print repr(repo)
90
91 Constants are attributes of the corresponding classes:
92
93 pool.set_flag(solv.Pool.POOL_FLAG_OBSOLETEUSESCOLORS, 1);
94
96 The ruby bindings can be loaded with:
97
98 require 'solv'
99
100 Objects are either created by calling the new method on a class or they
101 are returned by calling methods on other objects. Note that all classes
102 start with an uppercase letter in ruby, so the class is called “Solv”.
103
104 pool = Solv::Pool.new
105 repo = pool.add_repo("my_first_repo")
106
107 Attributes can be accessed as usual:
108
109 pool.appdata = 42
110 puts "appdata is #{pool.appdata}"
111
112 Iterators also work as expected:
113
114 for solvable in pool.solvables_iter() do ...
115
116 Arrays are passed and returned as array objects:
117
118 jobs = []
119 problems = solver.solve(jobs)
120
121 Most classes define a to_s method, so objects can be easily
122 stringified. Many also define an inspect() method.
123
124 puts dep
125 puts repo.inspect
126
127 Constants live in the namespace of the class they belong to:
128
129 pool.set_flag(Solv::Pool::POOL_FLAG_OBSOLETEUSESCOLORS, 1);
130
131 Note that boolean methods have an added trailing “?”, to be consistent
132 with other ruby modules:
133
134 puts "empty" if repo.isempty?
135
137 Libsolv’s tcl bindings can be loaded with the following statement:
138
139 package require solv
140
141 Objects are either created by calling class name prefixed with “new_”,
142 or they are returned by calling methods on other objects.
143
144 set pool [solv::new_Pool]
145 set repo [$pool add_repo "my_first_repo"]
146
147 Swig provides a “cget” method to read object attributes, and a
148 “configure” method to write them:
149
150 $pool configure -appdata 42
151 puts "appdata is [$pool cget -appdata]"
152
153 The tcl bindings provide a little helper to work with iterators in a
154 foreach style:
155
156 set iter [$pool solvables_iter]
157 solv::iter s $iter { ... }
158
159 libsolv’s arrays are mapped to tcl’s lists:
160
161 set jobs [list $job1 $job2]
162 set problems [$solver solve $jobs]
163 puts "We have [llength $problems] problems..."
164
165 Stringification is done by calling the object’s “str” method.
166
167 puts [$dep str]
168
169 There is one exception: you have to use “stringify” for Datamatch
170 objects, as swig reports a clash with the “str” attribute. Some objects
171 also support a “==” method for equality tests, and a “!=” method.
172
173 Swig implements all constants as numeric variables, constants belonging
174 to a libsolv class are prefixed with the class name:
175
176 $pool set_flag $solv::Pool_POOL_FLAG_OBSOLETEUSESCOLORS 1
177 puts [$solvable lookup_str $solv::SOLVABLE_SUMMARY]
178
180 This is the main namespace of the library, you cannot create objects of
181 this type but it contains some useful constants.
182
183 CONSTANTS
184 Relational flag constants, the first three can be or-ed together
185
186 REL_LT
187 the “less than” bit
188
189 REL_EQ
190 the “equals to” bit
191
192 REL_GT
193 the “greater than” bit
194
195 REL_ARCH
196 used for relations that describe an extra architecture filter, the
197 version part of the relation is interpreted as architecture.
198
199 Special Solvable Ids
200
201 SOLVID_META
202 Access the meta section of a repository or repodata area. This is
203 like an extra Solvable that has the Id SOLVID_META.
204
205 SOLVID_POS
206 Use the data position stored inside of the pool instead of
207 accessing some solvable by Id. The bindings have the Datapos
208 objects as an abstraction mechanism, so you most likely do not need
209 this constant.
210
211 Constant string Ids
212
213 ID_NULL
214 Always zero
215
216 ID_EMPTY
217 Always one, describes the empty string
218
219 SOLVABLE_NAME
220 The keyname Id of the name of the solvable.
221
222 ...
223 see the libsolv-constantids manpage for a list of fixed Ids.
224
226 The pool is libsolv’s central resource manager. A pool consists of
227 Solvables, Repositories, Dependencies, each indexed by Ids.
228
229 CLASS METHODS
230 Pool *Pool()
231 my $pool = solv::Pool->new();
232 pool = solv.Pool()
233 pool = Solv::Pool.new()
234
235 Create a new pool instance. In most cases you just need one pool. Note
236 that the returned object "owns" the pool, i.e. if the object is freed,
237 the pool is also freed. You can use the disown method to break this
238 ownership relation.
239
240 ATTRIBUTES
241 void *appdata; /* read/write */
242 $pool->{appdata}
243 pool.appdata
244 pool.appdata
245
246 Application specific data that may be used in any way by the code using
247 the pool.
248
249 Solvable solvables[]; /* read only */
250 my $solvable = $pool->{solvables}->[$solvid];
251 solvable = pool.solvables[solvid]
252 solvable = pool.solvables[solvid]
253
254 Look up a Solvable by its id.
255
256 Repo repos[]; /* read only */
257 my $repo = $pool->{repos}->[$repoid];
258 repo = pool.repos[repoid]
259 repo = pool.repos[repoid]
260
261 Look up a Repository by its id.
262
263 Repo *installed; /* read/write */
264 $pool->{installed} = $repo;
265 pool.installed = repo
266 pool.installed = repo
267
268 Define which repository contains all the installed packages.
269
270 const char *errstr; /* read only */
271 my $err = $pool->{errstr};
272 err = pool.errstr
273 err = pool.errstr
274
275 Return the last error string that was stored in the pool.
276
277 CONSTANTS
278 POOL_FLAG_PROMOTEEPOCH
279 Promote the epoch of the providing dependency to the requesting
280 dependency if it does not contain an epoch. Used at some time in
281 old rpm versions, modern systems should never need this.
282
283 POOL_FLAG_FORBIDSELFCONFLICTS
284 Disallow the installation of packages that conflict with
285 themselves. Debian always allows self-conflicting packages, rpm
286 used to forbid them but switched to also allowing them since
287 rpm-4.9.0.
288
289 POOL_FLAG_OBSOLETEUSESPROVIDES
290 Make obsolete type dependency match against provides instead of
291 just the name and version of packages. Very old versions of rpm
292 used the name/version, then it got switched to provides and later
293 switched back again to just name/version.
294
295 POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES
296 An implicit obsoletes is the internal mechanism to remove the old
297 package on an update. The default is to remove all packages with
298 the same name, rpm-5 switched to also removing packages providing
299 the same name.
300
301 POOL_FLAG_OBSOLETEUSESCOLORS
302 Rpm’s multilib implementation distinguishes between 32bit and 64bit
303 packages (the terminology is that they have a different color). If
304 obsoleteusescolors is set, packages with different colors will not
305 obsolete each other.
306
307 POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS
308 Same as POOL_FLAG_OBSOLETEUSESCOLORS, but used to find out if
309 packages of the same name can be installed in parallel. For current
310 Fedora systems, POOL_FLAG_OBSOLETEUSESCOLORS should be false and
311 POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS should be true (this is the
312 default if FEDORA is defined when libsolv is compiled).
313
314 POOL_FLAG_NOINSTALLEDOBSOLETES
315 Since version 4.9.0 rpm considers the obsoletes of installed
316 packages when checking for dependency conflicts, thus you may not
317 install a package that is obsoleted by some other installed package
318 unless you also erase the other package.
319
320 POOL_FLAG_HAVEDISTEPOCH
321 Mandriva added a new field called distepoch that gets checked in
322 version comparison if the epoch/version/release of two packages are
323 the same.
324
325 POOL_FLAG_NOOBSOLETESMULTIVERSION
326 If a package is installed in multiversion mode, rpm used to ignore
327 both the implicit obsoletes and the obsolete dependency of a
328 package. This was changed to ignoring just the implicit obsoletes,
329 thus you may install multiple versions of the same name, but
330 obsoleted packages still get removed.
331
332 POOL_FLAG_ADDFILEPROVIDESFILTERED
333 Make the addfileprovides method only add files from the standard
334 locations (i.e. the “bin” and “etc” directories). This is useful if
335 you have only few packages that use non-standard file dependencies,
336 but you still want the fast speed that addfileprovides() generates.
337
338 METHODS
339 void free()
340 $pool->free();
341 pool.free()
342 pool.free()
343
344 Force a free of the pool. After this call, you must not access any
345 object that still references the pool.
346
347 void disown()
348 $pool->disown();
349 pool.disown()
350 pool.disown()
351
352 Break the ownership relation between the binding object and the pool.
353 After this call, the pool will not get freed even if the object goes
354 out of scope. This also means that you must manually call the free
355 method to free the pool data.
356
357 void setdebuglevel(int level)
358 $pool->setdebuglevel($level);
359 pool.setdebuglevel(level)
360 pool.setdebuglevel(level)
361
362 Set the debug level. A value of zero means no debug output, the higher
363 the value, the more output is generated.
364
365 int set_flag(int flag, int value)
366 my $oldvalue = $pool->set_flag($flag, $value);
367 oldvalue = pool.set_flag(flag, value)
368 oldvalue = pool.set_flag(flag, value)
369
370 int get_flag(int flag)
371 my $value = $pool->get_flag($flag);
372 value = pool.get_flag(flag)
373 value = pool.get_flag(flag)
374
375 Set/get a pool specific flag. The flags define how the system works,
376 e.g. how the package manager treats obsoletes. The default flags should
377 be sane for most applications, but in some cases you may want to tweak
378 a flag, for example if you want to solve package dependencies for some
379 other system.
380
381 void set_rootdir(const char *rootdir)
382 $pool->set_rootdir(rootdir);
383 pool.set_rootdir(rootdir)
384 pool.set_rootdir(rootdir)
385
386 const char *get_rootdir()
387 my $rootdir = $pool->get_rootdir();
388 rootdir = pool.get_rootdir()
389 rootdir = pool.get_rootdir()
390
391 Set/get the rootdir to use. This is useful if you want package
392 management to work only in some directory, for example if you want to
393 setup a chroot jail. Note that the rootdir will only be prepended to
394 file paths if the REPO_USE_ROOTDIR flag is used.
395
396 void setarch(const char *arch = 0)
397 $pool->setarch();
398 pool.setarch()
399 pool.setarch()
400
401 Set the architecture for your system. The architecture is used to
402 determine which packages are installable. It defaults to the result of
403 “uname -m”.
404
405 Repo add_repo(const char *name)
406 $repo = $pool->add_repo($name);
407 repo = pool.add_repo(name)
408 repo = pool.add_repo(name)
409
410 Add a Repository with the specified name to the pool. The repository is
411 empty on creation, use the repository methods to populate it with
412 packages.
413
414 Repoiterator repos_iter()
415 for my $repo (@{$pool->repos_iter()})
416 for repo in pool.repos_iter():
417 for repo in pool.repos_iter()
418
419 Iterate over the existing repositories.
420
421 Solvableiterator solvables_iter()
422 for my $solvable (@{$pool->solvables_iter()})
423 for solvable in pool.solvables_iter():
424 for solvable in pool.solvables_iter()
425
426 Iterate over the existing solvables.
427
428 Dep Dep(const char *str, bool create = 1)
429 my $dep = $pool->Dep($string);
430 dep = pool.Dep(string)
431 dep = pool.Dep(string)
432
433 Create an object describing a string or dependency. If the string is
434 currently not in the pool and create is false, undef/None/nil is
435 returned.
436
437 void addfileprovides()
438 $pool->addfileprovides();
439 pool.addfileprovides()
440 pool.addfileprovides()
441
442 Id *addfileprovides_queue()
443 my @ids = $pool->addfileprovides_queue();
444 ids = pool.addfileprovides_queue()
445 ids = pool.addfileprovides_queue()
446
447 Some package managers like rpm allow dependencies on files contained in
448 other packages. To allow libsolv to deal with those dependencies in an
449 efficient way, you need to call the addfileprovides method after
450 creating and reading all repositories. This method will scan all
451 dependency for file names and then scan all packages for matching
452 files. If a filename has been matched, it will be added to the provides
453 list of the corresponding package. The addfileprovides_queue variant
454 works the same way but returns an array containing all file
455 dependencies. This information can be stored in the meta section of the
456 repositories to speed up the next time the repository is loaded and
457 addfileprovides is called.
458
459 void createwhatprovides()
460 $pool->createwhatprovides();
461 pool.createwhatprovides()
462 pool.createwhatprovides()
463
464 Create the internal “whatprovides” hash over all of the provides of all
465 installable packages. This method must be called before doing any
466 lookups on provides. It’s encouraged to do it right after all repos are
467 set up, usually right after the call to addfileprovides().
468
469 Solvable *whatprovides(DepId dep)
470 my @solvables = $pool->whatprovides($dep);
471 solvables = pool.whatprovides(dep)
472 solvables = pool.whatprovides(dep)
473
474 Return all solvables that provide the specified dependency. You can use
475 either a Dep object or a simple Id as argument.
476
477 Solvable *best_solvables(Solvable *solvables, int flags = 0)
478 my @solvables = $pool->best_solvables($solvables);
479 solvables = pool.best_solvables(solvables)
480 solvables = pool.best_solvables(solvables)
481
482 Filter list of solvables by repo priority, architecture and version.
483
484 Solvable *whatcontainsdep(Id keyname, DepId dep, Id marker = -1)
485 my @solvables = $pool->whatcontainsdep($keyname, $dep)
486 solvables = pool.whatcontainsdep(keyname, dep)
487 solvables = pool.whatcontainsdep(keyname, dep)
488
489 Return all solvables for which keyname contains the dependency.
490
491 Solvable *whatmatchesdep(Id keyname, DepId dep, Id marker = -1)
492 my @solvables = $pool->whatmatchesdep($keyname, $sdep)
493 solvables = pool.whatmatchesdep(keyname, dep)
494 solvables = pool.whatmatchesdep(keyname, dep)
495
496 Return all solvables that have dependencies in keyname that match the
497 dependency.
498
499 Solvable *whatmatchessolvable(Id keyname, Solvable solvable, Id marker = -1)
500 my @solvables = $pool->whatmatchessolvable($keyname, $solvable)
501 solvables = pool.whatmatchessolvable(keyname, solvable)
502 solvables = pool.whatmatchessolvable(keyname, solvable)
503
504 Return all solvables that match package dependencies against solvable’s
505 provides.
506
507 Id *matchprovidingids(const char *match, int flags)
508 my @ids = $pool->matchprovidingids($match, $flags);
509 ids = pool.matchprovidingids(match, flags)
510 ids = pool.matchprovidingids(match, flags)
511
512 Search the names of all provides and return the ones matching the
513 specified string. See the Dataiterator class for the allowed flags.
514
515 Id towhatprovides(Id *ids)
516 my $offset = $pool->towhatprovides(\@ids);
517 offset = pool.towhatprovides(ids)
518 offset = pool.towhatprovides(ids)
519
520 “Internalize” an array containing Ids. The returned value can be used
521 to create solver jobs working on a specific set of packages. See the
522 Solver class for more information.
523
524 void set_namespaceproviders(DepId ns, DepId evr, bool value = 1)
525 $pool->set_namespaceproviders($ns, $evr, 1);
526 pool.set_namespaceproviders(ns, evr, True)
527 pool.set_namespaceproviders(ns, evr, true)
528
529 Manually set a namespace provides entry in the whatprovides index.
530
531 void flush_namespaceproviders(DepId ns, DepId evr)
532 $pool->flush_namespaceproviders($ns, $evr);
533 $pool.flush_namespaceproviders(ns, evr)
534 $pool.flush_namespaceproviders(ns, evr)
535
536 Flush the cache of all namespaceprovides matching the specified
537 namespace dependency. You can use zero as a wildcard argument.
538
539 bool isknownarch(DepId id)
540 my $bool = $pool->isknownarch($id);
541 bool = pool.isknownarch(id)
542 bool = pool.isknownarch?(id)
543
544 Return true if the specified Id describes a known architecture.
545
546 Solver Solver()
547 my $solver = $pool->Solver();
548 solver = pool.Solver()
549 solver = pool.Solver()
550
551 Create a new solver object.
552
553 Job Job(int how, Id what)
554 my $job = $pool->Job($how, $what);
555 job = pool.Job(how, what)
556 job = pool.Job(how, what)
557
558 Create a new Job object. Kind of low level, in most cases you would
559 instead use a Selection or Dep job constructor.
560
561 Selection Selection()
562 my $sel = $pool->Selection();
563 sel = pool.Selection()
564 sel = pool.Selection()
565
566 Create an empty selection. Useful as a starting point for merging other
567 selections.
568
569 Selection Selection_all()
570 my $sel = $pool->Selection_all();
571 sel = pool.Selection_all()
572 sel = pool.Selection_all()
573
574 Create a selection containing all packages. Useful as starting point
575 for intersecting other selections or for update/distupgrade jobs.
576
577 Selection select(const char *name, int flags)
578 my $sel = $pool->select($name, $flags);
579 sel = pool.select(name, flags)
580 sel = pool.select(name, flags)
581
582 Create a selection by matching packages against the specified string.
583 See the Selection class for a list of flags and how to create solver
584 jobs from a selection.
585
586 Selection matchdeps(const char *name, int flags, Id keyname, Id marker = -1)
587 my $sel = $pool->matchdeps($name, $flags, $keyname);
588 sel = pool.matchdeps(name, flags, keyname)
589 sel = pool.matchdeps(name, flags, keyname)
590
591 Create a selection by matching package dependencies against the
592 specified string. This can be used if you want to match other
593 dependency types than “provides”.
594
595 Selection matchdepid(DepId dep, int flags, Id keyname, Id marker = -1)
596 my $sel = $pool->matchdepid($dep, $flags, $keyname);
597 sel = pool.matchdepid(dep, flags, keyname)
598 sel = pool.matchdepid(dep, flags, keyname)
599
600 Create a selection by matching package dependencies against the
601 specified dependency. This may be faster than matchdeps and also works
602 with complex dependencies. The downside is that you cannot use globs or
603 case insensitive matching.
604
605 Selection matchsolvable(Solvable solvable, int flags, Id keyname, Id marker = -1)
606 my $sel = $pool->matchsolvable($solvable, $flags, $keyname);
607 sel = pool.matchsolvable(solvable, flags, keyname)
608 sel = pool.matchsolvable(solvable, flags, keyname)
609
610 Create a selection by matching package dependencies against the
611 specified solvable’s provides.
612
613 void setpooljobs(Jobs *jobs)
614 $pool->setpooljobs(\@jobs);
615 pool.setpooljobs(jobs)
616 pool.setpooljobs(jobs)
617
618 Job *getpooljobs()
619 @jobs = $pool->getpooljobs();
620 jobs = pool.getpooljobs()
621 jobs = pool.getpooljobs()
622
623 Get/Set fixed jobs stored in the pool. Those jobs are automatically
624 appended to all solver jobs, they are meant for fixed configurations
625 like which packages can be multiversion installed, which packages were
626 userinstalled, or which packages must not be erased.
627
628 void set_loadcallback(Callable *callback)
629 $pool->setloadcallback(\&callbackfunction);
630 pool.setloadcallback(callbackfunction)
631 pool.setloadcallback { |repodata| ... }
632
633 Set the callback function called when repository metadata needs to be
634 loaded on demand. To make use of this feature, you need to create
635 repodata stubs that tell the library which data is available but not
636 loaded. If later on the data needs to be accessed, the callback
637 function is called with a repodata argument. You can then load the data
638 (maybe fetching it first from a remote server). The callback should
639 return true if the data has been made available.
640
641 /* bindings only */
642 $pool->appdata_disown()
643 pool.appdata_disown()
644 pool.appdata_disown()
645
646 Decrement the reference count of the appdata object. This can be used
647 to break circular references (e.g. if the pool’s appdata value points
648 to some meta data structure that contains a pool handle). If used
649 incorrectly, this method can lead to application crashes, so beware.
650 (This method is a no-op for ruby and tcl.)
651
652 Id *get_considered_list()
653 my @ids = $pool->get_considered_list();
654 ids = pool.get_considered_list()
655 ids = pool.get_considered_list()
656
657 void set_considered_list(Id *ids)
658 $pool->set_considered_list(\@ids);
659 pool.set_considered_list(ids)
660 pool.set_considered_list(ids)
661
662 Get/set the list of solvables that are eligible for installation. Note
663 that you need to recreate the whatprovides hash after changing the
664 list.
665
666 Id *get_disabled_list()
667 my @ids = $pool->get_disabled_list();
668 ids = pool.get_disabled_list()
669 ids = pool.get_disabled_list()
670
671 void set_disabled_list(Id *ids)
672 $pool->set_disabled_list(\@ids);
673 pool.set_disabled_list(ids)
674 pool.set_disabled_list(ids)
675
676 Get/set the list of solvables that are not eligible for installation.
677 This is basically the inverse of the “considered” methods above, i.e.
678 calling “set_disabled_list()” with an empty list will make all
679 solvables eligible for installation. Note you need to recreate the
680 whatprovides hash after changing the list.
681
682 DATA RETRIEVAL METHODS
683 In the following functions, the keyname argument describes what to
684 retrieve. For the standard cases you can use the available Id
685 constants. For example,
686
687 $solv::SOLVABLE_SUMMARY
688 solv.SOLVABLE_SUMMARY
689 Solv::SOLVABLE_SUMMARY
690
691 selects the “Summary” entry of a solvable. The solvid argument selects
692 the desired solvable by Id.
693
694 const char *lookup_str(Id solvid, Id keyname)
695 my $string = $pool->lookup_str($solvid, $keyname);
696 string = pool.lookup_str(solvid, keyname)
697 string = pool.lookup_str(solvid, keyname)
698
699 Id lookup_id(Id solvid, Id keyname)
700 my $id = $pool->lookup_id($solvid, $keyname);
701 id = pool.lookup_id(solvid, keyname)
702 id = pool.lookup_id(solvid, keyname)
703
704 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
705 my $num = $pool->lookup_num($solvid, $keyname);
706 num = pool.lookup_num(solvid, keyname)
707 num = pool.lookup_num(solvid, keyname)
708
709 bool lookup_void(Id solvid, Id keyname)
710 my $bool = $pool->lookup_void($solvid, $keyname);
711 bool = pool.lookup_void(solvid, keyname)
712 bool = pool.lookup_void(solvid, keyname)
713
714 Id *lookup_idarray(Id solvid, Id keyname)
715 my @ids = $pool->lookup_idarray($solvid, $keyname);
716 ids = pool.lookup_idarray(solvid, keyname)
717 ids = pool.lookup_idarray(solvid, keyname)
718
719 Chksum lookup_checksum(Id solvid, Id keyname)
720 my $chksum = $pool->lookup_checksum($solvid, $keyname);
721 chksum = pool.lookup_checksum(solvid, keyname)
722 chksum = pool.lookup_checksum(solvid, keyname)
723
724 Lookup functions. Return the data element stored in the specified
725 solvable. You should probably use the methods of the Solvable class
726 instead.
727
728 Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
729 my $di = $pool->Dataiterator($keyname, $match, $flags);
730 di = pool.Dataiterator(keyname, match, flags)
731 di = pool.Dataiterator(keyname, match, flags)
732
733 Dataiterator Dataiterator_solvid(Id solvid, Id keyname, const char *match = 0, int flags = 0)
734 my $di = $pool->Dataiterator($solvid, $keyname, $match, $flags);
735 di = pool.Dataiterator(solvid, keyname, match, flags)
736 di = pool.Dataiterator(solvid, keyname, match, flags)
737
738 for my $d (@$di)
739 for d in di:
740 for d in di
741
742 Iterate over the matching data elements. See the Dataiterator class for
743 more information. The Dataiterator method iterates over all solvables
744 in the pool, whereas the Dataiterator_solvid only iterates over the
745 specified solvable.
746
747 ID METHODS
748 The following methods deal with Ids, i.e. integers representing objects
749 in the pool. They are considered “low level”, in most cases you would
750 not use them but instead the object orientated methods.
751
752 Repo id2repo(Id id)
753 $repo = $pool->id2repo($id);
754 repo = pool.id2repo(id)
755 repo = pool.id2repo(id)
756
757 Lookup an existing Repository by id. You can also do this by using the
758 repos attribute.
759
760 Solvable id2solvable(Id id)
761 $solvable = $pool->id2solvable($id);
762 solvable = pool.id2solvable(id)
763 solvable = pool.id2solvable(id)
764
765 Lookup an existing Repository by id. You can also do this by using the
766 solvables attribute.
767
768 const char *solvid2str(Id id)
769 my $str = $pool->solvid2str($id);
770 str = pool.solvid2str(id)
771 str = pool.solvid2str(id)
772
773 Return a string describing the Solvable with the specified id. The
774 string consists of the name, version, and architecture of the Solvable.
775
776 Id str2id(const char *str, bool create = 1)
777 my $id = pool->str2id($string);
778 id = pool.str2id(string)
779 id = pool.str2id(string)
780
781 const char *id2str(Id id)
782 $string = pool->id2str($id);
783 string = pool.id2str(id)
784 string = pool.id2str(id)
785
786 Convert a string into an Id and back. If the string is currently not in
787 the pool and create is false, zero is returned.
788
789 Id rel2id(Id name, Id evr, int flags, bool create = 1)
790 my $id = pool->rel2id($nameid, $evrid, $flags);
791 id = pool.rel2id(nameid, evrid, flags)
792 id = pool.rel2id(nameid, evrid, flags)
793
794 Create a “relational” dependency. Such dependencies consist of a name
795 part, flags describing the relation, and a version part. The flags are:
796
797 $solv::REL_EQ | $solv::REL_GT | $solv::REL_LT
798 solv.REL_EQ | solv.REL_GT | solv.REL_LT
799 Solv::REL_EQ | Solv::REL_GT | Solv::REL_LT
800
801 Thus, if you want a “<=” relation, you would use REL_LT | REL_EQ.
802
803 Id id2langid(Id id, const char *lang, bool create = 1)
804 my $id = $pool->id2langid($id, $language);
805 id = pool.id2langid(id, language)
806 id = pool.id2langid(id, language)
807
808 Create a language specific Id from some other id. This function simply
809 converts the id into a string, appends a dot and the specified language
810 to the string and converts the result back into an Id.
811
812 const char *dep2str(Id id)
813 $string = pool->dep2str($id);
814 string = pool.dep2str(id)
815 string = pool.dep2str(id)
816
817 Convert a dependency id into a string. If the id is just a string, this
818 function has the same effect as id2str(). For relational dependencies,
819 the result is the correct “name relation evr” string.
820
822 The dependency class is an object orientated way to work with strings
823 and dependencies. Internally, dependencies are represented as Ids, i.e.
824 simple numbers. Dependency objects can be constructed by using the
825 Pool’s Dep() method.
826
827 ATTRIBUTES
828 Pool *pool; /* read only */
829 $dep->{pool}
830 dep.pool
831 dep.pool
832
833 Back reference to the pool this dependency belongs to.
834
835 Id id; /* read only */
836 $dep->{id}
837 dep.id
838 dep.id
839
840 The id of this dependency.
841
842 METHODS
843 Dep Rel(int flags, DepId evrid, bool create = 1)
844 my $reldep = $dep->Rel($flags, $evrdep);
845 reldep = dep.Rel(flags, evrdep)
846 reldep = dep.Rel(flags, evrdep)
847
848 Create a relational dependency from the caller dependency, the flags,
849 and a dependency describing the “version” part. See the pool’s rel2id
850 method for a description of the flags.
851
852 Selection Selection_name(int setflags = 0)
853 my $sel = $dep->Selection_name();
854 sel = dep.Selection_name()
855 sel = dep.Selection_name()
856
857 Create a Selection from a dependency. The selection consists of all
858 packages that have a name equal to the dependency. If the dependency is
859 of a relational type, the packages version must also fulfill the
860 dependency.
861
862 Selection Selection_provides(int setflags = 0)
863 my $sel = $dep->Selection_provides();
864 sel = dep.Selection_provides()
865 sel = dep.Selection_provides()
866
867 Create a Selection from a dependency. The selection consists of all
868 packages that have at least one provides matching the dependency.
869
870 const char *str()
871 my $str = $dep->str();
872 str = $dep.str()
873 str = $dep.str()
874
875 Return a string describing the dependency.
876
877 <stringification>
878 my $str = $dep->str;
879 str = str(dep)
880 str = dep.to_s
881
882 Same as calling the str() method.
883
884 <equality>
885 if ($dep1 == $dep2)
886 if dep1 == dep2:
887 if dep1 == dep2
888
889 Two dependencies are equal if they are part of the same pool and have
890 the same ids.
891
893 A Repository describes a group of packages, normally coming from the
894 same source. Repositories are created by the Pool’s add_repo() method.
895
896 ATTRIBUTES
897 Pool *pool; /* read only */
898 $repo->{pool}
899 repo.pool
900 repo.pool
901
902 Back reference to the pool this dependency belongs to.
903
904 Id id; /* read only */
905 $repo->{id}
906 repo.id
907 repo.id
908
909 The id of the repository.
910
911 const char *name; /* read/write */
912 $repo->{name}
913 repo.name
914 repo.name
915
916 The repositories name. To libsolv, the name is just a string with no
917 specific meaning.
918
919 int priority; /* read/write */
920 $repo->{priority}
921 repo.priority
922 repo.priority
923
924 The priority of the repository. A higher number means that packages of
925 this repository will be chosen over other repositories, even if they
926 have a greater package version.
927
928 int subpriority; /* read/write */
929 $repo->{subpriority}
930 repo.subpriority
931 repo.subpriority
932
933 The sub-priority of the repository. This value is compared when the
934 priorities of two repositories are the same. It is useful to make the
935 library prefer on-disk repositories to remote ones.
936
937 int nsolvables; /* read only */
938 $repo->{nsolvables}
939 repo.nsolvables
940 repo.nsolvables
941
942 The number of solvables in this repository.
943
944 void *appdata; /* read/write */
945 $repo->{appdata}
946 repo.appdata
947 repo.appdata
948
949 Application specific data that may be used in any way by the code using
950 the repository.
951
952 Datapos *meta; /* read only */
953 $repo->{meta}
954 repo.meta
955 repo.meta
956
957 Return a Datapos object of the repodata’s metadata. You can use the
958 lookup methods of the Datapos class to lookup metadata attributes, like
959 the repository timestamp.
960
961 CONSTANTS
962 REPO_REUSE_REPODATA
963 Reuse the last repository data area (“repodata”) instead of
964 creating a new area.
965
966 REPO_NO_INTERNALIZE
967 Do not internalize the added repository data. This is useful if you
968 plan to add more data because internalization is a costly
969 operation.
970
971 REPO_LOCALPOOL
972 Use the repodata’s pool for Id storage instead of the global pool.
973 Useful if you don’t want to pollute the global pool with many
974 unneeded ids, like when storing the filelist.
975
976 REPO_USE_LOADING
977 Use the repodata that is currently being loaded instead of creating
978 a new one. This only makes sense if used in a load callback.
979
980 REPO_EXTEND_SOLVABLES
981 Do not create new solvables for the new data, but match existing
982 solvables and add the data to them. Repository metadata is often
983 split into multiple parts, with one primary file describing all
984 packages and other parts holding information that is normally not
985 needed, like the changelog.
986
987 REPO_USE_ROOTDIR
988 Prepend the pool’s rootdir to the path when doing file operations.
989
990 REPO_NO_LOCATION
991 Do not add a location element to the solvables. Useful if the
992 solvables are not in the final position, so you can add the correct
993 location later in your code.
994
995 SOLV_ADD_NO_STUBS
996 Do not create stubs for repository parts that can be downloaded on
997 demand.
998
999 SUSETAGS_RECORD_SHARES
1000 This is specific to the add_susetags() method. Susetags allows one
1001 to refer to already read packages to save disk space. If this data
1002 sharing needs to work over multiple calls to add_susetags, you need
1003 to specify this flag so that the share information is made
1004 available to subsequent calls.
1005
1006 METHODS
1007 void free(bool reuseids = 0)
1008 $repo->free();
1009 repo.free()
1010 repo.free()
1011
1012 Free the repository and all solvables it contains. If reuseids is set
1013 to true, the solvable ids and the repository id may be reused by the
1014 library when added new solvables. Thus you should leave it false if you
1015 are not sure that somebody holds a reference.
1016
1017 void empty(bool reuseids = 0)
1018 $repo->empty();
1019 repo.empty()
1020 repo.empty()
1021
1022 Free all the solvables in a repository. The repository will be empty
1023 after this call. See the free() method for the meaning of reuseids.
1024
1025 bool isempty()
1026 $repo->isempty()
1027 repo.empty()
1028 repo.empty?
1029
1030 Return true if there are no solvables in this repository.
1031
1032 void internalize()
1033 $repo->internalize();
1034 repo.internalize()
1035 repo.internalize()
1036
1037 Internalize added data. Data must be internalized before it is
1038 available to the lookup and data iterator functions.
1039
1040 bool write(FILE *fp)
1041 $repo->write($fp)
1042 repo.write(fp)
1043 repo.write(fp)
1044
1045 Write a repo as a “solv” file. These files can be read very fast and
1046 thus are a good way to cache repository data. Returns false if there
1047 was some error writing the file.
1048
1049 Solvableiterator solvables_iter()
1050 for my $solvable (@{$repo->solvables_iter()})
1051 for solvable in repo.solvables_iter():
1052 for solvable in repo.solvables_iter()
1053
1054 Iterate over all solvables in a repository.
1055
1056 Repodata add_repodata(int flags = 0)
1057 my $repodata = $repo->add_repodata();
1058 repodata = repo.add_repodata()
1059 repodata = repo.add_repodata()
1060
1061 Add a new repodata area to the repository. This is normally
1062 automatically done by the repo_add methods, so you need this method
1063 only in very rare circumstances.
1064
1065 void create_stubs()
1066 $repo->create_stubs();
1067 repo.create_stubs()
1068 repo.create_stubs()
1069
1070 Calls the create_stubs() repodata method for the last repodata of the
1071 repository.
1072
1073 bool iscontiguous()
1074 $repo->iscontiguous()
1075 repo.iscontiguous()
1076 repo.iscontiguous?
1077
1078 Return true if the solvables of this repository are all in a single
1079 block with no holes, i.e. they have consecutive ids.
1080
1081 Repodata first_repodata()
1082 my $repodata = $repo->first_repodata();
1083 repodata = repo.first_repodata()
1084 repodata = repo.first_repodata()
1085
1086 Checks if all repodatas but the first repodata are extensions, and
1087 return the first repodata if this is the case. Useful if you want to do
1088 a store/retrieve sequence on the repository to reduce the memory using
1089 and enable paging, as this does not work if the repository contains
1090 multiple non-extension repodata areas.
1091
1092 Selection Selection(int setflags = 0)
1093 my $sel = $repo->Selection();
1094 sel = repo.Selection()
1095 sel = repo.Selection()
1096
1097 Create a Selection consisting of all packages in the repository.
1098
1099 Dataiterator Dataiterator(Id key, const char *match = 0, int flags = 0)
1100 my $di = $repo->Dataiterator($keyname, $match, $flags);
1101 di = repo.Dataiterator(keyname, match, flags)
1102 di = repo.Dataiterator(keyname, match, flags)
1103
1104 Dataiterator Dataiterator_meta(Id key, const char *match = 0, int flags = 0)
1105 my $di = $repo->Dataiterator_meta($keyname, $match, $flags);
1106 di = repo.Dataiterator_meta(keyname, match, flags)
1107 di = repo.Dataiterator_meta(keyname, match, flags)
1108
1109 for my $d (@$di)
1110 for d in di:
1111 for d in di
1112
1113 Iterate over the matching data elements in this repository. See the
1114 Dataiterator class for more information. The Dataiterator() method
1115 iterates over all solvables in a repository, whereas the
1116 Dataiterator_meta method only iterates over the repository’s meta data.
1117
1118 <stringification>
1119 my $str = $repo->str;
1120 str = str(repo)
1121 str = repo.to_s
1122
1123 Return the name of the repository, or "Repo#<id>" if no name is set.
1124
1125 <equality>
1126 if ($repo1 == $repo2)
1127 if repo1 == repo2:
1128 if repo1 == repo2
1129
1130 Two repositories are equal if they belong to the same pool and have the
1131 same id.
1132
1133 DATA ADD METHODS
1134 Solvable add_solvable()
1135 $repo->add_solvable();
1136 repo.add_solvable()
1137 repo.add_solvable()
1138
1139 Add a single empty solvable to the repository. Returns a Solvable
1140 object, see the Solvable class for more information.
1141
1142 bool add_solv(const char *name, int flags = 0)
1143 $repo->add_solv($name);
1144 repo.add_solv(name)
1145 repo.add_solv(name)
1146
1147 bool add_solv(FILE *fp, int flags = 0)
1148 $repo->add_solv($fp);
1149 repo.add_solv(fp)
1150 repo.add_solv(fp)
1151
1152 Read a “solv” file and add its contents to the repository. These files
1153 can be written with the write() method and are normally used as fast
1154 cache for repository metadata.
1155
1156 bool add_rpmdb(int flags = 0)
1157 $repo->add_rpmdb();
1158 repo.add_rpmdb()
1159 repo.add_rpmdb()
1160
1161 bool add_rpmdb_reffp(FILE *reffp, int flags = 0)
1162 $repo->add_rpmdb_reffp($reffp);
1163 repo.add_rpmdb_reffp(reffp)
1164 repo.add_rpmdb_reffp(reffp)
1165
1166 Add the contents of the rpm database to the repository. If a solv file
1167 containing an old version of the database is available, it can be
1168 passed as reffp to speed up reading.
1169
1170 Solvable add_rpm(const char *filename, int flags = 0)
1171 my $solvable = $repo->add_rpm($filename);
1172 solvable = repo.add_rpm(filename)
1173 solvable = repo.add_rpm(filename)
1174
1175 Add the metadata of a single rpm package to the repository.
1176
1177 bool add_rpmdb_pubkeys(int flags = 0)
1178 $repo->add_rpmdb_pubkeys();
1179 repo.add_rpmdb_pubkeys()
1180 repo.add_rpmdb_pubkeys()
1181
1182 Add all pubkeys contained in the rpm database to the repository. Note
1183 that newer rpm versions also allow to store the pubkeys in some
1184 directory instead of the rpm database.
1185
1186 Solvable add_pubkey(const char *keyfile, int flags = 0)
1187 my $solvable = $repo->add_pubkey($keyfile);
1188 solvable = repo.add_pubkey(keyfile)
1189 solvable = repo.add_pubkey(keyfile)
1190
1191 Add a pubkey from a file to the repository.
1192
1193 bool add_rpmmd(FILE *fp, const char *language, int flags = 0)
1194 $repo->add_rpmmd($fp, undef);
1195 repo.add_rpmmd(fp, None)
1196 repo.add_rpmmd(fp, nil)
1197
1198 Add metadata stored in the "rpm-md" format (i.e. from files in the
1199 “repodata” directory) to a repository. Supported files are "primary",
1200 "filelists", "other", "suseinfo". Do not forget to specify the
1201 REPO_EXTEND_SOLVABLES for extension files like "filelists" and "other".
1202 Use the language parameter if you have language extension files,
1203 otherwise simply use a undef/None/nil parameter.
1204
1205 bool add_repomdxml(FILE *fp, int flags = 0)
1206 $repo->add_repomdxml($fp);
1207 repo.add_repomdxml(fp)
1208 repo.add_repomdxml(fp)
1209
1210 Add the repomd.xml meta description from the "rpm-md" format to the
1211 repository. This file contains information about the repository like
1212 keywords, and also a list of all database files with checksums. The
1213 data is added to the "meta" section of the repository, i.e. no package
1214 gets created.
1215
1216 bool add_updateinfoxml(FILE *fp, int flags = 0)
1217 $repo->add_updateinfoxml($fp);
1218 repo.add_updateinfoxml(fp)
1219 repo.add_updateinfoxml(fp)
1220
1221 Add the updateinfo.xml file containing available maintenance updates to
1222 the repository. All updates are created as special packages that have a
1223 "patch:" prefix in their name.
1224
1225 bool add_deltainfoxml(FILE *fp, int flags = 0)
1226 $repo->add_deltainfoxml($fp);
1227 repo.add_deltainfoxml(fp)
1228 repo.add_deltainfoxml(fp)
1229
1230 Add the deltainfo.xml file (also called prestodelta.xml) containing
1231 available delta-rpms to the repository. The data is added to the "meta"
1232 section, i.e. no package gets created.
1233
1234 bool add_debdb(int flags = 0)
1235 $repo->add_debdb();
1236 repo.add_debdb()
1237 repo.add_debdb()
1238
1239 Add the contents of the debian installed package database to the
1240 repository.
1241
1242 bool add_debpackages(FILE *fp, int flags = 0)
1243 $repo->add_debpackages($fp);
1244 repo.add_debpackages($fp)
1245 repo.add_debpackages($fp)
1246
1247 Add the contents of the debian repository metadata (the "packages"
1248 file) to the repository.
1249
1250 Solvable add_deb(const char *filename, int flags = 0)
1251 my $solvable = $repo->add_deb($filename);
1252 solvable = repo.add_deb(filename)
1253 solvable = repo.add_deb(filename)
1254
1255 Add the metadata of a single deb package to the repository.
1256
1257 bool add_mdk(FILE *fp, int flags = 0)
1258 $repo->add_mdk($fp);
1259 repo.add_mdk(fp)
1260 repo.add_mdk(fp)
1261
1262 Add the contents of the mageia/mandriva repository metadata (the
1263 "synthesis.hdlist" file) to the repository.
1264
1265 bool add_mdk_info(FILE *fp, int flags = 0)
1266 $repo->add_mdk_info($fp);
1267 repo.add_mdk_info(fp)
1268 repo.add_mdk_info(fp)
1269
1270 Extend the packages from the synthesis file with the info.xml and
1271 files.xml data. Do not forget to specify REPO_EXTEND_SOLVABLES.
1272
1273 bool add_arch_repo(FILE *fp, int flags = 0)
1274 $repo->add_arch_repo($fp);
1275 repo.add_arch_repo(fp)
1276 repo.add_arch_repo(fp)
1277
1278 Add the contents of the archlinux repository metadata (the ".db.tar"
1279 file) to the repository.
1280
1281 bool add_arch_local(const char *dir, int flags = 0)
1282 $repo->add_arch_local($dir);
1283 repo.add_arch_local(dir)
1284 repo.add_arch_local(dir)
1285
1286 Add the contents of the archlinux installed package database to the
1287 repository. The dir parameter is usually set to
1288 "/var/lib/pacman/local".
1289
1290 bool add_content(FILE *fp, int flags = 0)
1291 $repo->add_content($fp);
1292 repo.add_content(fp)
1293 repo.add_content(fp)
1294
1295 Add the “content” meta description from the susetags format to the
1296 repository. This file contains information about the repository like
1297 keywords, and also a list of all database files with checksums. The
1298 data is added to the "meta" section of the repository, i.e. no package
1299 gets created.
1300
1301 bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0)
1302 $repo->add_susetags($fp, $defvendor, $language);
1303 repo.add_susetags(fp, defvendor, language)
1304 repo.add_susetags(fp, defvendor, language)
1305
1306 Add repository metadata in the susetags format to the repository. Like
1307 with add_rpmmd, you can specify a language if you have language
1308 extension files. The defvendor parameter provides a default vendor for
1309 packages with missing vendors, it is usually provided in the content
1310 file.
1311
1312 bool add_products(const char *dir, int flags = 0)
1313 $repo->add_products($dir);
1314 repo.add_products(dir)
1315 repo.add_products(dir)
1316
1317 Add the installed SUSE products database to the repository. The dir
1318 parameter is usually "/etc/products.d".
1319
1321 A solvable describes all the information of one package. Each solvable
1322 belongs to one repository, it can be added and filled manually but in
1323 most cases solvables will get created by the repo_add methods.
1324
1325 ATTRIBUTES
1326 Repo *repo; /* read only */
1327 $solvable->{repo}
1328 solvable.repo
1329 solvable.repo
1330
1331 The repository this solvable belongs to.
1332
1333 Pool *pool; /* read only */
1334 $solvable->{pool}
1335 solvable.pool
1336 solvable.pool
1337
1338 The pool this solvable belongs to, same as the pool of the repo.
1339
1340 Id id; /* read only */
1341 $solvable->{id}
1342 solvable.id
1343 solvable.id
1344
1345 The specific id of the solvable.
1346
1347 char *name; /* read/write */
1348 $solvable->{name}
1349 solvable.name
1350 solvable.name
1351
1352 char *evr; /* read/write */
1353 $solvable->{evr}
1354 solvable.evr
1355 solvable.evr
1356
1357 char *arch; /* read/write */
1358 $solvable->{arch}
1359 solvable.arch
1360 solvable.arch
1361
1362 char *vendor; /* read/write */
1363 $solvable->{vendor}
1364 solvable.vendor
1365 solvable.vendor
1366
1367 Easy access to often used attributes of solvables. They are internally
1368 stored as Ids.
1369
1370 Id nameid; /* read/write */
1371 $solvable->{nameid}
1372 solvable.nameid
1373 solvable.nameid
1374
1375 Id evrid; /* read/write */
1376 $solvable->{evrid}
1377 solvable.evrid
1378 solvable.evrid
1379
1380 Id archid; /* read/write */
1381 $solvable->{archid}
1382 solvable.archid
1383 solvable.archid
1384
1385 Id vendorid; /* read/write */
1386 $solvable->{vendorid}
1387 solvable.vendorid
1388 solvable.vendorid
1389
1390 Raw interface to the ids. Useful if you want to search for a specific
1391 id and want to avoid the string compare overhead.
1392
1393 METHODS
1394 const char *lookup_str(Id keyname)
1395 my $string = $solvable->lookup_str($keyname);
1396 string = solvable.lookup_str(keyname)
1397 string = solvable.lookup_str(keyname)
1398
1399 Id lookup_id(Id keyname)
1400 my $id = $solvable->lookup_id($keyname);
1401 id = solvable.lookup_id(keyname)
1402 id = solvable.lookup_id(keyname)
1403
1404 unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
1405 my $num = $solvable->lookup_num($keyname);
1406 num = solvable.lookup_num(keyname)
1407 num = solvable.lookup_num(keyname)
1408
1409 bool lookup_void(Id keyname)
1410 my $bool = $solvable->lookup_void($keyname);
1411 bool = solvable.lookup_void(keyname)
1412 bool = solvable.lookup_void(keyname)
1413
1414 Chksum lookup_checksum(Id keyname)
1415 my $chksum = $solvable->lookup_checksum($keyname);
1416 chksum = solvable.lookup_checksum(keyname)
1417 chksum = solvable.lookup_checksum(keyname)
1418
1419 Id *lookup_idarray(Id keyname, Id marker = -1)
1420 my @ids = $solvable->lookup_idarray($keyname);
1421 ids = solvable.lookup_idarray(keyname)
1422 ids = solvable.lookup_idarray(keyname)
1423
1424 Dep *lookup_deparray(Id keyname, Id marker = -1)
1425 my @deps = $solvable->lookup_deparray($keyname);
1426 deps = solvable.lookup_deparray(keyname)
1427 deps = solvable.lookup_deparray(keyname)
1428
1429 Generic lookup methods. Retrieve data stored for the specific keyname.
1430 The lookup_idarray() method will return an array of Ids, use
1431 lookup_deparray if you want an array of Dependency objects instead.
1432 Some Id arrays contain two parts of data divided by a specific marker,
1433 for example the provides array uses the SOLVABLE_FILEMARKER id to store
1434 both the ids provided by the package and the ids added by the
1435 addfileprovides method. The default, -1, translates to the correct
1436 marker for the keyname and returns the first part of the array, use 1
1437 to select the second part or 0 to retrieve all ids including the
1438 marker.
1439
1440 const char *lookup_location(unsigned int *OUTPUT);
1441 my ($location, $mediano) = $solvable->lookup_location();
1442 location, mediano = solvable.lookup_location()
1443 location, mediano = solvable.lookup_location()
1444
1445 Return a tuple containing the on-media location and an optional media
1446 number for multi-part repositories (e.g. repositories spawning multiple
1447 DVDs).
1448
1449 const char *lookup_sourcepkg();
1450 my $sourcepkg = $solvable->lookup_sourcepkg();
1451 sourcepkg = solvable.lookup_sourcepkg()
1452 sourcepkg = solvable.lookup_sourcepkg()
1453
1454 Return a sourcepkg name associated with solvable.
1455
1456 Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
1457 my $di = $solvable->Dataiterator($keyname, $match, $flags);
1458 di = solvable.Dataiterator(keyname, match, flags)
1459 di = solvable.Dataiterator(keyname, match, flags)
1460
1461 for my $d (@$di)
1462 for d in di:
1463 for d in di
1464
1465 Iterate over the matching data elements. See the Dataiterator class for
1466 more information.
1467
1468 void add_deparray(Id keyname, DepId dep, Id marker = -1);
1469 $solvable->add_deparray($keyname, $dep);
1470 solvable.add_deparray(keyname, dep)
1471 solvable.add_deparray(keyname, dep)
1472
1473 Add a new dependency to the attributes stored in keyname.
1474
1475 void unset(Id keyname);
1476 $solvable->unset($keyname);
1477 solvable.unset(keyname)
1478 solvable.unset(keyname)
1479
1480 Delete data stored for the specific keyname.
1481
1482 bool installable();
1483 $solvable->installable()
1484 solvable.installable()
1485 solvable.installable?
1486
1487 Return true if the solvable is installable on the system. Solvables are
1488 not installable if the system does not support their architecture.
1489
1490 bool isinstalled();
1491 $solvable->isinstalled()
1492 solvable.isinstalled()
1493 solvable.isinstalled?
1494
1495 Return true if the solvable is installed on the system.
1496
1497 bool identical(Solvable *other)
1498 $solvable->identical($other)
1499 solvable.identical(other)
1500 solvable.identical?(other)
1501
1502 Return true if the two solvables are identical.
1503
1504 int evrcmp(Solvable *other)
1505 $solvable->evrcmp($other)
1506 solvable.evrcmp(other)
1507 solvable.evrcmp(other)
1508
1509 Returns -1 if the epoch/version/release of the solvable is less than
1510 the one from the other solvable, 1 if it is greater, and 0 if they are
1511 equal. Note that "equal" does not mean that the evr is identical.
1512
1513 int matchesdep(Id keyname, DepId id, Id marker = -1)
1514 $solvable->matchesdep($keyname, $dep)
1515 solvable.matchesdep(keyname, dep)
1516 solvable.matchesdep?(keyname, dep)
1517
1518 Return true if the dependencies stored in keyname match the specified
1519 dependency.
1520
1521 Selection Selection(int setflags = 0)
1522 my $sel = $solvable->Selection();
1523 sel = solvable.Selection()
1524 sel = solvable.Selection()
1525
1526 Create a Selection containing just the single solvable.
1527
1528 const char *str()
1529 my $str = $solvable->str();
1530 str = $solvable.str()
1531 str = $solvable.str()
1532
1533 Return a string describing the solvable. The string consists of the
1534 name, version, and architecture of the Solvable.
1535
1536 <stringification>
1537 my $str = $solvable->str;
1538 str = str(solvable)
1539 str = solvable.to_s
1540
1541 Same as calling the str() method.
1542
1543 <equality>
1544 if ($solvable1 == $solvable2)
1545 if solvable1 == solvable2:
1546 if solvable1 == solvable2
1547
1548 Two solvables are equal if they are part of the same pool and have the
1549 same ids.
1550
1552 Dataiterators can be used to do complex string searches or to iterate
1553 over arrays. They can be created via the constructors in the Pool,
1554 Repo, and Solvable classes. The Repo and Solvable constructors will
1555 limit the search to the repository or the specific package.
1556
1557 CONSTANTS
1558 SEARCH_STRING
1559 Return a match if the search string matches the value.
1560
1561 SEARCH_STRINGSTART
1562 Return a match if the value starts with the search string.
1563
1564 SEARCH_STRINGEND
1565 Return a match if the value ends with the search string.
1566
1567 SEARCH_SUBSTRING
1568 Return a match if the search string can be matched somewhere in the
1569 value.
1570
1571 SEARCH_GLOB
1572 Do a glob match of the search string against the value.
1573
1574 SEARCH_REGEX
1575 Do a regular expression match of the search string against the
1576 value.
1577
1578 SEARCH_NOCASE
1579 Ignore case when matching strings. Works for all the above match
1580 types.
1581
1582 SEARCH_FILES
1583 Match the complete filenames of the file list, not just the base
1584 name.
1585
1586 SEARCH_COMPLETE_FILELIST
1587 When matching the file list, check every file of the package not
1588 just the subset from the primary metadata.
1589
1590 SEARCH_CHECKSUMS
1591 Allow the matching of checksum entries.
1592
1593 METHODS
1594 void prepend_keyname(Id keyname);
1595 $di->prepend_keyname($keyname);
1596 di.prepend_keyname(keyname)
1597 di.prepend_keyname(keyname)
1598
1599 Do a sub-search in the array stored in keyname.
1600
1601 void skip_solvable();
1602 $di->skip_solvable();
1603 di.skip_solvable()
1604 di.skip_solvable()
1605
1606 Stop matching the current solvable and advance to the next one.
1607
1608 <iteration>
1609 for my $d (@$di)
1610 for d in di:
1611 for d in di
1612
1613 Iterate through the matches. If there is a match, the object in d will
1614 be of type Datamatch.
1615
1617 Objects of this type will be created for every value matched by a
1618 dataiterator.
1619
1620 ATTRIBUTES
1621 Pool *pool; /* read only */
1622 $d->{pool}
1623 d.pool
1624 d.pool
1625
1626 Back pointer to pool.
1627
1628 Repo *repo; /* read only */
1629 $d->{repo}
1630 d.repo
1631 d.repo
1632
1633 The repository containing the matched object.
1634
1635 Solvable *solvable; /* read only */
1636 $d->{solvable}
1637 d.solvable
1638 d.solvable
1639
1640 The solvable containing the value that was matched.
1641
1642 Id solvid; /* read only */
1643 $d->{solvid}
1644 d.solvid
1645 d.solvid
1646
1647 The id of the solvable that matched.
1648
1649 Id key_id;
1650 $d->{key_id}
1651 d.key_id
1652 d.key_id
1653
1654 const char *key_idstr;
1655 $d->{key_idstr}
1656 d.key_idstr
1657 d.key_idstr
1658
1659 The keyname that matched, either as id or string.
1660
1661 Id type_id;
1662 $d->{type_id}
1663 d.type_id
1664 d.type_id
1665
1666 const char *type_idstr;
1667 $d->{type_idstr};
1668 d.type_idstr
1669 d.type_idstr
1670
1671 The key type of the value that was matched, either as id or string.
1672
1673 Id id;
1674 $d->{id}
1675 d.id
1676 d.id
1677
1678 Id idstr;
1679 $d->{idstr}
1680 d.idstr
1681 d.idstr
1682
1683 The Id of the value that was matched (only valid for id types), either
1684 as id or string.
1685
1686 const char *str;
1687 $d->{str}
1688 d.str
1689 d.str
1690
1691 The string value that was matched (only valid for string types).
1692
1693 unsigned long long num;
1694 $d->{num}
1695 d.num
1696 d.num
1697
1698 The numeric value that was matched (only valid for numeric types).
1699
1700 unsigned int num2;
1701 $d->{num2}
1702 d.num2
1703 d.num2
1704
1705 The secondary numeric value that was matched (only valid for types
1706 containing two values).
1707
1708 unsigned int binary;
1709 $d->{binary}
1710 d.binary
1711 d.binary
1712
1713 The value in binary form, useful for checksums and other data that
1714 cannot be represented as a string.
1715
1716 METHODS
1717 Datapos pos();
1718 my $pos = $d->pos();
1719 pos = d.pos()
1720 pos = d.pos()
1721
1722 The position object of the current match. It can be used to do
1723 sub-searches starting at the match (if it is of an array type). See the
1724 Datapos class for more information.
1725
1726 Datapos parentpos();
1727 my $pos = $d->parentpos();
1728 pos = d.parentpos()
1729 pos = d.parentpos()
1730
1731 The position object of the array containing the current match. It can
1732 be used to do sub-searches, see the Datapos class for more information.
1733
1734 <stringification>
1735 my $str = $d->str;
1736 str = str(d)
1737 str = d.to_s
1738
1739 Return the stringification of the matched value. Stringification
1740 depends on the search flags, for file list entries it will return just
1741 the base name unless SEARCH_FILES is used, for checksums it will return
1742 an empty string unless SEARCH_CHECKSUMS is used. Numeric values are
1743 currently stringified to an empty string.
1744
1746 Selections are a way to easily deal with sets of packages. There are
1747 multiple constructors to create them, the most useful is probably the
1748 select() method in the Pool class.
1749
1750 CONSTANTS
1751 SELECTION_NAME
1752 Create the selection by matching package names.
1753
1754 SELECTION_PROVIDES
1755 Create the selection by matching package provides.
1756
1757 SELECTION_FILELIST
1758 Create the selection by matching package files.
1759
1760 SELECTION_CANON
1761 Create the selection by matching the canonical representation of
1762 the package. This is normally a combination of the name, the
1763 version, and the architecture of a package.
1764
1765 SELECTION_DOTARCH
1766 Allow an ".<architecture>" suffix when matching names or provides.
1767
1768 SELECTION_REL
1769 Allow the specification of a relation when matching names or
1770 dependencies, e.g. "name >= 1.2".
1771
1772 SELECTION_GLOB
1773 Allow glob matching for package names, package provides, and file
1774 names.
1775
1776 SELECTION_NOCASE
1777 Ignore case when matching package names, package provides, and file
1778 names.
1779
1780 SELECTION_FLAT
1781 Return only one selection element describing the selected packages.
1782 The default is to create multiple elements for all globbed
1783 packages. Multiple elements are useful if you want to turn the
1784 selection into an install job, in that case you want an install job
1785 for every globbed package.
1786
1787 SELECTION_SKIP_KIND
1788 Remove a "packagekind:" prefix from the package names.
1789
1790 SELECTION_MATCH_DEPSTR
1791 When matching dependencies, do a string match on the result of
1792 dep2str instead of using the normal dependency intersect algorithm.
1793
1794 SELECTION_INSTALLED_ONLY
1795 Limit the package search to installed packages.
1796
1797 SELECTION_SOURCE_ONLY
1798 Limit the package search to source packages only.
1799
1800 SELECTION_WITH_SOURCE
1801 Extend the package search to also match source packages. The
1802 default is only to match binary packages.
1803
1804 SELECTION_WITH_DISABLED
1805 Extend the package search to also include disabled packages.
1806
1807 SELECTION_WITH_BADARCH
1808 Extend the package search to also include packages that are not
1809 installable on the configured architecture.
1810
1811 SELECTION_WITH_ALL
1812 Shortcut for selecting the three modifiers above.
1813
1814 SELECTION_ADD
1815 Add the result of the match to the current selection instead of
1816 replacing it.
1817
1818 SELECTION_SUBTRACT
1819 Remove the result of the match to the current selection instead of
1820 replacing it.
1821
1822 SELECTION_FILTER
1823 Intersect the result of the match to the current selection instead
1824 of replacing it.
1825
1826 ATTRIBUTES
1827 Pool *pool; /* read only */
1828 $d->{pool}
1829 d.pool
1830 d.pool
1831
1832 Back pointer to pool.
1833
1834 int flags; /* read only */
1835 $sel->{flags}
1836 flags = sel.flags
1837 flags = sel.flags
1838
1839 The result flags of the selection. The flags are a subset of the ones
1840 used when creating the selection, they describe which method was used
1841 to get the result. For example, if you create the selection with
1842 “SELECTION_NAME | SELECTION_PROVIDES”, the resulting flags will either
1843 be SELECTION_NAME or SELECTION_PROVIDES depending if there was a
1844 package that matched the name or not. If there was no match at all, the
1845 flags will be zero.
1846
1847 METHODS
1848 bool isempty()
1849 $sel->isempty()
1850 sel.isempty()
1851 sel.isempty?
1852
1853 Return true if the selection is empty, i.e. no package could be
1854 matched.
1855
1856 Selection clone(int flags = 0)
1857 my $cloned = $sel->clone();
1858 cloned = sel.clone()
1859 cloned = sel.clone()
1860
1861 Return a copy of a selection.
1862
1863 void filter(Selection *other)
1864 $sel->filter($other);
1865 sel.filter(other)
1866 sel.filter(other)
1867
1868 Intersect two selections. Packages will only stay in the selection if
1869 there are also included in the other selecting. Does an in-place
1870 modification.
1871
1872 void add(Selection *other)
1873 $sel->add($other);
1874 sel.add(other)
1875 sel.add(other)
1876
1877 Build the union of two selections. All packages of the other selection
1878 will be added to the set of packages of the selection object. Does an
1879 in-place modification. Note that the selection flags are no longer
1880 meaningful after the add operation.
1881
1882 void subtract(Selection *other)
1883 $sel->subtract($other);
1884 sel.subtract(other)
1885 sel.subtract(other)
1886
1887 Remove the packages of the other selection from the packages of the
1888 selection object. Does an in-place modification.
1889
1890 void add_raw(Id how, Id what)
1891 $sel->add_raw($how, $what);
1892 sel.add_raw(how, what)
1893 sel.add_raw(how, what)
1894
1895 Add a raw element to the selection. Check the Job class for information
1896 about the how and what parameters. Note that the selection flags are no
1897 longer meaningful after the add_raw operation.
1898
1899 Job *jobs(int action)
1900 my @jobs = $sel->jobs($action);
1901 jobs = sel.jobs(action)
1902 jobs = sel.jobs(action)
1903
1904 Convert a selection into an array of Job objects. The action parameter
1905 is or-ed to the “how” part of the job, it describes the type of job
1906 (e.g. install, erase). See the Job class for the action and action
1907 modifier constants.
1908
1909 Solvable *solvables()
1910 my @solvables = $sel->solvables();
1911 solvables = sel.solvables()
1912 solvables = sel.solvables()
1913
1914 Convert a selection into an array of Solvable objects.
1915
1916 void select(const char *name, int flags)
1917 $sel->select($name, $flags);
1918 sel.select(name, flags)
1919 sel.select(name, flags)
1920
1921 Do a select operation and combine the result with the current
1922 selection. You can choose the desired combination method by using
1923 either the SELECTION_ADD, SELECTION_SUBTRACT, or SELECTION_FILTER flag.
1924 If none of the flags are used, SELECTION_FILTER|SELECTION_WITH_ALL is
1925 assumed.
1926
1927 void matchdeps(const char *name, int flags, Id keyname, Id marker = -1)
1928 $sel->matchdeps($name, $flags, $keyname);
1929 sel.matchdeps(name, flags, keyname)
1930 sel.matchdeps(name, flags, keyname)
1931
1932 Do a matchdeps operation and combine the result with the current
1933 selection.
1934
1935 void matchdepid(DepId dep, int flags, Id keyname, Id marker = -1)
1936 $sel->matchdepid($dep, $flags, $keyname);
1937 sel.matchdepid(dep, flags, keyname)
1938 sel.matchdepid(dep, flags, keyname)
1939
1940 Do a matchdepid operation and combine the result with the current
1941 selection.
1942
1943 void matchsolvable(Solvable solvable, int flags, Id keyname, Id marker = -1)
1944 $sel->matchsolvable($solvable, $flags, $keyname);
1945 sel.matchsolvable(solvable, flags, keyname)
1946 sel.matchsolvable(solvable, flags, keyname)
1947
1948 Do a matchsolvable operation and combine the result with the current
1949 selection.
1950
1951 <stringification>
1952 my $str = $sel->str;
1953 str = str(sel)
1954 str = sel.to_s
1955
1956 Return a string describing the selection.
1957
1959 Jobs are the way to specify to the dependency solver what to do. Most
1960 of the times jobs will get created by calling the jobs() method on a
1961 Selection object, but there is also a Job() constructor in the Pool
1962 class.
1963
1964 CONSTANTS
1965 Selection constants:
1966
1967 SOLVER_SOLVABLE
1968 The “what” part is the id of a solvable.
1969
1970 SOLVER_SOLVABLE_NAME
1971 The “what” part is the id of a package name.
1972
1973 SOLVER_SOLVABLE_PROVIDES
1974 The “what” part is the id of a package provides.
1975
1976 SOLVER_SOLVABLE_ONE_OF
1977 The “what” part is an offset into the “whatprovides” data, created
1978 by calling the towhatprovides() pool method.
1979
1980 SOLVER_SOLVABLE_REPO
1981 The “what” part is the id of a repository.
1982
1983 SOLVER_SOLVABLE_ALL
1984 The “what” part is ignored, all packages are selected.
1985
1986 SOLVER_SOLVABLE_SELECTMASK
1987 A mask containing all the above selection bits.
1988
1989 Action constants:
1990
1991 SOLVER_NOOP
1992 Do nothing.
1993
1994 SOLVER_INSTALL
1995 Install a package of the specified set of packages. It tries to
1996 install the best matching package (i.e. the highest version of the
1997 packages from the repositories with the highest priority).
1998
1999 SOLVER_ERASE
2000 Erase all of the packages from the specified set. If a package is
2001 not installed, erasing it will keep it from getting installed.
2002
2003 SOLVER_UPDATE
2004 Update the matching installed packages to their best version. If
2005 none of the specified packages are installed, try to update the
2006 installed packages to the specified versions. See the section about
2007 targeted updates about more information.
2008
2009 SOLVER_WEAKENDEPS
2010 Allow to break the dependencies of the matching packages. Handle
2011 with care.
2012
2013 SOLVER_MULTIVERSION
2014 Mark the matched packages for multiversion install. If they get to
2015 be installed because of some other job, the installation will keep
2016 the old version of the package installed (for rpm this is done by
2017 using “-i” instead of “-U”).
2018
2019 SOLVER_LOCK
2020 Do not change the state of the matched packages, i.e. when they are
2021 installed they stay installed, if not they are not selected for
2022 installation.
2023
2024 SOLVER_DISTUPGRADE
2025 Update the matching installed packages to the best version included
2026 in one of the repositories. After this operation, all come from one
2027 of the available repositories except orphaned packages. Orphaned
2028 packages are packages that have no relation to the packages in the
2029 repositories, i.e. no package in the repositories have the same
2030 name or obsolete the orphaned package. This action brings the
2031 installed packages in sync with the ones in the repository. By
2032 default it also turns of arch/vendor/version locking for the
2033 affected packages to simulate a fresh installation. This means that
2034 distupgrade can actually downgrade packages if only lower versions
2035 of a package are available in the repositories. You can tweak this
2036 behavior with the SOLVER_FLAG_DUP_ solver flags.
2037
2038 SOLVER_DROP_ORPHANED
2039 Erase all the matching installed packages if they are orphaned.
2040 This only makes sense if there is a “distupgrade all packages” job.
2041 The default is to erase orphaned packages only if they block the
2042 installation of other packages.
2043
2044 SOLVER_VERIFY
2045 Fix dependency problems of matching installed packages. The default
2046 is to ignore dependency problems for installed packages.
2047
2048 SOLVER_USERINSTALLED
2049 The matching installed packages are considered to be installed by a
2050 user, thus not installed to fulfill some dependency. This is needed
2051 input for the calculation of unneeded packages for jobs that have
2052 the SOLVER_CLEANDEPS flag set.
2053
2054 SOLVER_ALLOWUNINSTALL
2055 Allow the solver to deinstall the matching installed packages if
2056 they get into the way of resolving a dependency. This is like the
2057 SOLVER_FLAG_ALLOW_UNINSTALL flag, but limited to a specific set of
2058 packages.
2059
2060 SOLVER_FAVOR
2061 Prefer the specified packages if the solver encounters an
2062 alternative. If a job contains multiple matching favor/disfavor
2063 elements, the last one takes precedence.
2064
2065 SOLVER_DISFAVOR
2066 Avoid the specified packages if the solver encounters an
2067 alternative. This can also be used to block recommended or
2068 supplemented packages from being installed.
2069
2070 SOLVER_JOBMASK
2071 A mask containing all the above action bits.
2072
2073 Action modifier constants:
2074
2075 SOLVER_WEAK
2076 Makes the job a weak job. The solver tries to fulfill weak jobs,
2077 but does not report a problem if it is not possible to do so.
2078
2079 SOLVER_ESSENTIAL
2080 Makes the job an essential job. If there is a problem with the job,
2081 the solver will not propose to remove the job as one solution
2082 (unless all other solutions are also to remove essential jobs).
2083
2084 SOLVER_CLEANDEPS
2085 The solver will try to also erase all packages dragged in through
2086 dependencies when erasing the package. This needs
2087 SOLVER_USERINSTALLED jobs to maximize user satisfaction.
2088
2089 SOLVER_FORCEBEST
2090 Insist on the best package for install, update, and distupgrade
2091 jobs. If this flag is not used, the solver will use the second-best
2092 package if the best package cannot be installed for some reason.
2093 When this flag is used, the solver will generate a problem instead.
2094
2095 SOLVER_TARGETED
2096 Forces targeted operation update and distupgrade jobs. See the
2097 section about targeted updates about more information.
2098
2099 Set constants.
2100
2101 SOLVER_SETEV
2102 The job specified the exact epoch and version of the package set.
2103
2104 SOLVER_SETEVR
2105 The job specified the exact epoch, version, and release of the
2106 package set.
2107
2108 SOLVER_SETARCH
2109 The job specified the exact architecture of the packages from the
2110 set.
2111
2112 SOLVER_SETVENDOR
2113 The job specified the exact vendor of the packages from the set.
2114
2115 SOLVER_SETREPO
2116 The job specified the exact repository of the packages from the
2117 set.
2118
2119 SOLVER_SETNAME
2120 The job specified the exact name of the packages from the set.
2121
2122 SOLVER_NOAUTOSET
2123 Turn of automatic set flag generation for SOLVER_SOLVABLE jobs.
2124
2125 SOLVER_SETMASK
2126 A mask containing all the above set bits.
2127
2128 See the section about set bits for more information.
2129
2130 ATTRIBUTES
2131 Pool *pool; /* read only */
2132 $job->{pool}
2133 d.pool
2134 d.pool
2135
2136 Back pointer to pool.
2137
2138 Id how; /* read/write */
2139 $job->{how}
2140 d.how
2141 d.how
2142
2143 Union of the selection, action, action modifier, and set flags. The
2144 selection part describes the semantics of the “what” Id.
2145
2146 Id what; /* read/write */
2147 $job->{what}
2148 d.what
2149 d.what
2150
2151 Id describing the set of packages, the meaning depends on the selection
2152 part of the “how” attribute.
2153
2154 METHODS
2155 Solvable *solvables()
2156 my @solvables = $job->solvables();
2157 solvables = job.solvables()
2158 solvables = job.solvables()
2159
2160 Return the set of solvables of the job as an array of Solvable objects.
2161
2162 bool isemptyupdate();
2163 $job->isemptyupdate()
2164 job.isemptyupdate()
2165 job.isemptyupdate?
2166
2167 Convenience function to find out if the job describes an update job
2168 with no matching packages, i.e. a job that does nothing. Some package
2169 managers like “zypper” like to turn those jobs into install jobs, i.e.
2170 an update of a not-installed package will result into the installation
2171 of the package.
2172
2173 <stringification>
2174 my $str = $job->str;
2175 str = str(job)
2176 str = job.to_s
2177
2178 Return a string describing the job.
2179
2180 <equality>
2181 if ($job1 == $job2)
2182 if job1 == job2:
2183 if job1 == job2
2184
2185 Two jobs are equal if they belong to the same pool and both the “how”
2186 and the “what” attributes are the same.
2187
2188 TARGETED UPDATES
2189 Libsolv has two modes for upgrades and distupgrade: targeted and
2190 untargeted. Untargeted mode means that the installed packages from the
2191 specified set will be updated to the best version. Targeted means that
2192 packages that can be updated to a package in the specified set will be
2193 updated to the best package of the set.
2194
2195 Here’s an example to explain the subtle difference. Suppose that you
2196 have package A installed in version "1.1", "A-1.2" is available in one
2197 of the repositories and there is also package "B" that obsoletes
2198 package A.
2199
2200 An untargeted update of "A" will update the installed "A-1.1" to
2201 package "B", because that is the newest version (B obsoletes A and is
2202 thus newer).
2203
2204 A targeted update of "A" will update "A-1.1" to "A-1.2", as the set of
2205 packages contains both "A-1.1" and "A-1.2", and "A-1.2" is the newer
2206 one.
2207
2208 An untargeted update of "B" will do nothing, as "B" is not installed.
2209
2210 An targeted update of "B" will update "A-1.1" to "B".
2211
2212 Note that the default is to do "auto-targeting", thus if the specified
2213 set of packages does not include an installed package, the solver will
2214 assume targeted operation even if SOLVER_TARGETED is not used.
2215
2216 This mostly matches the intent of the user, with one exception: In the
2217 example above, an update of "A-1.2" will update "A-1.1" to "A-1.2"
2218 (targeted mode), but a second update of "A-1.2" will suddenly update to
2219 "B", as untargeted mode is chosen because "A-1.2" is now installed.
2220
2221 If you want to have full control over when targeting mode is chosen,
2222 turn off auto-targeting with the SOLVER_FLAG_NO_AUTOTARGET solver
2223 option. In that case, all updates are considered to be untargeted
2224 unless they include the SOLVER_TARGETED flag.
2225
2226 SET BITS
2227 Set bits specify which parts of the specified packages where specified
2228 by the user. It is used by the solver when checking if an operation is
2229 allowed or not. For example, the solver will normally not allow the
2230 downgrade of an installed package. But it will not report a problem if
2231 the SOLVER_SETEVR flag is used, as it then assumes that the user
2232 specified the exact version and thus knows what he is doing.
2233
2234 So if a package "screen-1-1" is installed for the x86_64 architecture
2235 and version "2-1" is only available for the i586 architecture,
2236 installing package "screen-2.1" will ask the user for confirmation
2237 because of the different architecture. When using the Selection class
2238 to create jobs the set bits are automatically added, e.g. selecting
2239 “screen.i586” will automatically add SOLVER_SETARCH, and thus no
2240 problem will be reported.
2241
2243 Dependency solving is what this library is about. A solver object is
2244 needed for solving to store the result of the solver run. The solver
2245 object can be used multiple times for different jobs, reusing it allows
2246 the solver to re-use the dependency rules it already computed.
2247
2248 CONSTANTS
2249 Flags to modify some of the solver’s behavior:
2250
2251 SOLVER_FLAG_ALLOW_DOWNGRADE
2252 Allow the solver to downgrade packages without asking for
2253 confirmation (i.e. reporting a problem).
2254
2255 SOLVER_FLAG_ALLOW_ARCHCHANGE
2256 Allow the solver to change the architecture of an installed package
2257 without asking for confirmation. Note that changes to/from noarch
2258 are always considered to be allowed.
2259
2260 SOLVER_FLAG_ALLOW_VENDORCHANGE
2261 Allow the solver to change the vendor of an installed package
2262 without asking for confirmation. Each vendor is part of one or more
2263 vendor equivalence classes, normally installed packages may only
2264 change their vendor if the new vendor shares at least one
2265 equivalence class.
2266
2267 SOLVER_FLAG_ALLOW_NAMECHANGE
2268 Allow the solver to change the name of an installed package, i.e.
2269 install a package with a different name that obsoletes the
2270 installed package. This option is on by default.
2271
2272 SOLVER_FLAG_ALLOW_UNINSTALL
2273 Allow the solver to erase installed packages to fulfill the jobs.
2274 This flag also includes the above flags. You may want to set this
2275 flag if you only have SOLVER_ERASE jobs, as in that case it’s
2276 better for the user to check the transaction overview instead of
2277 approving every single package that needs to be erased.
2278
2279 SOLVER_FLAG_DUP_ALLOW_DOWNGRADE
2280 Like SOLVER_FLAG_ALLOW_DOWNGRADE, but used in distupgrade mode.
2281
2282 SOLVER_FLAG_DUP_ALLOW_ARCHCHANGE
2283 Like SOLVER_FLAG_ALLOW_ARCHCHANGE, but used in distupgrade mode.
2284
2285 SOLVER_FLAG_DUP_ALLOW_VENDORCHANGE
2286 Like SOLVER_FLAG_ALLOW_VENDORCHANGE, but used in distupgrade mode.
2287
2288 SOLVER_FLAG_DUP_ALLOW_NAMECHANGE
2289 Like SOLVER_FLAG_ALLOW_NAMECHANGE, but used in distupgrade mode.
2290
2291 SOLVER_FLAG_NO_UPDATEPROVIDE
2292 If multiple packages obsolete an installed package, the solver
2293 checks the provides of every such package and ignores all packages
2294 that do not provide the installed package name. Thus, you can have
2295 an official update candidate that provides the old name, and other
2296 packages that also obsolete the package but are not considered for
2297 updating. If you cannot use this feature, you can turn it off by
2298 setting this flag.
2299
2300 SOLVER_FLAG_NEED_UPDATEPROVIDE
2301 This is somewhat the opposite of SOLVER_FLAG_NO_UPDATEPROVIDE: Only
2302 packages that provide the installed package names are considered
2303 for updating.
2304
2305 SOLVER_FLAG_SPLITPROVIDES
2306 Make the solver aware of special provides of the form
2307 “<packagename>:<path>” used in SUSE systems to support package
2308 splits.
2309
2310 SOLVER_FLAG_IGNORE_RECOMMENDED
2311 Do not process optional (aka weak) dependencies.
2312
2313 SOLVER_FLAG_ADD_ALREADY_RECOMMENDED
2314 Install recommended or supplemented packages even if they have no
2315 connection to the current transaction. You can use this feature to
2316 implement a simple way for the user to install new recommended
2317 packages that were not available in the past.
2318
2319 SOLVER_FLAG_NO_INFARCHCHECK
2320 Turn off the inferior architecture checking that is normally done
2321 by the solver. Normally, the solver allows only the installation of
2322 packages from the "best" architecture if a package is available for
2323 multiple architectures.
2324
2325 SOLVER_FLAG_BEST_OBEY_POLICY
2326 Make the SOLVER_FORCEBEST job option consider only packages that
2327 meet the policies for installed packages, i.e. no downgrades, no
2328 architecture change, no vendor change (see the first flags of this
2329 section). If the flag is not specified, the solver will enforce the
2330 installation of the best package ignoring the installed packages,
2331 which may conflict with the set policy.
2332
2333 SOLVER_FLAG_NO_AUTOTARGET
2334 Do not enable auto-targeting up update and distupgrade jobs. See
2335 the section on targeted updates for more information.
2336
2337 SOLVER_FLAG_KEEP_ORPHANS
2338 Do not allow orphaned packages to be deinstalled if they get in the
2339 way of resolving other packages.
2340
2341 SOLVER_FLAG_BREAK_ORPHANS
2342 Ignore dependencies of orphaned packages that get in the way of
2343 resolving non-orphaned ones. Setting the flag might result in no
2344 longer working packages in case they are orphaned.
2345
2346 SOLVER_FLAG_FOCUS_INSTALLED
2347 Resolve installed packages before resolving the given jobs. Setting
2348 this flag means that the solver will prefer picking a package
2349 version that fits the other installed packages over updating
2350 installed packages.
2351
2352 SOLVER_FLAG_FOCUS_BEST
2353 First resolve the given jobs, then the dependencies of the
2354 resulting packages, then resolve all already installed packages.
2355 This will result in more packages being updated as when the flag is
2356 not used.
2357
2358 SOLVER_FLAG_INSTALL_ALSO_UPDATES
2359 Update the package if a job is already fulfilled by an installed
2360 package.
2361
2362 SOLVER_FLAG_YUM_OBSOLETES
2363 Turn on yum-like package split handling. See the yum documentation
2364 for more details.
2365
2366 SOLVER_FLAG_URPM_REORDER
2367 Turn on urpm like package reordering for kernel packages. See the
2368 urpm documentation for more details.
2369
2370 Basic rule types:
2371
2372 SOLVER_RULE_UNKNOWN
2373 A rule of an unknown class. You should never encounter those.
2374
2375 SOLVER_RULE_PKG
2376 A package dependency rule.
2377
2378 SOLVER_RULE_UPDATE
2379 A rule to implement the update policy of installed packages. Every
2380 installed package has an update rule that consists of the packages
2381 that may replace the installed package.
2382
2383 SOLVER_RULE_FEATURE
2384 Feature rules are fallback rules used when an update rule is
2385 disabled. They include all packages that may replace the installed
2386 package ignoring the update policy, i.e. they contain downgrades,
2387 arch changes and so on. Without them, the solver would simply erase
2388 installed packages if their update rule gets disabled.
2389
2390 SOLVER_RULE_JOB
2391 Job rules implement the job given to the solver.
2392
2393 SOLVER_RULE_DISTUPGRADE
2394 These are simple negative assertions that make sure that only
2395 packages are kept that are also available in one of the
2396 repositories.
2397
2398 SOLVER_RULE_INFARCH
2399 Infarch rules are also negative assertions, they disallow the
2400 installation of packages when there are packages of the same name
2401 but with a better architecture.
2402
2403 SOLVER_RULE_CHOICE
2404 Choice rules are used to make sure that the solver prefers updating
2405 to installing different packages when some dependency is provided
2406 by multiple packages with different names. The solver may always
2407 break choice rules, so you will not see them when a problem is
2408 found.
2409
2410 SOLVER_RULE_LEARNT
2411 These rules are generated by the solver to keep it from running
2412 into the same problem multiple times when it has to backtrack. They
2413 are the main reason why a sat solver is faster than other
2414 dependency solver implementations.
2415
2416 Special dependency rule types:
2417
2418 SOLVER_RULE_PKG_NOT_INSTALLABLE
2419 This rule was added to prevent the installation of a package of an
2420 architecture that does not work on the system.
2421
2422 SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP
2423 The package contains a required dependency which was not provided
2424 by any package.
2425
2426 SOLVER_RULE_PKG_REQUIRES
2427 Similar to SOLVER_RULE_PKG_NOTHING_PROVIDES_DEP, but in this case
2428 some packages provided the dependency but none of them could be
2429 installed due to other dependency issues.
2430
2431 SOLVER_RULE_PKG_SELF_CONFLICT
2432 The package conflicts with itself. This is not allowed by older rpm
2433 versions.
2434
2435 SOLVER_RULE_PKG_CONFLICTS
2436 To fulfill the dependencies two packages need to be installed, but
2437 one of the packages contains a conflict with the other one.
2438
2439 SOLVER_RULE_PKG_SAME_NAME
2440 The dependencies can only be fulfilled by multiple versions of a
2441 package, but installing multiple versions of the same package is
2442 not allowed.
2443
2444 SOLVER_RULE_PKG_OBSOLETES
2445 To fulfill the dependencies two packages need to be installed, but
2446 one of the packages obsoletes the other one.
2447
2448 SOLVER_RULE_PKG_IMPLICIT_OBSOLETES
2449 To fulfill the dependencies two packages need to be installed, but
2450 one of the packages has provides a dependency that is obsoleted by
2451 the other one. See the POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES flag.
2452
2453 SOLVER_RULE_PKG_INSTALLED_OBSOLETES
2454 To fulfill the dependencies a package needs to be installed that is
2455 obsoleted by an installed package. See the
2456 POOL_FLAG_NOINSTALLEDOBSOLETES flag.
2457
2458 SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP
2459 The user asked for installation of a package providing a specific
2460 dependency, but no available package provides it.
2461
2462 SOLVER_RULE_JOB_UNKNOWN_PACKAGE
2463 The user asked for installation of a package with a specific name,
2464 but no available package has that name.
2465
2466 SOLVER_RULE_JOB_PROVIDED_BY_SYSTEM
2467 The user asked for the erasure of a dependency that is provided by
2468 the system (i.e. for special hardware or language dependencies),
2469 this cannot be done with a job.
2470
2471 SOLVER_RULE_JOB_UNSUPPORTED
2472 The user asked for something that is not yet implemented, e.g. the
2473 installation of all packages at once.
2474
2475 Policy error constants
2476
2477 POLICY_ILLEGAL_DOWNGRADE
2478 The solver ask for permission before downgrading packages.
2479
2480 POLICY_ILLEGAL_ARCHCHANGE
2481 The solver ask for permission before changing the architecture of
2482 installed packages.
2483
2484 POLICY_ILLEGAL_VENDORCHANGE
2485 The solver ask for permission before changing the vendor of
2486 installed packages.
2487
2488 POLICY_ILLEGAL_NAMECHANGE
2489 The solver ask for permission before replacing an installed
2490 packages with a package that has a different name.
2491
2492 Solution element type constants
2493
2494 SOLVER_SOLUTION_JOB
2495 The problem can be solved by removing the specified job.
2496
2497 SOLVER_SOLUTION_POOLJOB
2498 The problem can be solved by removing the specified job that is
2499 defined in the pool.
2500
2501 SOLVER_SOLUTION_INFARCH
2502 The problem can be solved by allowing the installation of the
2503 specified package with an inferior architecture.
2504
2505 SOLVER_SOLUTION_DISTUPGRADE
2506 The problem can be solved by allowing to keep the specified package
2507 installed.
2508
2509 SOLVER_SOLUTION_BEST
2510 The problem can be solved by allowing to install the specified
2511 package that is not the best available package.
2512
2513 SOLVER_SOLUTION_ERASE
2514 The problem can be solved by allowing to erase the specified
2515 package.
2516
2517 SOLVER_SOLUTION_REPLACE
2518 The problem can be solved by allowing to replace the package with
2519 some other package.
2520
2521 SOLVER_SOLUTION_REPLACE_DOWNGRADE
2522 The problem can be solved by allowing to replace the package with
2523 some other package that has a lower version.
2524
2525 SOLVER_SOLUTION_REPLACE_ARCHCHANGE
2526 The problem can be solved by allowing to replace the package with
2527 some other package that has a different architecture.
2528
2529 SOLVER_SOLUTION_REPLACE_VENDORCHANGE
2530 The problem can be solved by allowing to replace the package with
2531 some other package that has a different vendor.
2532
2533 SOLVER_SOLUTION_REPLACE_NAMECHANGE
2534 The problem can be solved by allowing to replace the package with
2535 some other package that has a different name.
2536
2537 Reason constants
2538
2539 SOLVER_REASON_UNRELATED
2540 The package status did not change as it was not related to any job.
2541
2542 SOLVER_REASON_UNIT_RULE
2543 The package was installed/erased/kept because of a unit rule, i.e.
2544 a rule where all literals but one were false.
2545
2546 SOLVER_REASON_KEEP_INSTALLED
2547 The package was chosen when trying to keep as many packages
2548 installed as possible.
2549
2550 SOLVER_REASON_RESOLVE_JOB
2551 The decision happened to fulfill a job rule.
2552
2553 SOLVER_REASON_UPDATE_INSTALLED
2554 The decision happened to fulfill a package update request.
2555
2556 SOLVER_REASON_CLEANDEPS_ERASE
2557 The package was erased when cleaning up dependencies from other
2558 erased packages.
2559
2560 SOLVER_REASON_RESOLVE
2561 The package was installed to fulfill package dependencies.
2562
2563 SOLVER_REASON_WEAKDEP
2564 The package was installed because of a weak dependency (Recommends
2565 or Supplements).
2566
2567 SOLVER_REASON_RESOLVE_ORPHAN
2568 The decision about the package was made when deciding the fate of
2569 orphaned packages.
2570
2571 SOLVER_REASON_RECOMMENDED
2572 This is a special case of SOLVER_REASON_WEAKDEP.
2573
2574 SOLVER_REASON_SUPPLEMENTED
2575 This is a special case of SOLVER_REASON_WEAKDEP.
2576
2577 ATTRIBUTES
2578 Pool *pool; /* read only */
2579 $job->{pool}
2580 d.pool
2581 d.pool
2582
2583 Back pointer to pool.
2584
2585 METHODS
2586 int set_flag(int flag, int value)
2587 my $oldvalue = $solver->set_flag($flag, $value);
2588 oldvalue = solver.set_flag(flag, value)
2589 oldvalue = solver.set_flag(flag, value)
2590
2591 int get_flag(int flag)
2592 my $value = $solver->get_flag($flag);
2593 value = solver.get_flag(flag)
2594 value = solver.get_flag(flag)
2595
2596 Set/get a solver specific flag. The flags define the policies the
2597 solver has to obey. The flags are explained in the CONSTANTS section of
2598 this class.
2599
2600 Problem *solve(Job *jobs)
2601 my @problems = $solver->solve(\@jobs);
2602 problems = solver.solve(jobs)
2603 problems = solver.solve(jobs)
2604
2605 Solve a problem specified in the job list (plus the jobs defined in the
2606 pool). Returns an array of problems that need user interaction, or an
2607 empty array if no problems were encountered. See the Problem class on
2608 how to deal with problems.
2609
2610 Transaction transaction()
2611 my $trans = $solver->transaction();
2612 trans = solver.transaction()
2613 trans = solver.transaction()
2614
2615 Return the transaction to implement the calculated package changes. A
2616 transaction is available even if problems were found, this is useful
2617 for interactive user interfaces that show both the job result and the
2618 problems.
2619
2620 int reason = describe_decision(Solvable *s, Rule *OUTPUT)
2621 my ($reason, $rule) = $solver->describe_decision($solvable);
2622 (reason, rule) = solver.describe_decision(solvable)
2623 (reason, rule) = solver.describe_decision(solvable)
2624
2625 Return the reason why a specific solvable was installed or erased. For
2626 most of the reasons the rule that triggered the decision is also
2627 returned.
2628
2629 Solvable *get_recommended(bool noselected=0);
2630 my @solvables = $solver->get_recommended();
2631 solvables = solver.get_recommended()
2632 solvables = solver.get_recommended()
2633
2634 Return all solvables that are recommended by the solver run result.
2635 This includes solvables included in the result, set noselected if you
2636 want to filter those.
2637
2638 Solvable *get_suggested(bool noselected=0);
2639 my @solvables = $solver->get_suggested();
2640 solvables = solver.get_suggested()
2641 solvables = solver.get_suggested()
2642
2643 Return all solvables that are suggested by the solver run result. This
2644 includes solvables included in the result, set noselected if you want
2645 to filter those.
2646
2648 Problems are the way of the solver to interact with the user. You can
2649 simply list all problems and terminate your program, but a better way
2650 is to present solutions to the user and let him pick the ones he likes.
2651
2652 ATTRIBUTES
2653 Solver *solv; /* read only */
2654 $problem->{solv}
2655 problem.solv
2656 problem.solv
2657
2658 Back pointer to solver object.
2659
2660 Id id; /* read only */
2661 $problem->{id}
2662 problem.id
2663 problem.id
2664
2665 Id of the problem. The first problem has Id 1, they are numbered
2666 consecutively.
2667
2668 METHODS
2669 Rule findproblemrule()
2670 my $probrule = $problem->findproblemrule();
2671 probrule = problem.findproblemrule()
2672 probrule = problem.findproblemrule()
2673
2674 Return the rule that caused the problem. Of course in most situations
2675 there is no single responsible rule, but many rules that interconnect
2676 with each created the problem. Nevertheless, the solver uses some
2677 heuristic approach to find a rule that somewhat describes the problem
2678 best to the user.
2679
2680 Rule *findallproblemrules(bool unfiltered = 0)
2681 my @probrules = $problem->findallproblemrules();
2682 probrules = problem.findallproblemrules()
2683 probrules = problem.findallproblemrules()
2684
2685 Return all rules responsible for the problem. The returned set of rules
2686 contains all the needed information why there was a problem, but it’s
2687 hard to present them to the user in a sensible way. The default is to
2688 filter out all update and job rules (unless the returned rules only
2689 consist of those types).
2690
2691 Solution *solutions()
2692 my @solutions = $problem->solutions();
2693 solutions = problem.solutions()
2694 solutions = problem.solutions()
2695
2696 Return an array containing multiple possible solutions to fix the
2697 problem. See the solution class for more information.
2698
2699 int solution_count()
2700 my $cnt = $problem->solution_count();
2701 cnt = problem.solution_count()
2702 cnt = problem.solution_count()
2703
2704 Return the number of solutions without creating solution objects.
2705
2706 <stringification>
2707 my $str = $problem->str;
2708 str = str(problem)
2709 str = problem.to_s
2710
2711 Return a string describing the problem. This is a convenience function,
2712 it is a shorthand for calling findproblemrule(), then ruleinfo() on the
2713 problem rule and problemstr() on the ruleinfo object.
2714
2716 Rules are the basic block of sat solving. Each package dependency gets
2717 translated into one or multiple rules.
2718
2719 ATTRIBUTES
2720 Solver *solv; /* read only */
2721 $rule->{solv}
2722 rule.solv
2723 rule.solv
2724
2725 Back pointer to solver object.
2726
2727 Id id; /* read only */
2728 $rule->{id}
2729 rule.id
2730 rule.id
2731
2732 The id of the rule.
2733
2734 int type; /* read only */
2735 $rule->{type}
2736 rule.type
2737 rule.type
2738
2739 The basic type of the rule. See the constant section of the solver
2740 class for the type list.
2741
2742 METHODS
2743 Ruleinfo info()
2744 my $ruleinfo = $rule->info();
2745 ruleinfo = rule.info()
2746 ruleinfo = rule.info()
2747
2748 Return a Ruleinfo object that contains information about why the rule
2749 was created. But see the allinfos() method below.
2750
2751 Ruleinfo *allinfos()
2752 my @ruleinfos = $rule->allinfos();
2753 ruleinfos = rule.allinfos()
2754 ruleinfos = rule.allinfos()
2755
2756 As the same dependency rule can get created because of multiple
2757 dependencies, one Ruleinfo is not enough to describe the reason. Thus
2758 the allinfos() method returns an array of all infos about a rule.
2759
2760 <equality>
2761 if ($rule1 == $rule2)
2762 if rule1 == rule2:
2763 if rule1 == rule2
2764
2765 Two rules are equal if they belong to the same solver and have the same
2766 id.
2767
2769 A Ruleinfo describes one reason why a rule was created.
2770
2771 ATTRIBUTES
2772 Solver *solv; /* read only */
2773 $ruleinfo->{solv}
2774 ruleinfo.solv
2775 ruleinfo.solv
2776
2777 Back pointer to solver object.
2778
2779 int type; /* read only */
2780 $ruleinfo->{type}
2781 ruleinfo.type
2782 ruleinfo.type
2783
2784 The type of the ruleinfo. See the constant section of the solver class
2785 for the rule type list and the special type list.
2786
2787 Dep *dep; /* read only */
2788 $ruleinfo->{dep}
2789 ruleinfo.dep
2790 ruleinfo.dep
2791
2792 The dependency leading to the creation of the rule.
2793
2794 Dep *dep_id; /* read only */
2795 $ruleinfo->{'dep_id'}
2796 ruleinfo.dep_id
2797 ruleinfo.dep_id
2798
2799 The Id of the dependency leading to the creation of the rule, or zero.
2800
2801 Solvable *solvable; /* read only */
2802 $ruleinfo->{solvable}
2803 ruleinfo.solvable
2804 ruleinfo.solvable
2805
2806 The involved Solvable, e.g. the one containing the dependency.
2807
2808 Solvable *othersolvable; /* read only */
2809 $ruleinfo->{othersolvable}
2810 ruleinfo.othersolvable
2811 ruleinfo.othersolvable
2812
2813 The other involved Solvable (if any), e.g. the one containing providing
2814 the dependency for conflicts.
2815
2816 const char *problemstr();
2817 my $str = $ruleinfo->problemstr();
2818 str = ruleinfo.problemstr()
2819 str = ruleinfo.problemstr()
2820
2821 A string describing the ruleinfo from a problem perspective. This
2822 probably only makes sense if the rule is part of a problem.
2823
2825 A solution solves one specific problem. It consists of multiple
2826 solution elements that all need to be executed.
2827
2828 ATTRIBUTES
2829 Solver *solv; /* read only */
2830 $solution->{solv}
2831 solution.solv
2832 solution.solv
2833
2834 Back pointer to solver object.
2835
2836 Id problemid; /* read only */
2837 $solution->{problemid}
2838 solution.problemid
2839 solution.problemid
2840
2841 Id of the problem the solution solves.
2842
2843 Id id; /* read only */
2844 $solution->{id}
2845 solution.id
2846 solution.id
2847
2848 Id of the solution. The first solution has Id 1, they are numbered
2849 consecutively.
2850
2851 METHODS
2852 Solutionelement *elements(bool expandreplaces = 0)
2853 my @solutionelements = $solution->elements();
2854 solutionelements = solution.elements()
2855 solutionelements = solution.elements()
2856
2857 Return an array containing the elements describing what needs to be
2858 done to implement the specific solution. If expandreplaces is true,
2859 elements of type SOLVER_SOLUTION_REPLACE will be replaced by one or
2860 more elements replace elements describing the policy mismatches.
2861
2862 int element_count()
2863 my $cnt = $solution->solution_count();
2864 cnt = solution.element_count()
2865 cnt = solution.element_count()
2866
2867 Return the number of solution elements without creating objects. Note
2868 that the count does not match the number of objects returned by the
2869 elements() method of expandreplaces is set to true.
2870
2872 A solution element describes a single action of a solution. The action
2873 is always either to remove one specific job or to add a new job that
2874 installs or erases a single specific package.
2875
2876 ATTRIBUTES
2877 Solver *solv; /* read only */
2878 $solutionelement->{solv}
2879 solutionelement.solv
2880 solutionelement.solv
2881
2882 Back pointer to solver object.
2883
2884 Id problemid; /* read only */
2885 $solutionelement->{problemid}
2886 solutionelement.problemid
2887 solutionelement.problemid
2888
2889 Id of the problem the element (partly) solves.
2890
2891 Id solutionid; /* read only */
2892 $solutionelement->{solutionid}
2893 solutionelement.solutionid
2894 solutionelement.solutionid
2895
2896 Id of the solution the element is a part of.
2897
2898 Id id; /* read only */
2899 $solutionelement->{id}
2900 solutionelement.id
2901 solutionelement.id
2902
2903 Id of the solution element. The first element has Id 1, they are
2904 numbered consecutively.
2905
2906 Id type; /* read only */
2907 $solutionelement->{type}
2908 solutionelement.type
2909 solutionelement.type
2910
2911 Type of the solution element. See the constant section of the solver
2912 class for the existing types.
2913
2914 Solvable *solvable; /* read only */
2915 $solutionelement->{solvable}
2916 solutionelement.solvable
2917 solutionelement.solvable
2918
2919 The installed solvable that needs to be replaced for replacement
2920 elements.
2921
2922 Solvable *replacement; /* read only */
2923 $solutionelement->{replacement}
2924 solutionelement.replacement
2925 solutionelement.replacement
2926
2927 The solvable that needs to be installed to fix the problem.
2928
2929 int jobidx; /* read only */
2930 $solutionelement->{jobidx}
2931 solutionelement.jobidx
2932 solutionelement.jobidx
2933
2934 The index of the job that needs to be removed to fix the problem, or -1
2935 if the element is of another type. Note that it’s better to change the
2936 job to SOLVER_NOOP type so that the numbering of other elements does
2937 not get disturbed. This method works both for types SOLVER_SOLUTION_JOB
2938 and SOLVER_SOLUTION_POOLJOB.
2939
2940 METHODS
2941 Solutionelement *replaceelements()
2942 my @solutionelements = $solutionelement->replaceelements();
2943 solutionelements = solutionelement.replaceelements()
2944 solutionelements = solutionelement.replaceelements()
2945
2946 If the solution element is of type SOLVER_SOLUTION_REPLACE, return an
2947 array of elements describing the policy mismatches, otherwise return a
2948 copy of the element. See also the “expandreplaces” option in the
2949 solution’s elements() method.
2950
2951 int illegalreplace()
2952 my $illegal = $solutionelement->illegalreplace();
2953 illegal = solutionelement.illegalreplace()
2954 illegal = solutionelement.illegalreplace()
2955
2956 Return an integer that contains the policy mismatch bits or-ed
2957 together, or zero if there was no policy mismatch. See the policy error
2958 constants in the solver class.
2959
2960 Job Job()
2961 my $job = $solutionelement->Job();
2962 illegal = solutionelement.Job()
2963 illegal = solutionelement.Job()
2964
2965 Create a job that implements the solution element. Add this job to the
2966 array of jobs for all elements of type different to SOLVER_SOLUTION_JOB
2967 and SOLVER_SOLUTION_POOLJOB. For the latter two, a SOLVER_NOOB Job is
2968 created, you should replace the old job with the new one.
2969
2970 const char *str()
2971 my $str = $solutionelement->str();
2972 str = solutionelement.str()
2973 str = solutionelement.str()
2974
2975 A string describing the change the solution element consists of.
2976
2978 Transactions describe the output of a solver run. A transaction
2979 contains a number of transaction elements, each either the installation
2980 of a new package or the removal of an already installed package. The
2981 Transaction class supports a classify() method that puts the elements
2982 into different groups so that a transaction can be presented to the
2983 user in a meaningful way.
2984
2985 CONSTANTS
2986 Transaction element types, both active and passive
2987
2988 SOLVER_TRANSACTION_IGNORE
2989 This element does nothing. Used to map element types that do not
2990 match the view mode.
2991
2992 SOLVER_TRANSACTION_INSTALL
2993 This element installs a package.
2994
2995 SOLVER_TRANSACTION_ERASE
2996 This element erases a package.
2997
2998 SOLVER_TRANSACTION_MULTIINSTALL
2999 This element installs a package with a different version keeping
3000 the other versions installed.
3001
3002 SOLVER_TRANSACTION_MULTIREINSTALL
3003 This element reinstalls an installed package keeping the other
3004 versions installed.
3005
3006 Transaction element types, active view
3007
3008 SOLVER_TRANSACTION_REINSTALL
3009 This element re-installs a package, i.e. installs the same package
3010 again.
3011
3012 SOLVER_TRANSACTION_CHANGE
3013 This element installs a package with same name, version,
3014 architecture but different content.
3015
3016 SOLVER_TRANSACTION_UPGRADE
3017 This element installs a newer version of an installed package.
3018
3019 SOLVER_TRANSACTION_DOWNGRADE
3020 This element installs an older version of an installed package.
3021
3022 SOLVER_TRANSACTION_OBSOLETES
3023 This element installs a package that obsoletes an installed
3024 package.
3025
3026 Transaction element types, passive view
3027
3028 SOLVER_TRANSACTION_REINSTALLED
3029 This element re-installs a package, i.e. installs the same package
3030 again.
3031
3032 SOLVER_TRANSACTION_CHANGED
3033 This element replaces an installed package with one of the same
3034 name, version, architecture but different content.
3035
3036 SOLVER_TRANSACTION_UPGRADED
3037 This element replaces an installed package with a new version.
3038
3039 SOLVER_TRANSACTION_DOWNGRADED
3040 This element replaces an installed package with an old version.
3041
3042 SOLVER_TRANSACTION_OBSOLETED
3043 This element replaces an installed package with a package that
3044 obsoletes it.
3045
3046 Pseudo element types for showing extra information used by classify()
3047
3048 SOLVER_TRANSACTION_ARCHCHANGE
3049 This element replaces an installed package with a package of a
3050 different architecture.
3051
3052 SOLVER_TRANSACTION_VENDORCHANGE
3053 This element replaces an installed package with a package of a
3054 different vendor.
3055
3056 Transaction mode flags
3057
3058 SOLVER_TRANSACTION_SHOW_ACTIVE
3059 Filter for active view types. The default is to return passive view
3060 type, i.e. to show how the installed packages get changed.
3061
3062 SOLVER_TRANSACTION_SHOW_OBSOLETES
3063 Do not map the obsolete view type into INSTALL/ERASE elements.
3064
3065 SOLVER_TRANSACTION_SHOW_ALL
3066 If multiple packages replace an installed package, only the best of
3067 them is kept as OBSOLETE element, the other ones are mapped to
3068 INSTALL/ERASE elements. This is because most applications want to
3069 show just one package replacing the installed one. The
3070 SOLVER_TRANSACTION_SHOW_ALL makes the library keep all OBSOLETE
3071 elements.
3072
3073 SOLVER_TRANSACTION_SHOW_MULTIINSTALL
3074 The library maps MULTIINSTALL elements to simple INSTALL elements.
3075 This flag can be used to disable the mapping.
3076
3077 SOLVER_TRANSACTION_CHANGE_IS_REINSTALL
3078 Use this flag if you want to map CHANGE elements to the REINSTALL
3079 type.
3080
3081 SOLVER_TRANSACTION_OBSOLETE_IS_UPGRADE
3082 Use this flag if you want to map OBSOLETE elements to the UPGRADE
3083 type.
3084
3085 SOLVER_TRANSACTION_MERGE_ARCHCHANGES
3086 Do not add extra categories for every architecture change, instead
3087 cumulate them in one category.
3088
3089 SOLVER_TRANSACTION_MERGE_VENDORCHANGES
3090 Do not add extra categories for every vendor change, instead
3091 cumulate them in one category.
3092
3093 SOLVER_TRANSACTION_RPM_ONLY
3094 Special view mode that just returns IGNORE, ERASE, INSTALL,
3095 MULTIINSTALL elements. Useful if you want to find out what to feed
3096 to the underlying package manager.
3097
3098 Transaction order flags
3099
3100 SOLVER_TRANSACTION_KEEP_ORDERDATA
3101 Do not throw away the dependency graph used for ordering the
3102 transaction. This flag is needed if you want to do manual ordering.
3103
3104 ATTRIBUTES
3105 Pool *pool; /* read only */
3106 $trans->{pool}
3107 trans.pool
3108 trans.pool
3109
3110 Back pointer to pool.
3111
3112 METHODS
3113 bool isempty();
3114 $trans->isempty()
3115 trans.isempty()
3116 trans.isempty?
3117
3118 Returns true if the transaction does not do anything, i.e. has no
3119 elements.
3120
3121 Solvable *newsolvables();
3122 my @newsolvables = $trans->newsolvables();
3123 newsolvables = trans.newsolvables()
3124 newsolvables = trans.newsolvables()
3125
3126 Return all packages that are to be installed by the transaction. These
3127 are the packages that need to be downloaded from the repositories.
3128
3129 Solvable *keptsolvables();
3130 my @keptsolvables = $trans->keptsolvables();
3131 keptsolvables = trans.keptsolvables()
3132 keptsolvables = trans.keptsolvables()
3133
3134 Return all installed packages that the transaction will keep installed.
3135
3136 Solvable *steps();
3137 my @steps = $trans->steps();
3138 steps = trans.steps()
3139 steps = trans.steps()
3140
3141 Return all solvables that need to be installed (if the returned
3142 solvable is not already installed) or erased (if the returned solvable
3143 is installed). A step is also called a transaction element.
3144
3145 int steptype(Solvable *solvable, int mode)
3146 my $type = $trans->steptype($solvable, $mode);
3147 type = trans.steptype(solvable, mode)
3148 type = trans.steptype(solvable, mode)
3149
3150 Return the transaction type of the specified solvable. See the
3151 CONSTANTS sections for the mode argument flags and the list of returned
3152 types.
3153
3154 TransactionClass *classify(int mode = 0)
3155 my @classes = $trans->classify();
3156 classes = trans.classify()
3157 classes = trans.classify()
3158
3159 Group the transaction elements into classes so that they can be
3160 displayed in a structured way. You can use various mapping mode flags
3161 to tweak the result to match your preferences, see the mode argument
3162 flag in the CONSTANTS section. See the TransactionClass class for how
3163 to deal with the returned objects.
3164
3165 Solvable othersolvable(Solvable *solvable);
3166 my $other = $trans->othersolvable($solvable);
3167 other = trans.othersolvable(solvable)
3168 other = trans.othersolvable(solvable)
3169
3170 Return the “other” solvable for a given solvable. For installed
3171 packages the other solvable is the best package with the same name that
3172 replaces the installed package, or the best package of the obsoleting
3173 packages if the package does not get replaced by one with the same
3174 name.
3175
3176 For to be installed packages, the “other” solvable is the best
3177 installed package with the same name that will be replaced, or the best
3178 packages of all the packages that are obsoleted if the new package does
3179 not replace a package with the same name.
3180
3181 Thus, the “other” solvable is normally the package that is also shown
3182 for a given package.
3183
3184 Solvable *allothersolvables(Solvable *solvable);
3185 my @others = $trans->allothersolvables($solvable);
3186 others = trans.allothersolvables(solvable)
3187 others = trans.allothersolvables(solvable)
3188
3189 For installed packages, returns all of the packages that replace us.
3190 For to be installed packages, returns all of the packages that the new
3191 package replaces. The special “other” solvable is always the first
3192 entry of the returned array.
3193
3194 long long calc_installsizechange();
3195 my $change = $trans->calc_installsizechange();
3196 change = trans.calc_installsizechange()
3197 change = trans.calc_installsizechange()
3198
3199 Return the size change of the installed system in kilobytes
3200 (kibibytes).
3201
3202 void order(int flags = 0);
3203 $trans->order();
3204 trans.order()
3205 trans.order()
3206
3207 Order the steps in the transactions so that dependent packages are
3208 updated before packages that depend on them. For rpm, you can also use
3209 rpmlib’s ordering functionality, debian’s dpkg does not provide a way
3210 to order a transaction.
3211
3212 ACTIVE/PASSIVE VIEW
3213 Active view lists what new packages get installed, while passive view
3214 shows what happens to the installed packages. Most often there’s not
3215 much difference between the two modes, but things get interesting if
3216 multiple packages get replaced by one new package. Say you have
3217 installed packages A-1-1 and B-1-1, and now install A-2-1 which has a
3218 new dependency that obsoletes B. The transaction elements will be
3219
3220 updated A-1-1 (other: A-2-1)
3221 obsoleted B-1-1 (other: A-2-1)
3222
3223 in passive mode, but
3224
3225 update A-2-1 (other: A-1-1)
3226 erase B
3227
3228 in active mode. If the mode contains SOLVER_TRANSACTION_SHOW_ALL, the
3229 passive mode list will be unchanged but the active mode list will just
3230 contain A-2-1.
3231
3233 Objects of this type are returned by the classify() Transaction method.
3234
3235 ATTRIBUTES
3236 Transaction *transaction; /* read only */
3237 $class->{transaction}
3238 class.transaction
3239 class.transaction
3240
3241 Back pointer to transaction object.
3242
3243 int type; /* read only */
3244 $class->{type}
3245 class.type
3246 class.type
3247
3248 The type of the transaction elements in the class.
3249
3250 int count; /* read only */
3251 $class->{count}
3252 class.count
3253 class.count
3254
3255 The number of elements in the class.
3256
3257 const char *fromstr;
3258 $class->{fromstr}
3259 class.fromstr
3260 class.fromstr
3261
3262 The old vendor or architecture.
3263
3264 const char *tostr;
3265 $class->{tostr}
3266 class.tostr
3267 class.tostr
3268
3269 The new vendor or architecture.
3270
3271 Id fromid;
3272 $class->{fromid}
3273 class.fromid
3274 class.fromid
3275
3276 The id of the old vendor or architecture.
3277
3278 Id toid;
3279 $class->{toid}
3280 class.toid
3281 class.toid
3282
3283 The id of the new vendor or architecture.
3284
3285 METHODS
3286 void solvables();
3287 my @solvables = $class->solvables();
3288 solvables = class.solvables()
3289 solvables = class.solvables()
3290
3291 Return the solvables for all transaction elements in the class.
3292
3294 Checksums (also called hashes) are used to make sure that downloaded
3295 data is not corrupt and also as a fingerprint mechanism to check if
3296 data has changed.
3297
3298 CLASS METHODS
3299 Chksum Chksum(Id type)
3300 my $chksum = solv::Chksum->new($type);
3301 chksum = solv.Chksum(type)
3302 chksum = Solv::Chksum.new(type)
3303
3304 Create a checksum object. Currently the following types are supported:
3305
3306 REPOKEY_TYPE_MD5
3307 REPOKEY_TYPE_SHA1
3308 REPOKEY_TYPE_SHA256
3309
3310 These keys are constants in the solv class.
3311
3312 Chksum Chksum(Id type, const char *hex)
3313 my $chksum = solv::Chksum->new($type, $hex);
3314 chksum = solv.Chksum(type, hex)
3315 chksum = Solv::Chksum.new(type, hex)
3316
3317 Create an already finalized checksum object from a hex string.
3318
3319 Chksum Chksum_from_bin(Id type, char *bin)
3320 my $chksum = solv::Chksum->from_bin($type, $bin);
3321 chksum = solv.Chksum.from_bin(type, bin)
3322 chksum = Solv::Chksum.from_bin(type, bin)
3323
3324 Create an already finalized checksum object from a binary checksum.
3325
3326 ATTRIBUTES
3327 Id type; /* read only */
3328 $chksum->{type}
3329 chksum.type
3330 chksum.type
3331
3332 Return the type of the checksum object.
3333
3334 METHODS
3335 void add(const char *str)
3336 $chksum->add($str);
3337 chksum.add(str)
3338 chksum.add(str)
3339
3340 Add a (binary) string to the checksum.
3341
3342 void add_fp(FILE *fp)
3343 $chksum->add_fp($file);
3344 chksum.add_fp(file)
3345 chksum.add_fp(file)
3346
3347 Add the contents of a file to the checksum.
3348
3349 void add_stat(const char *filename)
3350 $chksum->add_stat($filename);
3351 chksum.add_stat(filename)
3352 chksum.add_stat(filename)
3353
3354 Stat the file and add the dev/ino/size/mtime member to the checksum. If
3355 the stat fails, the members are zeroed.
3356
3357 void add_fstat(int fd)
3358 $chksum->add_fstat($fd);
3359 chksum.add_fstat(fd)
3360 chksum.add_fstat(fd)
3361
3362 Same as add_stat, but instead of the filename a file descriptor is
3363 used.
3364
3365 unsigned char *raw()
3366 my $raw = $chksum->raw();
3367 raw = chksum.raw()
3368 raw = chksum.raw()
3369
3370 Finalize the checksum and return the result as raw bytes. This means
3371 that the result can contain NUL bytes or unprintable characters.
3372
3373 const char *hex()
3374 my $raw = $chksum->hex();
3375 raw = chksum.hex()
3376 raw = chksum.hex()
3377
3378 Finalize the checksum and return the result as hex string.
3379
3380 const char *typestr()
3381 my $typestr = $chksum->typestr();
3382 typestr = chksum.typestr
3383 typestr = chksum.typestr
3384
3385 Return the type of the checksum as a string, e.g. "sha256".
3386
3387 <equality>
3388 if ($chksum1 == $chksum2)
3389 if chksum1 == chksum2:
3390 if chksum1 == chksum2
3391
3392 Checksums are equal if they are of the same type and the finalized
3393 results are the same.
3394
3395 <stringification>
3396 my $str = $chksum->str;
3397 str = str(chksum)
3398 str = chksum.to_s
3399
3400 If the checksum is finished, the checksum is returned as "<type>:<hex>"
3401 string. Otherwise "<type>:unfinished" is returned.
3402
3404 This functions were added because libsolv uses standard FILE pointers
3405 to read/write files, but languages like perl have their own
3406 implementation of files. The libsolv functions also support
3407 decompression and compression, the algorithm is selected by looking at
3408 the file name extension.
3409
3410 FILE *xfopen(char *fn, char *mode = "r")
3411 my $file = solv::xfopen($path);
3412 file = solv.xfopen(path)
3413 file = Solv::xfopen(path)
3414
3415 Open a file at the specified path. The mode argument is passed on to
3416 the stdio library.
3417
3418 FILE *xfopen_fd(char *fn, int fileno)
3419 my $file = solv::xfopen_fd($path, $fileno);
3420 file = solv.xfopen_fd(path, fileno)
3421 file = Solv::xfopen_fd(path, fileno)
3422
3423 Create a file handle from the specified file descriptor. The path
3424 argument is only used to select the correct (de-)compression algorithm,
3425 use an empty path if you want to make sure to read/write raw data. The
3426 file descriptor is dup()ed before the file handle is created.
3427
3428 METHODS
3429 int fileno()
3430 my $fileno = $file->fileno();
3431 fileno = file.fileno()
3432 fileno = file.fileno()
3433
3434 Return file file descriptor of the file. If the file is not open, -1 is
3435 returned.
3436
3437 void cloexec(bool state)
3438 $file->cloexec($state)
3439 file.cloexec(state)
3440 file.cloexec(state)
3441
3442 Set the close-on-exec flag of the file descriptor. The xfopen function
3443 returns files with close-on-exec turned on, so if you want to pass a
3444 file to some other process you need to call cloexec(0) before calling
3445 exec.
3446
3447 int dup()
3448 my $fileno = $file->dup();
3449 fileno = file.dup()
3450 fileno = file.dup()
3451
3452 Return a copy of the descriptor of the file. If the file is not open,
3453 -1 is returned.
3454
3455 bool flush()
3456 $file->flush();
3457 file.flush()
3458 file.flush()
3459
3460 Flush the file. Returns false if there was an error. Flushing a closed
3461 file always returns true.
3462
3463 bool close()
3464 $file->close();
3465 file.close()
3466 file.close()
3467
3468 Close the file. This is needed for languages like Ruby that do not
3469 destruct objects right after they are no longer referenced. In that
3470 case, it is good style to close open files so that the file descriptors
3471 are freed right away. Returns false if there was an error.
3472
3474 The Repodata stores attributes for packages and the repository itself,
3475 each repository can have multiple repodata areas. You normally only
3476 need to directly access them if you implement lazy downloading of
3477 repository data. Repodata areas are created by calling the repository’s
3478 add_repodata() method or by using repo_add methods without the
3479 REPO_REUSE_REPODATA or REPO_USE_LOADING flag.
3480
3481 ATTRIBUTES
3482 Repo *repo; /* read only */
3483 $data->{repo}
3484 data.repo
3485 data.repo
3486
3487 Back pointer to repository object.
3488
3489 Id id; /* read only */
3490 $data->{id}
3491 data.id
3492 data.id
3493
3494 The id of the repodata area. Repodata ids of different repositories
3495 overlap.
3496
3497 METHODS
3498 internalize();
3499 $data->internalize();
3500 data.internalize()
3501 data.internalize()
3502
3503 Internalize newly added data. The lookup functions will only see the
3504 new data after it has been internalized.
3505
3506 bool write(FILE *fp);
3507 $data->write($fp);
3508 data.write(fp)
3509 data.write(fp)
3510
3511 Write the contents of the repodata area as solv file.
3512
3513 Id str2dir(const char *dir, bool create = 1)
3514 my $did = data->str2dir($dir);
3515 did = data.str2dir(dir)
3516 did = data.str2dir(dir)
3517
3518 const char *dir2str(Id did, const char *suffix = 0)
3519 $dir = pool->dir2str($did);
3520 dir = pool.dir2str(did)
3521 dir = pool.dir2str(did)
3522
3523 Convert a string (directory) into an Id and back. If the string is
3524 currently not in the pool and create is false, zero is returned.
3525
3526 void add_dirstr(Id solvid, Id keyname, Id dir, const char *str)
3527 $data->add_dirstr($solvid, $keyname, $dir, $string)
3528 data.add_dirstr(solvid, keyname, dir, string)
3529 data.add_dirstr(solvid, keyname, dir, string)
3530
3531 Add a file path consisting of a dirname Id and a basename string.
3532
3533 bool add_solv(FILE *fp, int flags = 0);
3534 $data->add_solv($fp);
3535 data.add_solv(fp)
3536 data.add_solv(fp)
3537
3538 Replace a stub repodata object with the data from a solv file. This
3539 method automatically adds the REPO_USE_LOADING flag. It should only be
3540 used from a load callback.
3541
3542 void create_stubs();
3543 $data->create_stubs()
3544 data.create_stubs()
3545 data.create_stubs()
3546
3547 Create stub repodatas from the information stored in the repodata meta
3548 area.
3549
3550 void extend_to_repo();
3551 $data->extend_to_repo();
3552 data.extend_to_repo()
3553 data.extend_to_repo()
3554
3555 Extend the repodata so that it has the same size as the repo it belongs
3556 to. This method is needed when setting up a new extension repodata so
3557 that it matches the repository size. It is also needed when switching
3558 to a just written repodata extension to make the repodata match the
3559 written extension (which is always of the size of the repo).
3560
3561 <equality>
3562 if ($data1 == $data2)
3563 if data1 == data2:
3564 if data1 == data2
3565
3566 Two repodata objects are equal if they belong to the same repository
3567 and have the same id.
3568
3569 DATA RETRIEVAL METHODS
3570 const char *lookup_str(Id solvid, Id keyname)
3571 my $string = $data->lookup_str($solvid, $keyname);
3572 string = data.lookup_str(solvid, keyname)
3573 string = data.lookup_str(solvid, keyname)
3574
3575 const char *lookup_id(Id solvid, Id keyname)
3576 my $string = $data->lookup_id($solvid, $keyname);
3577 string = data.lookup_id(solvid, keyname)
3578 string = data.lookup_id(solvid, keyname)
3579
3580 unsigned long long lookup_num(Id solvid, Id keyname, unsigned long long notfound = 0)
3581 my $num = $data->lookup_num($solvid, $keyname);
3582 num = data.lookup_num(solvid, keyname)
3583 num = data.lookup_num(solvid, keyname)
3584
3585 bool lookup_void(Id solvid, Id keyname)
3586 my $bool = $data->lookup_void($solvid, $keyname);
3587 bool = data.lookup_void(solvid, keyname)
3588 bool = data.lookup_void(solvid, keyname)
3589
3590 Id *lookup_idarray(Id solvid, Id keyname)
3591 my @ids = $data->lookup_idarray($solvid, $keyname);
3592 ids = data.lookup_idarray(solvid, keyname)
3593 ids = data.lookup_idarray(solvid, keyname)
3594
3595 Chksum lookup_checksum(Id solvid, Id keyname)
3596 my $chksum = $data->lookup_checksum($solvid, $keyname);
3597 chksum = data.lookup_checksum(solvid, keyname)
3598 chksum = data.lookup_checksum(solvid, keyname)
3599
3600 Lookup functions. Return the data element stored in the specified
3601 solvable. The methods probably only make sense to retrieve data from
3602 the special SOLVID_META solvid that stores repodata meta information.
3603
3604 DATA STORAGE METHODS
3605 void set_str(Id solvid, Id keyname, const char *str);
3606 $data->set_str($solvid, $keyname, $str);
3607 data.set_str(solvid, keyname, str)
3608 data.set_str(solvid, keyname, str)
3609
3610 void set_id(Id solvid, Id keyname, DepId id);
3611 $data->set_id($solvid, $keyname, $id);
3612 data.set_id(solvid, keyname, id)
3613 data.set_id(solvid, keyname, id)
3614
3615 void set_num(Id solvid, Id keyname, unsigned long long num);
3616 $data->set_num($solvid, $keyname, $num);
3617 data.set_num(solvid, keyname, num)
3618 data.set_num(solvid, keyname, num)
3619
3620 void set_void(Id solvid, Id keyname);
3621 $data->set_void($solvid, $keyname);
3622 data.set_void(solvid, keyname)
3623 data.set_void(solvid, keyname)
3624
3625 void set_poolstr(Id solvid, Id keyname, const char *str);
3626 $data->set_poolstr($solvid, $keyname, $str);
3627 data.set_poolstr(solvid, keyname, str)
3628 data.set_poolstr(solvid, keyname, str)
3629
3630 void set_checksum(Id solvid, Id keyname, Chksum *chksum);
3631 $data->set_checksum($solvid, $keyname, $chksum);
3632 data.set_checksum(solvid, keyname, chksum)
3633 data.set_checksum(solvid, keyname, chksum)
3634
3635 void set_sourcepkg(Id solvid, const char *sourcepkg);
3636 $data.set_sourcepkg($solvid, $sourcepkg);
3637 data.set_sourcepkg(solvid, sourcepkg)
3638 data.set_sourcepkg(solvid, sourcepkg)
3639
3640 void set_location(Id solvid, unsigned int mediano, const char *location);
3641 $data.set_location($solvid, $mediano, $location);
3642 data.set_location(solvid, mediano, location)
3643 data.set_location(solvid, mediano, location)
3644
3645 void add_idarray(Id solvid, Id keyname, DepId id);
3646 $data->add_idarray($solvid, $keyname, $id);
3647 data.add_idarray(solvid, keyname, id)
3648 data.add_idarray(solvid, keyname, id)
3649
3650 Id new_handle();
3651 my $handle = $data->new_handle();
3652 handle = data.new_handle()
3653 handle = data.new_handle()
3654
3655 void add_flexarray(Id solvid, Id keyname, Id handle);
3656 $data->add_flexarray($solvid, $keyname, $handle);
3657 data.add_flexarray(solvid, keyname, handle)
3658 data.add_flexarray(solvid, keyname, handle)
3659
3660 void unset(Id solvid, Id keyname);
3661 $data->unset($solvid, $keyname);
3662 data.unset(solvid, keyname)
3663 data.unset(solvid, keyname)
3664
3665 Data storage methods. Probably only useful to store data in the special
3666 SOLVID_META solvid that stores repodata meta information. Note that
3667 repodata areas can have their own Id pool (see the REPO_LOCALPOOL
3668 flag), so be careful if you need to store ids. Arrays are created by
3669 calling the add function for every element. A flexarray is an array of
3670 sub-structures, call new_handle to create a new structure, use the
3671 handle as solvid to fill the structure with data and call add_flexarray
3672 to put the structure in an array.
3673
3675 Datapos objects describe a specific position in the repository data
3676 area. Thus they are only valid until the repository is modified in some
3677 way. Datapos objects can be created by the pos() and parentpos()
3678 methods of a Datamatch object or by accessing the “meta” attribute of a
3679 repository.
3680
3681 ATTRIBUTES
3682 Repo *repo; /* read only */
3683 $data->{repo}
3684 data.repo
3685 data.repo
3686
3687 Back pointer to repository object.
3688
3689 METHODS
3690 Dataiterator(Id keyname, const char *match, int flags)
3691 my $di = $datapos->Dataiterator($keyname, $match, $flags);
3692 di = datapos.Dataiterator(keyname, match, flags)
3693 di = datapos.Dataiterator(keyname, match, flags)
3694
3695 Create a Dataiterator at the position of the datapos object.
3696
3697 const char *lookup_deltalocation(unsigned int *OUTPUT);
3698 my ($location, $mediano) = $datapos->lookup_deltalocation();
3699 location, mediano = datapos.lookup_deltalocation()
3700 location, mediano = datapos.lookup_deltalocation()
3701
3702 Return a tuple containing the on-media location and an optional media
3703 number for a delta rpm. This obviously only works if the data position
3704 points to structure describing a delta rpm.
3705
3706 const char *lookup_deltaseq();
3707 my $seq = $datapos->lookup_deltaseq();
3708 seq = datapos.lookup_deltaseq();
3709 seq = datapos.lookup_deltaseq();
3710
3711 Return the delta rpm sequence from the structure describing a delta
3712 rpm.
3713
3714 DATA RETRIEVAL METHODS
3715 const char *lookup_str(Id keyname)
3716 my $string = $datapos->lookup_str($keyname);
3717 string = datapos.lookup_str(keyname)
3718 string = datapos.lookup_str(keyname)
3719
3720 Id lookup_id(Id solvid, Id keyname)
3721 my $id = $datapos->lookup_id($keyname);
3722 id = datapos.lookup_id(keyname)
3723 id = datapos.lookup_id(keyname)
3724
3725 unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0)
3726 my $num = $datapos->lookup_num($keyname);
3727 num = datapos.lookup_num(keyname)
3728 num = datapos.lookup_num(keyname)
3729
3730 bool lookup_void(Id keyname)
3731 my $bool = $datapos->lookup_void($keyname);
3732 bool = datapos.lookup_void(keyname)
3733 bool = datapos.lookup_void(keyname)
3734
3735 Id *lookup_idarray(Id keyname)
3736 my @ids = $datapos->lookup_idarray($keyname);
3737 ids = datapos.lookup_idarray(keyname)
3738 ids = datapos.lookup_idarray(keyname)
3739
3740 Chksum lookup_checksum(Id keyname)
3741 my $chksum = $datapos->lookup_checksum($keyname);
3742 chksum = datapos.lookup_checksum(keyname)
3743 chksum = datapos.lookup_checksum(keyname)
3744
3745 Lookup functions. Note that the returned Ids are always translated into
3746 the Ids of the global pool even if the repodata area contains its own
3747 pool.
3748
3749 Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0)
3750 my $di = $datapos->Dataiterator($keyname, $match, $flags);
3751 di = datapos.Dataiterator(keyname, match, flags)
3752 di = datapos.Dataiterator(keyname, match, flags)
3753
3754 for my $d (@$di)
3755 for d in di:
3756 for d in di
3757
3758 Iterate over the matching data elements. See the Dataiterator class for
3759 more information.
3760
3762 Michael Schroeder <mls@suse.de>
3763
3764
3765
3766libsolv 11/18/2020 LIBSOLV-BINDINGS(3)