00001 #ifndef _H_SPEC_ 00002 #define _H_SPEC_ 00003 00011 typedef struct SpecStruct *Spec; 00012 00013 #include "rpmmacro.h" 00014 00017 struct TriggerFileEntry { 00018 int index; 00019 /*@only@*/ char *fileName; 00020 /*@only@*/ char *script; 00021 /*@only@*/ char *prog; 00022 /*@owned@*/ struct TriggerFileEntry *next; 00023 }; 00024 00025 #define RPMBUILD_ISSOURCE 1 00026 #define RPMBUILD_ISPATCH (1 << 1) 00027 #define RPMBUILD_ISICON (1 << 2) 00028 #define RPMBUILD_ISNO (1 << 3) 00029 00030 #define RPMBUILD_DEFAULT_LANG "C" 00031 00034 struct Source { 00035 /*@owned@*/ char * fullSource; 00036 /*@dependent@*/ char * source; /* Pointer into fullSource */ 00037 int flags; 00038 int num; 00039 /*@owned@*/ struct Source * next; 00040 }; 00041 00044 /*@-typeuse@*/ 00045 typedef struct ReadLevelEntry { 00046 int reading; 00047 /*@dependent@*/ struct ReadLevelEntry * next; 00048 } RLE_t; 00049 /*@=typeuse@*/ 00050 00053 typedef struct OpenFileInfo { 00054 /*@only@*/ const char * fileName; 00055 FD_t fd; 00056 int lineNum; 00057 char readBuf[BUFSIZ]; 00058 /*@dependent@*/ char *readPtr; 00059 /*@owned@*/ struct OpenFileInfo * next; 00060 } OFI_t; 00061 00064 typedef struct spectag_s { 00065 int t_tag; 00066 int t_startx; 00067 int t_nlines; 00068 /*@only@*/ const char * t_lang; 00069 /*@only@*/ const char * t_msgid; 00070 } * spectag; 00071 00074 typedef struct spectags_s { 00075 /*@owned@*/ spectag st_t; 00076 int st_nalloc; 00077 int st_ntags; 00078 } * spectags; 00079 00082 typedef struct speclines_s { 00083 /*@only@*/ char **sl_lines; 00084 int sl_nalloc; 00085 int sl_nlines; 00086 } * speclines; 00087 00091 struct SpecStruct { 00092 /*@only@*/ const char * specFile; 00093 /*@only@*/ const char * sourceRpmName; 00094 /*@only@*/ const char * buildRootURL; 00095 /*@only@*/ const char * buildSubdir; 00096 /*@only@*/ const char * rootURL; 00097 00098 /*@owned@*/ /*@null@*/ speclines sl; 00099 /*@owned@*/ /*@null@*/ spectags st; 00100 00101 /*@owned@*/ struct OpenFileInfo * fileStack; 00102 char lbuf[4*BUFSIZ]; 00103 char nextpeekc; 00104 /*@dependent@*/ char * nextline; 00105 /*@dependent@*/ char * line; 00106 int lineNum; 00107 00108 /*@owned@*/ struct ReadLevelEntry * readStack; 00109 00110 /*@refcounted@*/ Header buildRestrictions; 00111 /*@owned@*/ /*@null@*/ struct SpecStruct ** BASpecs; 00112 /*@only@*/ /*@null@*/ const char ** BANames; 00113 int BACount; 00114 int recursing; 00116 int force; 00117 int anyarch; 00118 00119 int gotBuildRootURL; 00120 00121 /*@null@*/ char * passPhrase; 00122 int timeCheck; 00123 /*@null@*/ const char * cookie; 00124 00125 /*@owned@*/ struct Source * sources; 00126 int numSources; 00127 int noSource; 00128 00129 /*@refcounted@*/ Header sourceHeader; 00130 /*@owned@*/ void * sourceCpioList; 00131 00132 /*@dependent@*/ /*@null@*/ MacroContext macros; 00133 00134 /*@only@*/ StringBuf prep; 00135 /*@only@*/ StringBuf build; 00136 /*@only@*/ StringBuf install; 00137 /*@only@*/ StringBuf clean; 00139 /*@owned@*/ struct PackageStruct * packages; 00140 }; 00141 00145 struct PackageStruct { 00146 /*@refcounted@*/ Header header; 00147 00148 /*@owned@*/ void * cpioList; 00149 00150 /*@owned@*/ struct Source * icon; 00151 00152 int autoReq; 00153 int autoProv; 00154 00155 /*@only@*/ const char * preInFile; 00156 /*@only@*/ const char * postInFile; 00157 /*@only@*/ const char * preUnFile; 00158 /*@only@*/ const char * postUnFile; 00159 /*@only@*/ const char * verifyFile; 00161 /*@only@*/ StringBuf specialDoc; 00162 00163 /*@only@*/ struct TriggerFileEntry * triggerFiles; 00164 00165 /*@only@*/ const char * fileFile; 00166 /*@only@*/ StringBuf fileList; /* If NULL, package will not be written */ 00167 00168 /*@dependent@*/ struct PackageStruct * next; 00169 }; 00170 00173 typedef struct PackageStruct * Package; 00174 00175 #ifdef __cplusplus 00176 extern "C" { 00177 #endif 00178 00183 /*@only@*/ Spec newSpec(void) /*@*/; 00184 00190 /*@null@*/ Spec freeSpec(/*@only@*/ /*@null@*/ Spec spec) 00191 /*@modifies spec @*/; 00192 00197 /*@-declundef@*/ 00198 extern /*@null@*/ Spec (*freeSpecVec) (Spec spec) /* XXX FIXME */ 00199 /*@modifies spec @*/; 00200 /*@=declundef@*/ 00201 00204 struct OpenFileInfo * newOpenFileInfo(void) /*@*/; 00205 00209 spectag stashSt(Spec spec, Header h, int tag, const char * lang) 00210 /*@modifies spec->st @*/; 00211 00215 int addSource(Spec spec, Package pkg, const char * field, int tag) 00216 /*@modifies spec->sources, spec->numSources, 00217 spec->st, spec->macros, 00218 pkg->icon @*/; 00219 00223 int parseNoSource(Spec spec, const char * field, int tag) 00224 /*@modifies nothing @*/; 00225 00226 #ifdef __cplusplus 00227 } 00228 #endif 00229 00230 #endif /* _H_SPEC_ */