00001 #ifndef _H_RPMBUILD_ 00002 #define _H_RPMBUILD_ 00003 00009 #include "rpmcli.h" 00010 00011 /* and it shouldn't need these :-( */ 00012 #include "stringbuf.h" 00013 #include "misc.h" 00014 00015 /* but this will be needed */ 00016 #include "rpmspec.h" 00017 00021 /*@-typeuse@*/ 00022 typedef enum rpmBuildFlags_e { 00023 /*@-enummemuse@*/ 00024 RPMBUILD_NONE = 0, 00025 /*@=enummemuse@*/ 00026 RPMBUILD_PREP = (1 << 0), 00027 RPMBUILD_BUILD = (1 << 1), 00028 RPMBUILD_INSTALL = (1 << 2), 00029 RPMBUILD_CHECK = (1 << 3), 00030 RPMBUILD_CLEAN = (1 << 4), 00031 RPMBUILD_FILECHECK = (1 << 5), 00032 RPMBUILD_PACKAGESOURCE = (1 << 6), 00033 RPMBUILD_PACKAGEBINARY = (1 << 7), 00034 RPMBUILD_RMSOURCE = (1 << 8), 00035 RPMBUILD_RMBUILD = (1 << 9), 00036 RPMBUILD_STRINGBUF = (1 << 10), 00037 RPMBUILD_RMSPEC = (1 << 11) 00038 } rpmBuildFlags; 00039 /*@=typeuse@*/ 00040 00041 #include <ctype.h> 00042 00043 #define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } 00044 #define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; } 00045 00046 #define PART_SUBNAME 0 00047 #define PART_NAME 1 00048 00052 typedef enum rpmParseState_e { 00053 PART_NONE = 0, 00054 PART_PREAMBLE = 1, 00055 PART_PREP = 2, 00056 PART_BUILD = 3, 00057 PART_INSTALL = 4, 00058 PART_CHECK = 5, 00059 PART_CLEAN = 6, 00060 PART_FILES = 7, 00061 PART_PRE = 8, 00062 PART_POST = 9, 00063 PART_PREUN = 10, 00064 PART_POSTUN = 11, 00065 PART_DESCRIPTION = 12, 00066 PART_CHANGELOG = 13, 00067 PART_TRIGGERIN = 14, 00068 PART_TRIGGERUN = 15, 00069 PART_VERIFYSCRIPT = 16, 00070 PART_BUILDARCHITECTURES= 17, 00071 PART_TRIGGERPOSTUN = 18, 00072 PART_LAST = 19 00073 } rpmParseState; 00074 00075 #define STRIP_NOTHING 0 00076 #define STRIP_TRAILINGSPACE (1 << 0) 00077 #define STRIP_COMMENTS (1 << 1) 00078 00079 #ifdef __cplusplus 00080 extern "C" { 00081 #endif 00082 /*@-redecl@*/ 00083 00087 void freeNames(void) 00088 /*@globals internalState@*/ 00089 /*@modifies internalState */; 00090 00097 extern /*@observer@*/ const char * getUname(uid_t uid) /*@*/; 00098 00105 extern /*@observer@*/ const char * getUnameS(const char * uname) /*@*/; 00106 00113 uid_t getUidS(const char * uname) /*@*/; 00114 00121 extern /*@observer@*/ const char * getGname(gid_t gid) /*@*/; 00122 00129 extern /*@observer@*/ const char * getGnameS(const char * gname) /*@*/; 00130 00137 gid_t getGidS(const char * gname) /*@*/; 00138 00143 extern /*@observer@*/ const char * const buildHost(void) /*@*/; 00144 00149 extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/; 00150 00157 int readLine(Spec spec, int strip) 00158 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00159 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00160 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00161 rpmGlobalMacroContext, fileSystem, internalState @*/; 00162 00167 void closeSpec(/*@partial@*/ Spec spec) 00168 /*@globals fileSystem, internalState @*/ 00169 /*@modifies spec->fileStack, fileSystem, internalState @*/; 00170 00175 void handleComments(char * s) 00176 /*@modifies s @*/; 00177 00183 rpmParseState isPart(const char * line) /*@*/; 00184 00191 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res) 00192 /*@modifies *res @*/; 00193 00201 void addChangelogEntry(Header h, time_t time, const char * name, 00202 const char * text) 00203 /*@modifies h @*/; 00204 00211 int parseBuildInstallClean(Spec spec, rpmParseState parsePart) 00212 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00213 /*@modifies spec->build, spec->install, spec->check, spec->clean, 00214 spec->macros, 00215 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00216 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00217 rpmGlobalMacroContext, fileSystem, internalState @*/; 00218 00224 int parseChangelog(Spec spec) 00225 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00226 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00227 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00228 spec->packages->header, 00229 rpmGlobalMacroContext, fileSystem, internalState @*/; 00230 00236 int parseDescription(Spec spec) 00237 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00238 /*@modifies spec->packages, 00239 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00240 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00241 spec->st, 00242 rpmGlobalMacroContext, fileSystem, internalState @*/; 00243 00249 int parseFiles(Spec spec) 00250 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00251 /*@modifies spec->packages, 00252 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00253 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00254 rpmGlobalMacroContext, fileSystem, internalState @*/; 00255 00262 int parsePreamble(Spec spec, int initialPackage) 00263 /*@globals rpmGlobalMacroContext, 00264 fileSystem, internalState @*/ 00265 /*@modifies spec->packages, 00266 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00267 spec->buildSubdir, 00268 spec->macros, spec->st, spec->buildRootURL, 00269 spec->sources, spec->numSources, spec->noSource, 00270 spec->buildRestrictions, spec->BANames, spec->BACount, 00271 spec->gotBuildRootURL, 00272 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00273 rpmGlobalMacroContext, fileSystem, internalState @*/; 00274 00280 int parsePrep(Spec spec) 00281 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00282 /*@modifies spec->prep, spec->buildSubdir, spec->macros, 00283 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00284 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00285 rpmGlobalMacroContext, fileSystem, internalState @*/; 00286 00297 int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index, 00298 rpmsenseFlags tagflags) 00299 /*@globals rpmGlobalMacroContext @*/ 00300 /*@modifies rpmGlobalMacroContext @*/; 00301 00308 int parseScript(Spec spec, int parsePart) 00309 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00310 /*@modifies spec->packages, 00311 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00312 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00313 rpmGlobalMacroContext, fileSystem, internalState @*/; 00314 00321 int parseExpressionBoolean(Spec spec, const char * expr) 00322 /*@globals rpmGlobalMacroContext @*/ 00323 /*@modifies rpmGlobalMacroContext @*/; 00324 00331 /*@unused@*/ 00332 char * parseExpressionString(Spec spec, const char * expr) 00333 /*@globals rpmGlobalMacroContext @*/ 00334 /*@modifies rpmGlobalMacroContext @*/; 00335 00346 int doScript(Spec spec, int what, const char * name, StringBuf sb, int test) 00347 /*@globals rpmGlobalMacroContext, 00348 fileSystem, internalState @*/ 00349 /*@modifies spec->macros, 00350 rpmGlobalMacroContext, fileSystem, internalState @*/; 00351 00360 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, 00361 /*@out@*/ Package * pkg) 00362 /*@modifies spec->packages, *pkg @*/; 00363 00369 /*@only@*/ 00370 Package newPackage(Spec spec) 00371 /*@modifies spec->packages, spec->packages->next @*/; 00372 00378 /*@null@*/ 00379 Package freePackages(/*@only@*/ /*@null@*/ Package packages) 00380 /*@globals fileSystem @*/ 00381 /*@modifies packages, fileSystem @*/; 00382 00388 /*@null@*/ 00389 Package freePackage(/*@only@*/ /*@null@*/ Package pkg) 00390 /*@globals fileSystem @*/ 00391 /*@modifies pkg, fileSystem @*/; 00392 00403 int addReqProv(/*@unused@*/Spec spec, Header h, 00404 rpmsenseFlags depFlags, const char * depName, 00405 const char * depEVR, int index) 00406 /*@modifies h @*/; 00407 00415 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR) 00416 /*@modifies h @*/; 00417 00425 int processBinaryFiles(Spec spec, int installSpecialDoc, int test) 00426 /*@globals rpmGlobalMacroContext, 00427 fileSystem, internalState @*/ 00428 /*@modifies spec->macros, 00429 spec->packages->cpioList, spec->packages->fileList, 00430 spec->packages->specialDoc, spec->packages->header, 00431 rpmGlobalMacroContext, fileSystem, internalState @*/; 00432 00437 void initSourceHeader(Spec spec) 00438 /*@modifies spec->sourceHeader, 00439 spec->buildRestrictions, spec->BANames, 00440 spec->packages->header @*/; 00441 00447 int processSourceFiles(Spec spec) 00448 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00449 /*@modifies spec->sourceHeader, spec->sourceCpioList, 00450 spec->buildRestrictions, spec->BANames, 00451 spec->packages->header, 00452 rpmGlobalMacroContext, fileSystem, internalState @*/; 00453 00467 int parseSpec(rpmts ts, const char * specFile, 00468 /*@null@*/ const char * rootURL, 00469 /*@null@*/ const char * buildRootURL, 00470 int recursing, 00471 /*@null@*/ const char * passPhrase, 00472 /*@null@*/ char * cookie, 00473 int anyarch, int force) 00474 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00475 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; 00476 00485 int buildSpec(rpmts ts, Spec spec, int what, int test) 00486 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00487 /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, 00488 spec->sourceRpmName, spec->sourcePkgId, 00489 spec->macros, spec->BASpecs, 00490 spec->buildRestrictions, spec->BANames, 00491 spec->packages->cpioList, spec->packages->fileList, 00492 spec->packages->specialDoc, spec->packages->header, 00493 rpmGlobalMacroContext, fileSystem, internalState @*/; 00494 00500 int packageBinaries(Spec spec) 00501 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00502 /*@modifies spec->packages->header, spec->packages->cpioList, 00503 spec->sourceRpmName, 00504 rpmGlobalMacroContext, fileSystem, internalState @*/; 00505 00511 int packageSources(Spec spec) 00512 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00513 /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList, 00514 spec->sourceRpmName, spec->sourcePkgId, 00515 rpmGlobalMacroContext, fileSystem, internalState @*/; 00516 00517 /*@=redecl@*/ 00518 #ifdef __cplusplus 00519 } 00520 #endif 00521 00522 #endif /* _H_RPMBUILD_ */