rpm  5.4.10
rpmspec.h
Go to the documentation of this file.
1 #ifndef _H_RPMSPEC_
2 #define _H_RPMSPEC_
3 
9 #include <rpmevr.h>
10 #include <rpmfi.h> /* XXX rpmfi typedef */
11 #include <rpmcli.h> /* XXX QVA_t typedef */
12 
15 typedef /*@abstract@*/ /*@refcounted@*/ struct Package_s * Package;
16 
19 typedef struct Source * SpecSource;
20 
24  int index;
25 /*@only@*/
26  char * fileName;
27 /*@only@*/
28  char * script;
29 /*@only@*/
30  char * prog;
31 /*@owned@*/
33 };
34 
35 #define RPMBUILD_DEFAULT_LANG "C"
36 
39 struct Source {
40 /*@owned@*/
41  const char * fullSource;
42 /*@dependent@*/ /*@relnull@*/
43  const char * source; /* Pointer into fullSource */
44  int flags;
46 /*@owned@*/
47  struct Source * next;
48 };
49 
52 /*@-typeuse@*/
53 typedef struct ReadLevelEntry {
54  int reading;
55 /*@dependent@*/
56  struct ReadLevelEntry * next;
57 } RLE_t;
58 /*@=typeuse@*/
59 
62 typedef struct OpenFileInfo {
63 /*@only@*/
64  const char * fileName;
65 /*@relnull@*/
67  int lineNum;
68  char readBuf[BUFSIZ];
69 /*@dependent@*/
70  char * readPtr;
71 /*@owned@*/
72  struct OpenFileInfo * next;
73 } OFI_t;
74 
77 typedef struct spectag_s {
78  int t_tag;
79  int t_startx;
80  int t_nlines;
81 /*@only@*/
82  const char * t_lang;
83 /*@only@*/
84  const char * t_msgid;
85 } * spectag;
86 
89 typedef struct spectags_s {
90 /*@owned@*/
92  int st_nalloc;
93  int st_ntags;
94 } * spectags;
95 
98 typedef struct speclines_s {
99 /*@only@*/
100  char **sl_lines;
103 } * speclines;
104 
108 struct Spec_s {
110 /*@only@*/
111  const char * specFile;
112 /*@only@*/
113  const char * buildSubdir;
114 /*@only@*/
115  const char * rootURL;
116 
117 /*@owned@*/ /*@null@*/
119 /*@owned@*/ /*@null@*/
121 
122 /*@owned@*/
124 /*@owned@*/
125  char *lbuf;
126  size_t lbuf_len;
127 /*@dependent@*/
128  char *lbufPtr;
129  char nextpeekc;
130 /*@dependent@*/
131  char * nextline;
132 /*@dependent@*/
133  char * line;
134  int lineNum;
135 
136 /*@owned@*/
138 
139 /*@owned@*/ /*@null@*/
141 /*@only@*/ /*@null@*/
142  const char ** BANames;
143  int BACount;
144  int recursing;
145  int toplevel;
146 
147  int force;
148  int anyarch;
149 
150 /*@null@*/
151  char * passPhrase;
153 /*@null@*/
154  const char * cookie;
155 
156 /*@owned@*/
157  struct Source * sources;
159  int noSource;
160 
161 /*@only@*/
162  const char * sourceRpmName;
163 /*@only@*/
164  unsigned char * sourcePkgId;
165 /*@refcounted@*/
167 /*@refcounted@*/
170 
171 /*@dependent@*/ /*@null@*/
173 
174  rpmRC (*_parseRCPOT) (Spec spec, Package pkg, const char *field, rpmTag tagN,
175  rpmuint32_t index, rpmsenseFlags tagflags);
176 
180 /*@only@*/
182 /*@only@*/
184 /*@only@*/
186 /*@only@*/
188 /*@only@*/
191  size_t nfoo;
192 /*@only@*/ /*@relnull@*/
194 
195  void * dig;
197  Package packages;
198 #if defined(__LCLINT__)
199 /*@refs@*/
200  int nrefs;
201 #endif
202 };
203 
207 struct Package_s {
209 /*@refcounted@*/
211 /*@refcounted@*/
213 /*@refcounted@*/
215 
216  int autoReq;
217  int autoProv;
218  int noarch;
219 
220 /*@only@*/
221  const char * preInFile;
222 /*@only@*/
223  const char * postInFile;
224 /*@only@*/
225  const char * preUnFile;
226 /*@only@*/
227  const char * postUnFile;
228 /*@only@*/
229  const char * preTransFile;
230 /*@only@*/
231  const char * postTransFile;
232 /*@only@*/
233  const char * verifyFile;
234 /*@only@*/
235  const char * sanityCheckFile;
237 /*@only@*/
239 
240 /*@only@*/
242 
243 /*@only@*/
244  const char * fileFile;
245 /*@only@*/
246  rpmiob fileList; /* If NULL, package will not be written */
247 
248  Package next;
249 #if defined(__LCLINT__)
250 /*@refs@*/
251  int nrefs;
252 #endif
253 };
254 
255 #ifdef __cplusplus
256 extern "C" {
257 #endif
258 
265 /*@null@*/
266 Spec freeSpec(/*@killref@*/ /*@null@*/ Spec spec)
267  /*@globals fileSystem, internalState @*/
268  /*@modifies spec, fileSystem, internalState @*/;
269 #define freeSpec(_spec) \
270  ((Spec)rpmioFreePoolItem((rpmioItem)(_spec), __FUNCTION__, __FILE__, __LINE__))
271 
276 /*@only@*/
277 Spec newSpec(void)
278  /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
279  /*@modifies rpmGlobalMacroContext, internalState @*/;
280 
288 int rpmspecQuery(rpmts ts, QVA_t qva, const char * arg)
289  /*@globals rpmCLIMacroContext,
290  rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
291  /*@modifies ts, qva, rpmCLIMacroContext, rpmGlobalMacroContext,
292  fileSystem, internalState @*/;
293 
296 struct OpenFileInfo * newOpenFileInfo(void)
297  /*@*/;
298 
307 spectag stashSt(Spec spec, Header h, rpmTag tag, const char * lang)
308  /*@globals internalState @*/
309  /*@modifies spec->st, internalState @*/;
310 
319 int addSource(Spec spec, Package pkg, const char * field, rpmTag tag)
320  /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
321  /*@modifies spec->sources, spec->numSources,
322  spec->st, spec->macros,
323  rpmGlobalMacroContext, fileSystem, internalState @*/;
324 
332 int parseNoSource(Spec spec, const char * field, rpmTag tag)
333  /*@*/;
334 
340 int SpecSourceCount(Spec spec)
341  /*@*/;
342 
349 SpecSource getSource(Spec spec, int num)
350  /*@*/;
351 
357 /*@exposed@*/
358 const char * specSourceName(SpecSource source)
359  /*@*/;
360 
366 /*@exposed@*/
367 const char * specFullSourceName(SpecSource source)
368  /*@*/;
369 
375 int specSourceNum(SpecSource source)
376  /*@*/;
377 
383 int specSourceFlags(SpecSource source)
384  /*@*/;
385 
391 /*@null@*/
392 #if defined(RPM_VENDOR_OPENPKG) /* splitted-source-directory */
393 const char * getSourceDir(rpmfileAttrs attr, const char *filename)
394 #else
395 const char * getSourceDir(rpmfileAttrs attr)
396 #endif
397  /*@*/;
398 
399 #ifdef __cplusplus
400 }
401 #endif
402 
403 #endif /* _H_SPEC_ */