4 /** \file lib/depends.h
11 * Dependncy ordering information.
16 /*@dependent@*/ struct availablePackage * suc;
18 #define tsi_count tsi_u.count
19 #define tsi_suc tsi_u.suc
20 /*@owned@*/ struct tsortInfo * tsi_next;
21 /*@dependent@*/ struct availablePackage * tsi_pkg;
27 * Info about a single package to be installed.
29 struct availablePackage {
30 Header h; /*!< Package header. */
31 /*@dependent@*/ const char * name; /*!< Header name. */
32 /*@dependent@*/ const char * version; /*!< Header version. */
33 /*@dependent@*/ const char * release; /*!< Header release. */
34 /*@owned@*/ const char ** provides; /*!< Provides: name strings. */
35 /*@owned@*/ const char ** providesEVR; /*!< Provides: [epoch:]version[-release] strings. */
36 /*@dependent@*/ int * provideFlags; /*!< Provides: logical range qualifiers. */
37 /*@owned@*/ const char ** requires; /*!< Requires: name strings. */
38 /*@owned@*/ const char ** requiresEVR; /*!< Requires: [epoch:]version[-release] strings. */
39 /*@dependent@*/ int * requireFlags; /*!< Requires: logical range qualifiers. */
40 /*@owned@*/ const char ** baseNames; /*!< Header file basenames. */
41 /*@dependent@*/ int_32 * epoch; /*!< Header epoch (if any). */
42 int providesCount; /*!< No. of Provide:'s in header. */
43 int requiresCount; /*!< No. of Require:'s in header. */
44 int filesCount; /*!< No. of files in header. */
45 struct tsortInfo tsi; /*!< Dependency tsort data. */
46 uint_32 multiLib; /* MULTILIB */
47 /*@dependent@*/ const void * key; /*!< Private data associated with a package (e.g. file name of package). */
48 rpmRelocation * relocs;
53 * A single available item (e.g. a Provides: dependency).
55 struct availableIndexEntry {
56 /*@dependent@*/ struct availablePackage * package; /*!< Containing package. */
57 /*@dependent@*/ const char * entry; /*!< Available item name. */
58 size_t entryLen; /*!< No. of bytes in name. */
60 IET_PROVIDES=1 /*!< A Provides: dependency. */
61 } type; /*!< Type of available item. */
65 * Index of all available items.
67 struct availableIndex {
68 /*@null@*/ struct availableIndexEntry * index; /*!< Array of available items. */
69 int size; /*!< No. of available items. */
73 * A file to be installed/removed.
75 struct fileIndexEntry {
76 int pkgNum; /*!< Containing package number. */
77 int fileFlags; /* MULTILIB */
78 /*@dependent@*/ const char * baseName; /*!< File basename. */
82 * A directory to be installed/removed.
85 /*@owned@*/ const char * dirName; /*!< Directory path (+ trailing '/'). */
86 int dirNameLen; /*!< No. bytes in directory path. */
87 /*@owned@*/ struct fileIndexEntry * files; /*!< Array of files in directory. */
88 int numFiles; /*!< No. files in directory. */
92 * Set of available packages, items, and directories.
94 struct availableList {
95 /*@owned@*/ /*@null@*/ struct availablePackage * list; /*!< Set of packages. */
96 struct availableIndex index; /*!< Set of available items. */
97 int delta; /*!< Delta for pkg list reallocation. */
98 int size; /*!< No. of pkgs in list. */
99 int alloced; /*!< No. of pkgs allocated for list. */
100 int numDirs; /*!< No. of directories. */
101 /*@owned@*/ struct dirInfo * dirs; /*!< Set of directories. */
105 * A single package instance to be installed/removed atomically.
107 struct transactionElement {
108 enum rpmTransactionType {
109 TR_ADDED, /*!< Package will be installed. */
110 TR_REMOVED /*!< Package will be removed. */
111 } type; /*!< Package disposition (installed/removed). */
122 * The set of packages to be installed/removed atomically.
124 struct rpmTransactionSet_s {
125 rpmtransFlags transFlags; /*!< Bit(s) to control operation. */
126 rpmCallbackFunction notify; /*!< Callback function. */
127 /*@observer@*/ rpmCallbackData notifyData;/*!< Callback private data. */
128 /*@dependent@*/ rpmProblemSet probs; /*!< Current problems in transaction. */
129 rpmprobFilterFlags ignoreSet; /*!< Bits to filter current problems. */
130 /*@owned@*/ /*@null@*/ rpmdb rpmdb; /*!< Database handle. */
131 /*@only@*/ int * removedPackages; /*!< Set of packages being removed. */
132 int numRemovedPackages; /*!< No. removed rpmdb instances. */
133 int allocedRemovedPackages; /*!< Size of removed packages array. */
134 struct availableList addedPackages;/*!< Set of packages being installed. */
135 struct availableList availablePackages;
136 /*!< Universe of possible packages. */
137 /*@only@*/ struct transactionElement * order;
138 /*!< Packages sorted by dependencies. */
139 int orderCount; /*!< No. of transaction elements. */
140 int orderAlloced; /*!< No. of allocated transaction elements. */
141 int chrootDone; /*!< Has chroot(2) been been done? */
142 /*@only@*/ const char * rootDir;/*!< Path to top of install tree. */
143 /*@only@*/ const char * currDir;/*!< Current working directory. */
144 /*@null@*/ FD_t scriptFd; /*!< Scriptlet stdout/stderr. */
145 int delta; /*!< Delta for reallocation. */
146 int id; /*!< Transaction id. */
150 * Problems encountered while checking dependencies.
153 struct rpmDependencyConflict * problems; /*!< Problems encountered. */
154 int num; /*!< No. of problems found. */
155 int alloced; /*!< No. of problems allocated. */
162 /* XXX lib/scriptlet.c */
164 * Compare package name-version-release from header with dependency, looking
166 * @deprecated Remove from API when obsoletes is correctly eliminated.
168 * @param reqName dependency name
169 * @param reqEVR dependency [epoch:]version[-release]
170 * @param reqFlags dependency logical range qualifiers
171 * @return 1 if dependency overlaps, 0 otherwise
173 int headerMatchesDepFlags(Header h,
174 const char *reqName, const char * reqEVR, int reqFlags);
180 #endif /* H_DEPENDS */