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 } 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
00081
00085 void freeNames(void)
00086
00087 ;
00088
00095 extern const char * getUname(uid_t uid) ;
00096
00103 extern const char * getUnameS(const char * uname) ;
00104
00111 uid_t getUidS(const char * uname) ;
00112
00119 extern const char * getGname(gid_t gid) ;
00120
00127 extern const char * getGnameS(const char * gname) ;
00128
00135 gid_t getGidS(const char * gname) ;
00136
00141 extern const char * const buildHost(void) ;
00142
00147 extern int_32 * const getBuildTime(void) ;
00148
00155 int readLine(Spec spec, int strip)
00156
00157
00158
00159
00160 ;
00161
00166 void closeSpec( Spec spec)
00167
00168 ;
00169
00174 void handleComments(char * s)
00175 ;
00176
00182 rpmParseState isPart(const char * line) ;
00183
00190 int parseNum( const char * line, int * res)
00191 ;
00192
00200 void addChangelogEntry(Header h, time_t time, const char * name,
00201 const char * text)
00202 ;
00203
00210 int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
00211
00212
00213
00214
00215
00216 ;
00217
00223 int parseChangelog(Spec spec)
00224
00225
00226
00227
00228
00229 ;
00230
00236 int parseDescription(Spec spec)
00237
00238
00239
00240
00241
00242
00243 ;
00244
00250 int parseFiles(Spec spec)
00251
00252
00253
00254
00255
00256 ;
00257
00264 int parsePreamble(Spec spec, int initialPackage)
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275 ;
00276
00282 int parsePrep(Spec spec)
00283
00284
00285
00286
00287
00288 ;
00289
00300 int parseRCPOT(Spec spec, Package pkg, const char * field, int tag, int index,
00301 rpmsenseFlags tagflags)
00302
00303 ;
00304
00311 int parseScript(Spec spec, int parsePart)
00312
00313
00314
00315
00316
00317 ;
00318
00325 int parseExpressionBoolean(Spec spec, const char * expr)
00326
00327 ;
00328
00335
00336 char * parseExpressionString(Spec spec, const char * expr)
00337
00338 ;
00339
00350 int doScript(Spec spec, int what, const char * name, StringBuf sb, int test)
00351
00352
00353
00354 ;
00355
00364 int lookupPackage(Spec spec, const char * name, int flag,
00365 Package * pkg)
00366 ;
00367
00373 Package newPackage(Spec spec)
00374 ;
00375
00381 Package freePackages( Package packages)
00382 ;
00383
00389 Package freePackage( Package pkg)
00390 ;
00391
00402 int addReqProv(Spec spec, Header h,
00403 rpmsenseFlags depFlags, const char * depName,
00404 const char * depEVR, int index)
00405 ;
00406
00414 int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
00415 ;
00416
00424 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
00425
00426
00427
00428
00429
00430 ;
00431
00436 void initSourceHeader(Spec spec)
00437
00438
00439 ;
00440
00446 int processSourceFiles(Spec spec)
00447
00448
00449
00450
00451
00452 ;
00453
00467 int parseSpec( Spec * specp, const char * specFile,
00468 const char * rootURL,
00469 const char * buildRootURL,
00470 int recursing,
00471 const char * passPhrase,
00472 char * cookie,
00473 int anyarch, int force)
00474
00475
00476
00477 ;
00478
00491
00492 extern int (*parseSpecVec) (Spec * specp, const char * specFile,
00493 const char * rootdir,
00494 const char * buildRoot,
00495 int recursing,
00496 const char * passPhrase,
00497 char * cookie,
00498 int anyarch, int force)
00499
00500
00501
00502 ;
00503
00504
00512 int buildSpec(Spec spec, int what, int test)
00513
00514
00515
00516
00517
00518
00519
00520
00521 ;
00522
00528 int packageBinaries(Spec spec)
00529
00530
00531
00532
00533 ;
00534
00540 int packageSources(Spec spec)
00541
00542
00543
00544
00545 ;
00546
00547
00548 #ifdef __cplusplus
00549 }
00550 #endif
00551
00552 #endif