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