rpm 5.2.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

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 /*@only@*/
    00418 Package newPackage(Spec spec)
    00419         /*@modifies spec->packages, spec->packages->next @*/;
    00420
    00426 /*@null@*/
    00427 Package freePackages(/*@only@*/ /*@null@*/ Package packages)
    00428         /*@globals fileSystem @*/
    00429         /*@modifies packages, fileSystem @*/;
    00430
    00436 /*@null@*/
    00437 Package  freePackage(/*@only@*/ /*@null@*/ Package pkg)
    00438         /*@globals fileSystem @*/
    00439         /*@modifies pkg, fileSystem @*/;
    00440
    00452 int addReqProv(/*@unused@*/Spec spec, Header h, rpmTag tagN,
    00453                 const char * N, const char * EVR, rpmsenseFlags Flags,
    00454                 rpmuint32_t index)
    00455         /*@globals internalState @*/
    00456         /*@modifies h, internalState @*/;
    00457
    00464 rpmRC processScriptFiles(Spec spec, Package pkg)
    00465         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00466         /*@modifies pkg->header, rpmGlobalMacroContext,
    00467                 fileSystem, internalState @*/;
    00468
    00474 void providePackageNVR(Header h)
    00475         /*@globals internalState @*/
    00476         /*@modifies h, internalState @*/;
    00477
    00485 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
    00486         /*@globals internalState @*/
    00487         /*@modifies h, internalState @*/;
    00488
    00496 rpmRC processBinaryFiles(Spec spec, int installSpecialDoc, int test)
    00497         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00498         /*@modifies spec->macros, *spec->packages,
    00499                 spec->packages->cpioList, spec->packages->fileList,
    00500                 spec->packages->specialDoc, spec->packages->header,
    00501                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00502
    00509 int initSourceHeader(Spec spec, /*@null@*/ rpmiob *sfp)
    00510         /*@globals rpmGlobalMacroContext, h_errno, internalState @*/
    00511         /*@modifies spec->sourceHeader, spec->sourceHdrInit,
    00512                 spec->BANames, *sfp,
    00513                 spec->packages->header,
    00514                 rpmGlobalMacroContext, internalState @*/;
    00515
    00521 int processSourceFiles(Spec spec)
    00522         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00523         /*@modifies spec->sourceHeader, spec->sourceCpioList,
    00524                 spec->BANames, spec->sourceHdrInit,
    00525                 spec->packages->header,
    00526                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00527
    00541 int parseSpec(rpmts ts, const char * specFile,
    00542                 /*@null@*/ const char * rootURL,
    00543                 int recursing,
    00544                 /*@null@*/ const char * passPhrase,
    00545                 /*@null@*/ const char * cookie,
    00546                 int anyarch, int force, int verify)
    00547         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00548         /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/;
    00549
    00558 rpmRC buildSpec(rpmts ts, Spec spec, int what, int test)
    00559         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00560         /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie,
    00561                 spec->sourceRpmName, spec->sourcePkgId, spec->sourceHdrInit,
    00562                 spec->macros, spec->BASpecs,
    00563                 spec->BANames, *spec->packages,
    00564                 spec->packages->cpioList, spec->packages->fileList,
    00565                 spec->packages->specialDoc, spec->packages->header,
    00566                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00567
    00573 rpmRC packageBinaries(Spec spec)
    00574         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00575         /*@modifies spec->packages->header, spec->packages->cpioList,
    00576                 spec->sourceRpmName, spec->cookie, spec->sourcePkgId,
    00577                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00578
    00584 rpmRC packageSources(Spec spec)
    00585         /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/
    00586         /*@modifies spec->sourceHeader, spec->cookie, spec->sourceCpioList,
    00587                 spec->sourceRpmName, spec->sourcePkgId, spec->packages->header,
    00588                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00589
    00590 /*@=redecl@*/
    00591 #ifdef __cplusplus
    00592 }
    00593 #endif
    00594
    00595 #endif  /* _H_RPMBUILD_ */