- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# RPMBUILD.

## Files
file | build.c
| Top-level build dispatcher.

file | buildio.h
| Routines to read and write packages.

file | expression.c
| Simple logical expression parser.

file | files.c
| The post-build, pre-packaging file tree walk to assemble the package manifest.

file | misc.c
file | myftw.c
| Modified ftw() -- uses Lstat() instead of stat().

file | myftw.h
| Portable ftw(3) using lstat() instead of stat().

file | names.c
| Simple user/group name/id cache (plus hostname and buildtime).

file | pack.c
| Assemble components of an RPM package.

file | parseBuildInstallClean.c
| Parse build/install/clean section from spec file.

file | parseChangelog.c
| Parse changelog section from spec file.

file | parseDescription.c
| Parse description section from spec file.

file | parseFiles.c
| Parse files section from spec file.

file | parsePreamble.c
| Parse tags in global section from spec file.

file | parsePrep.c
| Parse prep section from spec file.

file | parseReqs.c
| Parse dependency tag from spec file or from auto-dependency generator.

file | parseScript.c
| Parse install-time script section from spec file.

file | parseSpec.c
| Top level dispatcher for spec file parsing.

file | reqprov.c
| Add dependency tags to package header(s).

file | rpmbuild.h
| This is the *only* module users of librpmbuild should need to include.

file | rpmspec.h
| The Spec and Package data structures used during build.

file | spec.c
| Handle spec data structure.

file | rpmcli.h
## Data Structures
struct | TriggerFileEntry
struct | Source
struct | ReadLevelEntry
struct | OpenFileInfo
struct | spectag_s
struct | spectags_s
struct | speclines_s
struct | SpecStruct
| The structure used to store values parsed from a spec file. More...
struct | PackageStruct
| The structure used to store values for a package. More...
## Typedefs
typedef enum rpmBuildFlags_e | rpmBuildFlags
| Bit(s) to control buildSpec() operation.
typedef enum rpmParseState_e | rpmParseState
| Spec file parser states.
typedef SpecStruct * | Spec
typedef ReadLevelEntry | RLE_t
typedef OpenFileInfo | OFI_t
typedef spectag_s * | spectag
typedef spectags_s * | spectags
typedef speclines_s * | speclines
typedef PackageStruct * | Package
## Enumerations
enum | rpmBuildFlags_e { RPMBUILD_NONE = 0, RPMBUILD_PREP = (1 << 0), RPMBUILD_BUILD = (1 << 1), RPMBUILD_INSTALL = (1 << 2), RPMBUILD_CLEAN = (1 << 3), RPMBUILD_FILECHECK = (1 << 4), RPMBUILD_PACKAGESOURCE = (1 << 5), RPMBUILD_PACKAGEBINARY = (1 << 6), RPMBUILD_RMSOURCE = (1 << 7), RPMBUILD_RMBUILD = (1 << 8), RPMBUILD_STRINGBUF = (1 << 9), RPMBUILD_RMSPEC = (1 << 10) }
| Bit(s) to control buildSpec() operation. More...
enum | rpmParseState_e { PART_NONE = 0, PART_PREAMBLE = 1, PART_PREP = 2, PART_BUILD = 3, PART_INSTALL = 4, PART_CLEAN = 5, PART_FILES = 6, PART_PRE = 7, PART_POST = 8, PART_PREUN = 9, PART_POSTUN = 10, PART_DESCRIPTION = 11, PART_CHANGELOG = 12, PART_TRIGGERIN = 13, PART_TRIGGERUN = 14, PART_VERIFYSCRIPT = 15, PART_BUILDARCHITECTURES = 16, PART_TRIGGERPOSTUN = 17, PART_LAST = 18 }
| Spec file parser states. More...
## 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 *const | buildHost (void)
| Return build hostname.
int_32 *const | 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 (const char *line)
| Check line for section separator, return next parser state.
int | parseNum (const char *line, int *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)
| Parse %prep section of a spec file.
int | parseRCPOT (Spec spec, Package pkg, const char *field, int tag, int 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.
int | doScript (Spec spec, int what, const char *name, StringBuf sb, int test)
| Run a build script, assembled from spec file scriptlet section.
int | 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, rpmsenseFlags depFlags, const char *depName, const char *depEVR, int index)
| Add dependency to header, filtering duplicates.
int | rpmlibNeedsFeature (Header h, const char *feature, const char *featureEVR)
| Add rpmlib feature dependency.
int | processBinaryFiles (Spec spec, int installSpecialDoc, int test)
| Post-build processing for binary package(s).
void | initSourceHeader (Spec spec)
| Create and initialize header for source package.
int | processSourceFiles (Spec spec)
| Post-build processing for source package.
int | parseSpec (Spec *specp, const char *specFile, const char *rootURL, const char *buildRootURL, int recursing, const char *passPhrase, char *cookie, int anyarch, int force)
| Parse spec file into spec control structure.
int | buildSpec (Spec spec, int what, int test)
| Build stages state machine driver.
int | packageBinaries (Spec spec)
| Generate binary package(s).
int | packageSources (Spec spec)
| Generate source package.
Spec | newSpec (void)
| Create and initialize Spec structure.
Spec | freeSpec (Spec spec)
| Destroy Spec structure.
OpenFileInfo * | newOpenFileInfo (void)
spectag | stashSt (Spec spec, Header h, int tag, const char *lang)
  | Parameters:
  | spec | spec file control structure
int | addSource (Spec spec, Package pkg, const char *field, int tag)
  | Parameters:
  | spec | spec file control structure
int | parseNoSource (Spec spec, const char *field, int tag)
  | Parameters:
  | spec | spec file control structure
## Variables
int(*) | parseSpecVec (Spec *specp, const char *specFile, const char *rootdir, const char *buildRoot, int recursing, const char *passPhrase, char *cookie, int anyarch, int force)
  | Return values:
  | specp | spec file control structure
Spec(*) | freeSpecVec (Spec spec)
  | Parameters:
  | spec | spec file control structure

## Typedef Documentation

typedef struct OpenFileInfo OFI_t

typedef struct PackageStruct* Package

Definition at line 178 of file rpmspec.h.

typedef struct ReadLevelEntry RLE_t

typedef enum rpmBuildFlags_e rpmBuildFlags

Bit(s) to control buildSpec() operation.

typedef enum rpmParseState_e rpmParseState

Spec file parser states.

typedef struct SpecStruct* Spec

Definition at line 11 of file rpmspec.h.

typedef struct speclines_s * speclines

typedef struct spectag_s * spectag

typedef struct spectags_s * spectags

## Enumeration Type Documentation

enum rpmBuildFlags_e

Bit(s) to control buildSpec() operation.

Enumerator:

  RPMBUILD_NONE |
  RPMBUILD_PREP | Execute %prep.
  RPMBUILD_BUILD | Execute %build.
  RPMBUILD_INSTALL | Execute %install.
  RPMBUILD_CLEAN | Execute %clean.
  RPMBUILD_FILECHECK | Check %files manifest.
  RPMBUILD_PACKAGESOURCE | Create source package.
  RPMBUILD_PACKAGEBINARY | Create binary package(s).
  RPMBUILD_RMSOURCE | Remove source(s) and patch(s).
  RPMBUILD_RMBUILD | Remove build sub-tree.
  RPMBUILD_STRINGBUF | only for doScript()
  RPMBUILD_RMSPEC | Remove spec file.

Definition at line 22 of file rpmbuild.h.

enum rpmParseState_e

Spec file parser states.

Enumerator:

  PART_NONE |
  PART_PREAMBLE |
  PART_PREP |
  PART_BUILD |
  PART_INSTALL |
  PART_CLEAN |
  PART_FILES |
  PART_PRE |
  PART_POST |
  PART_PREUN |
  PART_POSTUN |
  PART_DESCRIPTION |
  PART_CHANGELOG |
  PART_TRIGGERIN |
  PART_TRIGGERUN |
  PART_VERIFYSCRIPT |
  PART_BUILDARCHITECTURES |
  PART_TRIGGERPOSTUN |
  PART_LAST |

Definition at line 51 of file rpmbuild.h.

## Function Documentation

void addChangelogEntry | ( | Header | h,
|  | time_t | time,
|  | const char * | name,
|  | const char * | text |
| ) |  |  |

Add changelog entry to header.

Parameters:

  | h | header
  | time | time of change
  | name | person who made the change
  | text | description of change

Definition at line 11 of file parseChangelog.c.

References headerAddEntry(), headerAppendEntry(), headerIsEntry(), RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMTAG_CHANGELOGNAME, RPMTAG_CHANGELOGTEXT, and RPMTAG_CHANGELOGTIME.

Referenced by addChangelog(), and headerInject().

int addReqProv | ( | Spec | spec,
|  | Header | h,
|  | rpmsenseFlags | depFlags,
|  | const char * | depName,
|  | const char * | depEVR,
|  | int | index |
| ) |  |  |

Add dependency to header, filtering duplicates.

Parameters:

  | spec | spec file control structure
  | h | header
  | depFlags | (e.g. Requires: foo < 0:1.2-3, both "Requires:" and "<")
  | depName | (e.g. Requires: foo < 0:1.2-3, "foo")
  | depEVR | (e.g. Requires: foo < 0:1.2-3, "0:1.2-3")
  | index | (0 always)

Returns:
  0 always

Definition at line 11 of file reqprov.c.

References _ALL_REQUIRES_MASK, headerAddOrAppendEntry(), headerFreeData(), headerGetEntryMinMemory(), isDependsMULTILIB, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMSENSE_ANY, RPMSENSE_CONFLICTS, RPMSENSE_FIND_PROVIDES, RPMSENSE_MULTILIB, RPMSENSE_OBSOLETES, RPMSENSE_PREREQ, RPMSENSE_PROVIDES, RPMSENSE_SENSEMASK, RPMSENSE_TRIGGER, RPMTAG_CONFLICTFLAGS, RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_OBSOLETEFLAGS, RPMTAG_OBSOLETENAME, RPMTAG_OBSOLETEVERSION, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, RPMTAG_REQUIREFLAGS, RPMTAG_REQUIRENAME, RPMTAG_REQUIREVERSION, RPMTAG_TRIGGERFLAGS, RPMTAG_TRIGGERINDEX, RPMTAG_TRIGGERNAME, and RPMTAG_TRIGGERVERSION.

Referenced by parseRCPOT(), parseScript(), and rpmlibNeedsFeature().

int addSource | ( | Spec | spec,
|  | Package | pkg,
|  | const char * | field,
|  | int | tag |
| ) |  |  |

Parameters:

  | spec | spec file control structure

Definition at line 245 of file spec.c.

References _, _free(), addMacro(), PackageStruct::icon, SpecStruct::line, SpecStruct::lineNum, SpecStruct::macros, name, Source::next, Source::num, SpecStruct::numSources, parseNum(), RMIL_SPEC, RPMBUILD_ISICON, RPMBUILD_ISPATCH, RPMBUILD_ISSOURCE, RPMERR_BADSPEC, rpmError, rpmGetPath(), RPMTAG_ICON, RPMTAG_PATCH, RPMTAG_SOURCE, SKIPSPACE, SpecStruct::sources, xmalloc(), and xstrdup().

Referenced by handlePreambleTag().

const char* const buildHost | ( | void |  | ) |

Return build hostname.

Returns:
  build hostname

Definition at line 179 of file names.c.

References _, RPMMESS_WARNING, and rpmMessage.

Referenced by headerInject(), packageBinaries(), packageSources(), and writeRPM().

int buildSpec | ( | Spec | spec,
|  | int | what,
|  | int | test |
| ) |  |  |

Build stages state machine driver.

Parameters:

  | spec | spec file control structure
  | what | bit(s) to enable stages of build
  | test | don't execute scripts or package if testing

Returns:
  0 on success

Definition at line 264 of file build.c.

References SpecStruct::BACount, SpecStruct::BASpecs, buildSpec(), SpecStruct::recursing, RPMBUILD_PACKAGESOURCE, and RPMBUILD_RMSOURCE.

Referenced by buildForTarget(), and buildSpec().

void closeSpec | ( | Spec | spec | ) |

Stop reading from spec file, freeing resources.

Parameters:

  | spec | spec file control structure

Definition at line 358 of file parseSpec.c.

References _free(), Fclose(), OpenFileInfo::fd, OpenFileInfo::fileName, SpecStruct::fileStack, and OpenFileInfo::next.

Referenced by freeSpec(), and parseSpec().

int doScript | ( | Spec | spec,
|  | int | what,
|  | const char * | name,
|  | StringBuf | sb,
|  | int | test |
| ) |  |  |

Run a build script, assembled from spec file scriptlet section.

Parameters:

  | spec | spec file control structure
  | what | type of script
  | name | name of scriptlet section
  | sb | lines that compose script body
  | test | don't execute scripts or package if testing

Returns:
  0 on success, RPMERR_SCRIPT on failure

Definition at line 57 of file build.c.

References _, _build_debug, _free(), addMacro(), SpecStruct::build, SpecStruct::buildSubdir, SpecStruct::clean, delMacro(), errno, Fclose(), fdGetFp(), Fdopen(), Ferror(), Fileno(), getStringBuf(), urlinfo_s::host, SpecStruct::install, SpecStruct::macros, makeTempFile(), poptParseArgvString(), SpecStruct::prep, RMIL_SPEC, SpecStruct::rootURL, RPMBUILD_BUILD, RPMBUILD_CLEAN, RPMBUILD_INSTALL, RPMBUILD_PREP, RPMBUILD_RMBUILD, RPMBUILD_STRINGBUF, RPMERR_SCRIPT, rpmError, rpmExpand(), rpmGenPath(), RPMMESS_NORMAL, rpmMessage, strerror(), Unlink(), URL_IS_FTP, URL_IS_HTTP, URL_IS_PATH, URL_IS_UNKNOWN, urlPath(), urlSplit(), and urlinfo_s::urltype.

Referenced by processPackageFiles().

void freeNames | ( | void |  | ) |

Destroy uid/gid caches.

Definition at line 29 of file names.c.

References _free(), gid_used, gnames, uid_used, and unames.

Referenced by main().

Package freePackage | ( | Package | pkg | ) |

Destroy package control structure.

Parameters:

  | pkg | package control structure

Returns:
  NULL

Definition at line 148 of file spec.c.

References _free(), PackageStruct::cpioList, PackageStruct::fileFile, PackageStruct::fileList, freeFi(), freeSources(), freeStringBuf(), freeTriggerFiles(), PackageStruct::header, headerFree(), PackageStruct::icon, PackageStruct::postInFile, PackageStruct::postUnFile, PackageStruct::preInFile, PackageStruct::preUnFile, PackageStruct::specialDoc, PackageStruct::triggerFiles, and PackageStruct::verifyFile.

Referenced by freePackages().

Package freePackages | ( | Package | packages | ) |

Destroy all packages associated with spec file.

Parameters:

  | packages | package control structure chain

Returns:
  NULL

Definition at line 176 of file spec.c.

References freePackage(), and PackageStruct::next.

Referenced by freeSpec().

Spec freeSpec | ( | Spec | spec | ) |

Destroy Spec structure.

Parameters:

  | spec | spec file control structure

Returns:
  NULL always

Definition at line 462 of file spec.c.

References _free(), SpecStruct::BACount, SpecStruct::BANames, SpecStruct::BASpecs, SpecStruct::build, SpecStruct::buildRestrictions, SpecStruct::buildRootURL, SpecStruct::buildSubdir, SpecStruct::clean, closeSpec(), SpecStruct::cookie, OpenFileInfo::fileName, SpecStruct::fileStack, freeFi(), freePackages(), freeSl(), freeSources(), freeSpec(), freeSt(), freeStringBuf(), headerFree(), SpecStruct::install, OpenFileInfo::next, ReadLevelEntry::next, SpecStruct::packages, SpecStruct::passPhrase, SpecStruct::prep, SpecStruct::readStack, SpecStruct::recursing, SpecStruct::rootURL, SpecStruct::sl, SpecStruct::sourceCpioList, SpecStruct::sourceHeader, SpecStruct::sourceRpmName, SpecStruct::sources, SpecStruct::specFile, and SpecStruct::st.

Referenced by buildForTarget(), freeSpec(), main(), parseSpec(), and readRPM().

int_32* const getBuildTime | ( | void |  | ) |

Return build time stamp.

Returns:
  build time stamp

Definition at line 170 of file names.c.

Referenced by headerInject(), packageBinaries(), packageSources(), and writeRPM().

gid_t getGidS | ( | const char * | gname | ) |

Return cached group id.

Todo:
  Implement using hash.

Parameters:

  | group | name

Returns:
  cached gid

Definition at line 148 of file names.c.

References _, gid_used, gids, gnames, rpmlog(), and xstrdup().

Referenced by genCpioListAndHeader().

const char* getGname | ( | gid_t | gid | ) |

Return cached group name from group id.

Todo:
  Implement using hash.

Parameters:

  | group | id

Returns:
  cached group name

Definition at line 104 of file names.c.

References _, gid_used, gids, gnames, rpmlog(), and xstrdup().

Referenced by addFile(), checkOwners(), and processSourceFiles().

const char* getGnameS | ( | const char * | gname | ) |

Return cached group name.

Todo:
  Implement using hash.

Parameters:

  | group | name

Returns:
  cached group name

Definition at line 126 of file names.c.

References _, gid_used, gids, gnames, rpmlog(), and xstrdup().

Referenced by addFile().

uid_t getUidS | ( | const char * | uname | ) |

Return cached user id.

Todo:
  Implement using hash.

Parameters:

  | user | name

Returns:
  cached uid

Definition at line 82 of file names.c.

References _, rpmlog(), uid_used, uids, unames, and xstrdup().

Referenced by genCpioListAndHeader().

const char* getUname | ( | uid_t | uid | ) |

Return cached user name from user id.

Todo:
  Implement using hash.

Parameters:

  | user | id

Returns:
  cached user name

Definition at line 38 of file names.c.

References _, rpmlog(), uid_used, uids, unames, and xstrdup().

Referenced by addFile(), checkOwners(), headerInject(), and processSourceFiles().

const char* getUnameS | ( | const char * | uname | ) |

Return cached user name.

Todo:
  Implement using hash.

Parameters:

  | user | name

Returns:
  cached user name

Definition at line 60 of file names.c.

References _, rpmlog(), uid_used, uids, unames, and xstrdup().

Referenced by addFile().

void handleComments | ( | char * | s | ) |

Truncate comment lines.

Parameters:

  | s | skip white space, truncate line at '#'

Definition at line 97 of file parseSpec.c.

References SKIPSPACE.

Referenced by copyNextLine(), and processPackageFiles().

void initSourceHeader | ( | Spec | spec | ) |

Create and initialize header for source package.

Parameters:

  | spec | spec file control structure

Definition at line 2008 of file files.c.

References SpecStruct::BACount, SpecStruct::BANames, SpecStruct::buildRestrictions, PackageStruct::header, HEADER_I18NTABLE, headerAddEntry(), headerFreeData(), headerFreeIterator(), headerInitIterator(), headerNew(), headerNextIterator(), SpecStruct::packages, RPM_STRING_ARRAY_TYPE, RPMTAG_ARCH, RPMTAG_BUILDARCHS, RPMTAG_CHANGELOGNAME, RPMTAG_CHANGELOGTEXT, RPMTAG_CHANGELOGTIME, RPMTAG_DESCRIPTION, RPMTAG_DISTRIBUTION, RPMTAG_DISTURL, RPMTAG_EPOCH, RPMTAG_GROUP, RPMTAG_LICENSE, RPMTAG_NAME, RPMTAG_OS, RPMTAG_PACKAGER, RPMTAG_RELEASE, RPMTAG_SUMMARY, RPMTAG_URL, RPMTAG_VENDOR, RPMTAG_VERSION, and SpecStruct::sourceHeader.

Referenced by buildForTarget(), and processSourceFiles().

rpmParseState isPart | ( | const char * | line | ) |

Check line for section separator, return next parser state.

Parameters:

  | line | from spec file

Returns:
  next parser state

Definition at line 54 of file parseSpec.c.

References initParts(), PartRec::len, PartRec::part, PART_NONE, partList, PartRec::token, xisspace(), and xstrncasecmp().

Referenced by parseBuildInstallClean(), parseChangelog(), parseDescription(), parseFiles(), parsePreamble(), parsePrep(), and parseScript().

int lookupPackage | ( | Spec | spec,
|  | const char * | name,
|  | int | flag,
|  | Package * | pkg |
| ) |  |  |

Find sub-package control structure by name.

Parameters:

  | spec | spec file control structure
  | name | (sub-)package name
  | flag | if PART_SUBNAME, then 1st package name is prepended

Return values:

  | pkg | package control structure

Returns:
  0 on success, 1 on failure

Definition at line 60 of file spec.c.

References alloca(), PackageStruct::header, headerNVR(), PackageStruct::next, SpecStruct::packages, and PART_SUBNAME.

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

struct OpenFileInfo* newOpenFileInfo | ( | void |  | ) | `[read]`

Definition at line 541 of file spec.c.

References xmalloc().

Referenced by forceIncludeFile(), and parseSpec().

Package newPackage | ( | Spec | spec | ) |

Create and initialize package control structure.

Parameters:

  | spec | spec file control structure

Returns:
  package control structure

Definition at line 101 of file spec.c.

References headerNew(), PackageStruct::next, SpecStruct::packages, and xcalloc().

Referenced by parsePreamble(), and readRPM().

Spec newSpec | ( | void |  | ) |

Create and initialize Spec structure.

Returns:
  spec spec file control structure

Definition at line 405 of file spec.c.

References headerNew(), newSl(), newSt(), rpmGlobalMacroContext, and xcalloc().

Referenced by parseSpec(), and readRPM().

int packageBinaries | ( | Spec | spec | ) |

Generate binary package(s).

Parameters:

  | spec | spec file control structure

Returns:
  0 on success

Definition at line 689 of file pack.c.

References _, _free(), buildHost(), SpecStruct::cookie, copyTags, PackageStruct::cpioList, errno, errorString(), fdFree, fdNew, PackageStruct::fileList, genSourceRpmName(), getBuildTime(), PackageStruct::header, headerAddEntry(), headerCopyTags(), headerNVR(), headerSprintf(), Mkdir(), name, PackageStruct::next, SpecStruct::packages, SpecStruct::passPhrase, processScriptFiles(), providePackageNVR(), RPM_INT32_TYPE, RPM_STRING_TYPE, RPMERR_BADFILENAME, rpmError, rpmExpand(), rpmGetPath(), rpmHeaderFormats, RPMLEAD_BINARY, RPMTAG_BUILDHOST, RPMTAG_BUILDTIME, RPMTAG_COOKIE, RPMTAG_OPTFLAGS, RPMTAG_RPMVERSION, RPMTAG_SOURCERPM, rpmTagTable, SpecStruct::sourceRpmName, Stat(), strerror(), VERSION, and writeRPM().

int packageSources | ( | Spec | spec | ) |

Generate source package.

Parameters:

  | spec | spec file control structure

Returns:
  0 on success

Definition at line 788 of file pack.c.

References _free(), buildHost(), SpecStruct::cookie, fdFree, fdNew, genSourceRpmName(), getBuildTime(), headerAddEntry(), SpecStruct::passPhrase, RPM_INT32_TYPE, RPM_STRING_TYPE, rpmGetPath(), RPMLEAD_SOURCE, RPMTAG_BUILDHOST, RPMTAG_BUILDTIME, RPMTAG_RPMVERSION, SpecStruct::sourceCpioList, SpecStruct::sourceHeader, SpecStruct::sourceRpmName, VERSION, and writeRPM().

int parseBuildInstallClean | ( | Spec | spec,
|  | rpmParseState | parsePart |
| ) |  |  |

Parse %build/%install/%clean section(s) of a spec file.

Parameters:

  | spec | spec file control structure
  | parsePart | current rpmParseState

Returns:
  >= 0 next rpmParseState, < 0 on error

Definition at line 12 of file parseBuildInstallClean.c.

References _, appendStringBuf, SpecStruct::build, SpecStruct::clean, SpecStruct::install, isPart(), SpecStruct::line, SpecStruct::lineNum, name, newStringBuf(), PART_BUILD, PART_CLEAN, PART_INSTALL, PART_NONE, readLine(), RPMERR_BADSPEC, rpmError, and STRIP_NOTHING.

Referenced by parseSpec().

int parseChangelog | ( | Spec | spec | ) |

Parse %changelog section of a spec file.

Parameters:

  | spec | spec file control structure

Returns:
  >= 0 next rpmParseState, < 0 on error

Definition at line 205 of file parseChangelog.c.

References addChangelog(), appendStringBuf, freeStringBuf(), PackageStruct::header, isPart(), SpecStruct::line, newStringBuf(), SpecStruct::packages, PART_NONE, readLine(), and STRIP_COMMENTS.

Referenced by parseSpec().

int parseDescription | ( | Spec | spec | ) |

Parse %description section of a spec file.

Parameters:

  | spec | spec file control structure

Returns:
  >= 0 next rpmParseState, < 0 on error

Definition at line 29 of file parseDescription.c.

References _, _free(), appendLineStringBuf, poptOption::arg, freeStringBuf(), getStringBuf(), PackageStruct::header, headerAddI18NString(), headerIsEntry(), isPart(), lang, SpecStruct::line, SpecStruct::lineNum, lookupPackage(), name, newStringBuf(), noLang, optionsTable, PART_NAME, PART_NONE, PART_SUBNAME, POPT_BADOPTION_NOALIAS, poptBadOption(), poptFreeContext(), poptGetArg(), poptGetContext(), poptGetNextOpt(), poptParseArgvString(), poptPeekArg(), poptStrerror(), readLine(), RPMBUILD_DEFAULT_LANG, RPMERR_BADSPEC, rpmError, RPMTAG_DESCRIPTION, stashSt(), STRIP_COMMENTS, STRIP_TRAILINGSPACE, stripTrailingBlanksStringBuf(), and spectag_s::t_nlines.

Referenced by parseSpec().

int parseExpressionBoolean | ( | Spec | spec,
|  | const char * | expr |
| ) |  |  |

Evaluate boolean expression.

Parameters:

  | spec | spec file control structure
  | expr | expression to parse

Returns:

Definition at line 674 of file expression.c.

References _, _free(), _value::data, DEBUG, doLogical(), _value::i, _parseState::nextToken, _parseState::p, rdToken(), RPMERR_BADSPEC, rpmError, _value::s, _parseState::spec, _parseState::str, TOK_EOF, _parseState::tokenValue, _value::type, valueFree(), and xstrdup().

Referenced by readLine().

char* parseExpressionString | ( | Spec | spec,
|  | const char * | expr |
| ) |  |  |

Evaluate string expression.

Parameters:

  | spec | spec file control structure
  | expr | expression to parse

Returns:

Definition at line 721 of file expression.c.

References _, _free(), _value::data, DEBUG, doLogical(), _value::i, _parseState::nextToken, _parseState::p, rdToken(), RPMERR_BADSPEC, rpmError, _value::s, _parseState::spec, _parseState::str, TOK_EOF, _parseState::tokenValue, _value::type, valueFree(), and xstrdup().

int parseFiles | ( | Spec | spec | ) |

Parse %files section of a spec file.

Parameters:

  | spec | spec file control structure

Returns:
  >= 0 next rpmParseState, < 0 on error

Definition at line 26 of file parseFiles.c.

References _, _free(), appendStringBuf, poptOption::arg, file, PackageStruct::fileFile, PackageStruct::fileList, isPart(), SpecStruct::line, SpecStruct::lineNum, lookupPackage(), name, newStringBuf(), optionsTable, PART_NAME, PART_NONE, PART_SUBNAME, POPT_BADOPTION_NOALIAS, poptBadOption(), poptFreeContext(), poptGetArg(), poptGetContext(), poptGetNextOpt(), poptParseArgvString(), poptPeekArg(), poptStrerror(), readLine(), RPMERR_BADSPEC, rpmError, rpmGetPath(), and STRIP_COMMENTS.

Referenced by parseSpec().

int parseNoSource | ( | Spec | spec,
|  | const char * | field,
|  | int | tag |
| ) |  |  |

Parameters:

  | spec | spec file control structure

Definition at line 201 of file spec.c.

References _, findSource(), SpecStruct::lineNum, name, Source::num, parseNum(), RPMBUILD_ISNO, RPMBUILD_ISPATCH, RPMBUILD_ISSOURCE, RPMERR_BADSPEC, rpmError, RPMTAG_NOSOURCE, SKIPNONWHITE, and SKIPWHITE.

Referenced by handlePreambleTag().

int parseNum | ( | const char * | line,
|  | int * | res |
| ) |  |  |

Parse a number.

Parameters:

  | line | from spec file

Return values:

  | res | pointer to int

Returns:
  0 on success, 1 on failure

Definition at line 9 of file misc.c.

Referenced by addSource(), doPatchMacro(), doSetupMacro(), handlePreambleTag(), and parseNoSource().

int parsePreamble | ( | Spec | spec,
|  | int | initialPackage |
| ) |  |  |

Parse tags from preamble of a spec file.

Parameters:

  | spec | spec file control structure
  | initialPackage |

Returns:
  >= 0 next rpmParseState, < 0 on error

Definition at line 835 of file parsePreamble.c.

References _, SpecStruct::anyarch, SpecStruct::BANames, SpecStruct::buildRootURL, checkForDuplicates(), checkForRequired(), checkForValidArchitectures(), copyTagsDuringParse, fillOutMainPackage(), findPreambleTag(), SpecStruct::gotBuildRootURL, handlePreambleTag(), PackageStruct::header, headerAddEntry(), headerCopyTags(), headerNVR(), isPart(), lang, SpecStruct::line, SpecStruct::lineNum, lookupPackage(), name, newPackage(), SpecStruct::packages, parseSimplePart(), PART_BUILDARCHITECTURES, PART_NONE, PART_SUBNAME, readLine(), SpecStruct::recursing, RPM_STRING_TYPE, RPMERR_BADSPEC, rpmError, RPMTAG_NAME, SKIPSPACE, STRIP_COMMENTS, STRIP_TRAILINGSPACE, and PreambleRec_s::tag.

Referenced by parseSpec().

int parsePrep | ( | Spec | spec | ) |

Parse %prep section of a spec file.

Parameters:

  | spec | spec file control structure

Returns:
  >= 0 next rpmParseState, < 0 on error

Definition at line 543 of file parsePrep.c.

References _, appendLineStringBuf, appendStringBuf, doPatchMacro(), doSetupMacro(), SpecStruct::force, freeSplitString(), freeStringBuf(), getStringBuf(), isPart(), SpecStruct::line, SpecStruct::lineNum, newStringBuf(), PART_NONE, SpecStruct::prep, readLine(), RPMERR_BADSPEC, rpmError, splitString(), and STRIP_NOTHING.

Referenced by parseSpec().

int parseRCPOT | ( | Spec | spec,
|  | Package | pkg,
|  | const char * | field,
|  | int | tag,
|  | int | index,
|  | rpmsenseFlags | tagflags |
| ) |  |  |

Parse dependency relations from spec file and/or autogenerated output buffer.

Parameters:

  | spec | spec file control structure
  | pkg | package control structure
  | field | text to parse (e.g. "foo < 0:1.2-3, bar = 5:6.7")
  | tag | tag, identifies type of dependency
  | index | (0 always)
  | tagflags | dependency flags already known from context

Returns:
  0 on success, RPMERR_BADSPEC on failure

Definition at line 35 of file parseReqs.c.

References _, _free(), addReqProv(), SpecStruct::buildRestrictions, PackageStruct::header, SpecStruct::line, SpecStruct::lineNum, ReqComparisons, RPMERR_BADSPEC, rpmError, rpmExpandNumeric(), rpmlibNeedsFeature(), RPMSENSE_ANY, RPMSENSE_CONFLICTS, RPMSENSE_OBSOLETES, RPMSENSE_PREREQ, RPMSENSE_PROVIDES, RPMSENSE_SENSEMASK, RPMSENSE_TRIGGERIN, RPMSENSE_TRIGGERPOSTUN, RPMSENSE_TRIGGERUN, RPMTAG_BUILDCONFLICTS, RPMTAG_BUILDPREREQ, RPMTAG_BUILDREQUIRES, RPMTAG_CONFLICTFLAGS, RPMTAG_OBSOLETEFLAGS, RPMTAG_PREREQ, RPMTAG_PROVIDEFLAGS, RPMTAG_REQUIREFLAGS, RPMTAG_TRIGGERIN, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERUN, ReqComp::sense, SKIPNONWHITE, SKIPWHITE, ReqComp::token, xisalnum(), and xmalloc().

Referenced by handlePreambleTag(), and parseScript().

int parseScript | ( | Spec | spec,
|  | int | parsePart |
| ) |  |  |

Parse %pre et al scriptlets from a spec file.

Parameters:

  | spec | spec file control structure
  | parsePart | current rpmParseState

Returns:
  >= 0 next rpmParseState, < 0 on error

Definition at line 69 of file parseScript.c.

References _, _free(), addReqProv(), addTriggerIndex(), appendStringBuf, poptOption::arg, file, freeStringBuf(), getStringBuf(), PackageStruct::header, headerAddEntry(), headerIsEntry(), isPart(), SpecStruct::line, SpecStruct::lineNum, lookupPackage(), name, newStringBuf(), optionsTable, parseRCPOT(), PART_NAME, PART_NONE, PART_POST, PART_POSTUN, PART_PRE, PART_PREUN, PART_SUBNAME, PART_TRIGGERIN, PART_TRIGGERPOSTUN, PART_TRIGGERUN, PART_VERIFYSCRIPT, POPT_BADOPTION_NOALIAS, poptBadOption(), poptFreeContext(), poptGetArg(), poptGetContext(), poptGetNextOpt(), poptParseArgvString(), poptPeekArg(), poptStrerror(), PackageStruct::postInFile, PackageStruct::postUnFile, PackageStruct::preInFile, PackageStruct::preUnFile, prog, readLine(), RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPMERR_BADSPEC, rpmError, rpmlibNeedsFeature(), RPMSENSE_INTERP, RPMSENSE_SCRIPT_POST, RPMSENSE_SCRIPT_POSTUN, RPMSENSE_SCRIPT_PRE, RPMSENSE_SCRIPT_PREUN, RPMSENSE_SCRIPT_VERIFY, RPMTAG_POSTIN, RPMTAG_POSTINPROG, RPMTAG_POSTUN, RPMTAG_POSTUNPROG, RPMTAG_PREIN, RPMTAG_PREINPROG, RPMTAG_PREUN, RPMTAG_PREUNPROG, RPMTAG_TRIGGERIN, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERSCRIPTPROG, RPMTAG_TRIGGERSCRIPTS, RPMTAG_TRIGGERUN, RPMTAG_VERIFYSCRIPT, RPMTAG_VERIFYSCRIPTPROG, STRIP_NOTHING, stripTrailingBlanksStringBuf(), PackageStruct::verifyFile, and xstrdup().

Referenced by parseSpec().

int parseSpec | ( | Spec * | specp,
|  | const char * | specFile,
|  | const char * | rootURL,
|  | const char * | buildRootURL,
|  | int | recursing,
|  | const char * | passPhrase,
|  | char * | cookie,
|  | int | anyarch,
|  | int | force |
| ) |  |  |

Parse spec file into spec control structure.

Return values:

  | specp | spec file control structure

Parameters:

  | specFile |
  | rootURL |
  | buildRootURL |
  | recursing | parse is recursive?
  | passPhrase |
  | cookie |
  | anyarch |
  | force |

Returns:

Definition at line 377 of file parseSpec.c.

References _, _debug, _free(), addMacro(), SpecStruct::anyarch, SpecStruct::BACount, SpecStruct::BANames, SpecStruct::BASpecs, SpecStruct::buildRootURL, closeSpec(), SpecStruct::cookie, delMacro(), OpenFileInfo::fileName, SpecStruct::fileStack, SpecStruct::force, freeSpec(), SpecStruct::gotBuildRootURL, PackageStruct::header, headerAddEntry(), headerIsEntry(), headerNVR(), SpecStruct::macros, name, newOpenFileInfo(), newSpec(), PackageStruct::next, SpecStruct::packages, parseBuildInstallClean(), parseChangelog(), parseDescription(), parseFiles(), parsePreamble(), parsePrep(), parseScript(), parseSpec(), PART_BUILD, PART_BUILDARCHITECTURES, PART_CHANGELOG, PART_CLEAN, PART_DESCRIPTION, PART_FILES, PART_INSTALL, PART_LAST, PART_NONE, PART_POST, PART_POSTUN, PART_PRE, PART_PREAMBLE, PART_PREP, PART_PREUN, PART_TRIGGERIN, PART_TRIGGERPOSTUN, PART_TRIGGERUN, PART_VERIFYSCRIPT, SpecStruct::passPhrase, SpecStruct::recursing, RMIL_RPMRC, RMIL_SPEC, SpecStruct::rootURL, RPM_MACHTABLE_BUILDARCH, RPM_STRING_TYPE, RPMERR_BADSPEC, rpmError, rpmExpand(), rpmExpandNumeric(), rpmGetArchInfo(), rpmGetMachine(), rpmGetOsInfo(), rpmGetPath(), rpmMachineScore(), rpmSetMachine(), RPMTAG_ARCH, RPMTAG_DESCRIPTION, RPMTAG_OS, RPMTAG_PLATFORM, RPMTAG_RHNPLATFORM, SpecStruct::specFile, SpecStruct::timeCheck, urlPath(), xcalloc(), and xstrdup().

Referenced by buildForTarget(), main(), and parseSpec().

int processBinaryFiles | ( | Spec | spec,
|  | int | installSpecialDoc,
|  | int | test |
| ) |  |  |

Post-build processing for binary package(s).

Parameters:

  | spec | spec file control structure
  | installSpecialDoc |
  | test | don't execute scripts or package if testing

Returns:
  0 on success

Definition at line 2648 of file files.c.

References _, PackageStruct::cpioList, PackageStruct::fileList, generateDepends(), PackageStruct::header, headerIsEntry(), headerNVR(), PackageStruct::next, SpecStruct::packages, printDeps(), processPackageFiles(), RPMMESS_NORMAL, rpmMessage, and RPMTAG_MULTILIBS.

int processSourceFiles | ( | Spec | spec | ) |

Post-build processing for source package.

Parameters:

  | spec | spec file control structure

Returns:
  0 on success

Definition at line 2071 of file files.c.

References _, _free(), appendLineStringBuf, FileList_s::buildRootURL, FileListRec_s::diskURL, errno, FileList_s::fileList, FileList_s::fileListRecsUsed, FileListRec_s::fileURL, FileListRec_s::fl_st, FileListRec_s::flags, Source::flags, freeFileList(), freeSplitString(), freeStringBuf(), genCpioListAndHeader(), getGname(), getStringBuf(), getUname(), FileListRec_s::gname, headerAddOrAppendEntry(), PackageStruct::icon, initSourceHeader(), FileListRec_s::langs, newStringBuf(), PackageStruct::next, Source::next, Source::num, FileList_s::prefix, FileList_s::processingFailed, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMBUILD_ISNO, RPMBUILD_ISPATCH, RPMBUILD_ISSOURCE, rpmError, RPMFILE_GHOST, RPMFILE_SPECFILE, rpmGetPath(), RPMTAG_NOPATCH, RPMTAG_NOSOURCE, RPMTAG_PATCH, RPMTAG_SOURCE, RPMVERIFY_ALL, SKIPSPACE, Source::source, SpecStruct::sourceHeader, splitString(), Stat(), strerror(), FileList_s::totalFileSize, FileListRec_s::uname, urlPath(), FileListRec_s::verifyFlags, xcalloc(), and xstrdup().

int readLine | ( | Spec | spec,
|  | int | strip |
| ) |  |  |

Read next line from spec file.

Parameters:

  | spec | spec file control structure
  | strip | truncate comments?

Returns:
  0 on success, 1 on EOF, <0 on error

Definition at line 179 of file parseSpec.c.

References _, _free(), copyNextLine(), Fclose(), OpenFileInfo::fd, fdGetFp(), Ferror(), OpenFileInfo::fileName, SpecStruct::fileStack, Fopen(), forceIncludeFile(), Fstrerror(), SpecStruct::line, OpenFileInfo::lineNum, SpecStruct::lineNum, matchTok(), OpenFileInfo::next, ReadLevelEntry::next, parseExpressionBoolean(), OpenFileInfo::readBuf, ReadLevelEntry::reading, OpenFileInfo::readPtr, SpecStruct::readStack, RPMERR_BADSPEC, RPMERR_UNMATCHEDIF, rpmError, rpmExpand(), rpmGetArchInfo(), rpmGetOsInfo(), SKIPNONSPACE, SKIPSPACE, SpecStruct::sl, speclines_s::sl_lines, speclines_s::sl_nalloc, speclines_s::sl_nlines, xisspace(), xmalloc(), xrealloc(), and xstrdup().

Referenced by parseBuildInstallClean(), parseChangelog(), parseDescription(), parseFiles(), parsePreamble(), parsePrep(), and parseScript().

int rpmlibNeedsFeature | ( | Header | h,
|  | const char * | feature,
|  | const char * | featureEVR |
| ) |  |  |

Add rpmlib feature dependency.

Parameters:

  | h | header
  | feature | rpm feature name (i.e. "rpmlib(Foo)" for feature Foo)
  | featureEVR | rpm feature epoch/version/release

Returns:
  0 always

Definition at line 120 of file reqprov.c.

References addReqProv(), alloca(), RPMSENSE_EQUAL, RPMSENSE_LESS, RPMSENSE_RPMLIB, and stpcpy().

Referenced by genCpioListAndHeader(), parseRCPOT(), parseScript(), processPackageFiles(), and writeRPM().

spectag stashSt | ( | Spec | spec,
|  | Header | h,
|  | int | tag,
|  | const char * | lang |
| ) |  |  |

Parameters:

  | spec | spec file control structure

Definition at line 401 of file parsePreamble.c.

References headerGetEntryMinMemory(), SpecStruct::lineNum, RPMBUILD_DEFAULT_LANG, RPMTAG_NAME, SpecStruct::st, spectags_s::st_nalloc, spectags_s::st_ntags, spectags_s::st_t, spectag_s::t_lang, spectag_s::t_msgid, spectag_s::t_nlines, spectag_s::t_startx, spectag_s::t_tag, tagName(), xrealloc(), and xstrdup().

Referenced by handlePreambleTag(), and parseDescription().

## Variable Documentation

Spec(*) freeSpecVec(Spec spec)

Parameters:

  | spec | spec file control structure

Todo:
  Eliminate linkage loop into librpmbuild.a

Definition at line 577 of file query.c.

Referenced by main(), and rpmQueryVerify().

int(*) parseSpecVec(Spec *specp, const char *specFile, const char *rootdir,const char *buildRoot, int recursing,const char *passPhrase,char *cookie, int anyarch, int force)

Return values:

  | specp | spec file control structure

Todo:
  Eliminate linkage loop into librpmbuild.a

Definition at line 571 of file query.c.

Referenced by main(), and rpmQueryVerify().