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_TRACK = (1 << 11), 00038 RPMBUILD_RMSPEC = (1 << 12), 00039 RPMBUILD_FETCHSOURCE= (1 << 13) 00040 } rpmBuildFlags; 00041 /*@=typeuse@*/ 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 #define PART_BASE 100 00053 typedef enum rpmParseState_e { 00054 PART_NONE = 0+PART_BASE, 00055 /* leave room for RPMRC_NOTFOUND returns. */ 00056 PART_PREAMBLE = 11+PART_BASE, 00057 PART_PREP = 12+PART_BASE, 00058 PART_BUILD = 13+PART_BASE, 00059 PART_INSTALL = 14+PART_BASE, 00060 PART_CHECK = 15+PART_BASE, 00061 PART_CLEAN = 16+PART_BASE, 00062 PART_FILES = 17+PART_BASE, 00063 PART_PRE = 18+PART_BASE, 00064 PART_POST = 19+PART_BASE, 00065 PART_PREUN = 20+PART_BASE, 00066 PART_POSTUN = 21+PART_BASE, 00067 PART_PRETRANS = 22+PART_BASE, 00068 PART_POSTTRANS = 23+PART_BASE, 00069 PART_DESCRIPTION = 24+PART_BASE, 00070 PART_CHANGELOG = 25+PART_BASE, 00071 PART_TRIGGERIN = 26+PART_BASE, 00072 PART_TRIGGERUN = 27+PART_BASE, 00073 PART_VERIFYSCRIPT = 28+PART_BASE, 00074 PART_BUILDARCHITECTURES= 29+PART_BASE, 00075 PART_TRIGGERPOSTUN = 30+PART_BASE, 00076 PART_TRIGGERPREIN = 31+PART_BASE, 00077 /* support "%sanitycheck" script */ 00078 PART_SANITYCHECK = 32+PART_BASE, 00079 PART_ARBITRARY = 33+PART_BASE, 00080 PART_LAST = 34+PART_BASE 00081 } rpmParseState; 00082 00083 #define STRIP_NOTHING 0 00084 #define STRIP_TRAILINGSPACE (1 << 0) 00085 #define STRIP_COMMENTS (1 << 1) 00086 00087 /*@unchecked@*/ 00088 extern int _rpmbuildFlags; 00089 00090 #ifdef __cplusplus 00091 extern "C" { 00092 #endif 00093 /*@-redecl@*/ 00094 00098 void freeNames(void) 00099 /*@globals internalState@*/ 00100 /*@modifies internalState */; 00101 00108 extern /*@observer@*/ const char * getUname(uid_t uid) 00109 /*@globals internalState @*/ 00110 /*@modifies internalState @*/; 00111 00118 extern /*@observer@*/ const char * getUnameS(const char * uname) 00119 /*@globals internalState @*/ 00120 /*@modifies internalState @*/; 00121 00128 uid_t getUidS(const char * uname) 00129 /*@globals internalState @*/ 00130 /*@modifies internalState @*/; 00131 00138 extern /*@observer@*/ const char * getGname(gid_t gid) 00139 /*@globals internalState @*/ 00140 /*@modifies internalState @*/; 00141 00148 extern /*@observer@*/ const char * getGnameS(const char * gname) 00149 /*@globals internalState @*/ 00150 /*@modifies internalState @*/; 00151 00158 gid_t getGidS(const char * gname) 00159 /*@globals internalState @*/ 00160 /*@modifies internalState @*/; 00161 00166 /*@observer@*/ 00167 extern const char * buildHost(void) 00168 /*@*/; 00169 00174 /*@observer@*/ 00175 extern uint32_t * getBuildTime(void) 00176 /*@*/; 00177 00184 int readLine(Spec spec, int strip) 00185 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00186 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00187 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00188 rpmGlobalMacroContext, fileSystem, internalState @*/; 00189 00194 void closeSpec(/*@partial@*/ Spec spec) 00195 /*@globals fileSystem, internalState @*/ 00196 /*@modifies spec->fileStack, fileSystem, internalState @*/; 00197 00202 void handleComments(char * s) 00203 /*@modifies s @*/; 00204 00210 rpmParseState isPart(Spec spec) 00211 /*@*/; 00212 00219 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/uint32_t * res) 00220 /*@modifies *res @*/; 00221 00230 void addChangelogEntry(Header h, time_t time, const char * name, 00231 const char * text) 00232 /*@modifies h @*/; 00233 00240 int parseBuildInstallClean(Spec spec, rpmParseState parsePart) 00241 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00242 /*@modifies spec->build, spec->install, spec->check, spec->clean, 00243 spec->macros, 00244 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00245 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00246 rpmGlobalMacroContext, fileSystem, internalState @*/; 00247 00253 int parseChangelog(Spec spec) 00254 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00255 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00256 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00257 spec->packages->header, 00258 rpmGlobalMacroContext, fileSystem, internalState @*/; 00259 00265 int parseDescription(Spec spec) 00266 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00267 /*@modifies spec->packages, 00268 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00269 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00270 spec->st, 00271 rpmGlobalMacroContext, fileSystem, internalState @*/; 00272 00278 int parseFiles(Spec spec) 00279 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00280 /*@modifies spec->packages, 00281 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00282 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00283 rpmGlobalMacroContext, fileSystem, internalState @*/; 00284 00291 int parsePreamble(Spec spec, int initialPackage) 00292 /*@globals rpmGlobalMacroContext, h_errno, 00293 fileSystem, internalState @*/ 00294 /*@modifies spec->packages, 00295 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00296 spec->buildSubdir, 00297 spec->macros, spec->st, 00298 spec->sources, spec->numSources, spec->noSource, 00299 spec->sourceHeader, spec->BANames, spec->BACount, 00300 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00301 rpmGlobalMacroContext, fileSystem, internalState @*/; 00302 00309 int parsePrep(Spec spec, int verify) 00310 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00311 /*@modifies spec->prep, spec->buildSubdir, spec->macros, 00312 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00313 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00314 spec->packages->header, 00315 rpmGlobalMacroContext, fileSystem, internalState @*/; 00316 00327 rpmRC parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN, 00328 uint32_t index, rpmsenseFlags tagflags) 00329 /*@*/; 00330 00337 int parseScript(Spec spec, int parsePart) 00338 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00339 /*@modifies spec->packages, 00340 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00341 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00342 rpmGlobalMacroContext, fileSystem, internalState @*/; 00343 00350 int parseExpressionBoolean(Spec spec, const char * expr) 00351 /*@globals rpmGlobalMacroContext, h_errno @*/ 00352 /*@modifies rpmGlobalMacroContext @*/; 00353 00360 /*@unused@*/ /*@null@*/ 00361 char * parseExpressionString(Spec spec, const char * expr) 00362 /*@globals rpmGlobalMacroContext, h_errno @*/ 00363 /*@modifies rpmGlobalMacroContext @*/; 00364 00375 rpmRC doScript(Spec spec, int what, /*@null@*/ const char * name, 00376 /*@null@*/ StringBuf sb, int test) 00377 /*@globals rpmGlobalMacroContext, h_errno, 00378 fileSystem, internalState @*/ 00379 /*@modifies spec->macros, 00380 rpmGlobalMacroContext, fileSystem, internalState @*/; 00381 00390 rpmRC lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, 00391 /*@out@*/ Package * pkg) 00392 /*@modifies spec->packages, *pkg @*/; 00393 00399 /*@only@*/ 00400 Package newPackage(Spec spec) 00401 /*@modifies spec->packages, spec->packages->next @*/; 00402 00408 /*@null@*/ 00409 Package freePackages(/*@only@*/ /*@null@*/ Package packages) 00410 /*@globals fileSystem @*/ 00411 /*@modifies packages, fileSystem @*/; 00412 00418 /*@null@*/ 00419 Package freePackage(/*@only@*/ /*@null@*/ Package pkg) 00420 /*@globals fileSystem @*/ 00421 /*@modifies pkg, fileSystem @*/; 00422 00434 int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN, 00435 const char * N, const char * EVR, rpmsenseFlags Flags, 00436 uint32_t index) 00437 /*@modifies h @*/; 00438 00445 rpmRC processScriptFiles(Spec spec, Package pkg) 00446 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00447 /*@modifies pkg->header, rpmGlobalMacroContext, 00448 fileSystem, internalState @*/; 00449 00455 void providePackageNVR(Header h) 00456 /*@modifies h @*/; 00457 00465 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR) 00466 /*@modifies h @*/; 00467 00475 rpmRC processBinaryFiles(Spec spec, int installSpecialDoc, int test) 00476 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00477 /*@modifies spec->macros, *spec->packages, 00478 spec->packages->cpioList, spec->packages->fileList, 00479 spec->packages->specialDoc, spec->packages->header, 00480 rpmGlobalMacroContext, fileSystem, internalState @*/; 00481 00488 int initSourceHeader(Spec spec, /*@null@*/ StringBuf *sfp) 00489 /*@globals rpmGlobalMacroContext, h_errno @*/ 00490 /*@modifies spec->sourceHeader, spec->sourceHdrInit, 00491 spec->BANames, *sfp, 00492 spec->packages->header, 00493 rpmGlobalMacroContext @*/; 00494 00500 int processSourceFiles(Spec spec) 00501 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00502 /*@modifies spec->sourceHeader, spec->sourceCpioList, 00503 spec->BANames, spec->sourceHdrInit, 00504 spec->packages->header, 00505 rpmGlobalMacroContext, fileSystem, internalState @*/; 00506 00520 int parseSpec(rpmts ts, const char * specFile, 00521 /*@null@*/ const char * rootURL, 00522 int recursing, 00523 /*@null@*/ const char * passPhrase, 00524 /*@null@*/ const char * cookie, 00525 int anyarch, int force, int verify) 00526 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00527 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; 00528 00537 rpmRC buildSpec(rpmts ts, Spec spec, int what, int test) 00538 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00539 /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, 00540 spec->sourceRpmName, spec->sourcePkgId, spec->sourceHdrInit, 00541 spec->macros, spec->BASpecs, 00542 spec->BANames, *spec->packages, 00543 spec->packages->cpioList, spec->packages->fileList, 00544 spec->packages->specialDoc, spec->packages->header, 00545 rpmGlobalMacroContext, fileSystem, internalState @*/; 00546 00552 rpmRC packageBinaries(Spec spec) 00553 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00554 /*@modifies spec->packages->header, spec->packages->cpioList, 00555 spec->sourceRpmName, spec->cookie, spec->sourcePkgId, 00556 rpmGlobalMacroContext, fileSystem, internalState @*/; 00557 00563 rpmRC packageSources(Spec spec) 00564 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00565 /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList, 00566 spec->sourceRpmName, spec->sourcePkgId, spec->packages->header, 00567 rpmGlobalMacroContext, fileSystem, internalState @*/; 00568 00569 /*@=redecl@*/ 00570 #ifdef __cplusplus 00571 } 00572 #endif 00573 00574 #endif /* _H_RPMBUILD_ */