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
00246 rpmRC rpmCharCheck(rpmSpec spec, char *field, size_t fsize, const char *whitelist);
00247
00258 rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char * field, rpmTag tagN,
00259 int index, rpmsenseFlags tagflags);
00260
00267 int parseScript(rpmSpec spec, int parsePart);
00268
00275 int parseExpressionBoolean(rpmSpec spec, const char * expr);
00276
00283 char * parseExpressionString(rpmSpec spec, const char * expr);
00284
00291 rpmRC doRmSource(rpmSpec spec);
00302 rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char * name,
00303 StringBuf sb, int test);
00304
00313 rpmRC lookupPackage(rpmSpec spec, const char * name, int flag,
00314 Package * pkg);
00315
00321 Package newPackage(rpmSpec spec);
00322
00328 Package freePackages(Package packages);
00329
00335 Package freePackage(Package pkg);
00336
00348 int addReqProv(rpmSpec spec, Header h, rpmTag tagN,
00349 const char * N, const char * EVR, rpmsenseFlags Flags,
00350 uint32_t index);
00351
00359 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR);
00360
00368 int processBinaryFiles(rpmSpec spec, int installSpecialDoc, int test);
00369
00374 void initSourceHeader(rpmSpec spec);
00375
00381 int processSourceFiles(rpmSpec spec);
00382
00396 int parseSpec(rpmts ts, const char * specFile,
00397 const char * rootDir,
00398 const char * buildRoot,
00399 int recursing,
00400 const char * passPhrase,
00401 const char * cookie,
00402 int anyarch, int force);
00403
00412 rpmRC buildSpec(rpmts ts, rpmSpec spec, int what, int test);
00413
00419 rpmRC checkPackages(char *pkgcheck);
00420
00426 rpmRC packageBinaries(rpmSpec spec);
00427
00433 rpmRC packageSources(rpmSpec spec);
00434
00435 #ifdef __cplusplus
00436 }
00437 #endif
00438
00439 #endif