5 * \file build/rpmspec.h
6 * The Spec and Package data structures used during build.
11 typedef struct SpecStruct *Spec;
17 struct TriggerFileEntry {
19 /*@only@*/ char *fileName;
20 /*@only@*/ char *script;
21 /*@only@*/ char *prog;
22 /*@owned@*/ struct TriggerFileEntry *next;
25 #define RPMBUILD_ISSOURCE 1
26 #define RPMBUILD_ISPATCH (1 << 1)
27 #define RPMBUILD_ISICON (1 << 2)
28 #define RPMBUILD_ISNO (1 << 3)
30 #define RPMBUILD_DEFAULT_LANG "C"
35 /*@owned@*/ char * fullSource;
36 /*@dependent@*/ char * source; /* Pointer into fullSource */
39 /*@owned@*/ struct Source * next;
45 typedef struct ReadLevelEntry {
47 /*@dependent@*/ struct ReadLevelEntry * next;
53 typedef struct OpenFileInfo {
54 /*@only@*/ const char * fileName;
58 /*@dependent@*/ char *readPtr;
59 /*@owned@*/ struct OpenFileInfo * next;
64 typedef struct spectag_s {
68 /*@only@*/ const char * t_lang;
69 /*@only@*/ const char * t_msgid;
74 typedef struct spectags_s {
75 /*@owned@*/ spectag st_t;
82 typedef struct speclines_s {
83 /*@only@*/ char **sl_lines;
89 * The structure used to store values parsed from a spec file.
92 /*@only@*/ const char * specFile; /*!< Name of the spec file. */
93 /*@only@*/ const char * sourceRpmName;
94 /*@only@*/ const char * buildRootURL;
95 /*@only@*/ const char * buildSubdir;
96 /*@only@*/ const char * rootURL;
98 /*@owned@*/ /*@null@*/ speclines sl;
99 /*@owned@*/ /*@null@*/ spectags st;
101 /*@owned@*/ struct OpenFileInfo * fileStack;
104 /*@dependent@*/ char * nextline;
105 /*@dependent@*/ char * line;
108 /*@owned@*/ struct ReadLevelEntry * readStack;
110 /*@refcounted@*/ Header buildRestrictions;
111 /*@owned@*/ /*@null@*/ struct SpecStruct ** BASpecs;
112 /*@only@*/ /*@null@*/ const char ** BANames;
114 int recursing; /*!< parse is recursive? */
121 /*@null@*/ char * passPhrase;
123 /*@null@*/ const char * cookie;
125 /*@owned@*/ struct Source * sources;
129 /*@refcounted@*/ Header sourceHeader;
130 /*@owned@*/ void * sourceCpioList;
132 /*@dependent@*/ /*@null@*/ MacroContext macros;
134 /*@only@*/ StringBuf prep; /*!< %prep scriptlet. */
135 /*@only@*/ StringBuf build; /*!< %build scriptlet. */
136 /*@only@*/ StringBuf install; /*!< %install scriptlet. */
137 /*@only@*/ StringBuf clean; /*!< %clean scriptlet. */
139 /*@owned@*/ struct PackageStruct * packages; /*!< Package list. */
142 /** \ingroup rpmbuild
143 * The structure used to store values for a package.
145 struct PackageStruct {
146 /*@refcounted@*/ Header header;
148 /*@owned@*/ void * cpioList;
150 /*@owned@*/ struct Source * icon;
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. */
161 /*@only@*/ StringBuf specialDoc;
163 /*@only@*/ struct TriggerFileEntry * triggerFiles;
165 /*@only@*/ const char * fileFile;
166 /*@only@*/ StringBuf fileList; /* If NULL, package will not be written */
168 /*@dependent@*/ struct PackageStruct * next;
171 /** \ingroup rpmbuild
173 typedef struct PackageStruct * Package;
179 /** \ingroup rpmbuild
180 * Create and initialize Spec structure.
181 * @return spec spec file control structure
183 /*@only@*/ Spec newSpec(void)
184 /*@globals rpmGlobalMacroContext @*/
185 /*@modifies rpmGlobalMacroContext @*/;
187 /** \ingroup rpmbuild
188 * Destroy Spec structure.
189 * @param spec spec file control structure
190 * @return NULL always
192 /*@null@*/ Spec freeSpec(/*@only@*/ /*@null@*/ Spec spec)
193 /*@globals fileSystem @*/
194 /*@modifies spec, fileSystem @*/;
196 /** \ingroup rpmbuild
197 * @param spec spec file control structure
198 * @return NULL always
201 extern /*@null@*/ Spec (*freeSpecVec) (Spec spec) /* XXX FIXME */
202 /*@globals fileSystem @*/
203 /*@modifies spec, fileSystem @*/;
206 /** \ingroup rpmbuild
208 struct OpenFileInfo * newOpenFileInfo(void) /*@*/;
210 /** \ingroup rpmbuild
211 * @param spec spec file control structure
213 spectag stashSt(Spec spec, Header h, int tag, const char * lang)
214 /*@modifies spec->st @*/;
216 /** \ingroup rpmbuild
217 * @param spec spec file control structure
219 int addSource(Spec spec, Package pkg, const char * field, int tag)
220 /*@globals rpmGlobalMacroContext @*/
221 /*@modifies spec->sources, spec->numSources,
222 spec->st, spec->macros,
225 /** \ingroup rpmbuild
226 * @param spec spec file control structure
228 int parseNoSource(Spec spec, const char * field, int tag)
229 /*@modifies nothing @*/;
235 #endif /* _H_SPEC_ */