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_CLEAN = (1 << 3), 00030 RPMBUILD_FILECHECK = (1 << 4), 00031 RPMBUILD_PACKAGESOURCE = (1 << 5), 00032 RPMBUILD_PACKAGEBINARY = (1 << 6), 00033 RPMBUILD_RMSOURCE = (1 << 7), 00034 RPMBUILD_RMBUILD = (1 << 8), 00035 RPMBUILD_STRINGBUF = (1 << 9), 00036 RPMBUILD_RMSPEC = (1 << 10) 00037 } rpmBuildFlags; 00038 /*@=typeuse@*/ 00039 00040 #include <ctype.h> 00041 00042 #define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; } 00043 #define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; } 00044 00045 #define PART_SUBNAME 0 00046 #define PART_NAME 1 00047 00051 typedef enum rpmParseState_e { 00052 PART_NONE = 0, 00053 PART_PREAMBLE = 1, 00054 PART_PREP = 2, 00055 PART_BUILD = 3, 00056 PART_INSTALL = 4, 00057 PART_CLEAN = 5, 00058 PART_FILES = 6, 00059 PART_PRE = 7, 00060 PART_POST = 8, 00061 PART_PREUN = 9, 00062 PART_POSTUN = 10, 00063 PART_DESCRIPTION = 11, 00064 PART_CHANGELOG = 12, 00065 PART_TRIGGERIN = 13, 00066 PART_TRIGGERUN = 14, 00067 PART_VERIFYSCRIPT = 15, 00068 PART_BUILDARCHITECTURES= 16, 00069 PART_TRIGGERPOSTUN = 17, 00070 PART_LAST = 18 00071 } rpmParseState; 00072 00073 #define STRIP_NOTHING 0 00074 #define STRIP_TRAILINGSPACE (1 << 0) 00075 #define STRIP_COMMENTS (1 << 1) 00076 00077 #ifdef __cplusplus 00078 extern "C" { 00079 #endif 00080 /*@-redecl@*/ 00081 00085 void freeNames(void) 00086 /*@globals internalState@*/ 00087 /*@modifies internalState */; 00088 00095 extern /*@observer@*/ const char * getUname(uid_t uid) /*@*/; 00096 00103 extern /*@observer@*/ const char * getUnameS(const char * uname) /*@*/; 00104 00111 uid_t getUidS(const char * uname) /*@*/; 00112 00119 extern /*@observer@*/ const char * getGname(gid_t gid) /*@*/; 00120 00127 extern /*@observer@*/ const char * getGnameS(const char * gname) /*@*/; 00128 00135 gid_t getGidS(const char * gname) /*@*/; 00136 00141 extern /*@observer@*/ const char * const buildHost(void) /*@*/; 00142 00147 extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/; 00148 00155 int readLine(Spec spec, int strip) 00156 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00157 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00158 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00159 rpmGlobalMacroContext, fileSystem, internalState @*/; 00160 00165 void closeSpec(/*@partial@*/ Spec spec) 00166 /*@globals fileSystem, internalState @*/ 00167 /*@modifies spec->fileStack, fileSystem, internalState @*/; 00168 00173 void handleComments(char * s) 00174 /*@modifies s @*/; 00175 00181 rpmParseState isPart(const char * line) /*@*/; 00182 00189 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res) 00190 /*@modifies *res @*/; 00191 00199 void addChangelogEntry(Header h, time_t time, const char * name, 00200 const char * text) 00201 /*@modifies h @*/; 00202 00209 int parseBuildInstallClean(Spec spec, rpmParseState parsePart) 00210 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00211 /*@modifies spec->build, spec->install, spec->clean, spec->macros, 00212 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00213 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00214 rpmGlobalMacroContext, fileSystem, internalState @*/; 00215 00221 int parseChangelog(Spec spec) 00222 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00223 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00224 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00225 spec->packages->header, 00226 rpmGlobalMacroContext, fileSystem, internalState @*/; 00227 00233 int parseDescription(Spec spec) 00234 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00235 /*@modifies spec->packages, 00236 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00237 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00238 spec->st, 00239 rpmGlobalMacroContext, fileSystem, internalState @*/; 00240 00246 int parseFiles(Spec spec) 00247 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00248 /*@modifies spec->packages, 00249 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00250 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00251 rpmGlobalMacroContext, fileSystem, internalState @*/; 00252 00259 int parsePreamble(Spec spec, int initialPackage) 00260 /*@globals rpmGlobalMacroContext, 00261 fileSystem, internalState @*/ 00262 /*@modifies spec->packages, 00263 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00264 spec->buildSubdir, 00265 spec->macros, spec->st, spec->buildRootURL, 00266 spec->sources, spec->numSources, spec->noSource, 00267 spec->buildRestrictions, spec->BANames, spec->BACount, 00268 spec->gotBuildRootURL, 00269 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00270 rpmGlobalMacroContext, fileSystem, internalState @*/; 00271 00277 int parsePrep(Spec spec) 00278 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00279 /*@modifies spec->prep, spec->buildSubdir, spec->macros, 00280 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00281 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00282 rpmGlobalMacroContext, fileSystem, internalState @*/; 00283 00294 int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index, 00295 rpmsenseFlags tagflags) 00296 /*@globals rpmGlobalMacroContext @*/ 00297 /*@modifies rpmGlobalMacroContext @*/; 00298 00305 int parseScript(Spec spec, int parsePart) 00306 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00307 /*@modifies spec->packages, 00308 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00309 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00310 rpmGlobalMacroContext, fileSystem, internalState @*/; 00311 00318 int parseExpressionBoolean(Spec spec, const char * expr) 00319 /*@globals rpmGlobalMacroContext @*/ 00320 /*@modifies rpmGlobalMacroContext @*/; 00321 00328 /*@unused@*/ 00329 char * parseExpressionString(Spec spec, const char * expr) 00330 /*@globals rpmGlobalMacroContext @*/ 00331 /*@modifies rpmGlobalMacroContext @*/; 00332 00343 int doScript(Spec spec, int what, const char * name, StringBuf sb, int test) 00344 /*@globals rpmGlobalMacroContext, 00345 fileSystem, internalState @*/ 00346 /*@modifies spec->macros, 00347 rpmGlobalMacroContext, fileSystem, internalState @*/; 00348 00357 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, 00358 /*@out@*/ Package * pkg) 00359 /*@modifies spec->packages, *pkg @*/; 00360 00366 /*@only@*/ 00367 Package newPackage(Spec spec) 00368 /*@modifies spec->packages, spec->packages->next @*/; 00369 00375 /*@null@*/ 00376 Package freePackages(/*@only@*/ /*@null@*/ Package packages) 00377 /*@globals fileSystem @*/ 00378 /*@modifies packages, fileSystem @*/; 00379 00385 /*@null@*/ 00386 Package freePackage(/*@only@*/ /*@null@*/ Package pkg) 00387 /*@globals fileSystem @*/ 00388 /*@modifies pkg, fileSystem @*/; 00389 00400 int addReqProv(/*@unused@*/Spec spec, Header h, 00401 rpmsenseFlags depFlags, const char * depName, 00402 const char * depEVR, int index) 00403 /*@modifies h @*/; 00404 00412 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR) 00413 /*@modifies h @*/; 00414 00422 int processBinaryFiles(Spec spec, int installSpecialDoc, int test) 00423 /*@globals rpmGlobalMacroContext, 00424 fileSystem, internalState @*/ 00425 /*@modifies spec->macros, 00426 spec->packages->cpioList, spec->packages->fileList, 00427 spec->packages->specialDoc, spec->packages->header, 00428 rpmGlobalMacroContext, fileSystem, internalState @*/; 00429 00434 void initSourceHeader(Spec spec) 00435 /*@modifies spec->sourceHeader, 00436 spec->buildRestrictions, spec->BANames, 00437 spec->packages->header @*/; 00438 00444 int processSourceFiles(Spec spec) 00445 /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ 00446 /*@modifies spec->sourceHeader, spec->sourceCpioList, 00447 spec->buildRestrictions, spec->BANames, 00448 spec->packages->header, 00449 rpmGlobalMacroContext, fileSystem, internalState @*/; 00450 00464 int parseSpec(/*@out@*/ Spec * specp, const char * specFile, 00465 /*@null@*/ const char * rootURL, 00466 /*@null@*/ const char * buildRootURL, 00467 int recursing, 00468 /*@null@*/ const char * passPhrase, 00469 /*@null@*/ char * cookie, 00470 int anyarch, int force) 00471 /*@globals rpmGlobalMacroContext, 00472 fileSystem, internalState @*/ 00473 /*@modifies *specp, 00474 rpmGlobalMacroContext, fileSystem, internalState @*/; 00475 00488 /*@-declundef@*/ 00489 extern int (*parseSpecVec) (Spec * specp, const char * specFile, 00490 const char * rootdir, 00491 /*@null@*/ const char * buildRoot, 00492 int recursing, 00493 /*@null@*/ const char * passPhrase, 00494 /*@null@*/ char * cookie, 00495 int anyarch, int force) 00496 /*@globals rpmGlobalMacroContext, 00497 fileSystem, internalState @*/ 00498 /*@modifies *specp, 00499 rpmGlobalMacroContext, fileSystem, internalState @*/; 00500 /*@=declundef@*/ 00501 00509 int buildSpec(Spec spec, int what, int test) 00510 /*@globals rpmGlobalMacroContext, 00511 fileSystem, internalState @*/ 00512 /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, 00513 spec->sourceRpmName, spec->macros, 00514 spec->BASpecs, 00515 spec->buildRestrictions, spec->BANames, 00516 spec->packages->cpioList, spec->packages->fileList, 00517 spec->packages->specialDoc, spec->packages->header, 00518 rpmGlobalMacroContext, fileSystem, internalState @*/; 00519 00525 int packageBinaries(Spec spec) 00526 /*@globals rpmGlobalMacroContext, 00527 fileSystem, internalState @*/ 00528 /*@modifies spec->packages->header, 00529 spec->sourceRpmName, 00530 rpmGlobalMacroContext, fileSystem, internalState @*/; 00531 00537 int packageSources(Spec spec) 00538 /*@globals rpmGlobalMacroContext, 00539 fileSystem, internalState @*/ 00540 /*@modifies spec->sourceHeader, spec->cookie, 00541 spec->sourceRpmName, 00542 rpmGlobalMacroContext, fileSystem, internalState @*/; 00543 00544 /*@=redecl@*/ 00545 #ifdef __cplusplus 00546 } 00547 #endif 00548 00549 #endif /* _H_RPMBUILD_ */