00001 #ifndef _H_RPMBUILD_
00002 #define _H_RPMBUILD_
00003
00009 #include <rpm/rpmcli.h>
00010 #include <rpm/rpmds.h>
00011
00012
00013 #include <rpm/rpmstring.h>
00014
00015
00016 #include <rpm/rpmspec.h>
00017
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021
00025 typedef enum rpmBuildFlags_e {
00026 RPMBUILD_NONE = 0,
00027 RPMBUILD_PREP = (1 << 0),
00028 RPMBUILD_BUILD = (1 << 1),
00029 RPMBUILD_INSTALL = (1 << 2),
00030 RPMBUILD_CHECK = (1 << 3),
00031 RPMBUILD_CLEAN = (1 << 4),
00032 RPMBUILD_FILECHECK = (1 << 5),
00033 RPMBUILD_PACKAGESOURCE = (1 << 6),
00034 RPMBUILD_PACKAGEBINARY = (1 << 7),
00035 RPMBUILD_RMSOURCE = (1 << 8),
00036 RPMBUILD_RMBUILD = (1 << 9),
00037 RPMBUILD_STRINGBUF = (1 << 10),
00038 RPMBUILD_RMSPEC = (1 << 11)
00039 } rpmBuildFlags;
00040
00041 #define PART_SUBNAME 0
00042 #define PART_NAME 1
00043
00050 #define PART_BASE 0
00051 typedef enum rpmParseState_e {
00052 PART_ERROR = -1,
00053 PART_NONE = 0+PART_BASE,
00054
00055 PART_PREAMBLE = 11+PART_BASE,
00056 PART_PREP = 12+PART_BASE,
00057 PART_BUILD = 13+PART_BASE,
00058 PART_INSTALL = 14+PART_BASE,
00059 PART_CHECK = 15+PART_BASE,
00060 PART_CLEAN = 16+PART_BASE,
00061 PART_FILES = 17+PART_BASE,
00062 PART_PRE = 18+PART_BASE,
00063 PART_POST = 19+PART_BASE,
00064 PART_PREUN = 20+PART_BASE,
00065 PART_POSTUN = 21+PART_BASE,
00066 PART_PRETRANS = 22+PART_BASE,
00067 PART_POSTTRANS = 23+PART_BASE,
00068 PART_DESCRIPTION = 24+PART_BASE,
00069 PART_CHANGELOG = 25+PART_BASE,
00070 PART_TRIGGERIN = 26+PART_BASE,
00071 PART_TRIGGERUN = 27+PART_BASE,
00072 PART_VERIFYSCRIPT = 28+PART_BASE,
00073 PART_BUILDARCHITECTURES= 29+PART_BASE,
00074 PART_TRIGGERPOSTUN = 30+PART_BASE,
00075 PART_TRIGGERPREIN = 31+PART_BASE,
00076 PART_LAST = 32+PART_BASE
00077 } rpmParseState;
00078
00079
00080 #define STRIP_NOTHING 0
00081 #define STRIP_TRAILINGSPACE (1 << 0)
00082 #define STRIP_COMMENTS (1 << 1)
00083
00087 void freeNames(void);
00088
00095 const char * getUname(uid_t uid);
00096
00103 const char * getUnameS(const char * uname);
00104
00111 uid_t getUidS(const char * uname);
00112
00119 const char * getGname(gid_t gid);
00120
00127 const char * getGnameS(const char * gname);
00128
00135 gid_t getGidS(const char * gname);
00136
00141 const char * buildHost(void) ;
00142
00147 rpm_time_t * getBuildTime(void) ;
00148
00155 int readLine(rpmSpec spec, int strip);
00156
00161 void closeSpec(rpmSpec spec);
00162
00167 void handleComments(char * s);
00168
00174 rpmParseState isPart(const char * line) ;
00175
00182 uint32_t parseUnsignedNum(const char * line, uint32_t * res);
00183
00191 void addChangelogEntry(Header h, time_t time, const char * name,
00192 const char * text);
00193
00200 int parseBuildInstallClean(rpmSpec spec, rpmParseState parsePart);
00201
00207 int parseChangelog(rpmSpec spec);
00208
00214 int parseDescription(rpmSpec spec);
00215
00221 int parseFiles(rpmSpec spec);
00222
00229 int parsePreamble(rpmSpec spec, int initialPackage);
00230
00236 int parsePrep(rpmSpec spec);
00237
00248 rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char * field, rpmTag tagN,
00249 int index, rpmsenseFlags tagflags);
00250
00257 int parseScript(rpmSpec spec, int parsePart);
00258
00265 int parseExpressionBoolean(rpmSpec spec, const char * expr);
00266
00273 char * parseExpressionString(rpmSpec spec, const char * expr);
00274
00285 rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char * name,
00286 StringBuf sb, int test);
00287
00296 rpmRC lookupPackage(rpmSpec spec, const char * name, int flag,
00297 Package * pkg);
00298
00304 Package newPackage(rpmSpec spec);
00305
00311 Package freePackages(Package packages);
00312
00318 Package freePackage(Package pkg);
00319
00331 int addReqProv(rpmSpec spec, Header h, rpmTag tagN,
00332 const char * N, const char * EVR, rpmsenseFlags Flags,
00333 uint32_t index);
00334
00342 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR);
00343
00351 int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test);
00352
00357 void initSourceHeader(rpmSpec spec);
00358
00364 int processSourceFiles(rpmSpec spec);
00365
00379 int parseSpec(rpmts ts, const char * specFile,
00380 const char * rootDir,
00381 const char * buildRoot,
00382 int recursing,
00383 const char * passPhrase,
00384 const char * cookie,
00385 int anyarch, int force);
00386
00395 rpmRC buildSpec(rpmts ts, rpmSpec spec, int what, int test);
00396
00402 rpmRC packageBinaries(rpmSpec spec);
00403
00409 rpmRC packageSources(rpmSpec spec);
00410
00411 #ifdef __cplusplus
00412 }
00413 #endif
00414
00415 #endif