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_PRETRANS = 12, 00066 PART_POSTTRANS = 13, 00067 PART_DESCRIPTION = 14, 00068 PART_CHANGELOG = 15, 00069 PART_TRIGGERIN = 16, 00070 PART_TRIGGERUN = 17, 00071 PART_VERIFYSCRIPT = 18, 00072 PART_BUILDARCHITECTURES= 19, 00073 PART_TRIGGERPOSTUN = 20, 00074 PART_TRIGGERPREIN = 21, 00075 PART_LAST = 22 00076 } rpmParseState; 00077 00078 #define STRIP_NOTHING 0 00079 #define STRIP_TRAILINGSPACE (1 << 0) 00080 #define STRIP_COMMENTS (1 << 1) 00081 00082 #ifdef __cplusplus 00083 extern "C" { 00084 #endif 00085 /*@-redecl@*/ 00086 00090 void freeNames(void) 00091 /*@globals internalState@*/ 00092 /*@modifies internalState */; 00093 00100 extern /*@observer@*/ const char * getUname(uid_t uid) 00101 /*@globals internalState @*/ 00102 /*@modifies internalState @*/; 00103 00110 extern /*@observer@*/ const char * getUnameS(const char * uname) 00111 /*@globals internalState @*/ 00112 /*@modifies internalState @*/; 00113 00120 uid_t getUidS(const char * uname) 00121 /*@globals internalState @*/ 00122 /*@modifies internalState @*/; 00123 00130 extern /*@observer@*/ const char * getGname(gid_t gid) 00131 /*@globals internalState @*/ 00132 /*@modifies internalState @*/; 00133 00140 extern /*@observer@*/ const char * getGnameS(const char * gname) 00141 /*@globals internalState @*/ 00142 /*@modifies internalState @*/; 00143 00150 gid_t getGidS(const char * gname) 00151 /*@globals internalState @*/ 00152 /*@modifies internalState @*/; 00153 00158 extern /*@observer@*/ const char * const buildHost(void) /*@*/; 00159 00164 extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/; 00165 00172 int readLine(Spec spec, int strip) 00173 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00174 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00175 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00176 rpmGlobalMacroContext, fileSystem, internalState @*/; 00177 00182 void closeSpec(/*@partial@*/ Spec spec) 00183 /*@globals fileSystem, internalState @*/ 00184 /*@modifies spec->fileStack, fileSystem, internalState @*/; 00185 00190 void handleComments(char * s) 00191 /*@modifies s @*/; 00192 00198 rpmParseState isPart(const char * line) /*@*/; 00199 00206 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res) 00207 /*@modifies *res @*/; 00208 00216 void addChangelogEntry(Header h, time_t time, const char * name, 00217 const char * text) 00218 /*@modifies h @*/; 00219 00226 int parseBuildInstallClean(Spec spec, rpmParseState parsePart) 00227 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00228 /*@modifies spec->build, spec->install, spec->check, spec->clean, 00229 spec->macros, 00230 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00231 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00232 rpmGlobalMacroContext, fileSystem, internalState @*/; 00233 00239 int parseChangelog(Spec spec) 00240 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00241 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00242 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00243 spec->packages->header, 00244 rpmGlobalMacroContext, fileSystem, internalState @*/; 00245 00251 int parseDescription(Spec spec) 00252 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00253 /*@modifies spec->packages, 00254 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00255 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00256 spec->st, 00257 rpmGlobalMacroContext, fileSystem, internalState @*/; 00258 00264 int parseFiles(Spec spec) 00265 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00266 /*@modifies spec->packages, 00267 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00268 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00269 rpmGlobalMacroContext, fileSystem, internalState @*/; 00270 00277 int parsePreamble(Spec spec, int initialPackage) 00278 /*@globals rpmGlobalMacroContext, h_errno, 00279 fileSystem, internalState @*/ 00280 /*@modifies spec->packages, 00281 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00282 spec->buildSubdir, 00283 spec->macros, spec->st, spec->buildRootURL, 00284 spec->sources, spec->numSources, spec->noSource, 00285 spec->buildRestrictions, spec->BANames, spec->BACount, 00286 spec->gotBuildRootURL, 00287 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00288 rpmGlobalMacroContext, fileSystem, internalState @*/; 00289 00295 int parsePrep(Spec spec) 00296 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00297 /*@modifies spec->prep, spec->buildSubdir, spec->macros, 00298 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00299 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00300 rpmGlobalMacroContext, fileSystem, internalState @*/; 00301 00312 int parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN, 00313 int index, rpmsenseFlags tagflags) 00314 /*@globals rpmGlobalMacroContext, h_errno @*/ 00315 /*@modifies rpmGlobalMacroContext @*/; 00316 00323 int parseScript(Spec spec, int parsePart) 00324 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00325 /*@modifies spec->packages, 00326 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00327 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00328 rpmGlobalMacroContext, fileSystem, internalState @*/; 00329 00336 int parseExpressionBoolean(Spec spec, const char * expr) 00337 /*@globals rpmGlobalMacroContext, h_errno @*/ 00338 /*@modifies rpmGlobalMacroContext @*/; 00339 00346 /*@unused@*/ /*@null@*/ 00347 char * parseExpressionString(Spec spec, const char * expr) 00348 /*@globals rpmGlobalMacroContext, h_errno @*/ 00349 /*@modifies rpmGlobalMacroContext @*/; 00350 00361 int doScript(Spec spec, int what, /*@null@*/ const char * name, 00362 /*@null@*/ StringBuf sb, int test) 00363 /*@globals rpmGlobalMacroContext, h_errno, 00364 fileSystem, internalState @*/ 00365 /*@modifies spec->macros, 00366 rpmGlobalMacroContext, fileSystem, internalState @*/; 00367 00376 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, 00377 /*@out@*/ Package * pkg) 00378 /*@modifies spec->packages, *pkg @*/; 00379 00385 /*@only@*/ 00386 Package newPackage(Spec spec) 00387 /*@modifies spec->packages, spec->packages->next @*/; 00388 00394 /*@null@*/ 00395 Package freePackages(/*@only@*/ /*@null@*/ Package packages) 00396 /*@globals fileSystem @*/ 00397 /*@modifies packages, fileSystem @*/; 00398 00404 /*@null@*/ 00405 Package freePackage(/*@only@*/ /*@null@*/ Package pkg) 00406 /*@globals fileSystem @*/ 00407 /*@modifies pkg, fileSystem @*/; 00408 00420 int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN, 00421 const char * N, const char * EVR, rpmsenseFlags Flags, 00422 int index) 00423 /*@modifies h @*/; 00424 00432 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR) 00433 /*@modifies h @*/; 00434 00442 int processBinaryFiles(Spec spec, int installSpecialDoc, int test) 00443 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00444 /*@modifies spec->macros, 00445 spec->packages->cpioList, spec->packages->fileList, 00446 spec->packages->specialDoc, spec->packages->header, 00447 rpmGlobalMacroContext, fileSystem, internalState @*/; 00448 00453 void initSourceHeader(Spec spec) 00454 /*@modifies spec->sourceHeader, 00455 spec->buildRestrictions, spec->BANames, 00456 spec->packages->header @*/; 00457 00463 int processSourceFiles(Spec spec) 00464 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00465 /*@modifies spec->sourceHeader, spec->sourceCpioList, 00466 spec->buildRestrictions, spec->BANames, 00467 spec->packages->header, 00468 rpmGlobalMacroContext, fileSystem, internalState @*/; 00469 00483 int parseSpec(rpmts ts, const char * specFile, 00484 /*@null@*/ const char * rootURL, 00485 /*@null@*/ const char * buildRootURL, 00486 int recursing, 00487 /*@null@*/ const char * passPhrase, 00488 /*@null@*/ char * cookie, 00489 int anyarch, int force) 00490 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00491 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; 00492 00501 int buildSpec(rpmts ts, Spec spec, int what, int test) 00502 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00503 /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, 00504 spec->sourceRpmName, spec->sourcePkgId, 00505 spec->macros, spec->BASpecs, 00506 spec->buildRestrictions, spec->BANames, 00507 spec->packages->cpioList, spec->packages->fileList, 00508 spec->packages->specialDoc, spec->packages->header, 00509 rpmGlobalMacroContext, fileSystem, internalState @*/; 00510 00516 int packageBinaries(Spec spec) 00517 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00518 /*@modifies spec->packages->header, spec->packages->cpioList, 00519 spec->sourceRpmName, 00520 rpmGlobalMacroContext, fileSystem, internalState @*/; 00521 00527 int packageSources(Spec spec) 00528 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00529 /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList, 00530 spec->sourceRpmName, spec->sourcePkgId, 00531 rpmGlobalMacroContext, fileSystem, internalState @*/; 00532 00533 /*@=redecl@*/ 00534 #ifdef __cplusplus 00535 } 00536 #endif 00537 00538 #endif /* _H_RPMBUILD_ */