build/rpmbuild.h

Go to the documentation of this file.
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_LAST           = 21    
00075 } rpmParseState;
00076 
00077 #define STRIP_NOTHING             0
00078 #define STRIP_TRAILINGSPACE (1 << 0)
00079 #define STRIP_COMMENTS      (1 << 1)
00080 
00081 #ifdef __cplusplus
00082 extern "C" {
00083 #endif
00084 /*@-redecl@*/
00085 
00089 void freeNames(void)
00090         /*@globals internalState@*/
00091         /*@modifies internalState */;
00092 
00099 extern /*@observer@*/ const char * getUname(uid_t uid)
00100         /*@globals internalState @*/
00101         /*@modifies internalState @*/;
00102 
00109 extern /*@observer@*/ const char * getUnameS(const char * uname)
00110         /*@globals internalState @*/
00111         /*@modifies internalState @*/;
00112 
00119 uid_t getUidS(const char * uname)
00120         /*@globals internalState @*/
00121         /*@modifies internalState @*/;
00122 
00129 extern /*@observer@*/ const char * getGname(gid_t gid)
00130         /*@globals internalState @*/
00131         /*@modifies internalState @*/;
00132 
00139 extern /*@observer@*/ const char * getGnameS(const char * gname)
00140         /*@globals internalState @*/
00141         /*@modifies internalState @*/;
00142 
00149 gid_t getGidS(const char * gname)
00150         /*@globals internalState @*/
00151         /*@modifies internalState @*/;
00152 
00157 extern /*@observer@*/ const char * const buildHost(void)        /*@*/;
00158 
00163 extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/;
00164 
00171 int readLine(Spec spec, int strip)
00172         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00173         /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00174                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00175                 rpmGlobalMacroContext, fileSystem, internalState  @*/;
00176 
00181 void closeSpec(/*@partial@*/ Spec spec)
00182         /*@globals fileSystem, internalState @*/
00183         /*@modifies spec->fileStack, fileSystem, internalState @*/;
00184 
00189 void handleComments(char * s)
00190         /*@modifies s @*/;
00191 
00197 rpmParseState isPart(const char * line) /*@*/;
00198 
00205 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res)
00206         /*@modifies *res @*/;
00207 
00215 void addChangelogEntry(Header h, time_t time, const char * name,
00216                 const char * text)
00217         /*@modifies h @*/;
00218 
00225 int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
00226         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00227         /*@modifies spec->build, spec->install, spec->check, spec->clean,
00228                 spec->macros,
00229                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00230                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00231                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00232 
00238 int parseChangelog(Spec spec)
00239         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00240         /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00241                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00242                 spec->packages->header,
00243                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00244 
00250 int parseDescription(Spec spec)
00251         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00252         /*@modifies spec->packages,
00253                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00254                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00255                 spec->st,
00256                 rpmGlobalMacroContext, fileSystem, internalState  @*/;
00257 
00263 int parseFiles(Spec spec)
00264         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00265         /*@modifies spec->packages,
00266                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00267                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00268                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00269 
00276 int parsePreamble(Spec spec, int initialPackage)
00277         /*@globals rpmGlobalMacroContext, h_errno,
00278                 fileSystem, internalState @*/
00279         /*@modifies spec->packages,
00280                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00281                 spec->buildSubdir,
00282                 spec->macros, spec->st, spec->buildRootURL,
00283                 spec->sources, spec->numSources, spec->noSource,
00284                 spec->buildRestrictions, spec->BANames, spec->BACount,
00285                 spec->gotBuildRootURL,
00286                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00287                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00288 
00294 int parsePrep(Spec spec)
00295         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00296         /*@modifies spec->prep, spec->buildSubdir, spec->macros,
00297                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00298                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00299                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00300 
00311 int parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN,
00312                 int index, rpmsenseFlags tagflags)
00313         /*@globals rpmGlobalMacroContext, h_errno @*/
00314         /*@modifies rpmGlobalMacroContext @*/;
00315 
00322 int parseScript(Spec spec, int parsePart)
00323         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00324         /*@modifies spec->packages,
00325                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00326                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00327                 rpmGlobalMacroContext, fileSystem, internalState  @*/;
00328 
00335 int parseExpressionBoolean(Spec spec, const char * expr)
00336         /*@globals rpmGlobalMacroContext, h_errno @*/
00337         /*@modifies rpmGlobalMacroContext @*/;
00338 
00345 /*@unused@*/ /*@null@*/
00346 char * parseExpressionString(Spec spec, const char * expr)
00347         /*@globals rpmGlobalMacroContext, h_errno @*/
00348         /*@modifies rpmGlobalMacroContext @*/;
00349 
00360 int doScript(Spec spec, int what, /*@null@*/ const char * name,
00361                 /*@null@*/ StringBuf sb, int test)
00362         /*@globals rpmGlobalMacroContext, h_errno,
00363                 fileSystem, internalState @*/
00364         /*@modifies spec->macros,
00365                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00366 
00375 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag,
00376                 /*@out@*/ Package * pkg)
00377         /*@modifies spec->packages, *pkg @*/;
00378 
00384 /*@only@*/
00385 Package newPackage(Spec spec)
00386         /*@modifies spec->packages, spec->packages->next @*/;
00387 
00393 /*@null@*/
00394 Package freePackages(/*@only@*/ /*@null@*/ Package packages)
00395         /*@globals fileSystem @*/
00396         /*@modifies packages, fileSystem @*/;
00397 
00403 /*@null@*/
00404 Package  freePackage(/*@only@*/ /*@null@*/ Package pkg)
00405         /*@globals fileSystem @*/
00406         /*@modifies pkg, fileSystem @*/;
00407 
00419 int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN,
00420                 const char * N, const char * EVR, rpmsenseFlags Flags,
00421                 int index)
00422         /*@modifies h @*/;
00423 
00431 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
00432         /*@modifies h @*/;
00433 
00441 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
00442         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00443         /*@modifies spec->macros,
00444                 spec->packages->cpioList, spec->packages->fileList,
00445                 spec->packages->specialDoc, spec->packages->header,
00446                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00447 
00452 void initSourceHeader(Spec spec)
00453         /*@modifies spec->sourceHeader,
00454                 spec->buildRestrictions, spec->BANames,
00455                 spec->packages->header @*/;
00456 
00462 int processSourceFiles(Spec spec)
00463         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00464         /*@modifies spec->sourceHeader, spec->sourceCpioList,
00465                 spec->buildRestrictions, spec->BANames,
00466                 spec->packages->header,
00467                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00468 
00482 int parseSpec(rpmts ts, const char * specFile,
00483                 /*@null@*/ const char * rootURL,
00484                 /*@null@*/ const char * buildRootURL,
00485                 int recursing,
00486                 /*@null@*/ const char * passPhrase,
00487                 /*@null@*/ char * cookie,
00488                 int anyarch, int force)
00489         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00490         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00491 
00500 int buildSpec(rpmts ts, Spec spec, int what, int test)
00501         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00502         /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie,
00503                 spec->sourceRpmName, spec->sourcePkgId,
00504                 spec->macros, spec->BASpecs,
00505                 spec->buildRestrictions, spec->BANames,
00506                 spec->packages->cpioList, spec->packages->fileList,
00507                 spec->packages->specialDoc, spec->packages->header,
00508                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00509 
00515 int packageBinaries(Spec spec)
00516         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00517         /*@modifies spec->packages->header, spec->packages->cpioList,
00518                 spec->sourceRpmName,
00519                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00520 
00526 int packageSources(Spec spec)
00527         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00528         /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList,
00529                 spec->sourceRpmName, spec->sourcePkgId,
00530                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00531 
00532 /*@=redecl@*/
00533 #ifdef __cplusplus
00534 }
00535 #endif
00536 
00537 #endif  /* _H_RPMBUILD_ */

Generated on Fri Oct 12 08:44:53 2007 for rpm by  doxygen 1.5.2