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