# build/rpmbuild.h File Reference

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

`#include <rpmcli.h>`
`#include "stringbuf.h"`
`#include "misc.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.

## Defines

#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.
#define | STRIP_NOTHING 0
#define | STRIP_TRAILINGSPACE (1 << 0)
#define | STRIP_COMMENTS (1 << 1)

## Typedefs

typedef enum rpmBuildFlags_e | rpmBuildFlags
| Bit(s) to control buildSpec() operation.
typedef enum rpmParseState_e | rpmParseState

## 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
}

## Functions

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

## Variables

int | _rpmbuildFlags

## Detailed Description

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

Definition in file rpmbuild.h.

## Define Documentation

#define PART_NAME 1

Definition at line 47 of file rpmbuild.h.

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

#define PART_SUBNAME 0

Definition at line 46 of file rpmbuild.h.

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

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

Definition at line 44 of file rpmbuild.h.

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

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

Definition at line 43 of file rpmbuild.h.

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

#define STRIP_COMMENTS (1 << 1)

Definition at line 85 of file rpmbuild.h.

Referenced by copyNextLineFinish(), parseChangelog(), parseDescription(), parseFiles(), and parsePreamble().

#define STRIP_NOTHING 0

Definition at line 83 of file rpmbuild.h.

Referenced by parseBuildInstallClean(), parsePrep(), and parseScript().

#define STRIP_TRAILINGSPACE (1 << 0)

Definition at line 84 of file rpmbuild.h.

Referenced by copyNextLineFinish(), parseDescription(), and parsePreamble().

## 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 53 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 226 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 463 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_EPOCH, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, stpcpy(), _HE_s::t, _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by processBinaryFiles().

## Variable Documentation

int _rpmbuildFlags

Definition at line 51 of file poptBT.c.

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