13 #include "pooltypes.h"
24 // see initpool_data[] in pool.c
29 #define SOLVABLE_NAME 2
30 #define SOLVABLE_ARCH 3
31 #define SOLVABLE_EVR 4
32 #define SOLVABLE_PROVIDES 5
33 #define SOLVABLE_OBSOLETES 6
34 #define SOLVABLE_CONFLICTS 7
35 #define SOLVABLE_REQUIRES 8
36 #define SOLVABLE_RECOMMENDS 9
37 #define SOLVABLE_SUGGESTS 10
38 #define SOLVABLE_SUPPLEMENTS 11
39 #define SOLVABLE_ENHANCES 12
40 #define SOLVABLE_FRESHENS 13
41 #define RPM_RPMDBID 14
42 #define SOLVABLE_PREREQMARKER 15 // normal requires before this, prereqs after this
43 #define SOLVABLE_FILEMARKER 16 // normal provides before this, generated file provides after this
44 #define NAMESPACE_INSTALLED 17
45 #define NAMESPACE_MODALIAS 18
48 #define ARCH_NOARCH 21
50 //-----------------------------------------------
53 int verbose; // pool is used everywhere, so put the verbose flag here
55 Offset *strings; // table of offsets into stringspace, indexed by Id: Id -> Offset
56 int nstrings; // number of unique strings in stringspace
57 char *stringspace; // space for all unique strings: stringspace + Offset = string
58 Offset sstrings; // next free pos in stringspace
60 Hashtable stringhashtbl; // hash table: (string ->) Hash -> Id
61 Hashmask stringhashmask; // modulo value for hash table (size of table - 1)
63 Reldep *rels; // table of rels: Id -> Reldep
64 int nrels; // number of unique rels
65 Hashtable relhashtbl; // hash table: (name,evr,op ->) Hash -> Id
76 Id *id2arch; /* map arch ids to scores */
77 Id lastarch; /* last valid entry in id2arch */
79 /* providers data, as two-step indirect list
80 * whatprovides[Id] -> Offset into whatprovidesdata for name
81 * whatprovidesdata[Offset] -> ID_NULL-terminated list of solvables providing Id
83 Offset *whatprovides; /* Offset to providers of a specific name, Id -> Offset */
84 Id *whatprovidesdata; /* Ids of solvable providing Id */
85 Offset whatprovidesdataoff; /* next free slot within whatprovidesdata */
86 int whatprovidesdataleft; /* number of 'free slots' within whatprovidesdata */
90 #define TYPE_IDARRAY 2
93 #define TYPE_BITMAP 128
96 //-----------------------------------------------
99 // "foo" -> Id -> lookup in table, returns offset into whatprovidesdata where array of Ids providing 'foo' are located, 0-terminated
102 #define GET_PROVIDESP(d, v) (ISRELDEP(d) ? \
103 (v = GETRELID(pool, d), pool->whatprovides[v] ? \
104 pool->whatprovidesdata + pool->whatprovides[v] : \
105 addrelproviders(pool, d) \
107 (pool->whatprovidesdata + pool->whatprovides[d]))
109 /* loop over all providers of d */
110 #define FOR_PROVIDES(v, vp, d) \
111 for (vp = GET_PROVIDESP(d, v) ; (v = *vp++) != ID_NULL; )
113 /* mark dependencies with relation by setting bit31 */
115 #define MAKERELDEP(id) ((id) | 0x80000000)
116 #define ISRELDEP(id) (((id) & 0x80000000) != 0)
117 #define GETRELID(pool, id) ((pool)->nstrings + ((id) ^ 0x80000000)) /* returns Id */
118 #define GETRELDEP(pool, id) ((pool)->rels + ((id) ^ 0x80000000)) /* returns Reldep* */
127 #define REL_NAMESPACE 19
129 extern Pool *pool_create(void);
130 extern void pool_free(Pool *pool);
131 extern void pool_freesource(Pool *pool, Source *source);
132 extern void pool_prepare(Pool *pool);
133 extern void pool_freewhatprovides(Pool *pool);
134 extern Id pool_queuetowhatprovides(Pool *pool, Queue *q);
136 extern Id *addrelproviders(Pool *pool, Id d);
138 extern Source *pool_source(Pool *pool, Solvable *s);