rpm 5.3.12
build/rpmbuild.h
Go to the documentation of this file.
00001 #ifndef _H_RPMBUILD_
00002 #define _H_RPMBUILD_
00003 
00009 #include <rpmiotypes.h>
00010 #include <rpmmacro.h>
00011 #include <rpmtypes.h>
00012 #include <rpmtag.h>
00013 
00014 #include <rpmfi.h>
00015 
00016 #include <rpmcli.h>
00017 
00018 #include "rpmspec.h"
00019 
00023 /*@-typeuse@*/
00024 typedef enum rpmBuildFlags_e {
00025 /*@-enummemuse@*/
00026     RPMBUILD_NONE       = 0,
00027 /*@=enummemuse@*/
00028     RPMBUILD_PREP       = (1 <<  0),    
00029     RPMBUILD_BUILD      = (1 <<  1),    
00030     RPMBUILD_INSTALL    = (1 <<  2),    
00031     RPMBUILD_CHECK      = (1 <<  3),    
00032     RPMBUILD_CLEAN      = (1 <<  4),    
00033     RPMBUILD_FILECHECK  = (1 <<  5),    
00034     RPMBUILD_PACKAGESOURCE = (1 <<  6), 
00035     RPMBUILD_PACKAGEBINARY = (1 <<  7), 
00036     RPMBUILD_RMSOURCE   = (1 <<  8),    
00037     RPMBUILD_RMBUILD    = (1 <<  9),    
00038     RPMBUILD_STRINGBUF  = (1 << 10),    
00039     RPMBUILD_TRACK      = (1 << 11),    
00040     RPMBUILD_RMSPEC     = (1 << 12),    
00041     RPMBUILD_FETCHSOURCE= (1 << 13)     
00042 } rpmBuildFlags;
00043 /*@=typeuse@*/
00044 
00045 #define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; }
00046 #define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; }
00047 
00048 #define PART_SUBNAME  0
00049 #define PART_NAME     1
00050 
00054 #define PART_BASE       100
00055 typedef enum rpmParseState_e {
00056     PART_NONE           =  0+PART_BASE, 
00057     /* leave room for RPMRC_NOTFOUND returns. */
00058     PART_PREAMBLE       = 11+PART_BASE, 
00059     PART_PREP           = 12+PART_BASE, 
00060     PART_BUILD          = 13+PART_BASE, 
00061     PART_INSTALL        = 14+PART_BASE, 
00062     PART_CHECK          = 15+PART_BASE, 
00063     PART_CLEAN          = 16+PART_BASE, 
00064     PART_FILES          = 17+PART_BASE, 
00065     PART_PRE            = 18+PART_BASE, 
00066     PART_POST           = 19+PART_BASE, 
00067     PART_PREUN          = 20+PART_BASE, 
00068     PART_POSTUN         = 21+PART_BASE, 
00069     PART_PRETRANS       = 22+PART_BASE, 
00070     PART_POSTTRANS      = 23+PART_BASE, 
00071     PART_DESCRIPTION    = 24+PART_BASE, 
00072     PART_CHANGELOG      = 25+PART_BASE, 
00073     PART_TRIGGERIN      = 26+PART_BASE, 
00074     PART_TRIGGERUN      = 27+PART_BASE, 
00075     PART_VERIFYSCRIPT   = 28+PART_BASE, 
00076     PART_BUILDARCHITECTURES= 29+PART_BASE,
00077     PART_TRIGGERPOSTUN  = 30+PART_BASE, 
00078     PART_TRIGGERPREIN   = 31+PART_BASE, 
00079     /* support "%sanitycheck" script */
00080     PART_SANITYCHECK    = 32+PART_BASE, 
00081     PART_ARBITRARY      = 33+PART_BASE, 
00082     PART_LAST           = 34+PART_BASE  
00083 } rpmParseState;
00084 
00088 typedef enum rpmStripFlags_e {
00089     STRIP_NOTHING       = 0,
00090     STRIP_TRAILINGSPACE = (1 << 0),
00091     STRIP_COMMENTS      = (1 << 1),
00092     STRIP_NOEXPAND      = (1 << 2)
00093 } rpmStripFlags;
00094 
00095 /*@unchecked@*/
00096 extern int _rpmbuildFlags;
00097 
00098 #ifdef __cplusplus
00099 extern "C" {
00100 #endif
00101 /*@-redecl@*/
00102 
00106 void freeNames(void)
00107         /*@globals internalState@*/
00108         /*@modifies internalState */;
00109 
00116 extern /*@observer@*/ const char * getUname(uid_t uid)
00117         /*@globals internalState @*/
00118         /*@modifies internalState @*/;
00119 
00126 extern /*@observer@*/ const char * getUnameS(const char * uname)
00127         /*@globals internalState @*/
00128         /*@modifies internalState @*/;
00129 
00136 uid_t getUidS(const char * uname)
00137         /*@globals internalState @*/
00138         /*@modifies internalState @*/;
00139 
00146 extern /*@observer@*/ const char * getGname(gid_t gid)
00147         /*@globals internalState @*/
00148         /*@modifies internalState @*/;
00149 
00156 extern /*@observer@*/ const char * getGnameS(const char * gname)
00157         /*@globals internalState @*/
00158         /*@modifies internalState @*/;
00159 
00166 gid_t getGidS(const char * gname)
00167         /*@globals internalState @*/
00168         /*@modifies internalState @*/;
00169 
00174 /*@observer@*/
00175 extern const char * buildHost(void)
00176         /*@*/;
00177 
00182 /*@observer@*/
00183 extern rpmuint32_t * getBuildTime(void)
00184         /*@*/;
00185 
00192 int readLine(Spec spec, rpmStripFlags strip)
00193         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00194         /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00195                 spec->lbufPtr,
00196                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00197                 rpmGlobalMacroContext, fileSystem, internalState  @*/;
00198 
00203 void closeSpec(/*@partial@*/ Spec spec)
00204         /*@globals fileSystem, internalState @*/
00205         /*@modifies spec->fileStack, fileSystem, internalState @*/;
00206 
00211 void handleComments(char * s)
00212         /*@modifies s @*/;
00213 
00219 rpmParseState isPart(Spec spec)
00220         /*@modifies spec->foo, spec->nfoo @*/;
00221 
00228 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/rpmuint32_t * res)
00229         /*@modifies *res @*/;
00230 
00239 void addChangelogEntry(Header h, time_t time, const char * name,
00240                 const char * text)
00241         /*@modifies h @*/;
00242 
00249 int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
00250         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00251         /*@modifies spec->build, spec->install, spec->check, spec->clean,
00252                 spec->macros, spec->foo, spec->nfoo, spec->lbufPtr,
00253                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00254                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00255                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00256 
00262 int parseChangelog(Spec spec)
00263         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00264         /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00265                 spec->foo, spec->nfoo, spec->lbufPtr,
00266                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00267                 spec->packages->header,
00268                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00269 
00275 int parseDescription(Spec spec)
00276         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00277         /*@modifies spec->packages,
00278                 spec->foo, spec->nfoo, spec->lbufPtr,
00279                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00280                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00281                 spec->st,
00282                 rpmGlobalMacroContext, fileSystem, internalState  @*/;
00283 
00289 int parseFiles(Spec spec)
00290         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00291         /*@modifies spec->packages,
00292                 spec->foo, spec->nfoo, spec->lbufPtr,
00293                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00294                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00295                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00296 
00303 int parsePreamble(Spec spec, int initialPackage)
00304         /*@globals rpmGlobalMacroContext, h_errno,
00305                 fileSystem, internalState @*/
00306         /*@modifies spec->packages,
00307                 spec->foo, spec->nfoo, spec->lbufPtr,
00308                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00309                 spec->buildSubdir,
00310                 spec->macros, spec->st,
00311                 spec->sources, spec->numSources, spec->noSource,
00312                 spec->sourceHeader, spec->BANames, spec->BACount,
00313                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00314                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00315 
00322 int parsePrep(Spec spec, int verify)
00323         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00324         /*@modifies spec->prep, spec->buildSubdir, spec->macros,
00325                 spec->foo, spec->nfoo, spec->lbufPtr,
00326                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00327                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00328                 spec->packages->header,
00329                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00330 
00341 rpmRC parseRCPOT(Spec spec, Package pkg, const char * field, rpmTag tagN,
00342                 rpmuint32_t index, rpmsenseFlags tagflags)
00343         /*@globals internalState @*/
00344         /*@modifies internalState @*/;
00345 
00352 int parseScript(Spec spec, int parsePart)
00353         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00354         /*@modifies spec->packages,
00355                 spec->foo, spec->nfoo, spec->lbufPtr,
00356                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
00357                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
00358                 rpmGlobalMacroContext, fileSystem, internalState  @*/;
00359 
00366 int parseExpressionBoolean(Spec spec, const char * expr)
00367         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00368         /*@modifies rpmGlobalMacroContext, internalState @*/;
00369 
00376 /*@unused@*/ /*@null@*/
00377 char * parseExpressionString(Spec spec, const char * expr)
00378         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00379         /*@modifies rpmGlobalMacroContext, internalState @*/;
00380 
00391 rpmRC doScript(Spec spec, int what, /*@null@*/ const char * name,
00392                 /*@null@*/ rpmiob iob, int test)
00393         /*@globals rpmGlobalMacroContext, h_errno,
00394                 fileSystem, internalState @*/
00395         /*@modifies spec->macros,
00396                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00397 
00406 rpmRC lookupPackage(Spec spec, /*@null@*/ const char * name, int flag,
00407                 /*@out@*/ Package * pkg)
00408         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00409         /*@modifies spec->packages, *pkg, rpmGlobalMacroContext,
00410                 internalState @*/;
00411 
00417 /*@null@*/
00418 Package freePackages(/*@only@*/ /*@null@*/ Package packages)
00419         /*@globals fileSystem @*/
00420         /*@modifies packages, fileSystem @*/;
00421 
00428 /*@null@*/
00429 Package freePackage(/*@killref@*/ /*@null@*/ Package pkg)
00430         /*@globals fileSystem @*/
00431         /*@modifies pkg, fileSystem @*/;
00432 #define freePackage(_pkg)       \
00433     ((Package)rpmioFreePoolItem((rpmioItem)(_pkg), __FUNCTION__, __FILE__, __LINE__))
00434 
00440 /*@only@*/
00441 Package newPackage(Spec spec)
00442         /*@modifies spec->packages, spec->packages->next @*/;
00443 
00455 int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN,
00456                 const char * N, const char * EVR, rpmsenseFlags Flags,
00457                 rpmuint32_t index)
00458         /*@globals internalState @*/
00459         /*@modifies h, internalState @*/;
00460 
00467 rpmRC processScriptFiles(Spec spec, Package pkg)
00468         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00469         /*@modifies pkg->header, rpmGlobalMacroContext,
00470                 fileSystem, internalState @*/;
00471 
00477 void providePackageNVR(Header h)
00478         /*@globals internalState @*/
00479         /*@modifies h, internalState @*/;
00480 
00488 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
00489         /*@globals internalState @*/
00490         /*@modifies h, internalState @*/;
00491 
00499 rpmRC processBinaryFiles(Spec spec, int installSpecialDoc, int test)
00500         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00501         /*@modifies spec->macros, *spec->packages,
00502                 spec->packages->fi, spec->packages->fileList,
00503                 spec->packages->specialDoc, spec->packages->header,
00504                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00505 
00512 int initSourceHeader(Spec spec, /*@null@*/ rpmiob *sfp)
00513         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
00514         /*@modifies spec->sourceHeader, spec->sourceHdrInit,
00515                 spec->BANames, *sfp,
00516                 spec->packages->header,
00517                 rpmGlobalMacroContext, internalState @*/;
00518 
00524 int processSourceFiles(Spec spec)
00525         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00526         /*@modifies spec->sourceHeader, spec->sourceCpioList,
00527                 spec->BANames, spec->sourceHdrInit,
00528                 spec->packages->header,
00529                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00530 
00544 int parseSpec(rpmts ts, const char * specFile,
00545                 /*@null@*/ const char * rootURL,
00546                 int recursing,
00547                 /*@null@*/ const char * passPhrase,
00548                 /*@null@*/ const char * cookie,
00549                 int anyarch, int force, int verify)
00550         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00551         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
00552 
00561 rpmRC buildSpec(rpmts ts, Spec spec, int what, int test)
00562         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00563         /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie,
00564                 spec->sourceRpmName, spec->sourcePkgId, spec->sourceHdrInit,
00565                 spec->macros, spec->BASpecs,
00566                 spec->BANames, *spec->packages,
00567                 spec->packages->fi, spec->packages->fileList,
00568                 spec->packages->specialDoc, spec->packages->header,
00569                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00570 
00576 rpmRC packageBinaries(Spec spec)
00577         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00578         /*@modifies spec->packages->header, spec->packages->fi,
00579                 spec->sourceRpmName, spec->cookie, spec->sourcePkgId,
00580                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00581 
00587 rpmRC packageSources(Spec spec)
00588         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
00589         /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList,
00590                 spec->sourceRpmName, spec->sourcePkgId, spec->packages->header,
00591                 rpmGlobalMacroContext, fileSystem, internalState @*/;
00592 
00593 /*@=redecl@*/
00594 #ifdef __cplusplus
00595 }
00596 #endif
00597 
00598 #endif  /* _H_RPMBUILD_ */