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 typedef struct ReadLevelEntry { 00045 int reading; 00046 /*@dependent@*/ struct ReadLevelEntry *next; 00047 } RLE_t; 00048 00051 typedef struct OpenFileInfo { 00052 /*@only@*/ const char *fileName; 00053 FD_t fd; 00054 int lineNum; 00055 char readBuf[BUFSIZ]; 00056 /*@dependent@*/ char *readPtr; 00057 /*@owned@*/ struct OpenFileInfo *next; 00058 } OFI_t; 00059 00062 struct spectag { 00063 int t_tag; 00064 int t_startx; 00065 int t_nlines; 00066 /*@only@*/ const char *t_lang; 00067 /*@only@*/ const char *t_msgid; 00068 }; 00069 00072 struct spectags { 00073 /*@owned@*/ struct spectag *st_t; 00074 int st_nalloc; 00075 int st_ntags; 00076 }; 00077 00080 struct speclines { 00081 /*@only@*/ char **sl_lines; 00082 int sl_nalloc; 00083 int sl_nlines; 00084 }; 00085 00089 struct SpecStruct { 00090 /*@only@*/ const char *specFile; 00091 /*@only@*/ const char *sourceRpmName; 00092 /*@only@*/ const char *buildRootURL; 00093 /*@only@*/ const char *buildSubdir; 00094 /*@only@*/ const char *rootURL; 00095 00096 /*@owned@*/ struct speclines *sl; 00097 /*@owned@*/ struct spectags *st; 00098 00099 /*@owned@*/ struct OpenFileInfo *fileStack; 00100 char lbuf[4*BUFSIZ]; 00101 char nextpeekc; 00102 /*@dependent@*/ char *nextline; 00103 /*@dependent@*/ char *line; 00104 int lineNum; 00105 00106 /*@owned@*/ struct ReadLevelEntry *readStack; 00107 00108 /*@refcounted@*/ Header buildRestrictions; 00109 /*@owned@*/ struct SpecStruct **buildArchitectureSpecs; 00110 /*@only@*/ const char ** buildArchitectures; 00111 int buildArchitectureCount; 00112 int inBuildArchitectures; 00113 00114 int force; 00115 int anyarch; 00116 00117 int gotBuildRootURL; 00118 00119 char *passPhrase; 00120 int timeCheck; 00121 const char *cookie; 00122 00123 /*@owned@*/ struct Source *sources; 00124 int numSources; 00125 int noSource; 00126 00127 /*@refcounted@*/ Header sourceHeader; 00128 int sourceCpioCount; 00129 /*@owned@*/ struct cpioFileMapping *sourceCpioList; 00130 00131 /*@dependent@*/ struct MacroContext *macros; 00132 00133 /*@only@*/ StringBuf prep; 00134 /*@only@*/ StringBuf build; 00135 /*@only@*/ StringBuf install; 00136 /*@only@*/ StringBuf clean; 00138 /*@owned@*/ struct PackageStruct *packages; 00139 }; 00140 00144 struct PackageStruct { 00145 /*@refcounted@*/ Header header; 00146 00147 int cpioCount; 00148 /*@owned@*/ struct cpioFileMapping *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 #if 0 00164 struct ReqProvTrigger *triggers; 00165 char *triggerScripts; 00166 #endif 00167 00168 /*@only@*/ struct TriggerFileEntry *triggerFiles; 00169 00170 /*@only@*/ const char *fileFile; 00171 /*@only@*/ StringBuf fileList; /* If NULL, package will not be written */ 00172 00173 /*@dependent@*/ struct PackageStruct *next; 00174 }; 00175 00178 typedef struct PackageStruct *Package; 00179 00180 #ifdef __cplusplus 00181 extern "C" { 00182 #endif 00183 00187 /*@only@*/ Spec newSpec(void); 00188 00193 void freeSpec(/*@only@*/ Spec spec); 00194 00198 extern void (*freeSpecVec) (Spec spec); /* XXX FIXME */ 00199 00202 struct OpenFileInfo * newOpenFileInfo(void); 00203 00207 struct spectag *stashSt(Spec spec, Header h, int tag, const char *lang); 00208 00212 int addSource(Spec spec, Package pkg, const char *field, int tag); 00213 00217 int parseNoSource(Spec spec, const char *field, int tag); 00218 00219 #ifdef __cplusplus 00220 } 00221 #endif 00222 00223 #endif /* _H_SPEC_ */