Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

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_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     RPMBUILD_PREPROCESS = (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_CLEAN          = 5,    
00059     PART_FILES          = 6,    
00060     PART_PRE            = 7,    
00061     PART_POST           = 8,    
00062     PART_PREUN          = 9,    
00063     PART_POSTUN         = 10,   
00064     PART_DESCRIPTION    = 11,   
00065     PART_CHANGELOG      = 12,   
00066     PART_TRIGGERIN      = 13,   
00067     PART_TRIGGERUN      = 14,   
00068     PART_VERIFYSCRIPT   = 15,   
00069     PART_BUILDARCHITECTURES= 16,
00070     PART_TRIGGERPOSTUN  = 17,   
00071     PART_LAST           = 18    
00072 } rpmParseState;
00073 
00074 #define STRIP_NOTHING             0
00075 #define STRIP_TRAILINGSPACE (1 << 0)
00076 #define STRIP_COMMENTS      (1 << 1)
00077 
00078 #ifdef __cplusplus
00079 extern "C" {
00080 #endif
00081 /*@-redecl@*/
00082 
00086 void freeNames(void)
00087         /*@globals internalState@*/
00088         /*@modifies internalState */;
00089 
00096 extern /*@observer@*/ const char * getUname(uid_t uid)  /*@*/;
00097 
00104 extern /*@observer@*/ const char * getUnameS(const char * uname)        /*@*/;
00105 
00112 uid_t getUidS(const char * uname)       /*@*/;
00113 
00120 extern /*@observer@*/ const char * getGname(gid_t gid)          /*@*/;
00121 
00128 extern /*@observer@*/ const char * getGnameS(const char * gname)        /*@*/;
00129 
00136 gid_t getGidS(const char * gname)       /*@*/;
00137 
00142 extern /*@observer@*/ const char * const buildHost(void)        /*@*/;
00143 
00148 extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/;
00149 
00156 int readLine(Spec spec, int strip)
00157         /*@globals rpmGlobalMacroContext,
00158                 fileSystem@*/
00159         /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00160                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00161                 rpmGlobalMacroContext, fileSystem @*/;
00162 
00167 void closeSpec(/*@partial@*/ Spec spec)
00168         /*@globals fileSystem@*/
00169         /*@modifies spec->fileStack, fileSystem @*/;
00170 
00175 void handleComments(char * s)
00176         /*@modifies s @*/;
00177 
00183 rpmParseState isPart(const char * line) /*@*/;
00184 
00191 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res)
00192         /*@modifies *res @*/;
00193 
00201 void addChangelogEntry(Header h, time_t time, const char * name,
00202                 const char * text)
00203         /*@modifies h @*/;
00204 
00211 int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
00212         /*@globals rpmGlobalMacroContext,
00213                 fileSystem @*/
00214         /*@modifies spec->build, spec->install, spec->clean, spec->macros,
00215                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00216                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00217                 rpmGlobalMacroContext, fileSystem @*/;
00218 
00224 int parseChangelog(Spec spec)
00225         /*@globals rpmGlobalMacroContext,
00226                 fileSystem@*/
00227         /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00228                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00229                 spec->packages->header,
00230                 rpmGlobalMacroContext, fileSystem @*/;
00231 
00237 int parseDescription(Spec spec)
00238         /*@globals rpmGlobalMacroContext,
00239                 fileSystem@*/
00240         /*@modifies spec->packages,
00241                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00242                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00243                 spec->st,
00244                 rpmGlobalMacroContext, fileSystem @*/;
00245 
00251 int parseFiles(Spec spec)
00252         /*@globals rpmGlobalMacroContext,
00253                 fileSystem@*/
00254         /*@modifies spec->packages,
00255                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00256                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00257                 rpmGlobalMacroContext, fileSystem @*/;
00258 
00265 int parsePreamble(Spec spec, int initialPackage)
00266         /*@globals rpmGlobalMacroContext,
00267                 fileSystem, internalState @*/
00268         /*@modifies spec->packages,
00269                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00270                 spec->buildSubdir,
00271                 spec->macros, spec->st, spec->buildRootURL,
00272                 spec->sources, spec->numSources, spec->noSource,
00273                 spec->buildRestrictions, spec->BANames, spec->BACount,
00274                 spec->gotBuildRootURL,
00275                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00276                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00277 
00283 int parsePrep(Spec spec)
00284         /*@globals rpmGlobalMacroContext,
00285                 fileSystem@*/
00286         /*@modifies spec->prep, spec->buildSubdir, spec->macros,
00287                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00288                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00289                 rpmGlobalMacroContext, fileSystem @*/;
00290 
00301 int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index,
00302                rpmsenseFlags tagflags)
00303         /*@globals rpmGlobalMacroContext @*/
00304         /*@modifies rpmGlobalMacroContext @*/;
00305 
00312 int parseScript(Spec spec, int parsePart)
00313         /*@globals rpmGlobalMacroContext,
00314                 fileSystem@*/
00315         /*@modifies spec->packages,
00316                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00317                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00318                 rpmGlobalMacroContext, fileSystem @*/;
00319 
00326 int parseExpressionBoolean(Spec spec, const char * expr)
00327         /*@globals rpmGlobalMacroContext @*/
00328         /*@modifies rpmGlobalMacroContext @*/;
00329 
00336 /*@unused@*/
00337 char * parseExpressionString(Spec spec, const char * expr)
00338         /*@globals rpmGlobalMacroContext @*/
00339         /*@modifies rpmGlobalMacroContext @*/;
00340 
00351 int doScript(Spec spec, int what, const char * name, StringBuf sb, int test)
00352         /*@globals rpmGlobalMacroContext,
00353                 fileSystem, internalState @*/
00354         /*@modifies spec->macros,
00355                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00356 
00365 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag,
00366                 /*@out@*/ Package * pkg)
00367         /*@modifies spec->packages, *pkg @*/;
00368 
00374 /*@only@*/ Package newPackage(Spec spec)
00375         /*@modifies spec->packages, spec->packages->next @*/;
00376 
00382 /*@null@*/ Package freePackages(/*@only@*/ /*@null@*/ Package packages)
00383         /*@modifies packages @*/;
00384 
00390 /*@null@*/ Package  freePackage(/*@only@*/ /*@null@*/ Package pkg)
00391         /*@modifies pkg @*/;
00392 
00403 int addReqProv(/*@unused@*/Spec spec, Header h,
00404                 rpmsenseFlags depFlags, const char * depName,
00405                 const char * depEVR, int index)
00406         /*@modifies h @*/;
00407 
00415 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
00416         /*@modifies h @*/;
00417 
00425 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
00426         /*@globals rpmGlobalMacroContext,
00427                 fileSystem, internalState @*/
00428         /*@modifies spec->macros,
00429                 spec->packages->cpioList, spec->packages->fileList,
00430                 spec->packages->specialDoc, spec->packages->header,
00431                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00432 
00437 void initSourceHeader(Spec spec)
00438         /*@modifies spec->sourceHeader,
00439                 spec->buildRestrictions, spec->BANames,
00440                 spec->packages->header @*/;
00441 
00447 int processSourceFiles(Spec spec)
00448         /*@globals rpmGlobalMacroContext,
00449                 fileSystem @*/
00450         /*@modifies spec->sourceHeader, spec->sourceCpioList,
00451                 spec->buildRestrictions, spec->BANames,
00452                 spec->packages->header,
00453                 rpmGlobalMacroContext, fileSystem @*/;
00454 
00469 int parseSpec(/*@out@*/ Spec * specp, const char * specFile,
00470                 /*@null@*/ const char * rootURL,
00471                 /*@null@*/ const char * buildRootURL,
00472                 int recursing,
00473                 /*@null@*/ const char * passPhrase,
00474                 /*@null@*/ char * cookie,
00475                 int anyarch, int force, int preprocess)
00476         /*@globals rpmGlobalMacroContext,
00477                 fileSystem, internalState @*/
00478         /*@modifies *specp,
00479                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00480 
00494 /*@-declundef@*/
00495 extern int (*parseSpecVec) (Spec * specp, const char * specFile,
00496                 const char * rootdir,
00497                 /*@null@*/ const char * buildRoot,
00498                 int recursing,
00499                 /*@null@*/ const char * passPhrase,
00500                 /*@null@*/ char * cookie,
00501                 int anyarch, int force, int preprocess)
00502         /*@globals rpmGlobalMacroContext,
00503                 fileSystem, internalState @*/
00504         /*@modifies *specp,
00505                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00506 /*@=declundef@*/
00507 
00515 int buildSpec(Spec spec, int what, int test)
00516         /*@globals rpmGlobalMacroContext,
00517                 fileSystem, internalState @*/
00518         /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie,
00519                 spec->sourceRpmName, spec->macros,
00520                 spec->BASpecs,
00521                 spec->buildRestrictions, spec->BANames,
00522                 spec->packages->cpioList, spec->packages->fileList,
00523                 spec->packages->specialDoc, spec->packages->header,
00524                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00525 
00531 int packageBinaries(Spec spec)
00532         /*@globals rpmGlobalMacroContext,
00533                 fileSystem, internalState @*/
00534         /*@modifies spec->packages->header,
00535                 spec->sourceRpmName,
00536                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00537 
00543 int packageSources(Spec spec)
00544         /*@globals rpmGlobalMacroContext,
00545                 fileSystem, internalState @*/
00546         /*@modifies spec->sourceHeader, spec->cookie,
00547                 spec->sourceRpmName,
00548                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00549 
00550 /*@=redecl@*/
00551 #ifdef __cplusplus
00552 }
00553 #endif
00554 
00555 #endif  /* _H_RPMBUILD_ */

Generated on Sun Feb 2 23:31:59 2003 for rpm by doxygen1.2.18