rpmbuild.h File Reference
RPMBUILD.

This is the only module users of librpmbuild should need to include. More...

`#include <rpmiotypes.h>`
`#include <rpmmacro.h>`
`#include <rpmtypes.h>`
`#include <rpmtag.h>`
`#include <rpmfi.h>`
`#include <rpmcli.h>`
`#include "rpmspec.h"`
Include dependency graph for rpmbuild.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros

#define | SKIPSPACE(s) { while (*(s) && xisspace(*(s))) (s)++; }
#define | SKIPNONSPACE(s) { while (*(s) && !xisspace(*(s))) (s)++; }
#define | PART_SUBNAME 0
#define | PART_NAME 1
#define | PART_BASE 100
| Spec file parser states. More...

## Typedefs

typedef enum rpmBuildFlags_e | rpmBuildFlags
| Bit(s) to control buildSpec() operation. More...
typedef enum rpmParseState_e | rpmParseState
typedef enum rpmStripFlags_e | rpmStripFlags
| Spec file parser stripping flags. More...

## Enumerations

enum

rpmBuildFlags_e {
RPMBUILD_NONE = 0, RPMBUILD_PREP = (1 << 0), RPMBUILD_BUILD = (1 << 1), RPMBUILD_INSTALL = (1 << 2),
RPMBUILD_CHECK = (1 << 3), RPMBUILD_CLEAN = (1 << 4), RPMBUILD_FILECHECK = (1 << 5), RPMBUILD_PACKAGESOURCE = (1 << 6),
RPMBUILD_PACKAGEBINARY = (1 << 7), RPMBUILD_RMSOURCE = (1 << 8), RPMBUILD_RMBUILD = (1 << 9), RPMBUILD_STRINGBUF = (1 << 10),
RPMBUILD_TRACK = (1 << 11), RPMBUILD_RMSPEC = (1 << 12), RPMBUILD_FETCHSOURCE = (1 << 13)
}

| Bit(s) to control buildSpec() operation. More...

enum

rpmParseState_e {
PART_NONE = 0+ 100, PART_PREAMBLE = 11+ 100, PART_PREP = 12+ 100, PART_BUILD = 13+ 100,
PART_INSTALL = 14+ 100, PART_CHECK = 15+ 100, PART_CLEAN = 16+ 100, PART_FILES = 17+ 100,
PART_PRE = 18+ 100, PART_POST = 19+ 100, PART_PREUN = 20+ 100, PART_POSTUN = 21+ 100,
PART_PRETRANS = 22+ 100, PART_POSTTRANS = 23+ 100, PART_DESCRIPTION = 24+ 100, PART_CHANGELOG = 25+ 100,
PART_TRIGGERIN = 26+ 100, PART_TRIGGERUN = 27+ 100, PART_VERIFYSCRIPT = 28+ 100, PART_BUILDARCHITECTURES = 29+ 100,
PART_TRIGGERPOSTUN = 30+ 100, PART_TRIGGERPREIN = 31+ 100, PART_SANITYCHECK = 32+ 100, PART_ARBITRARY = 33+ 100,
PART_LAST = 34+ 100
}

enum | rpmStripFlags_e { STRIP_NOTHING = 0, STRIP_TRAILINGSPACE = (1 << 0), STRIP_COMMENTS = (1 << 1), STRIP_NOEXPAND = (1 << 2) }
| Spec file parser stripping flags. More...

## Functions

void | freeNames (void)
| Destroy uid/gid caches. More...
const char * | getUname (uid_t uid)
| Return cached user name from user id. More...
const char * | getUnameS (const char *uname)
| Return cached user name. More...
uid_t | getUidS (const char *uname)
| Return cached user id. More...
const char * | getGname (gid_t gid)
| Return cached group name from group id. More...
const char * | getGnameS (const char *gname)
| Return cached group name. More...
gid_t | getGidS (const char *gname)
| Return cached group id. More...
const char * | buildHost (void)
| Return build hostname. More...
rpmuint32_t * | getBuildTime (void)
| Return build time stamp. More...
int | readLine (Spec spec, rpmStripFlags strip)
| Read next line from spec file. More...
void | closeSpec (Spec spec)
| Stop reading from spec file, freeing resources. More...
void | handleComments (char *s)
| Truncate comment lines. More...
rpmParseState | isPart (Spec spec)
| Check line for section separator, return next parser state. More...
int | parseNum (const char *line, rpmuint32_t *res)
| Parse a number. More...
void | addChangelogEntry (Header h, time_t time, const char *name, const char *text)
| Add changelog entry to header. More...
int | parseBuildInstallClean (Spec spec, rpmParseState parsePart)
| Parse %build/%install/%clean section(s) of a spec file. More...
int | parseChangelog (Spec spec)
| Parse %changelog section of a spec file. More...
int | parseDescription (Spec spec)
| Parse %description section of a spec file. More...
int | parseFiles (Spec spec)
| Parse %files section of a spec file. More...
int | parsePreamble (Spec spec, int initialPackage)
| Parse tags from preamble of a spec file. More...
int | parsePrep (Spec spec, int verify)
| Parse %prep section of a spec file. More...
rpmRC | parseRCPOT (Spec spec, Package pkg, const char *field, rpmTag tagN, rpmuint32_t index, rpmsenseFlags tagflags)
| Parse dependency relations from spec file and/or autogenerated output buffer. More...
int | parseScript (Spec spec, int parsePart)
| Parse %pre et al scriptlets from a spec file. More...
int | parseExpressionBoolean (Spec spec, const char *expr)
| Evaluate boolean expression. More...
char * | parseExpressionString (Spec spec, const char *expr)
| Evaluate string expression. More...
rpmRC | doScript (Spec spec, int what, const char *name, rpmiob iob, int test)
| Run a build script, assembled from spec file scriptlet section. More...
rpmRC | lookupPackage (Spec spec, const char *name, int flag, Package *pkg)
| Find sub-package control structure by name. More...
Package | newPackage (Spec spec)
| Create and initialize package control structure. More...
Package | freePackages (Package packages)
| Destroy all packages associated with spec file. More...
Package | freePackage (Package pkg)
| Destroy package control structure. More...
int | addReqProv (Spec spec, Header h, rpmTag tagN, const char *N, const char *EVR, rpmsenseFlags Flags, rpmuint32_t index)
| Add dependency to header, filtering duplicates. More...
rpmRC | processScriptFiles (Spec spec, Package pkg)
| Append files (if any) to scriptlet tags. More...
void | providePackageNVR (Header h)
| Retrofit an explicit Provides: N = E:V-R dependency into package headers. More...
int | rpmlibNeedsFeature (Header h, const char *feature, const char *featureEVR)
| Add rpmlib feature dependency. More...
rpmRC | processBinaryFiles (Spec spec, int installSpecialDoc, int test)
| Post-build processing for binary package(s). More...
int | initSourceHeader (Spec spec, rpmiob *sfp)
| Create and initialize header for source package. More...
int | processSourceFiles (Spec spec)
| Post-build processing for source package. More...
int | parseSpec (rpmts ts, const char *specFile, const char *rootURL, int recursing, const char *passPhrase, const char *cookie, int anyarch, int force, int verify)
| Parse spec file into spec control structure. More...
rpmRC | buildSpec (rpmts ts, Spec spec, int what, int test)
| Build stages state machine driver. More...
rpmRC | packageBinaries (Spec spec)
| Generate binary package(s). More...
rpmRC | packageSources (Spec spec)
| Generate source package. More...

## Variables

int | _rpmbuildFlags

## Detailed Description

This is the only module users of librpmbuild should need to include.

Definition in file rpmbuild.h.

## Macro Definition Documentation

#define PART_NAME 1

Definition at line 49 of file rpmbuild.h.

Referenced by parseDescription(), parseFiles(), parseScript(), and parseSimplePart().

#define PART_SUBNAME 0

Definition at line 48 of file rpmbuild.h.

Referenced by lookupPackage(), parseDescription(), parseFiles(), parsePreamble(), parseScript(), and parseSimplePart().

#define SKIPNONSPACE | ( |  | s | ) | { while (*(s) && !xisspace(*(s))) (s)++; }

Definition at line 46 of file rpmbuild.h.

Referenced by handlePreambleTag(), matchTok(), and readLine().

#define SKIPSPACE | ( |  | s | ) | { while (*(s) && xisspace(*(s))) (s)++; }

Definition at line 45 of file rpmbuild.h.

Referenced by addSource(), findPreambleTag(), handleComments(), handlePreambleTag(), matchTok(), parseForAttr(), parseForConfig(), parseForDev(), parseForLang(), parseForVerify(), parsePreamble(), processPackageFiles(), processSourceFiles(), and readLine().

## Typedef Documentation

typedef enum rpmParseState_e rpmParseState

## Enumeration Type Documentation

enum rpmParseState_e

Enumerator
PART_NONE |
PART_PREAMBLE |
PART_PREP |
PART_BUILD |
PART_INSTALL |
PART_CHECK |
PART_CLEAN |
PART_FILES |
PART_PRE |
PART_POST |
PART_PREUN |
PART_POSTUN |
PART_PRETRANS |
PART_POSTTRANS |
PART_DESCRIPTION |
PART_CHANGELOG |
PART_TRIGGERIN |
PART_TRIGGERUN |
PART_VERIFYSCRIPT |
PART_BUILDARCHITECTURES |
PART_TRIGGERPOSTUN |
PART_TRIGGERPREIN |
PART_SANITYCHECK |
PART_ARBITRARY |
PART_LAST |

Definition at line 55 of file rpmbuild.h.

## Function Documentation

rpmRC processScriptFiles | ( | Spec | spec,
|  | Package | pkg
| ) |  |

Append files (if any) to scriptlet tags.

Parameters

  spec | spec file control structure
  pkg | package control structure

Returns
  RPMRC_OK on success

Definition at line 212 of file pack.c.

References _, addFileToArrayTag(), addFileToTag(), alloca(), _HE_s::append, rpmDataType_u::argv, _HE_s::c, TriggerFileEntry::fileName, Package_s::header, headerPut(), TriggerFileEntry::next, _HE_s::p, Package_s::postInFile, Package_s::postTransFile, Package_s::postUnFile, Package_s::preInFile, Package_s::preTransFile, Package_s::preUnFile, TriggerFileEntry::prog, RPM_STRING_ARRAY_TYPE, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, RPMTAG_POSTIN, RPMTAG_POSTTRANS, RPMTAG_POSTUN, RPMTAG_PREIN, RPMTAG_PRETRANS, RPMTAG_PREUN, RPMTAG_SANITYCHECK, RPMTAG_TRIGGERSCRIPTPROG, RPMTAG_TRIGGERSCRIPTS, RPMTAG_VERIFYSCRIPT, Package_s::sanityCheckFile, TriggerFileEntry::script, _HE_s::t, _HE_s::tag, Package_s::triggerFiles, and Package_s::verifyFile.

Referenced by processBinaryFiles().

void providePackageNVR | ( | Header | h | ) |

Retrofit an explicit Provides: N = E:V-R dependency into package headers.

Up to rpm 3.0.4, packages implicitly provided their own name-version-release.

Parameters

  h | header

Definition at line 452 of file pack.c.

References _free(), alloca(), _HE_s::append, rpmDataType_u::argv, _HE_s::c, headerGet(), headerNEVRA(), headerPut(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_ARRAY_TYPE, RPM_UINT32_TYPE, RPMSENSE_EQUAL, RPMTAG_DISTEPOCH, RPMTAG_EPOCH, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, stpcpy(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by processBinaryFiles().

## Variable Documentation

int _rpmbuildFlags

Definition at line 57 of file poptBT.c.

Referenced by genCpioListAndHeader(), newPackage(), packageBinaries(), and rpmlibMarkers().