00001 #ifndef _H_RPMBUILD_
00002 #define _H_RPMBUILD_
00003
00009 #include <rpmcli.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 RPMBUILD_PREPROCESS = (1 << 11)
00038 } rpmBuildFlags;
00039
00040
00041 #include <ctype.h>
00042
00043 #define SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; }
00044 #define SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; }
00045
00046 #define PART_SUBNAME 0
00047 #define PART_NAME 1
00048
00052 typedef enum rpmParseState_e {
00053 PART_NONE = 0,
00054 PART_PREAMBLE = 1,
00055 PART_PREP = 2,
00056 PART_BUILD = 3,
00057 PART_INSTALL = 4,
00058 PART_CLEAN = 5,
00059 PART_FILES = 6,
00060 PART_PRE = 7,
00061 PART_POST = 8,
00062 PART_PREUN = 9,
00063 PART_POSTUN = 10,
00064 PART_DESCRIPTION = 11,
00065 PART_CHANGELOG = 12,
00066 PART_TRIGGERIN = 13,
00067 PART_TRIGGERUN = 14,
00068 PART_VERIFYSCRIPT = 15,
00069 PART_BUILDARCHITECTURES= 16,
00070 PART_TRIGGERPOSTUN = 17,
00071 PART_LAST = 18
00072 } rpmParseState;
00073
00074 #define STRIP_NOTHING 0
00075 #define STRIP_TRAILINGSPACE (1 << 0)
00076 #define STRIP_COMMENTS (1 << 1)
00077
00078 #ifdef __cplusplus
00079 extern "C" {
00080 #endif
00081
00082
00086 void freeNames(void)
00087
00088 ;
00089
00096 extern const char * getUname(uid_t uid) ;
00097
00104 extern const char * getUnameS(const char * uname) ;
00105
00112 uid_t getUidS(const char * uname) ;
00113
00120 extern const char * getGname(gid_t gid) ;
00121
00128 extern const char * getGnameS(const char * gname) ;
00129
00136 gid_t getGidS(const char * gname) ;
00137
00142 extern const char * const buildHost(void) ;
00143
00148 extern int_32 * const getBuildTime(void) ;
00149
00156 int readLine(Spec spec, int strip)
00157
00158
00159
00160
00161 ;
00162
00167 void closeSpec( Spec spec)
00168
00169 ;
00170
00175 void handleComments(char * s)
00176 ;
00177
00183 rpmParseState isPart(const char * line) ;
00184
00191 int parseNum( const char * line, int * res)
00192 ;
00193
00201 void addChangelogEntry(Header h, time_t time, const char * name,
00202 const char * text)
00203 ;
00204
00211 int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
00212
00213
00214
00215
00216
00217 ;
00218
00224 int parseChangelog(Spec spec)
00225
00226
00227
00228
00229
00230 ;
00231
00237 int parseDescription(Spec spec)
00238
00239
00240
00241
00242
00243
00244 ;
00245
00251 int parseFiles(Spec spec)
00252
00253
00254
00255
00256
00257 ;
00258
00265 int parsePreamble(Spec spec, int initialPackage)
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276 ;
00277
00283 int parsePrep(Spec spec)
00284
00285
00286
00287
00288
00289 ;
00290
00301 int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index,
00302 rpmsenseFlags tagflags)
00303
00304 ;
00305
00312 int parseScript(Spec spec, int parsePart)
00313
00314
00315
00316
00317
00318 ;
00319
00326 int parseExpressionBoolean(Spec spec, const char * expr)
00327
00328 ;
00329
00336
00337 char * parseExpressionString(Spec spec, const char * expr)
00338
00339 ;
00340
00351 int doScript(Spec spec, int what, const char * name, StringBuf sb, int test)
00352
00353
00354
00355 ;
00356
00365 int lookupPackage(Spec spec, const char * name, int flag,
00366 Package * pkg)
00367 ;
00368
00374 Package newPackage(Spec spec)
00375 ;
00376
00382 Package freePackages( Package packages)
00383 ;
00384
00390 Package freePackage( Package pkg)
00391 ;
00392
00403 int addReqProv(Spec spec, Header h,
00404 rpmsenseFlags depFlags, const char * depName,
00405 const char * depEVR, int index)
00406 ;
00407
00415 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
00416 ;
00417
00425 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
00426
00427
00428
00429
00430
00431 ;
00432
00437 void initSourceHeader(Spec spec)
00438
00439
00440 ;
00441
00447 int processSourceFiles(Spec spec)
00448
00449
00450
00451
00452
00453 ;
00454
00469 int parseSpec( Spec * specp, const char * specFile,
00470 const char * rootURL,
00471 const char * buildRootURL,
00472 int recursing,
00473 const char * passPhrase,
00474 char * cookie,
00475 int anyarch, int force, int preprocess)
00476
00477
00478
00479 ;
00480
00494
00495 extern int (*parseSpecVec) (Spec * specp, const char * specFile,
00496 const char * rootdir,
00497 const char * buildRoot,
00498 int recursing,
00499 const char * passPhrase,
00500 char * cookie,
00501 int anyarch, int force, int preprocess)
00502
00503
00504
00505 ;
00506
00507
00515 int buildSpec(Spec spec, int what, int test)
00516
00517
00518
00519
00520
00521
00522
00523
00524 ;
00525
00531 int packageBinaries(Spec spec)
00532
00533
00534
00535
00536 ;
00537
00543 int packageSources(Spec spec)
00544
00545
00546
00547
00548 ;
00549
00550
00551 #ifdef __cplusplus
00552 }
00553 #endif
00554
00555 #endif