rpm  4.18.0
About: RPM - The Red Hat Package Manager (rpm.org). See also the rpm 5 releases for Unix (not only Linux).
  Fossies Dox: rpm-4.18.0.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches

API for building packages. More...

Collaboration diagram for Build API.:

Files

file  build.c
 Top-level build dispatcher.
 
file  files.c
 The post-build, pre-packaging file tree walk to assemble the package manifest.
 
file  misc.c
 
file  pack.c
 Assemble components of an RPM package.
 
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  parsePolicies.c
 Parse policies 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  policies.c
 The post-build, packaging of policies.
 
file  reqprov.c
 Add dependency tags to package header(s).
 
file  spec.c
 Handle spec data structure.
 
file  rpmbuild.h
 This is the only module users of librpmbuild should need to include.
 
file  rpmcli.h
 Parsing RPM command line arguments.
 
file  rpmfc.h
 Structures and methods for build-time file classification.
 
file  rpmspec.h
 The rpmSpec and Package data structures used during build.
 

Data Structures

struct  Source
 
struct  rpmSpec_s
 The structure used to store values parsed from a spec file. More...
 
struct  Package_s
 The structure used to store values for a package. More...
 
struct  rpmBuildArguments_s
 Describe build request. More...
 

Macros

#define PART_BASE   0
 rpmSpec file parser states. More...
 

Typedefs

typedef struct rpmBuildArguments_sBTA_t
 
typedef struct Package_srpmSpecPkg
 

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_RMSPEC = (1 << 11) , RPMBUILD_FILE_FILE = (1 << 16) , RPMBUILD_FILE_LIST = (1 << 17) , RPMBUILD_POLICY = (1 << 18) ,
  RPMBUILD_CHECKBUILDREQUIRES = (1 << 19) , RPMBUILD_BUILDREQUIRES = (1 << 20) , RPMBUILD_DUMPBUILDREQUIRES = (1 << 21) , RPMBUILD_CONF = (1 << 22) ,
  RPMBUILD_NOBUILD = (1 << 31)
}
 Bit(s) to control rpmSpecBuild() operation. More...
 
enum  rpmBuildPkgFlags_e { RPMBUILD_PKG_NONE = 0 , RPMBUILD_PKG_NODIRTOKENS = (1 << 0) }
 Bit(s) to control package generation. More...
 

Functions

RPM_GNUC_INTERNAL rpmSpec newSpec (void)
 Create and initialize rpmSpec structure. More...
 
RPM_GNUC_INTERNAL void closeSpec (rpmSpec spec)
 Stop reading from spec file, freeing resources. More...
 
RPM_GNUC_INTERNAL int readLine (rpmSpec spec, int strip)
 Read next line from spec file. More...
 
RPM_GNUC_INTERNAL int parseLines (rpmSpec spec, int strip, ARGV_t *avp, StringBuf *sbp)
 Read next line from spec file. More...
 
RPM_GNUC_INTERNAL struct SourcefreeSources (struct Source *s)
 Destroy source component chain. More...
 
RPM_GNUC_INTERNAL int isPart (const char *line)
 Check line for section separator, return next parser state. More...
 
RPM_GNUC_INTERNAL int parseSimpleScript (rpmSpec spec, const char *name, StringBuf *sbp)
 Parse %build/%install/%clean section(s) of a spec file. More...
 
RPM_GNUC_INTERNAL int parseChangelog (rpmSpec spec)
 Parse %changelog section of a spec file. More...
 
RPM_GNUC_INTERNAL int parseDescription (rpmSpec spec)
 Parse %description section of a spec file. More...
 
RPM_GNUC_INTERNAL int parseFiles (rpmSpec spec)
 Parse %files section of a spec file. More...
 
RPM_GNUC_INTERNAL int parsePolicies (rpmSpec spec)
 Parse %sepolicy section of a spec file. More...
 
RPM_GNUC_INTERNAL int parsePreamble (rpmSpec spec, int initialPackage)
 Parse tags from preamble of a spec file. More...
 
RPM_GNUC_INTERNAL int parsePrep (rpmSpec spec)
 Parse %prep section of a spec file. More...
 
RPM_GNUC_INTERNAL int parseScript (rpmSpec spec, int parsePart)
 Parse %pre et al scriptlets from a spec file. More...
 
RPM_GNUC_INTERNAL rpmRC rpmCharCheck (rpmSpec spec, const char *field, const char *allowedchars, const char *allowedcharsfirst)
 Check for inappropriate characters. More...
 
RPM_GNUC_INTERNAL rpmRC parseRCPOT (rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN, int index, rpmsenseFlags tagflags, addReqProvFunction cb, void *cbdata)
 Parse dependency relations from spec file and/or autogenerated output buffer. More...
 
RPM_GNUC_INTERNAL rpmRC doScript (rpmSpec spec, rpmBuildFlags what, const char *name, const char *sb, int test, StringBuf *sb_stdoutp)
 Run a build script, assembled from spec file scriptlet section. More...
 
RPM_GNUC_INTERNAL rpmRC lookupPackage (rpmSpec spec, const char *name, int flag, Package *pkg)
 Find sub-package control structure by name. More...
 
RPM_GNUC_INTERNAL Package newPackage (const char *name, rpmstrPool pool, Package *pkglist)
 Create and initialize package control structure. More...
 
RPM_GNUC_INTERNAL Package freePackage (Package pkg)
 Free a package control structure. More...
 
RPM_GNUC_INTERNAL rpmdspackageDependencies (Package pkg, rpmTagVal tag)
 Return rpmds containing the dependencies of a given type. More...
 
RPM_GNUC_INTERNAL rpmRC processBinaryFiles (rpmSpec spec, rpmBuildPkgFlags pkgFlags, int didInstall, int test)
 Post-build processing for binary package(s). More...
 
RPM_GNUC_INTERNAL rpmRC processBinaryPolicies (rpmSpec spec, int test)
 Post-build processing for policies in binary package(s). More...
 
RPM_GNUC_INTERNAL rpmRC processSourceFiles (rpmSpec spec, rpmBuildPkgFlags pkgFlags)
 Post-build processing for source package. More...
 
RPM_GNUC_INTERNAL rpmRC packageBinaries (rpmSpec spec, const char *cookie, int cheating)
 Generate binary package(s). More...
 
RPM_GNUC_INTERNAL rpmRC packageSources (rpmSpec spec, char **cookie)
 Generate source package. More...
 
RPM_GNUC_INTERNAL int addReqProv (Package pkg, rpmTagVal tagN, const char *N, const char *EVR, rpmsenseFlags Flags, uint32_t index)
 Add dependency to package, filtering duplicates. More...
 
RPM_GNUC_INTERNAL void addPackageProvides (Package pkg)
 Add self-provides to package. More...
 
RPM_GNUC_INTERNAL int rpmlibNeedsFeature (Package pkg, const char *feature, const char *featureEVR)
 Add rpmlib feature dependency. More...
 
RPM_GNUC_INTERNAL void copyInheritedTags (Header h, Header fromh)
 Copy tags inherited by subpackages from the source header to the target header. More...
 
RPM_GNUC_INTERNAL int handleComments (char *s)
 Truncate comment lines. More...
 
RPM_GNUC_INTERNAL int parseUnsignedNum (const char *line, uint32_t *res)
 Parse an unsigned number. More...
 
rpmSpec rpmSpecParse (const char *specFile, rpmSpecFlags flags, const char *buildRoot)
 Parse spec file into spec control structure. More...
 
Header rpmSpecSourceHeader (rpmSpec spec)
 Return the headers of the SRPM that would be built from the spec file. More...
 
rpmps rpmSpecCheckDeps (rpmts ts, rpmSpec spec)
 Verify build depencies of a spec against. More...
 
rpmds rpmSpecDS (rpmSpec spec, rpmTagVal tag)
 Retrieve build dependency set from spec. More...
 
int rpmSpecBuild (rpmts ts, rpmSpec spec, BTA_t buildArgs)
 Spec build stages state machine driver. More...
 
rpmSpec rpmSpecFree (rpmSpec spec)
 Destroy Spec structure. More...
 
int rpmspecQuery (rpmts ts, QVA_t qva, const char *arg)
 Function to query spec file(s). More...
 

Detailed Description

API for building packages.

Macro Definition Documentation

◆ PART_BASE

#define PART_BASE   0

rpmSpec file parser states.

Definition at line 207 of file rpmbuild_internal.h.

Typedef Documentation

◆ BTA_t

typedef struct rpmBuildArguments_s* BTA_t

Definition at line 73 of file rpmbuild.h.

◆ rpmSpecPkg

typedef struct Package_s* rpmSpecPkg

Definition at line 18 of file rpmspec.h.

Enumeration Type Documentation

◆ rpmBuildFlags_e

Bit(s) to control rpmSpecBuild() operation.

Also used as argument to rpmSpecGetSection and rpmSpecPkgGetSection.

Enumerator
RPMBUILD_NONE 
RPMBUILD_PREP 

Execute %prep.

RPMBUILD_BUILD 

Execute %build.

RPMBUILD_INSTALL 

Execute %install.

RPMBUILD_CHECK 

Execute %check.

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 

Internal use only

RPMBUILD_RMSPEC 

Remove spec file.

RPMBUILD_FILE_FILE 

rpmSpecPkgGetSection: files -f

RPMBUILD_FILE_LIST 

rpmSpecPkgGetSection: files

RPMBUILD_POLICY 

rpmSpecPkgGetSection: policy

RPMBUILD_CHECKBUILDREQUIRES 

Check %buildrequires.

RPMBUILD_BUILDREQUIRES 

Execute %buildrequires.

RPMBUILD_DUMPBUILDREQUIRES 

Write buildrequires.nosrc.rpm.

RPMBUILD_CONF 

Execute %conf.

RPMBUILD_NOBUILD 

Don't execute or package.

Definition at line 21 of file rpmbuild.h.

◆ rpmBuildPkgFlags_e

Bit(s) to control package generation.

Enumerator
RPMBUILD_PKG_NONE 
RPMBUILD_PKG_NODIRTOKENS 

Legacy filename layout

Definition at line 51 of file rpmbuild.h.

Function Documentation

◆ addPackageProvides()

RPM_GNUC_INTERNAL void addPackageProvides ( Package  pkg)

Add self-provides to package.

Parameters
pkgpackage

Definition at line 713 of file parseSpec.c.

References addReqProv(), Package_s::header, headerGetAsString(), headerGetString(), rpmExpand(), RPMSENSE_EQUAL, RPMTAG_ARCH, RPMTAG_EVR, RPMTAG_NAME, RPMTAG_PROVIDENAME, and rstreq().

Referenced by addTargets(), and cloneDebuginfoPackage().

◆ addReqProv()

RPM_GNUC_INTERNAL int addReqProv ( Package  pkg,
rpmTagVal  tagN,
const char *  N,
const char *  EVR,
rpmsenseFlags  Flags,
uint32_t  index 
)

Add dependency to package, filtering duplicates.

Parameters
pkgpackage
tagNtag, identifies type of dependency
N(e.g. Requires: foo < 0:1.2-3, "foo")
EVR(e.g. Requires: foo < 0:1.2-3, "0:1.2-3")
Flags(e.g. Requires: foo < 0:1.2-3, both "Requires:" and "<")
index(# trigger script for triggers, 0 for others)
Returns
0 on success, 1 on error

Definition at line 14 of file reqprov.c.

References packageDependencies(), Package_s::pool, rpmdsFree(), rpmdsMerge(), rpmdsSinglePoolTix(), rpmSanitizeDSFlags(), RPMSENSE_RPMLIB, RPMTAG_PROVIDENAME, RPMTAG_REQUIRENAME, and rstreqn().

Referenced by addPackageDeps(), addPackageProvides(), addReqProvPkg(), parseScript(), and rpmlibNeedsFeature().

◆ closeSpec()

RPM_GNUC_INTERNAL void closeSpec ( rpmSpec  spec)

Stop reading from spec file, freeing resources.

Parameters
specspec file control structure

Definition at line 615 of file parseSpec.c.

References popOFI().

Referenced by parseSpec(), and rpmSpecFree().

◆ copyInheritedTags()

RPM_GNUC_INTERNAL void copyInheritedTags ( Header  h,
Header  fromh 
)

Copy tags inherited by subpackages from the source header to the target header.

Parameters
htarget header
fromhsource header

Definition at line 563 of file parsePreamble.c.

References copyTagsDuringParse, and headerCopyTags().

Referenced by cloneDebuginfoPackage(), and parsePreamble().

◆ doScript()

RPM_GNUC_INTERNAL rpmRC doScript ( rpmSpec  spec,
rpmBuildFlags  what,
const char *  name,
const char *  sb,
int  test,
StringBuf sb_stdoutp 
)

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

Parameters
specspec file control structure
whattype of script
namename of scriptlet section
sblines that compose script body
testdon't execute scripts or package if testing
sb_stdoutpStringBuf to catupre the stdout of the script or NULL
Returns
RPMRC_OK on success

Definition at line 102 of file build.c.

References _, errno, Fclose(), Ferror(), Fileno(), Fstrerror(), rpmSpec_s::rootDir, RPMBUILD_BUILD, RPMBUILD_BUILDREQUIRES, RPMBUILD_CHECK, RPMBUILD_CLEAN, RPMBUILD_CONF, RPMBUILD_INSTALL, RPMBUILD_PREP, RPMBUILD_RMBUILD, RPMBUILD_STRINGBUF, rpmExpand(), rpmfcExec(), rpmGenPath(), rpmGetPath(), rpmIsDebug, rpmlog(), RPMLOG_ERR, RPMLOG_NOTICE, rpmMkTempFile(), RPMRC_FAIL, RPMRC_OK, and test.

Referenced by buildSpec(), doBuildRequires(), and processSpecialDir().

◆ freePackage()

◆ freeSources()

RPM_GNUC_INTERNAL struct Source * freeSources ( struct Source s)

Destroy source component chain.

Parameters
ssource component chain
Returns
NULL always

Definition at line 43 of file spec.c.

References _free, Source::fullSource, Source::next, and Source::path.

Referenced by buildSpec(), freePackage(), and rpmSpecFree().

◆ handleComments()

RPM_GNUC_INTERNAL int handleComments ( char *  s)

Truncate comment lines.

Parameters
sskip white space, truncate line at '#'
Returns
1 on comment lines, 0 otherwise

Definition at line 124 of file parseSpec.c.

References SKIPSPACE.

Referenced by copyNextLineFinish(), and readManifest().

◆ isPart()

RPM_GNUC_INTERNAL int isPart ( const char *  line)

Check line for section separator, return next parser state.

Parameters
linefrom spec file
Returns
next parser state

Definition at line 85 of file parseSpec.c.

References PartRec::len, PartRec::part, PART_NONE, partList, risspace(), rstrncasecmp(), and PartRec::token.

Referenced by parseEmpty(), parseLines(), and parsePreamble().

◆ lookupPackage()

RPM_GNUC_INTERNAL rpmRC lookupPackage ( rpmSpec  spec,
const char *  name,
int  flag,
Package pkg 
)

Find sub-package control structure by name.

Parameters
specspec file control structure
name(sub-)package name
flagif PART_SUBNAME, then 1st package name is prepended
[out]pkgpackage control structure
Returns
0 on success, 1 on failure

Definition at line 57 of file spec.c.

References _, Package_s::header, headerGetString(), rpmSpec_s::line, rpmSpec_s::lineNum, Package_s::name, Package_s::next, rpmSpec_s::packages, PART_NAME, PART_QUIET, rpmSpec_s::pool, rasprintf(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, rpmstrPoolId(), and RPMTAG_NAME.

Referenced by cloneDebuginfoPackage(), findDebuginfoPackage(), findDebugsourcePackage(), parseDescription(), parseFiles(), parsePolicies(), parsePreamble(), and parseScript().

◆ newPackage()

RPM_GNUC_INTERNAL Package newPackage ( const char *  name,
rpmstrPool  pool,
Package pkglist 
)

Create and initialize package control structure.

Parameters
namepackage name for sub-packages (or NULL)
poolstring pool
pkglistpackage list pointer to append to (or NULL)
Returns
package control structure

Definition at line 103 of file spec.c.

References Package_s::autoProv, Package_s::autoReq, Package_s::dpaths, Package_s::fileExcludeList, Package_s::fileFile, Package_s::fileList, Package_s::fileRenameMap, Package_s::header, headerNew(), Package_s::name, Package_s::next, Package_s::policyList, Package_s::pool, rpmstrPoolId(), rpmstrPoolLink(), and xcalloc.

Referenced by cloneDebuginfoPackage(), and parsePreamble().

◆ newSpec()

◆ packageBinaries()

RPM_GNUC_INTERNAL rpmRC packageBinaries ( rpmSpec  spec,
const char *  cookie,
int  cheating 
)

Generate binary package(s).

Parameters
specspec file control structure
cookiebuild identifier "cookie" or NULL
cheatingwas build shortcircuited?
Returns
RPMRC_OK on success

Definition at line 747 of file pack.c.

References _, checkPackageSet(), compareBinaries(), Package_s::filename, Package_s::next, packageBinary(), rpmSpec_s::packages, Package_s::rc, rpmlog(), RPMLOG_DEBUG, RPMRC_OK, and xcalloc.

Referenced by buildSpec().

◆ packageDependencies()

RPM_GNUC_INTERNAL rpmds * packageDependencies ( Package  pkg,
rpmTagVal  tag 
)

Return rpmds containing the dependencies of a given type.

Parameters
pkgpackage
tagname tag denominating the dependency
Returns
pointer to dependency set

Definition at line 185 of file spec.c.

References Package_s::dependencies, PACKAGE_NUM_DEPS, and rpmdsTagN().

Referenced by addReqProv(), doBuildRequires(), parseRCPOT(), rpmfcApplyInternal(), rpmfcDependencies(), and rpmfcGenerateDepends().

◆ packageSources()

RPM_GNUC_INTERNAL rpmRC packageSources ( rpmSpec  spec,
char **  cookie 
)

◆ parseChangelog()

RPM_GNUC_INTERNAL int parseChangelog ( rpmSpec  spec)

Parse %changelog section of a spec file.

Parameters
specspec file control structure
Returns
>= 0 next rpmParseState, < 0 on error

Definition at line 316 of file parseChangelog.c.

References _, addChangelog(), argvFree(), Package_s::header, headerIsEntry(), rpmSpec_s::lineNum, rpmSpec_s::packages, parseLines(), PART_ERROR, rpmlog(), RPMLOG_ERR, RPMTAG_CHANGELOGTIME, and STRIP_COMMENTS.

Referenced by parseSpec().

◆ parseDescription()

RPM_GNUC_INTERNAL int parseDescription ( rpmSpec  spec)

Parse %description section of a spec file.

Parameters
specspec file control structure
Returns
>= 0 next rpmParseState, < 0 on error

Definition at line 13 of file parseDescription.c.

References _, addLangTag(), freeStringBuf(), getStringBuf(), Package_s::header, rpmSpec_s::line, rpmSpec_s::lineNum, lookupPackage(), optionsTable, parseLines(), PART_ERROR, PART_NAME, PART_SUBNAME, RPMBUILD_DEFAULT_LANG, rpmlog(), RPMLOG_ERR, RPMTAG_DESCRIPTION, STRIP_COMMENTS, STRIP_TRAILINGSPACE, stripTrailingBlanksStringBuf(), and xstrdup.

Referenced by parseSpec().

◆ parseFiles()

◆ parseLines()

RPM_GNUC_INTERNAL int parseLines ( rpmSpec  spec,
int  strip,
ARGV_t avp,
StringBuf sbp 
)

Read next line from spec file.

Parameters
specspec file control structure
striptruncate comments?
[out]avppointer to argv (optional, alloced)
[out]sbppointer to string buf (optional, alloced)
Returns
next spec part or PART_ERROR on error

Definition at line 582 of file parseSpec.c.

References appendStringBufAux(), argvAdd(), isPart(), rpmSpec_s::line, newStringBuf(), PART_ERROR, PART_NONE, readLine(), and STRIP_TRAILINGSPACE.

Referenced by parseChangelog(), parseDescription(), parseFiles(), parseList(), parsePolicies(), parsePrep(), parseScript(), and parseSimpleScript().

◆ parsePolicies()

RPM_GNUC_INTERNAL int parsePolicies ( rpmSpec  spec)

Parse %sepolicy section of a spec file.

Parameters
specspec file control structure
Returns
>= 0 next rpmParseState, < 0 on error

Definition at line 15 of file parsePolicies.c.

References _, rpmSpec_s::line, rpmSpec_s::lineNum, lookupPackage(), optionsTable, parseLines(), PART_ERROR, PART_NAME, PART_SUBNAME, Package_s::policyList, rpmlog(), RPMLOG_ERR, STRIP_COMMENTS, STRIP_TRAILINGSPACE, and xstrdup.

Referenced by parseSpec().

◆ parsePreamble()

◆ parsePrep()

RPM_GNUC_INTERNAL int parsePrep ( rpmSpec  spec)

Parse %prep section of a spec file.

Parameters
specspec file control structure
Returns
>= 0 next rpmParseState, < 0 on error

Definition at line 416 of file parsePrep.c.

References _, appendBuf(), argvFree(), doPatchMacro(), doSetupMacro(), rpmSpec_s::flags, rpmSpec_s::lineNum, newStringBuf(), parseLines(), PART_ERROR, rpmSpec_s::prep, rpmlog(), RPMLOG_ERR, RPMRC_OK, RPMSPEC_FORCE, rstreqn(), and STRIP_PARSED.

Referenced by parseSpec().

◆ parseRCPOT()

RPM_GNUC_INTERNAL rpmRC parseRCPOT ( rpmSpec  spec,
Package  pkg,
const char *  field,
rpmTagVal  tagN,
int  index,
rpmsenseFlags  tagflags,
addReqProvFunction  cb,
void *  cbdata 
)

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

Parameters
specspec file control structure
pkgpackage control structure
fieldtext to parse (e.g. "foo < 0:1.2-3, bar = 5:6.7")
tagNtag, identifies type of dependency
index(0 always)
tagflagsdependency flags already known from context
cbCallback for adding dependency (nullable)
cbdataCallback data (@pkg if NULL)
Returns
RPMRC_OK on success, RPMRC_FAIL on failure

Definition at line 123 of file parseReqs.c.

References _, _free, ALLOWED_CHARS_NAME, ALLOWED_FIRSTCHARS_NAME, checkDep(), freeStringBuf(), getStringBuf(), rpmSpec_s::line, rpmSpec_s::lineNum, newStringBuf(), packageDependencies(), parseRCPOTRichCB(), rasprintf(), rpmCharCheck(), rpmdsCompare(), rpmdsFlags(), rpmdsFree(), rpmdsInit(), rpmdsNext(), rpmdsSingle(), rpmlog(), RPMLOG_ERR, RPMLOG_WARNING, rpmParseDSFlags(), RPMRC_FAIL, RPMRC_OK, rpmrichParseForTag(), RPMSENSE_ANY, RPMSENSE_FIND_PROVIDES, RPMSENSE_FIND_REQUIRES, RPMSENSE_GREATER, RPMSENSE_SCRIPT_PRE, RPMSENSE_SCRIPT_PREUN, RPMSENSE_TRIGGERIN, RPMSENSE_TRIGGERPOSTUN, RPMSENSE_TRIGGERPREIN, RPMSENSE_TRIGGERUN, RPMTAG_BUILDCONFLICTS, RPMTAG_BUILDPREREQ, RPMTAG_BUILDREQUIRES, RPMTAG_CONFLICTNAME, RPMTAG_ENHANCENAME, RPMTAG_FILETRIGGERIN, RPMTAG_FILETRIGGERNAME, RPMTAG_FILETRIGGERPOSTUN, RPMTAG_FILETRIGGERUN, RPMTAG_NOT_FOUND, RPMTAG_OBSOLETENAME, RPMTAG_ORDERNAME, RPMTAG_PREREQ, RPMTAG_PROVIDENAME, RPMTAG_RECOMMENDNAME, RPMTAG_REQUIRENAME, RPMTAG_SUGGESTNAME, RPMTAG_SUPPLEMENTNAME, RPMTAG_TRANSFILETRIGGERIN, RPMTAG_TRANSFILETRIGGERNAME, RPMTAG_TRANSFILETRIGGERPOSTUN, RPMTAG_TRANSFILETRIGGERUN, RPMTAG_TRIGGERIN, RPMTAG_TRIGGERNAME, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERPREIN, RPMTAG_TRIGGERUN, rstrlcpy(), parseRCPOTRichData::sb, SKIPNONWHITE, SKIPWHITE, parseRCPOTRichData::spec, and xmalloc.

Referenced by doBuildRequires(), handlePreambleTag(), parseScript(), rpmfcApplyExternal(), and rpmfcHelper().

◆ parseScript()

RPM_GNUC_INTERNAL int parseScript ( rpmSpec  spec,
int  parsePart 
)

Parse %pre et al scriptlets from a spec file.

Parameters
specspec file control structure
parsePartcurrent rpmParseState
Returns
>= 0 next rpmParseState, < 0 on error

Definition at line 73 of file parseScript.c.

References _, addReqProv(), addReqProvPkg(), addTriggerIndex(), rpmtd_s::count, rpmtd_s::data, freeStringBuf(), getStringBuf(), Package_s::header, headerIsEntry(), headerPut(), HEADERPUT_DEFAULT, headerPutString(), headerPutUint32(), TriggerFileEntry::index, rpmSpec_s::line, rpmSpec_s::lineNum, lookupPackage(), optionsTable, parseLines(), parseRCPOT(), PART_ERROR, PART_FILETRIGGERIN, PART_FILETRIGGERPOSTUN, PART_FILETRIGGERUN, PART_NAME, PART_POST, PART_POSTTRANS, PART_POSTUN, PART_PRE, PART_PRETRANS, PART_PREUN, PART_SUBNAME, PART_TRANSFILETRIGGERIN, PART_TRANSFILETRIGGERPOSTUN, PART_TRANSFILETRIGGERUN, PART_TRIGGERIN, PART_TRIGGERPOSTUN, PART_TRIGGERPREIN, PART_TRIGGERUN, PART_VERIFYSCRIPT, Package_s::postInFile, Package_s::postTransFile, Package_s::postUnFile, Package_s::preInFile, Package_s::preTransFile, Package_s::preUnFile, TriggerFileEntry::priority, TriggerFileEntry::prog, risblank(), RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, rpmlibNeedsFeature(), rpmlog(), RPMLOG_ERR, rpmluaCheckScript(), RPMRC_OK, RPMSCRIPT_FLAG_EXPAND, RPMSCRIPT_FLAG_QFORMAT, RPMSENSE_INTERP, RPMSENSE_POSTTRANS, RPMSENSE_PRETRANS, RPMSENSE_SCRIPT_POST, RPMSENSE_SCRIPT_POSTUN, RPMSENSE_SCRIPT_PRE, RPMSENSE_SCRIPT_PREUN, RPMSENSE_SCRIPT_VERIFY, RPMTAG_FILETRIGGERIN, RPMTAG_FILETRIGGERPOSTUN, RPMTAG_FILETRIGGERSCRIPTFLAGS, RPMTAG_FILETRIGGERSCRIPTPROG, RPMTAG_FILETRIGGERSCRIPTS, RPMTAG_FILETRIGGERUN, RPMTAG_POSTIN, RPMTAG_POSTINFLAGS, RPMTAG_POSTINPROG, RPMTAG_POSTTRANS, RPMTAG_POSTTRANSFLAGS, RPMTAG_POSTTRANSPROG, RPMTAG_POSTUN, RPMTAG_POSTUNFLAGS, RPMTAG_POSTUNPROG, RPMTAG_PREIN, RPMTAG_PREINFLAGS, RPMTAG_PREINPROG, RPMTAG_PRETRANS, RPMTAG_PRETRANSFLAGS, RPMTAG_PRETRANSPROG, RPMTAG_PREUN, RPMTAG_PREUNFLAGS, RPMTAG_PREUNPROG, RPMTAG_REQUIRENAME, RPMTAG_TRANSFILETRIGGERIN, RPMTAG_TRANSFILETRIGGERPOSTUN, RPMTAG_TRANSFILETRIGGERSCRIPTFLAGS, RPMTAG_TRANSFILETRIGGERSCRIPTPROG, RPMTAG_TRANSFILETRIGGERSCRIPTS, RPMTAG_TRANSFILETRIGGERUN, RPMTAG_TRIGGERIN, RPMTAG_TRIGGERPOSTUN, RPMTAG_TRIGGERPREIN, RPMTAG_TRIGGERSCRIPTFLAGS, RPMTAG_TRIGGERSCRIPTPROG, RPMTAG_TRIGGERSCRIPTS, RPMTAG_TRIGGERUN, RPMTAG_VERIFYSCRIPT, RPMTAG_VERIFYSCRIPTFLAGS, RPMTAG_VERIFYSCRIPTPROG, rpmtdReset(), rstreq(), SKIPSPACE, STRIP_NOTHING, stripTrailingBlanksStringBuf(), rpmtd_s::tag, rpmtd_s::type, Package_s::verifyFile, and xstrdup.

Referenced by parseSpec().

◆ parseSimpleScript()

RPM_GNUC_INTERNAL int parseSimpleScript ( rpmSpec  spec,
const char *  name,
StringBuf sbp 
)

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

Parameters
specspec file control structure
parsePartcurrent rpmParseState
Returns
>= 0 next rpmParseState, < 0 on error

Definition at line 12 of file parseSimpleScript.c.

References _, rpmSpec_s::lineNum, parseLines(), PART_ERROR, rpmlog(), RPMLOG_ERR, and STRIP_NOTHING.

Referenced by parseSpec().

◆ parseUnsignedNum()

RPM_GNUC_INTERNAL int parseUnsignedNum ( const char *  line,
uint32_t *  res 
)

Parse an unsigned number.

Parameters
linefrom spec file
[out]respointer to uint32_t
Returns
0 on success, -1 on failure

Definition at line 83 of file misc.c.

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

◆ processBinaryFiles()

◆ processBinaryPolicies()

RPM_GNUC_INTERNAL rpmRC processBinaryPolicies ( rpmSpec  spec,
int  test 
)

Post-build processing for policies in binary package(s).

Parameters
specspec file control structure
testdon't execute scripts or package if testing
Returns
0 on success

Definition at line 298 of file policies.c.

References _, Package_s::header, headerGetAsString(), Package_s::next, rpmSpec_s::packages, Package_s::policyList, rpmlog(), RPMLOG_NOTICE, RPMRC_FAIL, RPMRC_OK, RPMTAG_NVRA, and test.

Referenced by buildSpec().

◆ processSourceFiles()

◆ readLine()

◆ rpmCharCheck()

RPM_GNUC_INTERNAL rpmRC rpmCharCheck ( rpmSpec  spec,
const char *  field,
const char *  allowedchars,
const char *  allowedfirstchars 
)

Check for inappropriate characters.

All alphanums are considered sane.

Parameters
specspec
fieldstring to check
allowedcharsstring of permitted characters
Returns
RPMRC_OK if OK

All alphanums are considered sane.

Parameters
specspec (or NULL)
fieldstring to check
allowedcharsstring of permitted characters
Returns
RPMRC_OK if OK

Definition at line 649 of file parsePreamble.c.

References _, rasprintf(), risalnum(), RPMLOG_ERR, RPMLOG_WARNING, RPMRC_FAIL, RPMRC_OK, and specLog().

Referenced by checkDep(), handlePreambleTag(), parsePreamble(), and parseRCPOT().

◆ rpmlibNeedsFeature()

RPM_GNUC_INTERNAL int rpmlibNeedsFeature ( Package  pkg,
const char *  feature,
const char *  featureEVR 
)

Add rpmlib feature dependency.

Parameters
pkgpackage
featurerpm feature name (i.e. "rpmlib(Foo)" for feature Foo)
featureEVRrpm feature epoch/version/release
Returns
0 always

Definition at line 51 of file reqprov.c.

References addReqProv(), rasprintf(), RPMSENSE_EQUAL, RPMSENSE_LESS, RPMSENSE_MISSINGOK, RPMSENSE_RPMLIB, RPMTAG_REQUIRENAME, and rstreq().

Referenced by finalizeDeps(), genCpioListAndHeader(), getIOFlags(), packageBinary(), packageSources(), parseScript(), and processPackageFiles().

◆ rpmSpecBuild()

int rpmSpecBuild ( rpmts  ts,
rpmSpec  spec,
BTA_t  buildArgs 
)

Spec build stages state machine driver.

Parameters
tsrpm transaction set
specspec file control structure
buildArgsbuild arguments
Returns
0 on success, 1 on build error, RPMRC_MISSINGBUILDREQUIRES on missing build requirements

Definition at line 478 of file build.c.

References rpmBuildArguments_s::buildAmount, and buildSpec().

Referenced by buildForTarget().

◆ rpmSpecCheckDeps()

rpmps rpmSpecCheckDeps ( rpmts  ts,
rpmSpec  spec 
)

Verify build depencies of a spec against.

Parameters
ts(empty) transaction set
specparsed spec control structure
Returns
rpm problem set or NULL on no problems

Definition at line 325 of file spec.c.

References rpmSpecSourceHeader(), rpmtsAddInstallElement(), rpmtsCheck(), rpmtsEmpty(), and rpmtsProblems().

Referenced by doCheckBuildRequires().

◆ rpmSpecDS()

rpmds rpmSpecDS ( rpmSpec  spec,
rpmTagVal  tag 
)

Retrieve build dependency set from spec.

Parameters
specparsed spec control structure
tagdependency tag
Returns
dependency set of tag (or NULL)

Definition at line 320 of file spec.c.

References Package_s::header, rpmdsNew(), and rpmSpec_s::sourcePackage.

◆ rpmSpecFree()

◆ rpmSpecParse()

rpmSpec rpmSpecParse ( const char *  specFile,
rpmSpecFlags  flags,
const char *  buildRoot 
)

Parse spec file into spec control structure.

Todo:
Eliminate buildRoot from here, its a build, not spec property
Parameters
specFilepath to spec file
flagsflags to control operation
buildRootbuildRoot override or NULL for default
Returns
new spec control structure

Definition at line 1123 of file parseSpec.c.

References rpmtd_s::flags, and parseSpec().

Referenced by buildForTarget(), doSpec(), rpmspecQuery(), and spec_new().

◆ rpmspecQuery()

int rpmspecQuery ( rpmts  ts,
QVA_t  qva,
const char *  arg 
)

Function to query spec file(s).

Parameters
tstransaction set
qvaparsed query/verify options
argquery argument
Returns
0 on success, else no. of failures

Definition at line 446 of file spec.c.

References _, Package_s::header, Package_s::next, rpmSpec_s::packages, rpmQVKArguments_s::qva_showPackage, rpmQVKArguments_s::qva_source, rpmlog(), RPMLOG_ERR, RPMQV_SPECBUILTRPMS, RPMQV_SPECRPMS, RPMSPEC_ANYARCH, RPMSPEC_FORCE, rpmSpecFree(), rpmSpecParse(), and rpmSpec_s::sourcePackage.

Referenced by main().

◆ rpmSpecSourceHeader()

Header rpmSpecSourceHeader ( rpmSpec  spec)

Return the headers of the SRPM that would be built from the spec file.

Parameters
specpath to spec file
Returns
Header

Definition at line 315 of file spec.c.

References Package_s::header, and rpmSpec_s::sourcePackage.

Referenced by rpmSpecCheckDeps(), and spec_get_source_header().