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 } rpmBuildFlags;
    00038 /*@=typeuse@*/
    00039
    00040 #include <ctype.h>
    00041
    00042 #define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; }
    00043 #define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; }
    00044
    00045 #define PART_SUBNAME  0
    00046 #define PART_NAME     1
    00047
    00051 typedef enum rpmParseState_e {
    00052     PART_NONE           = 0,
    00053     PART_PREAMBLE       = 1,
    00054     PART_PREP           = 2,
    00055     PART_BUILD          = 3,
    00056     PART_INSTALL        = 4,
    00057     PART_CLEAN          = 5,
    00058     PART_FILES          = 6,
    00059     PART_PRE            = 7,
    00060     PART_POST           = 8,
    00061     PART_PREUN          = 9,
    00062     PART_POSTUN         = 10,
    00063     PART_DESCRIPTION    = 11,
    00064     PART_CHANGELOG      = 12,
    00065     PART_TRIGGERIN      = 13,
    00066     PART_TRIGGERUN      = 14,
    00067     PART_VERIFYSCRIPT   = 15,
    00068     PART_BUILDARCHITECTURES= 16,
    00069     PART_TRIGGERPOSTUN  = 17,
    00070     PART_LAST           = 18
    00071 } rpmParseState;
    00072
    00073 #define STRIP_NOTHING             0
    00074 #define STRIP_TRAILINGSPACE (1 << 0)
    00075 #define STRIP_COMMENTS      (1 << 1)
    00076
    00077 #ifdef __cplusplus
    00078 extern "C" {
    00079 #endif
    00080 /*@-redecl@*/
    00081
    00085 void freeNames(void)
    00086         /*@globals internalState@*/
    00087         /*@modifies internalState */;
    00088
    00095 extern /*@observer@*/ const char * getUname(uid_t uid)  /*@*/;
    00096
    00103 extern /*@observer@*/ const char * getUnameS(const char * uname)        /*@*/;
    00104
    00111 uid_t getUidS(const char * uname)       /*@*/;
    00112
    00119 extern /*@observer@*/ const char * getGname(gid_t gid)          /*@*/;
    00120
    00127 extern /*@observer@*/ const char * getGnameS(const char * gname)        /*@*/;
    00128
    00135 gid_t getGidS(const char * gname)       /*@*/;
    00136
    00141 extern /*@observer@*/ const char * const buildHost(void)        /*@*/;
    00142
    00147 extern /*@observer@*/ int_32 * const getBuildTime(void) /*@*/;
    00148
    00155 int readLine(Spec spec, int strip)
    00156         /*@globals rpmGlobalMacroContext,
    00157                 fileSystem@*/
    00158         /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
    00159                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
    00160                 rpmGlobalMacroContext, fileSystem @*/;
    00161
    00166 void closeSpec(/*@partial@*/ Spec spec)
    00167         /*@globals fileSystem@*/
    00168         /*@modifies spec->fileStack, fileSystem @*/;
    00169
    00174 void handleComments(char * s)
    00175         /*@modifies s @*/;
    00176
    00182 rpmParseState isPart(const char * line) /*@*/;
    00183
    00190 int parseNum(/*@null@*/ const char * line, /*@null@*/ /*@out@*/int * res)
    00191         /*@modifies *res @*/;
    00192
    00200 void addChangelogEntry(Header h, time_t time, const char * name,
    00201                 const char * text)
    00202         /*@modifies h @*/;
    00203
    00210 int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
    00211         /*@globals rpmGlobalMacroContext,
    00212                 fileSystem @*/
    00213         /*@modifies spec->build, spec->install, spec->clean, spec->macros,
    00214                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
    00215                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
    00216                 rpmGlobalMacroContext, fileSystem @*/;
    00217
    00223 int parseChangelog(Spec spec)
    00224         /*@globals rpmGlobalMacroContext,
    00225                 fileSystem@*/
    00226         /*@modifies spec->fileStack, spec->readStack, spec->line, spec->lineNum,
    00227                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
    00228                 spec->packages->header,
    00229                 rpmGlobalMacroContext, fileSystem @*/;
    00230
    00236 int parseDescription(Spec spec)
    00237         /*@globals rpmGlobalMacroContext,
    00238                 fileSystem@*/
    00239         /*@modifies spec->packages,
    00240                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
    00241                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
    00242                 spec->st,
    00243                 rpmGlobalMacroContext, fileSystem @*/;
    00244
    00250 int parseFiles(Spec spec)
    00251         /*@globals rpmGlobalMacroContext,
    00252                 fileSystem@*/
    00253         /*@modifies spec->packages,
    00254                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
    00255                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
    00256                 rpmGlobalMacroContext, fileSystem @*/;
    00257
    00264 int parsePreamble(Spec spec, int initialPackage)
    00265         /*@globals rpmGlobalMacroContext,
    00266                 fileSystem, internalState @*/
    00267         /*@modifies spec->packages,
    00268                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
    00269                 spec->buildSubdir,
    00270                 spec->macros, spec->st, spec->buildRootURL,
    00271                 spec->sources, spec->numSources, spec->noSource,
    00272                 spec->buildRestrictions, spec->BANames, spec->BACount,
    00273                 spec->gotBuildRootURL,
    00274                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
    00275                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00276
    00282 int parsePrep(Spec spec)
    00283         /*@globals rpmGlobalMacroContext,
    00284                 fileSystem@*/
    00285         /*@modifies spec->prep, spec->buildSubdir, spec->macros,
    00286                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
    00287                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
    00288                 rpmGlobalMacroContext, fileSystem @*/;
    00289
    00300 int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index,
    00301                rpmsenseFlags tagflags)
    00302         /*@globals rpmGlobalMacroContext @*/
    00303         /*@modifies rpmGlobalMacroContext @*/;
    00304
    00311 int parseScript(Spec spec, int parsePart)
    00312         /*@globals rpmGlobalMacroContext,
    00313                 fileSystem@*/
    00314         /*@modifies spec->packages,
    00315                 spec->fileStack, spec->readStack, spec->line, spec->lineNum,
    00316                 spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
    00317                 rpmGlobalMacroContext, fileSystem @*/;
    00318
    00325 int parseExpressionBoolean(Spec spec, const char * expr)
    00326         /*@globals rpmGlobalMacroContext @*/
    00327         /*@modifies rpmGlobalMacroContext @*/;
    00328
    00335 /*@unused@*/
    00336 char * parseExpressionString(Spec spec, const char * expr)
    00337         /*@globals rpmGlobalMacroContext @*/
    00338         /*@modifies rpmGlobalMacroContext @*/;
    00339
    00350 int doScript(Spec spec, int what, const char * name, StringBuf sb, int test)
    00351         /*@globals rpmGlobalMacroContext,
    00352                 fileSystem, internalState @*/
    00353         /*@modifies spec->macros,
    00354                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00355
    00364 int lookupPackage(Spec spec, /*@null@*/ const char * name, int flag,
    00365                 /*@out@*/ Package * pkg)
    00366         /*@modifies spec->packages, *pkg @*/;
    00367
    00373 /*@only@*/ Package newPackage(Spec spec)
    00374         /*@modifies spec->packages, spec->packages->next @*/;
    00375
    00381 /*@null@*/ Package freePackages(/*@only@*/ /*@null@*/ Package packages)
    00382         /*@modifies packages @*/;
    00383
    00389 /*@null@*/ Package  freePackage(/*@only@*/ /*@null@*/ Package pkg)
    00390         /*@modifies pkg @*/;
    00391
    00402 int addReqProv(/*@unused@*/Spec spec, Header h,
    00403                 rpmsenseFlags depFlags, const char * depName,
    00404                 const char * depEVR, int index)
    00405         /*@modifies h @*/;
    00406
    00414 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
    00415         /*@modifies h @*/;
    00416
    00424 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
    00425         /*@globals rpmGlobalMacroContext,
    00426                 fileSystem, internalState @*/
    00427         /*@modifies spec->macros,
    00428                 spec->packages->cpioList, spec->packages->fileList,
    00429                 spec->packages->specialDoc, spec->packages->header,
    00430                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00431
    00436 void initSourceHeader(Spec spec)
    00437         /*@modifies spec->sourceHeader,
    00438                 spec->buildRestrictions, spec->BANames,
    00439                 spec->packages->header @*/;
    00440
    00446 int processSourceFiles(Spec spec)
    00447         /*@globals rpmGlobalMacroContext,
    00448                 fileSystem @*/
    00449         /*@modifies spec->sourceHeader, spec->sourceCpioList,
    00450                 spec->buildRestrictions, spec->BANames,
    00451                 spec->packages->header,
    00452                 rpmGlobalMacroContext, fileSystem @*/;
    00453
    00467 int parseSpec(/*@out@*/ Spec * specp, const char * specFile,
    00468                 /*@null@*/ const char * rootURL,
    00469                 /*@null@*/ const char * buildRootURL,
    00470                 int recursing,
    00471                 /*@null@*/ const char * passPhrase,
    00472                 /*@null@*/ char * cookie,
    00473                 int anyarch, int force)
    00474         /*@globals rpmGlobalMacroContext,
    00475                 fileSystem, internalState @*/
    00476         /*@modifies *specp,
    00477                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00478
    00491 /*@-declundef@*/
    00492 extern int (*parseSpecVec) (Spec * specp, const char * specFile,
    00493                 const char * rootdir,
    00494                 /*@null@*/ const char * buildRoot,
    00495                 int recursing,
    00496                 /*@null@*/ const char * passPhrase,
    00497                 /*@null@*/ char * cookie,
    00498                 int anyarch, int force)
    00499         /*@globals rpmGlobalMacroContext,
    00500                 fileSystem, internalState @*/
    00501         /*@modifies *specp,
    00502                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00503 /*@=declundef@*/
    00504
    00512 int buildSpec(Spec spec, int what, int test)
    00513         /*@globals rpmGlobalMacroContext,
    00514                 fileSystem, internalState @*/
    00515         /*@modifies spec->sourceHeader, spec->sourceCpioList, spec->cookie,
    00516                 spec->sourceRpmName, spec->macros,
    00517                 spec->BASpecs,
    00518                 spec->buildRestrictions, spec->BANames,
    00519                 spec->packages->cpioList, spec->packages->fileList,
    00520                 spec->packages->specialDoc, spec->packages->header,
    00521                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00522
    00528 int packageBinaries(Spec spec)
    00529         /*@globals rpmGlobalMacroContext,
    00530                 fileSystem, internalState @*/
    00531         /*@modifies spec->packages->header,
    00532                 spec->sourceRpmName,
    00533                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00534
    00540 int packageSources(Spec spec)
    00541         /*@globals rpmGlobalMacroContext,
    00542                 fileSystem, internalState @*/
    00543         /*@modifies spec->sourceHeader, spec->cookie,
    00544                 spec->sourceRpmName,
    00545                 rpmGlobalMacroContext, fileSystem, internalState @*/;
    00546
    00547 /*@=redecl@*/
    00548 #ifdef __cplusplus
    00549 }
    00550 #endif
    00551
    00552 #endif  /* _H_RPMBUILD_ */