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