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 /*@globals internalState @*/ 00099 /*@modifies internalState @*/; 00100 00107 extern /*@observer@*/ const char * getUnameS(const char * uname) 00108 /*@globals internalState @*/ 00109 /*@modifies internalState @*/; 00110 00117 uid_t getUidS(const char * uname) 00118 /*@globals internalState @*/ 00119 /*@modifies internalState @*/; 00120 00127 extern /*@observer@*/ const char * getGname(gid_t gid) 00128 /*@globals internalState @*/ 00129 /*@modifies internalState @*/; 00130 00137 extern /*@observer@*/ const char * getGnameS(const char * gname) 00138 /*@globals internalState @*/ 00139 /*@modifies internalState @*/; 00140 00147 gid_t getGidS(const char * gname) 00148 /*@globals internalState @*/ 00149 /*@modifies internalState @*/; 00150 00155 extern /*@observer@*/ const char * const buildHost(void) /*@*/; 00156 00161 extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/; 00162 00169 int readLine(Spec spec, int strip) 00170 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00171 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00172 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00173 rpmGlobalMacroContext, fileSystem, internalState @*/; 00174 00179 void closeSpec(/*@partial@*/ Spec spec) 00180 /*@globals fileSystem, internalState @*/ 00181 /*@modifies spec->fileStack, fileSystem, internalState @*/; 00182 00187 void handleComments(char * s) 00188 /*@modifies s @*/; 00189 00195 rpmParseState isPart(const char * line) /*@*/; 00196 00203 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res) 00204 /*@modifies *res @*/; 00205 00213 void addChangelogEntry(Header h, time_t time, const char * name, 00214 const char * text) 00215 /*@modifies h @*/; 00216 00223 int parseBuildInstallClean(Spec spec, rpmParseState parsePart) 00224 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00225 /*@modifies spec->build, spec->install, spec->check, spec->clean, 00226 spec->macros, 00227 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00228 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00229 rpmGlobalMacroContext, fileSystem, internalState @*/; 00230 00236 int parseChangelog(Spec spec) 00237 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00238 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00239 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00240 spec->packages->header, 00241 rpmGlobalMacroContext, fileSystem, internalState @*/; 00242 00248 int parseDescription(Spec spec) 00249 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00250 /*@modifies spec->packages, 00251 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00252 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00253 spec->st, 00254 rpmGlobalMacroContext, fileSystem, internalState @*/; 00255 00261 int parseFiles(Spec spec) 00262 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00263 /*@modifies spec->packages, 00264 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00265 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00266 rpmGlobalMacroContext, fileSystem, internalState @*/; 00267 00274 int parsePreamble(Spec spec, int initialPackage) 00275 /*@globals rpmGlobalMacroContext, h_errno, 00276 fileSystem, internalState @*/ 00277 /*@modifies spec->packages, 00278 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00279 spec->buildSubdir, 00280 spec->macros, spec->st, spec->buildRootURL, 00281 spec->sources, spec->numSources, spec->noSource, 00282 spec->buildRestrictions, spec->BANames, spec->BACount, 00283 spec->gotBuildRootURL, 00284 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00285 rpmGlobalMacroContext, fileSystem, internalState @*/; 00286 00292 int parsePrep(Spec spec) 00293 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00294 /*@modifies spec->prep, spec->buildSubdir, spec->macros, 00295 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00296 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00297 rpmGlobalMacroContext, fileSystem, internalState @*/; 00298 00309 int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index, 00310 rpmsenseFlags tagflags) 00311 /*@globals rpmGlobalMacroContext, h_errno @*/ 00312 /*@modifies rpmGlobalMacroContext @*/; 00313 00320 int parseScript(Spec spec, int parsePart) 00321 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00322 /*@modifies spec->packages, 00323 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00324 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00325 rpmGlobalMacroContext, fileSystem, internalState @*/; 00326 00333 int parseExpressionBoolean(Spec spec, const char * expr) 00334 /*@globals rpmGlobalMacroContext, h_errno @*/ 00335 /*@modifies rpmGlobalMacroContext @*/; 00336 00343 /*@unused@*/ /*@null@*/ 00344 char * parseExpressionString(Spec spec, const char * expr) 00345 /*@globals rpmGlobalMacroContext, h_errno @*/ 00346 /*@modifies rpmGlobalMacroContext @*/; 00347 00358 int doScript(Spec spec, int what, /*@null@*/ const char * name, 00359 /*@null@*/ StringBuf sb, int test) 00360 /*@globals rpmGlobalMacroContext, h_errno, 00361 fileSystem, internalState @*/ 00362 /*@modifies spec->macros, 00363 rpmGlobalMacroContext, fileSystem, internalState @*/; 00364 00373 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, 00374 /*@out@*/ Package * pkg) 00375 /*@modifies spec->packages, *pkg @*/; 00376 00382 /*@only@*/ 00383 Package newPackage(Spec spec) 00384 /*@modifies spec->packages, spec->packages->next @*/; 00385 00391 /*@null@*/ 00392 Package freePackages(/*@only@*/ /*@null@*/ Package packages) 00393 /*@globals fileSystem @*/ 00394 /*@modifies packages, fileSystem @*/; 00395 00401 /*@null@*/ 00402 Package freePackage(/*@only@*/ /*@null@*/ Package pkg) 00403 /*@globals fileSystem @*/ 00404 /*@modifies pkg, fileSystem @*/; 00405 00416 int addReqProv(/*@unused@*/Spec spec, Header h, 00417 rpmsenseFlags depFlags, const char * depName, 00418 const char * depEVR, int index) 00419 /*@modifies h @*/; 00420 00428 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR) 00429 /*@modifies h @*/; 00430 00438 int processBinaryFiles(Spec spec, int installSpecialDoc, int test) 00439 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00440 /*@modifies spec->macros, 00441 spec->packages->cpioList, spec->packages->fileList, 00442 spec->packages->specialDoc, spec->packages->header, 00443 rpmGlobalMacroContext, fileSystem, internalState @*/; 00444 00449 void initSourceHeader(Spec spec) 00450 /*@modifies spec->sourceHeader, 00451 spec->buildRestrictions, spec->BANames, 00452 spec->packages->header @*/; 00453 00459 int processSourceFiles(Spec spec) 00460 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00461 /*@modifies spec->sourceHeader, spec->sourceCpioList, 00462 spec->buildRestrictions, spec->BANames, 00463 spec->packages->header, 00464 rpmGlobalMacroContext, fileSystem, internalState @*/; 00465 00479 int parseSpec(rpmts ts, const char * specFile, 00480 /*@null@*/ const char * rootURL, 00481 /*@null@*/ const char * buildRootURL, 00482 int recursing, 00483 /*@null@*/ const char * passPhrase, 00484 /*@null@*/ char * cookie, 00485 int anyarch, int force) 00486 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00487 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; 00488 00497 int buildSpec(rpmts ts, Spec spec, int what, int test) 00498 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00499 /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, 00500 spec->sourceRpmName, spec->sourcePkgId, 00501 spec->macros, spec->BASpecs, 00502 spec->buildRestrictions, spec->BANames, 00503 spec->packages->cpioList, spec->packages->fileList, 00504 spec->packages->specialDoc, spec->packages->header, 00505 rpmGlobalMacroContext, fileSystem, internalState @*/; 00506 00512 int packageBinaries(Spec spec) 00513 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00514 /*@modifies spec->packages->header, spec->packages->cpioList, 00515 spec->sourceRpmName, 00516 rpmGlobalMacroContext, fileSystem, internalState @*/; 00517 00523 int packageSources(Spec spec) 00524 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00525 /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList, 00526 spec->sourceRpmName, spec->sourcePkgId, 00527 rpmGlobalMacroContext, fileSystem, internalState @*/; 00528 00529 /*@=redecl@*/ 00530 #ifdef __cplusplus 00531 } 00532 #endif 00533 00534 #endif /* _H_RPMBUILD_ */