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