fix: do chroot around pre-transaction syscalls.
[tools/librpm-tizen.git] / lib / depends.h
1 #ifndef H_DEPENDS
2 #define H_DEPENDS
3
4 #include <header.h>
5
6 struct availablePackage {
7     Header h;
8 /*@owned@*/ const char ** provides;
9 /*@owned@*/ const char ** providesEVR;
10 /*@dependent@*/ int * provideFlags;
11 /*@owned@*/ const char ** baseNames;
12 /*@dependent@*/ const char * name;
13 /*@dependent@*/ const char * version;
14 /*@dependent@*/ const char * release;
15 /*@dependent@*/ int_32 * epoch;
16     int providesCount;
17     int filesCount;
18     uint_32 multiLib;   /* MULTILIB */
19 /*@dependent@*/ const void * key;
20     rpmRelocation * relocs;
21 /*@null@*/ FD_t fd;
22 } ;
23
24 enum indexEntryType { IET_NAME, IET_PROVIDES };
25
26 struct availableIndexEntry {
27 /*@dependent@*/ struct availablePackage * package;
28 /*@dependent@*/ const char * entry;
29     size_t entryLen;
30     enum indexEntryType type;
31 } ;
32
33 struct fileIndexEntry {
34     int pkgNum;
35     int fileFlags;      /* MULTILIB */
36 /*@dependent@*/ const char * baseName;
37 } ;
38
39 struct dirInfo {
40 /*@owned@*/ char * dirName;                     /* xstrdup'd */
41     int dirNameLen;
42 /*@owned@*/ struct fileIndexEntry * files;      /* xmalloc'd */
43     int numFiles;
44 } ;
45
46 struct availableIndex {
47 /*@null@*/ struct availableIndexEntry * index ;
48     int size;
49 } ;
50
51 struct availableList {
52 /*@owned@*/ /*@null@*/ struct availablePackage * list;
53     struct availableIndex index;
54     int size;
55     int alloced;
56     int numDirs;
57 /*@owned@*/ struct dirInfo * dirs;              /* xmalloc'd */
58 };
59
60 struct transactionElement {
61     enum rpmTransactionType { TR_ADDED, TR_REMOVED } type;
62     union { 
63         int addedIndex;
64         struct {
65             int dboffset;
66             int dependsOnIndex;
67         } removed;
68     } u;
69 };
70
71 struct rpmTransactionSet_s {
72 /*@owned@*/ /*@null@*/ rpmdb rpmdb;                     /* may be NULL */
73 /*@only@*/ int * removedPackages;
74     int numRemovedPackages;
75     int allocedRemovedPackages;
76     struct availableList addedPackages;
77     struct availableList availablePackages;
78 /*@only@*/ struct transactionElement * order;
79     int orderCount;
80     int orderAlloced;
81 /*@only@*/ const char * rootDir;
82 /*@only@*/ const char * currDir;
83 /*@null@*/ FD_t scriptFd;
84 };
85
86 struct problemsSet {
87     struct rpmDependencyConflict * problems;
88     int num;
89     int alloced;
90 };
91
92 #ifdef __cplusplus
93 extern "C" {
94 #endif
95
96 /* XXX lib/uninstall.c */
97 int headerMatchesDepFlags(Header h, const char *reqName, const char * reqInfo, int reqFlags);
98
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif  /* H_DEPENDS */