00001 #ifndef _H_RPMBUILD_
00002 #define _H_RPMBUILD_
00003
00009 #include "rpmlib.h"
00010
00011
00012 #include "stringbuf.h"
00013 #include "misc.h"
00014
00015
00016 #include "rpmspec.h"
00017
00021
00022 typedef enum rpmBuildFlags_e {
00023
00024 RPMBUILD_NONE = 0,
00025
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
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
00084 void freeNames(void)
00085 ;
00086
00093 const char * getUname(uid_t uid) ;
00094
00101 const char * getUnameS(const char * uname) ;
00102
00109 uid_t getUidS(const char * uname) ;
00110
00117 const char * getGname(gid_t gid) ;
00118
00125 const char * getGnameS(const char * gname) ;
00126
00133 gid_t getGidS(const char * gname) ;
00134
00139 const char * const buildHost(void) ;
00140
00145 int_32 * const getBuildTime(void) ;
00146
00153 int readLine(Spec spec, int strip)
00154
00155 ;
00156
00161 void closeSpec( Spec spec)
00162 ;
00163
00168 void handleComments(char * s)
00169 ;
00170
00176 rpmParseState isPart(const char * line) ;
00177
00184 int parseNum( const char * line, int * res)
00185 ;
00186
00194 void addChangelogEntry(Header h, time_t time, const char * name,
00195 const char * text)
00196 ;
00197
00204 int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
00205
00206
00207 ;
00208
00214 int parseChangelog(Spec spec)
00215
00216
00217 ;
00218
00224 int parseDescription(Spec spec)
00225
00226
00227 ;
00228
00234 int parseFiles(Spec spec)
00235
00236
00237 ;
00238
00245 int parsePreamble(Spec spec, int initialPackage)
00246
00247
00248
00249
00250
00251
00252 ;
00253
00259 int parsePrep(Spec spec)
00260
00261
00262 ;
00263
00274 int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index,
00275 rpmsenseFlags flags)
00276 ;
00277
00284 int parseScript(Spec spec, int parsePart)
00285
00286
00287 ;
00288
00295 int parseExpressionBoolean(Spec spec, const char * expr) ;
00296
00303
00304 char * parseExpressionString(Spec spec, const char * expr)
00305 ;
00306
00317 int doScript(Spec spec, int what, const char * name, StringBuf sb, int test)
00318 ;
00319
00328 int lookupPackage(Spec spec, const char * name, int flag,
00329 Package * pkg)
00330 ;
00331
00337 Package newPackage(Spec spec)
00338 ;
00339
00345 Package freePackages( Package packages)
00346 ;
00347
00353 Package freePackage( Package pkg)
00354 ;
00355
00366 int addReqProv(Spec spec, Header h,
00367 rpmsenseFlags flag, const char * depName, const char * depEVR,
00368 int index)
00369 ;
00370
00378 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
00379 ;
00380
00388 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
00389
00390
00391
00392 ;
00393
00398 void initSourceHeader(Spec spec)
00399
00400
00401 ;
00402
00408 int processSourceFiles(Spec spec)
00409
00410
00411 ;
00412
00413
00414
00428 int parseSpec( Spec * specp, const char * specFile,
00429 const char * rootdir,
00430 const char * buildRoot,
00431 int recursing,
00432 const char * passPhrase,
00433 char * cookie,
00434 int anyarch, int force)
00435
00436 ;
00437
00450
00451 extern int (*parseSpecVec) (Spec * specp, const char * specFile,
00452 const char * rootdir,
00453 const char * buildRoot,
00454 int recursing,
00455 const char * passPhrase,
00456 char * cookie,
00457 int anyarch, int force)
00458
00459 ;
00460
00461
00469 int buildSpec(Spec spec, int what, int test)
00470
00471
00472
00473
00474
00475
00476 ;
00477
00483 int packageBinaries(Spec spec)
00484
00485
00486 ;
00487
00493 int packageSources(Spec spec)
00494
00495
00496 ;
00497
00498 #ifdef __cplusplus
00499 }
00500 #endif
00501
00502 #endif