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 /*@observer@*/ 00159 extern const char * buildHost(void) 00160 /*@*/; 00161 00166 /*@observer@*/ 00167 extern int_32 * getBuildTime(void) 00168 /*@*/; 00169 00176 int readLine(Spec spec, int strip) 00177 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00178 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00179 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00180 rpmGlobalMacroContext, fileSystem, internalState @*/; 00181 00186 void closeSpec(/*@partial@*/ Spec spec) 00187 /*@globals fileSystem, internalState @*/ 00188 /*@modifies spec->fileStack, fileSystem, internalState @*/; 00189 00194 void handleComments(char * s) 00195 /*@modifies s @*/; 00196 00202 rpmParseState isPart(const char * line) /*@*/; 00203 00210 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res) 00211 /*@modifies *res @*/; 00212 00221 void addChangelogEntry(Header h, time_t time, const char * name, 00222 const char * text) 00223 /*@modifies h @*/; 00224 00231 int parseBuildInstallClean(Spec spec, rpmParseState parsePart) 00232 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00233 /*@modifies spec->build, spec->install, spec->check, spec->clean, 00234 spec->macros, 00235 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00236 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00237 rpmGlobalMacroContext, fileSystem, internalState @*/; 00238 00244 int parseChangelog(Spec spec) 00245 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00246 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00247 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00248 spec->packages->header, 00249 rpmGlobalMacroContext, fileSystem, internalState @*/; 00250 00256 int parseDescription(Spec spec) 00257 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00258 /*@modifies spec->packages, 00259 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00260 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00261 spec->st, 00262 rpmGlobalMacroContext, fileSystem, internalState @*/; 00263 00269 int parseFiles(Spec spec) 00270 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00271 /*@modifies spec->packages, 00272 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00273 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00274 rpmGlobalMacroContext, fileSystem, internalState @*/; 00275 00282 int parsePreamble(Spec spec, int initialPackage) 00283 /*@globals rpmGlobalMacroContext, h_errno, 00284 fileSystem, internalState @*/ 00285 /*@modifies spec->packages, 00286 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00287 spec->buildSubdir, 00288 spec->macros, spec->st, 00289 spec->sources, spec->numSources, spec->noSource, 00290 spec->sourceHeader, spec->BANames, spec->BACount, 00291 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00292 rpmGlobalMacroContext, fileSystem, internalState @*/; 00293 00300 int parsePrep(Spec spec, int verify) 00301 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00302 /*@modifies spec->prep, spec->buildSubdir, spec->macros, 00303 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00304 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00305 rpmGlobalMacroContext, fileSystem, internalState @*/; 00306 00317 int parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN, 00318 int index, rpmsenseFlags tagflags) 00319 /*@globals rpmGlobalMacroContext, h_errno @*/ 00320 /*@modifies rpmGlobalMacroContext @*/; 00321 00328 int parseScript(Spec spec, int parsePart) 00329 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00330 /*@modifies spec->packages, 00331 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00332 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00333 rpmGlobalMacroContext, fileSystem, internalState @*/; 00334 00341 int parseExpressionBoolean(Spec spec, const char * expr) 00342 /*@globals rpmGlobalMacroContext, h_errno @*/ 00343 /*@modifies rpmGlobalMacroContext @*/; 00344 00351 /*@unused@*/ /*@null@*/ 00352 char * parseExpressionString(Spec spec, const char * expr) 00353 /*@globals rpmGlobalMacroContext, h_errno @*/ 00354 /*@modifies rpmGlobalMacroContext @*/; 00355 00366 int doScript(Spec spec, int what, /*@null@*/ const char * name, 00367 /*@null@*/ StringBuf sb, int test) 00368 /*@globals rpmGlobalMacroContext, h_errno, 00369 fileSystem, internalState @*/ 00370 /*@modifies spec->macros, 00371 rpmGlobalMacroContext, fileSystem, internalState @*/; 00372 00381 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, 00382 /*@out@*/ Package * pkg) 00383 /*@modifies spec->packages, *pkg @*/; 00384 00390 /*@only@*/ 00391 Package newPackage(Spec spec) 00392 /*@modifies spec->packages, spec->packages->next @*/; 00393 00399 /*@null@*/ 00400 Package freePackages(/*@only@*/ /*@null@*/ Package packages) 00401 /*@globals fileSystem @*/ 00402 /*@modifies packages, fileSystem @*/; 00403 00409 /*@null@*/ 00410 Package freePackage(/*@only@*/ /*@null@*/ Package pkg) 00411 /*@globals fileSystem @*/ 00412 /*@modifies pkg, fileSystem @*/; 00413 00425 int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN, 00426 const char * N, const char * EVR, rpmsenseFlags Flags, 00427 int index) 00428 /*@modifies h @*/; 00429 00436 int processScriptFiles(Spec spec, Package pkg) 00437 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00438 /*@modifies pkg->header, rpmGlobalMacroContext, 00439 fileSystem, internalState @*/; 00440 00446 void providePackageNVR(Header h) 00447 /*@modifies h @*/; 00448 00456 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR) 00457 /*@modifies h @*/; 00458 00466 int processBinaryFiles(Spec spec, int installSpecialDoc, int test) 00467 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00468 /*@modifies spec->macros, *spec->packages, 00469 spec->packages->cpioList, spec->packages->fileList, 00470 spec->packages->specialDoc, spec->packages->header, 00471 rpmGlobalMacroContext, fileSystem, internalState @*/; 00472 00479 int initSourceHeader(Spec spec, /*@null@*/ StringBuf *sfp) 00480 /*@modifies spec->sourceHeader, 00481 spec->BANames, *sfp, 00482 spec->packages->header @*/; 00483 00489 int processSourceFiles(Spec spec) 00490 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00491 /*@modifies spec->sourceHeader, spec->sourceCpioList, 00492 spec->BANames, 00493 spec->packages->header, 00494 rpmGlobalMacroContext, fileSystem, internalState @*/; 00495 00509 int parseSpec(rpmts ts, const char * specFile, 00510 /*@null@*/ const char * rootURL, 00511 int recursing, 00512 /*@null@*/ const char * passPhrase, 00513 /*@null@*/ char * cookie, 00514 int anyarch, int force, int verify) 00515 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00516 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; 00517 00526 int buildSpec(rpmts ts, Spec spec, int what, int test) 00527 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00528 /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, 00529 spec->sourceRpmName, spec->sourcePkgId, 00530 spec->macros, spec->BASpecs, 00531 spec->BANames, *spec->packages, 00532 spec->packages->cpioList, spec->packages->fileList, 00533 spec->packages->specialDoc, spec->packages->header, 00534 rpmGlobalMacroContext, fileSystem, internalState @*/; 00535 00541 int packageBinaries(Spec spec) 00542 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00543 /*@modifies spec->packages->header, spec->packages->cpioList, 00544 spec->sourceRpmName, 00545 rpmGlobalMacroContext, fileSystem, internalState @*/; 00546 00552 int packageSources(Spec spec) 00553 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00554 /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList, 00555 spec->sourceRpmName, spec->sourcePkgId, 00556 rpmGlobalMacroContext, fileSystem, internalState @*/; 00557 00558 /*@=redecl@*/ 00559 #ifdef __cplusplus 00560 } 00561 #endif 00562 00563 #endif /* _H_RPMBUILD_ */