1LIBSOLV-POOL(3) LIBSOLV LIBSOLV-POOL(3)
2
3
4
6 libsolv-pool - Libsolv's pool object
7
9 void *appdata
10 A no-purpose pointer free to use for the library user. Freeing the
11 pool simply discards the pointer.
12
13 Stringpool ss
14 The pool of unified strings.
15
16 Reldep *rels
17 The pool of unified relation dependencies.
18
19 int nrels
20 Number of allocated relation dependencies.
21
22 Repo **repos
23 The array of repository pointers, indexed by repository Id.
24
25 int nrepos
26 Number of allocated repository array elements, i.e. the size of the
27 repos array.
28
29 int urepos
30 Number of used (i.e. non-zero) repository array elements.
31
32 Repo *installed
33 Pointer to the repo holding the installed packages. You are free to
34 read this attribute, but you should use pool_set_installed() if you
35 want to change it.
36
37 Solvable *solvables
38 The array of Solvable objects.
39
40 int nsolvables
41 Number of Solvable objects, i.e. the size of the solvables array.
42 Note that the array may contain freed solvables, in that case the
43 repo pointer of the solvable will be zero.
44
45 int disttype
46 The distribution type of your system, e.g. DISTTYPE_DEB. You are
47 free to read this attribute, but you should use pool_setdisttype()
48 if you want to change it.
49
50 Id *whatprovidesdata
51 Multi-purpose Id storage holding zero terminated arrays of Ids.
52 pool_whatprovides() returns an offset into this data.
53
54 Map *considered
55 Optional bitmap that can make the library ignore solvables. If a
56 bitmap is set, only solvables that have a set bit in the bitmap at
57 their Id are considered usable.
58
59 int debugmask
60 A mask that defines which debug events should be reported.
61 pool_setdebuglevel() sets this mask.
62
63 Datapos pos
64 An object storing some position in the repository data. Functions
65 like dataiterator_set_pos() set this object, accessing data with a
66 pseudo solvable Id of SOLVID_POS uses it.
67
68 Queue pooljobs
69 A queue where fixed solver jobs can be stored. This jobs are
70 automatically added when solver_solve() is called, they are useful
71 to store configuration data like which packages should be
72 multiversion installed.
73
75 Pool *pool_create();
76
77 Create a new instance of a pool.
78
79 void pool_free(Pool *pool);
80
81 Free a pool and all of the data it contains, e.g. the solvables,
82 repositories, strings.
83
85 Constants
86 SOLV_FATAL
87 Report the error and call “exit(1)” afterwards. You cannot mask
88 this level. Reports to stderr instead of stdout.
89
90 SOLV_ERROR
91 Used to report errors. Reports to stderr instead of stdout.
92
93 SOLV_WARN
94 Used to report warnings.
95
96 SOLV_DEBUG_STATS
97 Used to report statistical data.
98
99 SOLV_DEBUG_RULE_CREATION
100 Used to report information about the solver’s creation of rules.
101
102 SOLV_DEBUG_PROPAGATE
103 Used to report information about the solver’s unit rule propagation
104 process.
105
106 SOLV_DEBUG_ANALYZE
107 Used to report information about the solver’s learnt rule
108 generation mechanism.
109
110 SOLV_DEBUG_UNSOLVABLE
111 Used to report information about the solver dealing with
112 conflicting rules.
113
114 SOLV_DEBUG_SOLUTIONS
115 Used to report information about the solver creating solutions to
116 solve problems.
117
118 SOLV_DEBUG_POLICY
119 Used to report information about the solver searching for an
120 optimal solution.
121
122 SOLV_DEBUG_RESULT
123 Used by the debug functions to output results.
124
125 SOLV_DEBUG_JOB
126 Used to report information about the job rule generation process.
127
128 SOLV_DEBUG_SOLVER
129 Used to report information about what the solver is currently
130 doing.
131
132 SOLV_DEBUG_TRANSACTION
133 Used to report information about the transaction generation and
134 ordering process.
135
136 SOLV_DEBUG_TO_STDERR
137 Write debug messages to stderr instead of stdout.
138
139 Functions
140 void pool_debug(Pool *pool, int type, const char *format, ...);
141
142 Report a message of the type type. You can filter debug messages by
143 setting a debug mask.
144
145 void pool_setdebuglevel(Pool *pool, int level);
146
147 Set a predefined debug mask. A higher level generally means more bits
148 in the mask are set, thus more messages are printed.
149
150 void pool_setdebugmask(Pool *pool, int mask);
151
152 Set the debug mask to filter debug messages.
153
154 int pool_error(Pool *pool, int ret, const char *format, ...);
155
156 Set the pool’s error string. The ret value is simply used as a return
157 value of the function so that you can write code like return
158 pool_error(...);. If the debug mask contains the SOLV_ERROR bit,
159 pool_debug() is also called with the message and type SOLV_ERROR.
160
161 extern char *pool_errstr(Pool *pool);
162
163 Return the current error string stored in the pool. Like with the
164 libc’s errno value, the string is only meaningful after a function
165 returned an error.
166
167 void pool_setdebugcallback(Pool *pool, void (*debugcallback)(Pool *, void *data, int type, const char *str), void *debugcallbackdata);
168
169 Set a custom debug callback function. Instead of writing to stdout or
170 stderr, the callback function will be called.
171
173 Constants
174 DISTTYPE_RPM
175 Used for systems which use rpm as low level package manager.
176
177 DISTTYPE_DEB
178 Used for systems which use dpkg as low level package manager.
179
180 DISTTYPE_ARCH
181 Used for systems which use the arch linux package manager.
182
183 DISTTYPE_HAIKU
184 Used for systems which use haiku packages.
185
186 POOL_FLAG_PROMOTEEPOCH
187 Promote the epoch of the providing dependency to the requesting
188 dependency if it does not contain an epoch. Used at some time in
189 old rpm versions, modern systems should never need this.
190
191 POOL_FLAG_FORBIDSELFCONFLICTS
192 Disallow the installation of packages that conflict with
193 themselves. Debian always allows self-conflicting packages, rpm
194 used to forbid them but switched to also allowing them recently.
195
196 POOL_FLAG_OBSOLETEUSESPROVIDES
197 Make obsolete type dependency match against provides instead of
198 just the name and version of packages. Very old versions of rpm
199 used the name/version, then it got switched to provides and later
200 switched back again to just name/version.
201
202 POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES
203 An implicit obsoletes is the internal mechanism to remove the old
204 package on an update. The default is to remove all packages with
205 the same name, rpm-5 switched to also removing packages providing
206 the same name.
207
208 POOL_FLAG_OBSOLETEUSESCOLORS
209 Rpm’s multilib implementation (used in RedHat and Fedora)
210 distinguishes between 32bit and 64bit packages (the terminology is
211 that they have a different color). If obsoleteusescolors is set,
212 packages with different colors will not obsolete each other.
213
214 POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS
215 Same as POOL_FLAG_OBSOLETEUSESCOLORS, but used to find out if
216 packages of the same name can be installed in parallel. For current
217 Fedora systems, POOL_FLAG_OBSOLETEUSESCOLORS should be false and
218 POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS should be true (this is the
219 default if FEDORA is defined when libsolv is compiled).
220
221 POOL_FLAG_NOINSTALLEDOBSOLETES
222 New versions of rpm consider the obsoletes of installed packages
223 when checking for dependency, thus you may not install a package
224 that is obsoleted by some other installed package, unless you also
225 erase the other package.
226
227 POOL_FLAG_HAVEDISTEPOCH
228 Mandriva added a new field called distepoch that gets checked in
229 version comparison if the epoch/version/release of two packages are
230 the same.
231
232 POOL_FLAG_NOOBSOLETESMULTIVERSION
233 If a package is installed in multiversionmode, rpm used to ignore
234 both the implicit obsoletes and the obsolete dependency of a
235 package. This was changed to ignoring just the implicit obsoletes,
236 thus you may install multiple versions of the same name, but
237 obsoleted packages still get removed.
238
239 POOL_FLAG_ADDFILEPROVIDESFILTERED
240 Make the addfileprovides method only add files from the standard
241 locations (i.e. the “bin” and “etc” directories). This is useful if
242 you have only few packages that use non-standard file dependencies,
243 but you still want the fast speed that addfileprovides() generates.
244
245 Functions
246 int pool_setdisttype(Pool *pool, int disttype);
247
248 Set the package type of your system. The disttype is used for example
249 to define package comparison semantics. Libsolv’s default disttype
250 should match the package manager of your system, so you only need to
251 use this function if you want to use the library to solve packaging
252 problems for different systems. The Function returns the old disttype
253 on success, and -1 if the new disttype is not supported. Note that any
254 pool_setarch and pool_setarchpolicy calls need to come after the
255 pool_setdisttype call, as they make use of the noarch/any/all
256 architecture id.
257
258 int pool_set_flag(Pool *pool, int flag, int value);
259
260 Set a flag to a new value. Returns the old value of the flag.
261
262 int pool_get_flag(Pool *pool, int flag);
263
264 Get the value of a pool flag. See the constants section about the
265 meaning of the flags.
266
267 void pool_set_rootdir(Pool *pool, const char *rootdir);
268
269 Set a specific root directory. Some library functions support a flag
270 that tells the function to prepend the rootdir to file and directory
271 names.
272
273 const char *pool_get_rootdir(Pool *pool);
274
275 Return the current value of the root directory.
276
277 char *pool_prepend_rootdir(Pool *pool, const char *dir);
278
279 Prepend the root directory to the dir argument string. The returned
280 string has been newly allocated and needs to be freed after use.
281
282 char *pool_prepend_rootdir_tmp(Pool *pool, const char *dir);
283
284 Same as pool_prepend_rootdir, but uses the pool’s temporary space for
285 allocation.
286
287 void pool_set_installed(Pool *pool, Repo *repo);
288
289 Set which repository should be treated as the “installed” repository,
290 i.e. the one that holds information about the installed packages.
291
292 void pool_set_languages(Pool *pool, const char **languages, int nlanguages);
293
294 Set the language of your system. The library provides lookup functions
295 that return localized strings, for example for package descriptions.
296 You can set an array of languages to provide a fallback mechanism if
297 one language is not available.
298
299 void pool_setarch(Pool *pool, const char *arch);
300
301 Set the architecture of your system. The architecture is used to
302 determine which packages are installable and which packages cannot be
303 installed. The arch argument is normally the “machine” value of the
304 “uname” system call.
305
306 void pool_setarchpolicy(Pool *, const char *);
307
308 Set the architecture policy for your system. This is the general
309 version of pool_setarch (in fact pool_setarch calls pool_setarchpolicy
310 internally). See the section about architecture policies for more
311 information.
312
313 void pool_addvendorclass(Pool *pool, const char **vendorclass);
314
315 Add a new vendor equivalence class to the system. A vendor equivalence
316 class defines if an installed package of one vendor can be replaced by
317 a package coming from a different vendor. The vendorclass argument must
318 be a NULL terminated array of strings. See the section about vendor
319 policies for more information.
320
321 void pool_setvendorclasses(Pool *pool, const char **vendorclasses);
322
323 Set all allowed vendor equivalences. The vendorclasses argument must be
324 an NULL terminated array consisting of all allowed classes
325 concatenated. Each class itself must be NULL terminated, thus the last
326 class ends with two NULL elements, one to finish the class and one to
327 finish the list of classes.
328
329 void pool_set_custom_vendorcheck(Pool *pool, int (*vendorcheck)(Pool *, Solvable *, Solvable *));
330
331 Define a custom vendor check mechanism. You can use this if libsolv’s
332 internal vendor equivalence class mechanism does not match your needs.
333
334 void pool_setloadcallback(Pool *pool, int (*cb)(Pool *, Repodata *, void *), void *loadcbdata);
335
336 Define a callback function that gets called when repository metadata
337 needs to be loaded on demand. See the section about on demand loading
338 in the libsolv-repodata manual.
339
340 void pool_setnamespacecallback(Pool *pool, Id (*cb)(Pool *, void *, Id, Id), void *nscbdata);
341
342 Define a callback function to implement custom namespace support. See
343 the section about namespace dependencies.
344
346 Constants
347 ID_EMPTY
348 The Id of the empty string, it is always Id 1.
349
350 REL_LT
351 Represents a “<” relation.
352
353 REL_EQ
354 Represents a “=” relation.
355
356 REL_GT
357 Represents a “>” relation. You can use combinations of REL_GT,
358 REL_EQ, and REL_LT or-ed together to create any relation you like.
359
360 REL_AND
361 A boolean AND operation, the “name” and “evr” parts of the relation
362 can be two sub-dependencies. Packages must match both parts of the
363 dependency.
364
365 REL_OR
366 A boolean OR operation, the “name” and “evr” parts of the relation
367 can be two sub-dependencies. Packages can match any part of the
368 dependency.
369
370 REL_WITH
371 Like REL_AND, but packages must match both dependencies
372 simultaneously. See the section about boolean dependencies about
373 more information.
374
375 REL_NAMESPACE
376 A special namespace relation. See the section about namespace
377 dependencies for more information.
378
379 REL_ARCH
380 An architecture filter dependency. The “name” part of the relation
381 is a sub-dependency, the “evr” part is the Id of an architecture
382 that the matching packages must have (note that this is an exact
383 match ignoring architecture policies).
384
385 REL_FILECONFLICT
386 An internal file conflict dependency used to represent file
387 conflicts. See the pool_add_fileconflicts_deps() function.
388
389 REL_COND
390 A conditional dependency, the “name” sub-dependency is only
391 considered if the “evr” sub-dependency is fulfilled. See the
392 section about boolean dependencies about more information.
393
394 REL_UNLESS
395 A conditional dependency, the “name” sub-dependency is only
396 considered if the “evr” sub-dependency is not fulfilled. See the
397 section about boolean dependencies about more information.
398
399 REL_COMPAT
400 A compat dependency used in Haiku to represent version ranges. The
401 “name” part is the actual version, the “evr” part is the backwards
402 compatibility version.
403
404 REL_KIND
405 A pseudo dependency that limits the solvables to a specific kind.
406 The kind is expected to be a prefix of the solvable name, e.g.
407 “patch:foo” would be of kind “patch”. “REL_KIND” is only supported
408 in the selection functions.
409
410 REL_MULTIARCH
411 A debian multiarch annotation. The most common value for the “evr”
412 part is “any”.
413
414 REL_ELSE
415 The else part of a “REL_COND” or “REL_UNLESS” dependency. See the
416 section about boolean dependencies.
417
418 REL_ERROR
419 An illegal dependency. This is useful to encode dependency parse
420 errors.
421
422 Functions
423 Id pool_str2id(Pool *pool, const char *str, int create);
424
425 Add a string to the pool of unified strings, returning the Id of the
426 string. If create is zero, new strings will not be added to the pool,
427 instead Id 0 is returned.
428
429 Id pool_strn2id(Pool *pool, const char *str, unsigned int len, int create);
430
431 Same as pool_str2id, but only len characters of the string are used.
432 This can be used to add substrings to the pool.
433
434 Id pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create);
435
436 Create a relational dependency from to other dependencies, name and
437 evr, and a flag. See the REL_ constants for the supported flags. As
438 with pool_str2id, create defines if new dependencies will get added or
439 Id zero will be returned instead.
440
441 Id pool_id2langid(Pool *pool, Id id, const char *lang, int create);
442
443 Attach a language suffix to a string Id. This function can be used to
444 create language keyname Ids from keynames, it is functional equivalent
445 to converting the id argument to a string, adding a “:” character and
446 the lang argument to the string and then converting the result back
447 into an Id.
448
449 const char *pool_id2str(const Pool *pool, Id id);
450
451 Convert an Id back into a string. If the Id is a relational Id, the
452 “name” part will be converted instead.
453
454 const char *pool_id2rel(const Pool *pool, Id id);
455
456 Return the relation string of a relational Id. Returns an empty string
457 if the passed Id is not a relation.
458
459 const char *pool_id2evr(const Pool *pool, Id id);
460
461 Return the “evr” part of a relational Id as string. Returns an empty
462 string if the passed Id is not a relation.
463
464 const char *pool_dep2str(Pool *pool, Id id);
465
466 Convert an Id back into a string. If the passed Id belongs to a
467 relation, a string representing the relation is returned. Note that in
468 that case the string is allocated on the pool’s temporary space.
469
470 void pool_freeidhashes(Pool *pool);
471
472 Free the hashes used to unify strings and relations. You can use this
473 function to save memory if you know that you will no longer create new
474 strings and relations.
475
477 Solvable *pool_id2solvable(const Pool *pool, Id p);
478
479 Convert a solvable Id into a pointer to the solvable data. Note that
480 the pointer may become invalid if new solvables are created or old
481 solvables deleted, because the array storing all solvables may get
482 reallocated.
483
484 const char *pool_solvid2str(Pool *pool, Id p);
485
486 Return a string representing the solvable with the Id p. The string
487 will be some canonical representation of the solvable, usually a
488 combination of the name, the version, and the architecture.
489
490 const char *pool_solvable2str(Pool *pool, Solvable *s);
491
492 Same as pool_solvid2str, but instead of the Id, a pointer to the
493 solvable is passed.
494
496 Constants
497 EVRCMP_COMPARE
498 Compare all parts of the version, treat missing parts as empty
499 strings.
500
501 EVRCMP_MATCH_RELEASE
502 A special mode for rpm version string matching. If a version misses
503 a release part, it matches all releases. In that case the special
504 values “-2” and “2” are returned, depending on which of the two
505 versions did not have a release part.
506
507 EVRCMP_MATCH
508 A generic match, missing parts always match.
509
510 EVRCMP_COMPARE_EVONLY
511 Only compare the epoch and the version parts, ignore the release
512 part.
513
514 Functions
515 int pool_evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode);
516
517 Compare two version Ids, return -1 if the first version is less than
518 the second version, 0 if they are identical, and 1 if the first version
519 is bigger than the second one.
520
521 int pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode);
522
523 Same as pool_evrcmp(), but uses strings instead of Ids.
524
525 int pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version, const char *release);
526
527 Match a version Id against an epoch, a version and a release string.
528 Passing NULL means that the part should match everything.
529
530 int pool_match_dep(Pool *pool, Id d1, Id d2);
531
532 Returns “1” if the dependency d1 (the provider) is matched by the
533 dependency d2, otherwise “0” is returned. For two dependencies to
534 match, both the “name” parts must match and the version range described
535 by the “evr” parts must overlap.
536
537 int pool_match_nevr(Pool *pool, Solvable *s, Id d);
538
539 Like pool_match_dep, but the provider is the "self-provides" dependency
540 of the Solvable s, i.e. the dependency “s→name = s→evr”.
541
543 void pool_createwhatprovides(Pool *pool);
544
545 Create an index that maps dependency Ids to sets of packages that
546 provide the dependency.
547
548 void pool_freewhatprovides(Pool *pool);
549
550 Free the whatprovides index to save memory.
551
552 Id pool_whatprovides(Pool *pool, Id d);
553
554 Return an offset into the Pool’s whatprovidesdata array. The solvables
555 with the Ids stored starting at that offset provide the dependency d.
556 The solvable list is zero terminated.
557
558 Id *pool_whatprovides_ptr(Pool *pool, Id d);
559
560 Instead of returning the offset, return the pointer to the Ids stored
561 at that offset. Note that this pointer has a very limit validity time,
562 as any call that adds new values to the whatprovidesdata area may
563 reallocate the array.
564
565 Id pool_queuetowhatprovides(Pool *pool, Queue *q);
566
567 Add the contents of the Queue q to the end of the whatprovidesdata
568 array, returning the offset into the array.
569
570 void pool_addfileprovides(Pool *pool);
571
572 Some package managers like rpm allow dependencies on files contained in
573 other packages. To allow libsolv to deal with those dependencies in an
574 efficient way, you need to call the addfileprovides method after
575 creating and reading all repositories. This method will scan all
576 dependency for file names and then scan all packages for matching
577 files. If a filename has been matched, it will be added to the provides
578 list of the corresponding package.
579
580 void pool_addfileprovides_queue(Pool *pool, Queue *idq, Queue *idqinst);
581
582 Same as pool_addfileprovides, but the added Ids are returned in two
583 Queues, idq for all repositories except the one containing the
584 “installed” packages, idqinst for the latter one. This information can
585 be stored in the meta section of the repositories to speed up the next
586 time the repository is loaded and addfileprovides is called
587
588 void pool_set_whatprovides(pool, Id id, Id offset);
589
590 Manually set an entry in the whatprovides index. You’ll never do this
591 for package dependencies, as those entries are created by calling the
592 pool_createwhatprovides() function. But this function is useful for
593 namespace provides if you do not want to use a namespace callback to
594 lazily set the provides. The offset argument is a offset in the
595 whatprovides array, thus you can use “1” as a false value and “2” as
596 true value.
597
598 void pool_flush_namespaceproviders(Pool *pool, Id ns, Id evr);
599
600 Clear the cache of the providers for namespace dependencies matching
601 namespace ns. If the evr argument is non-zero, the namespace dependency
602 for exactly that dependency is cleared, otherwise all matching
603 namespace dependencies are cleared. See the section about Namespace
604 dependencies for further information.
605
606 void pool_add_fileconflicts_deps(Pool *pool, Queue *conflicts);
607
608 Some package managers like rpm report conflicts when a package
609 installation overwrites a file of another installed package with
610 different content. As file content information is not stored in the
611 repository metadata, those conflicts can only be detected after the
612 packages are downloaded. Libsolv provides a function to check for such
613 conflicts, pool_findfileconflicts(). If conflicts are found, they can
614 be added as special REL_FILECONFLICT provides dependencies, so that the
615 solver will know about the conflict when it is re-run.
616
618 char *pool_alloctmpspace(Pool *pool, int len);
619
620 Allocate space on the pool’s temporary space area. This space has a
621 limited lifetime, it will be automatically freed after a fixed amount
622 (currently 16) of other pool_alloctmpspace() calls are done.
623
624 void pool_freetmpspace(Pool *pool, const char *space);
625
626 Give the space allocated with pool_alloctmpspace back to the system.
627 You do not have to use this function, as the space is automatically
628 reclaimed, but it can be useful to extend the lifetime of other
629 pointers to the pool’s temporary space area.
630
631 const char *pool_bin2hex(Pool *pool, const unsigned char *buf, int len);
632
633 Convert some binary data to hexadecimal, returning a string allocated
634 in the pool’s temporary space area.
635
636 char *pool_tmpjoin(Pool *pool, const char *str1, const char *str2, const char *str3);
637
638 Join three strings and return the result in the pool’s temporary space
639 area. You can use NULL arguments if you just want to join less strings.
640
641 char *pool_tmpappend(Pool *pool, const char *str1, const char *str2, const char *str3);
642
643 Like pool_tmpjoin(), but if the first argument is the last allocated
644 space in the pool’s temporary space area, it will be replaced with the
645 result of the join and no new temporary space slot will be used. Thus
646 you can join more than three strings by a combination of one
647 pool_tmpjoin() and multiple pool_tmpappend() calls. Note that the str1
648 pointer is no longer usable after the call.
649
651 Constants
652 SOLVID_POS
653 Use the data position stored in the pool for the lookup instead of
654 looking up the data of a solvable.
655
656 SOLVID_META
657 Use the data stored in the meta section of a repository (or
658 repodata area) instead of looking up the data of a solvable. This
659 constant does not work for the pool’s lookup functions, use it for
660 the repo’s or repodata’s lookup functions instead. It’s just listed
661 for completeness.
662
663 Functions
664 const char *pool_lookup_str(Pool *pool, Id solvid, Id keyname);
665
666 Return the string value stored under the attribute keyname in solvable
667 solvid.
668
669 unsigned long long pool_lookup_num(Pool *pool, Id solvid, Id keyname, unsigned long long notfound);
670
671 Return the 64bit unsigned number stored under the attribute keyname in
672 solvable solvid. If no such number is found, the value of the notfound
673 argument is returned instead.
674
675 Id pool_lookup_id(Pool *pool, Id solvid, Id keyname);
676
677 Return the Id stored under the attribute keyname in solvable solvid.
678
679 int pool_lookup_idarray(Pool *pool, Id solvid, Id keyname, Queue *q);
680
681 Fill the queue q with the content of the Id array stored under the
682 attribute keyname in solvable solvid. Returns “1” if an array was
683 found, otherwise the queue will be empty and “0” will be returned.
684
685 int pool_lookup_void(Pool *pool, Id solvid, Id keyname);
686
687 Returns “1” if a void value is stored under the attribute keyname in
688 solvable solvid, otherwise “0”.
689
690 const char *pool_lookup_checksum(Pool *pool, Id solvid, Id keyname, Id *typep);
691
692 Return the checksum that is stored under the attribute keyname in
693 solvable solvid. The type of the checksum will be returned over the
694 typep pointer. If no such checksum is found, NULL will be returned and
695 the type will be set to zero. Note that the result is stored in the
696 Pool’s temporary space area.
697
698 const unsigned char *pool_lookup_bin_checksum(Pool *pool, Id solvid, Id keyname, Id *typep);
699
700 Return the checksum that is stored under the attribute keyname in
701 solvable solvid. Returns the checksum as binary data, you can use the
702 returned type to calculate the length of the checksum. No temporary
703 space area is needed.
704
705 const char *pool_lookup_deltalocation(Pool *pool, Id solvid, unsigned int *medianrp);
706
707 This is a utility lookup function to return the delta location for a
708 delta rpm. As solvables cannot store deltas, you have to use SOLVID_POS
709 as argument and set the Pool’s datapos pointer to point to valid delta
710 rpm data.
711
712 void pool_search(Pool *pool, Id solvid, Id keyname, const char *match, int flags, int (*callback)(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyValue *kv), void *cbdata);
713
714 Perform a search on all data stored in the pool. You can limit the
715 search area by using the solvid and keyname arguments. The values can
716 be optionally matched against the match argument, use NULL if you do
717 not want this matching. See the Dataiterator manpage about the possible
718 matches modes and the flags argument. For all (matching) values, the
719 callback function is called with the cbdata callback argument and the
720 data describing the value.
721
723 A Job consists of two Ids, how and what. The how part describes the
724 action, the job flags, and the selection method while the what part is
725 in input for the selection. A Selection is a queue consisting of
726 multiple jobs (thus the number of elements in the queue must be a
727 multiple of two). See the Solver manpage for more information about
728 jobs.
729
730 const char *pool_job2str(Pool *pool, Id how, Id what, Id flagmask);
731
732 Convert a job into a string. Useful for debugging purposes. The
733 flagmask can be used to mask the flags of the job, use “0” if you do
734 not want to see such flags, “-1” to see all flags, or a combination of
735 the flags you want to see.
736
737 void pool_job2solvables(Pool *pool, Queue *pkgs, Id how, Id what);
738
739 Return a list of solvables that the specified job selects.
740
741 int pool_isemptyupdatejob(Pool *pool, Id how, Id what);
742
743 Return “1” if the job is an update job that does not work with any
744 installed package, i.e. the job is basically a no-op. You can use this
745 to turn no-op update jobs into install jobs (as done by package
746 managers like “zypper”).
747
748 const char *pool_selection2str(Pool *pool, Queue *selection, Id flagmask);
749
750 Convert a selection into a string. Useful for debugging purposes. See
751 the pool_job2str() function for the flagmask argument.
752
754 void pool_freeallrepos(Pool *pool, int reuseids);
755
756 Free all repos from the pool (including all solvables). If reuseids is
757 true, all Ids of the solvables are free to be reused the next time
758 solvables are created.
759
760 void pool_clear_pos(Pool *pool);
761
762 Clear the data position stored in the pool.
763
765 An architecture policy defines a list of architectures that can be
766 installed on the system, and also the relationship between them (i.e.
767 the ordering). Architectures can be delimited with three different
768 characters:
769
770 ':'
771 No relationship between the architectures. A package of one
772 architecture can not be replaced with one of the other
773 architecture.
774
775 '>'
776 The first architecture is better than the second one. An installed
777 package of the second architecture may be replaced with one from
778 the first architecture and vice versa. The solver will select the
779 better architecture if the versions are the same.
780
781 '='
782 The two architectures are freely exchangeable. Used to define
783 aliases for architectures.
784
785 An example would be 'x86_64:i686=athlon>i586'. This means that x86_64
786 packages can only be replaced by other x86_64 packages, i686 packages
787 can be replaced by i686 and i586 packages (but i686 packages will be
788 preferred) and athlon is another name for the i686 architecture.
789
790 You can turn off the architecture replacement checks with the Solver’s
791 SOLVER_FLAG_ALLOW_ARCHCHANGE flag.
792
794 Different vendors often compile packages with different features, so
795 Libsolv only replace installed packages of one vendor with packages
796 coming from the same vendor. Also, while the version of a package is
797 normally defined by the upstream project, the release part of the
798 version is set by the vendor’s package maintainer, so it’s not
799 meaningful to do version comparisons for packages coming from different
800 vendors.
801
802 Vendor in this case means the SOLVABLE_VENDOR string stored in each
803 solvable. Sometimes a vendor changes names, or multiple vendors form a
804 group that coordinate their package building, so libsolv offers a way
805 to define that a group of vendors are compatible. You do that be
806 defining vendor equivalence classes, packages from a vendor from one
807 class may be replaced with packages from all the other vendors in the
808 class.
809
810 There can be multiple equivalence classes, the set of allowed vendor
811 changes for an installed package is calculated by building the union of
812 all of the equivalence classes the vendor of the installed package is
813 part of.
814
815 You can turn off the architecture replacement checks with the Solver’s
816 SOLVER_FLAG_ALLOW_VENDORCHANGE flag.
817
819 Boolean Dependencies allow to build complex expressions from simple
820 dependencies. Note that depending on the package manager only a subset
821 of those may be useful. For example, debian currently only allows an
822 "OR" expression.
823
824 REL_OR
825 The expression is true if either the first dependency or the second
826 one is true. This is useful for package dependencies like
827 “Requires”, where you can specify that either one of the packages
828 need to be installed.
829
830 REL_AND
831 The expression is true if both dependencies are true. The packages
832 fulfilling the dependencies may be different, i.e. “Supplements:
833 perl REL_AND python” is true if both a package providing perl and a
834 package providing python are installed.
835
836 REL_WITH
837 The expression is true if both dependencies are true and are
838 fulfilled by the same package. Thus “Supplements: perl REL_WITH
839 python” would only be true if a package is installed that provides
840 both dependencies (some kind of multi-language interpreter).
841
842 REL_COND
843 The expression is true if the first dependency is true or the
844 second dependency is false. “A REL_COND B” is equivalent to “A
845 REL_OR (NOT B)” (except that libsolv does not expose “NOT”).
846
847 REL_UNLESS
848 The expression is true if the first dependency is true and the
849 second dependency is false. “A REL_UNLESS B” is equivalent to “A
850 REL_AND (NOT B)” (except that libsolv does not expose “NOT”).
851
852 REL_ELSE
853 The “else” part of a “REL_COND” or “REL_UNLESS” dependency. It has
854 to be directly in the evr part of the condition, e.g. “foo REL_COND
855 (bar REL_ELSE baz)”. For “REL_COND” this is equivalent to writing
856 “(foo REL_COND bar) REL_AND (bar REL_OR baz)”. For “REL_UNLESS”
857 this is equivalent to writing “(foo REL_UNLESS bar) REL_OR (bar
858 REL_AND baz)”.
859
860 Each sub-dependency of a boolean dependency can in turn be a boolean
861 dependency, so you can chain them to create complex dependencies.
862
864 Namespace dependencies can be used to implement dependencies on
865 attributes external to libsolv. An example would be a dependency on the
866 language set by the user. This types of dependencies are usually only
867 used for “Conflicts” or “Supplements” dependencies, as the underlying
868 package manager does not know how to deal with them.
869
870 If the library needs to evaluate a namespace dependency, it calls the
871 namespace callback function set in the pool. The callback function can
872 return a set of packages that “provide” the dependency. If the
873 dependency is provided by the system, the returned set should consist
874 of just the system solvable (Solvable Id 1).
875
876 The returned set of packages must be returned as offset into the
877 whatprovidesdata array. You can use the pool_queuetowhatprovides
878 function to convert a queue into such an offset. To ease programming
879 the callback function, the return values “0” and “1” are not
880 interpreted as an offset. “0” means that no package is in the return
881 set, “1” means that just the system solvable is in the set.
882
883 The returned set is cached, so that for each namespace dependency the
884 callback is just called once. If you need to flush the cache (maybe
885 because the user has selected a different language), use the
886 pool_flush_namespaceproviders() function.
887
889 Michael Schroeder <mls@suse.de>
890
891
892
893libsolv 01/18/2018 LIBSOLV-POOL(3)