Rip out cpioFileMap.
[platform/upstream/rpm.git] / build / rpmspec.h
1 #ifndef _H_SPEC_
2 #define _H_SPEC_
3
4 /** \ingroup rpmbuild
5  * \file build/rpmspec.h
6  *  The Spec and Package data structures used during build.
7  */
8
9 /** \ingroup rpmbuild
10  */
11 typedef struct SpecStruct *Spec;
12
13 #include "rpmmacro.h"
14
15 /** \ingroup rpmbuild
16  */
17 struct TriggerFileEntry {
18     int index;
19 /*@only@*/ char *fileName;
20 /*@only@*/ char *script;
21 /*@only@*/ char *prog;
22 /*@owned@*/ struct TriggerFileEntry *next;
23 };
24
25 #define RPMBUILD_ISSOURCE     1
26 #define RPMBUILD_ISPATCH     (1 << 1)
27 #define RPMBUILD_ISICON      (1 << 2)
28 #define RPMBUILD_ISNO        (1 << 3)
29
30 #define RPMBUILD_DEFAULT_LANG "C"
31
32 /** \ingroup rpmbuild
33  */
34 struct Source {
35 /*@owned@*/ char *fullSource;
36 /*@dependent@*/ char *source;     /* Pointer into fullSource */
37     int flags;
38     int num;
39 /*@owned@*/ struct Source *next;
40 };
41
42 /** \ingroup rpmbuild
43  */
44 typedef struct ReadLevelEntry {
45     int reading;
46 /*@dependent@*/ struct ReadLevelEntry *next;
47 } RLE_t;
48
49 /** \ingroup rpmbuild
50  */
51 typedef struct OpenFileInfo {
52 /*@only@*/ const char *fileName;
53     FD_t fd;
54     int lineNum;
55     char readBuf[BUFSIZ];
56 /*@dependent@*/ char *readPtr;
57 /*@owned@*/ struct OpenFileInfo *next;
58 } OFI_t;
59
60 /** \ingroup rpmbuild
61  */
62 struct spectag {
63     int t_tag;
64     int t_startx;
65     int t_nlines;
66 /*@only@*/ const char *t_lang;
67 /*@only@*/ const char *t_msgid;
68 };
69
70 /** \ingroup rpmbuild
71  */
72 struct spectags {
73 /*@owned@*/ struct spectag *st_t;
74     int st_nalloc;
75     int st_ntags;
76 };
77
78 /** \ingroup rpmbuild
79  */
80 struct speclines {
81 /*@only@*/ char **sl_lines;
82     int sl_nalloc;
83     int sl_nlines;
84 };
85
86 /** \ingroup rpmbuild
87  * The structure used to store values parsed from a spec file.
88  */
89 struct SpecStruct {
90 /*@only@*/ const char *specFile;        /*!< Name of the spec file. */
91 /*@only@*/ const char *sourceRpmName;
92 /*@only@*/ const char *buildRootURL;
93 /*@only@*/ const char *buildSubdir;
94 /*@only@*/ const char *rootURL;
95
96 /*@owned@*/ struct speclines *sl;
97 /*@owned@*/ struct spectags *st;
98
99 /*@owned@*/ struct OpenFileInfo *fileStack;
100     char lbuf[4*BUFSIZ];
101     char nextpeekc;
102 /*@dependent@*/ char *nextline;
103 /*@dependent@*/ char *line;
104     int lineNum;
105
106 /*@owned@*/ struct ReadLevelEntry *readStack;
107
108 /*@refcounted@*/ Header buildRestrictions;
109 /*@owned@*/ struct SpecStruct **buildArchitectureSpecs;
110 /*@only@*/ const char ** buildArchitectures;
111     int buildArchitectureCount;
112     int inBuildArchitectures;
113
114     int force;
115     int anyarch;
116
117     int gotBuildRootURL;
118
119     char *passPhrase;
120     int timeCheck;
121     const char *cookie;
122
123 /*@owned@*/ struct Source *sources;
124     int numSources;
125     int noSource;
126
127 /*@refcounted@*/ Header sourceHeader;
128     int sourceCpioCount;
129 /*@owned@*/ void * sourceCpioList;
130
131 /*@dependent@*/ struct MacroContext *macros;
132
133 /*@only@*/ StringBuf prep;              /*!< %prep scriptlet. */
134 /*@only@*/ StringBuf build;             /*!< %build scriptlet. */
135 /*@only@*/ StringBuf install;           /*!< %install scriptlet. */
136 /*@only@*/ StringBuf clean;             /*!< %clean scriptlet. */
137
138 /*@owned@*/ struct PackageStruct *packages;     /*!< Package list. */
139 };
140
141 /** \ingroup rpmbuild
142  * The structure used to store values for a package.
143  */
144 struct PackageStruct {
145 /*@refcounted@*/ Header header;
146
147     int cpioCount;
148 /*@owned@*/ void * cpioList;
149
150 /*@owned@*/ struct Source *icon;
151
152     int autoReq;
153     int autoProv;
154
155 /*@only@*/ const char *preInFile;       /*!< %pre scriptlet. */
156 /*@only@*/ const char *postInFile;      /*!< %post scriptlet. */
157 /*@only@*/ const char *preUnFile;       /*!< %preun scriptlet. */
158 /*@only@*/ const char *postUnFile;      /*!< %postun scriptlet. */
159 /*@only@*/ const char *verifyFile;      /*!< %verifyscript scriptlet. */
160
161 /*@only@*/ StringBuf specialDoc;
162
163 #if 0
164     struct ReqProvTrigger *triggers;
165     char *triggerScripts;
166 #endif
167
168 /*@only@*/ struct TriggerFileEntry *triggerFiles;
169
170 /*@only@*/ const char *fileFile;
171 /*@only@*/ StringBuf fileList; /* If NULL, package will not be written */
172
173 /*@dependent@*/ struct PackageStruct *next;
174 };
175
176 /** \ingroup rpmbuild
177  */
178 typedef struct PackageStruct *Package;
179
180 #ifdef __cplusplus
181 extern "C" {
182 #endif
183
184 /** \ingroup rpmbuild
185  * Create and initialize Spec structure.
186  */
187 /*@only@*/ Spec newSpec(void);
188
189 /** \ingroup rpmbuild
190  * Destroy Spec structure.
191  * @param spec          spec file control structure
192  */
193 void freeSpec(/*@only@*/ Spec spec);
194
195 /** \ingroup rpmbuild
196  * @param spec          spec file control structure
197  */
198 extern void (*freeSpecVec) (Spec spec); /* XXX FIXME */
199
200 /** \ingroup rpmbuild
201  */
202 struct OpenFileInfo * newOpenFileInfo(void);
203
204 /** \ingroup rpmbuild
205  * @param spec          spec file control structure
206  */
207 struct spectag *stashSt(Spec spec, Header h, int tag, const char *lang);
208
209 /** \ingroup rpmbuild
210  * @param spec          spec file control structure
211  */
212 int addSource(Spec spec, Package pkg, const char *field, int tag);
213
214 /** \ingroup rpmbuild
215  * @param spec          spec file control structure
216  */
217 int parseNoSource(Spec spec, const char *field, int tag);
218
219 #ifdef __cplusplus
220 }
221 #endif
222
223 #endif /* _H_SPEC_ */