rpm
4.5
|
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 #define STRIP_NOEXPAND (1 << 2) 00082 00083 #ifdef __cplusplus 00084 extern "C" { 00085 #endif 00086 /*@-redecl@*/ 00087 00091 void freeNames(void) 00092 /*@globals internalState@*/ 00093 /*@modifies internalState */; 00094 00101 extern /*@observer@*/ const char * getUname(uid_t uid) 00102 /*@globals internalState @*/ 00103 /*@modifies internalState @*/; 00104 00111 extern /*@observer@*/ const char * getUnameS(const char * uname) 00112 /*@globals internalState @*/ 00113 /*@modifies internalState @*/; 00114 00121 uid_t getUidS(const char * uname) 00122 /*@globals internalState @*/ 00123 /*@modifies internalState @*/; 00124 00131 extern /*@observer@*/ const char * getGname(gid_t gid) 00132 /*@globals internalState @*/ 00133 /*@modifies internalState @*/; 00134 00141 extern /*@observer@*/ const char * getGnameS(const char * gname) 00142 /*@globals internalState @*/ 00143 /*@modifies internalState @*/; 00144 00151 gid_t getGidS(const char * gname) 00152 /*@globals internalState @*/ 00153 /*@modifies internalState @*/; 00154 00159 /*@observer@*/ 00160 extern const char * buildHost(void) 00161 /*@*/; 00162 00167 /*@observer@*/ 00168 extern int_32 * getBuildTime(void) 00169 /*@*/; 00170 00177 int readLine(Spec spec, int strip) 00178 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00179 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00180 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00181 rpmGlobalMacroContext, fileSystem, internalState @*/; 00182 00187 void closeSpec(/*@partial@*/ Spec spec) 00188 /*@globals fileSystem, internalState @*/ 00189 /*@modifies spec->fileStack, fileSystem, internalState @*/; 00190 00195 void handleComments(char * s) 00196 /*@modifies s @*/; 00197 00203 rpmParseState isPart(const char * line) /*@*/; 00204 00211 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res) 00212 /*@modifies *res @*/; 00213 00222 void addChangelogEntry(Header h, time_t time, const char * name, 00223 const char * text) 00224 /*@modifies h @*/; 00225 00232 int parseBuildInstallClean(Spec spec, rpmParseState parsePart) 00233 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00234 /*@modifies spec->build, spec->install, spec->check, spec->clean, 00235 spec->macros, 00236 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00237 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00238 rpmGlobalMacroContext, fileSystem, internalState @*/; 00239 00245 int parseChangelog(Spec spec) 00246 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00247 /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00248 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00249 spec->packages->header, 00250 rpmGlobalMacroContext, fileSystem, internalState @*/; 00251 00257 int parseDescription(Spec spec) 00258 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00259 /*@modifies spec->packages, 00260 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00261 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00262 spec->st, 00263 rpmGlobalMacroContext, fileSystem, internalState @*/; 00264 00270 int parseFiles(Spec spec) 00271 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00272 /*@modifies spec->packages, 00273 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00274 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00275 rpmGlobalMacroContext, fileSystem, internalState @*/; 00276 00283 int parsePreamble(Spec spec, int initialPackage) 00284 /*@globals rpmGlobalMacroContext, h_errno, 00285 fileSystem, internalState @*/ 00286 /*@modifies spec->packages, 00287 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00288 spec->buildSubdir, 00289 spec->macros, spec->st, 00290 spec->sources, spec->numSources, spec->noSource, 00291 spec->sourceHeader, spec->BANames, spec->BACount, 00292 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00293 rpmGlobalMacroContext, fileSystem, internalState @*/; 00294 00301 int parsePrep(Spec spec, int verify) 00302 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00303 /*@modifies spec->prep, spec->buildSubdir, spec->macros, 00304 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00305 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00306 rpmGlobalMacroContext, fileSystem, internalState @*/; 00307 00318 int parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN, 00319 int index, rpmsenseFlags tagflags) 00320 /*@globals rpmGlobalMacroContext, h_errno @*/ 00321 /*@modifies rpmGlobalMacroContext @*/; 00322 00329 int parseScript(Spec spec, int parsePart) 00330 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00331 /*@modifies spec->packages, 00332 spec->fileStack, spec->readStack, spec->line, spec->lineNum, 00333 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl, 00334 rpmGlobalMacroContext, fileSystem, internalState @*/; 00335 00342 int parseExpressionBoolean(Spec spec, const char * expr) 00343 /*@globals rpmGlobalMacroContext, h_errno @*/ 00344 /*@modifies rpmGlobalMacroContext @*/; 00345 00352 /*@unused@*/ /*@null@*/ 00353 char * parseExpressionString(Spec spec, const char * expr) 00354 /*@globals rpmGlobalMacroContext, h_errno @*/ 00355 /*@modifies rpmGlobalMacroContext @*/; 00356 00367 int doScript(Spec spec, int what, /*@null@*/ const char * name, 00368 /*@null@*/ StringBuf sb, int test) 00369 /*@globals rpmGlobalMacroContext, h_errno, 00370 fileSystem, internalState @*/ 00371 /*@modifies spec->macros, 00372 rpmGlobalMacroContext, fileSystem, internalState @*/; 00373 00382 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag, 00383 /*@out@*/ Package * pkg) 00384 /*@modifies spec->packages, *pkg @*/; 00385 00391 /*@only@*/ 00392 Package newPackage(Spec spec) 00393 /*@modifies spec->packages, spec->packages->next @*/; 00394 00400 /*@null@*/ 00401 Package freePackages(/*@only@*/ /*@null@*/ Package packages) 00402 /*@globals fileSystem @*/ 00403 /*@modifies packages, fileSystem @*/; 00404 00410 /*@null@*/ 00411 Package freePackage(/*@only@*/ /*@null@*/ Package pkg) 00412 /*@globals fileSystem @*/ 00413 /*@modifies pkg, fileSystem @*/; 00414 00426 int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN, 00427 const char * N, const char * EVR, rpmsenseFlags Flags, 00428 int index) 00429 /*@modifies h @*/; 00430 00437 int processScriptFiles(Spec spec, Package pkg) 00438 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00439 /*@modifies pkg->header, rpmGlobalMacroContext, 00440 fileSystem, internalState @*/; 00441 00447 void providePackageNVR(Header h) 00448 /*@modifies h @*/; 00449 00457 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR) 00458 /*@modifies h @*/; 00459 00467 int processBinaryFiles(Spec spec, int installSpecialDoc, int test) 00468 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00469 /*@modifies spec->macros, *spec->packages, 00470 spec->packages->cpioList, spec->packages->fileList, 00471 spec->packages->specialDoc, spec->packages->header, 00472 rpmGlobalMacroContext, fileSystem, internalState @*/; 00473 00480 int initSourceHeader(Spec spec, /*@null@*/ StringBuf *sfp) 00481 /*@modifies spec->sourceHeader, 00482 spec->BANames, *sfp, 00483 spec->packages->header @*/; 00484 00490 int processSourceFiles(Spec spec) 00491 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00492 /*@modifies spec->sourceHeader, spec->sourceCpioList, 00493 spec->BANames, 00494 spec->packages->header, 00495 rpmGlobalMacroContext, fileSystem, internalState @*/; 00496 00510 int parseSpec(rpmts ts, const char * specFile, 00511 /*@null@*/ const char * rootURL, 00512 int recursing, 00513 /*@null@*/ const char * passPhrase, 00514 /*@null@*/ char * cookie, 00515 int anyarch, int force, int verify) 00516 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00517 /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; 00518 00527 int buildSpec(rpmts ts, Spec spec, int what, int test) 00528 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00529 /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie, 00530 spec->sourceRpmName, spec->sourcePkgId, 00531 spec->macros, spec->BASpecs, 00532 spec->BANames, *spec->packages, 00533 spec->packages->cpioList, spec->packages->fileList, 00534 spec->packages->specialDoc, spec->packages->header, 00535 rpmGlobalMacroContext, fileSystem, internalState @*/; 00536 00542 int packageBinaries(Spec spec) 00543 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00544 /*@modifies spec->packages->header, spec->packages->cpioList, 00545 spec->sourceRpmName, 00546 rpmGlobalMacroContext, fileSystem, internalState @*/; 00547 00553 int packageSources(Spec spec) 00554 /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ 00555 /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList, 00556 spec->sourceRpmName, spec->sourcePkgId, 00557 rpmGlobalMacroContext, fileSystem, internalState @*/; 00558 00559 /*@=redecl@*/ 00560 #ifdef __cplusplus 00561 } 00562 #endif 00563 00564 #endif /* _H_RPMBUILD_ */