rpm
4.8.1
|
This is the only module users of librpmbuild should need to include. More...
#include <rpm/rpmcli.h>
#include <rpm/rpmds.h>
#include <rpm/rpmstring.h>
#include <rpm/rpmspec.h>
Go to the source code of this file.
Macros | |
#define | PART_SUBNAME 0 |
#define | PART_NAME 1 |
#define | PART_BASE 0 |
rpmSpec file parser states. More... | |
#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. More... | |
typedef enum rpmParseState_e | rpmParseState |
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... | |
rpm_time_t * | getBuildTime (void) |
Return build time stamp. More... | |
int | readLine (rpmSpec spec, int strip) |
Read next line from spec file. More... | |
void | closeSpec (rpmSpec spec) |
Stop reading from spec file, freeing resources. More... | |
void | handleComments (char *s) |
Truncate comment lines. More... | |
rpmParseState | isPart (const char *line) |
Check line for section separator, return next parser state. More... | |
uint32_t | parseUnsignedNum (const char *line, uint32_t *res) |
Parse an unsigned number. More... | |
void | addChangelogEntry (Header h, time_t time, const char *name, const char *text) |
Add changelog entry to header. More... | |
int | parseBuildInstallClean (rpmSpec spec, rpmParseState parsePart) |
Parse %build/%install/%clean section(s) of a spec file. More... | |
int | parseChangelog (rpmSpec spec) |
Parse %changelog section of a spec file. More... | |
int | parseDescription (rpmSpec spec) |
Parse %description section of a spec file. More... | |
int | parseFiles (rpmSpec spec) |
Parse %files section of a spec file. More... | |
int | parsePreamble (rpmSpec spec, int initialPackage) |
Parse tags from preamble of a spec file. More... | |
int | parsePrep (rpmSpec spec) |
Parse %prep section of a spec file. More... | |
rpmRC | rpmCharCheck (rpmSpec spec, char *field, size_t fsize, const char *whitelist) |
Check for inappropriate characters. More... | |
rpmRC | parseRCPOT (rpmSpec spec, Package pkg, const char *field, rpmTag tagN, int index, rpmsenseFlags tagflags) |
Parse dependency relations from spec file and/or autogenerated output buffer. More... | |
int | parseScript (rpmSpec spec, int parsePart) |
Parse %pre et al scriptlets from a spec file. More... | |
int | parseExpressionBoolean (rpmSpec spec, const char *expr) |
Evaluate boolean expression. More... | |
char * | parseExpressionString (rpmSpec spec, const char *expr) |
Evaluate string expression. More... | |
rpmRC | doRmSource (rpmSpec spec) |
Remove all sources assigned to spec file. More... | |
rpmRC | doScript (rpmSpec spec, rpmBuildFlags what, const char *name, StringBuf sb, int test) |
Run a build script, assembled from spec file scriptlet section. More... | |
rpmRC | lookupPackage (rpmSpec spec, const char *name, int flag, Package *pkg) |
Find sub-package control structure by name. More... | |
Package | newPackage (rpmSpec 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 (rpmSpec spec, Header h, rpmTag tagN, const char *N, const char *EVR, rpmsenseFlags Flags, uint32_t index) |
Add dependency to header, filtering duplicates. More... | |
int | rpmlibNeedsFeature (Header h, const char *feature, const char *featureEVR) |
Add rpmlib feature dependency. More... | |
int | processBinaryFiles (rpmSpec spec, int installSpecialDoc, int test) |
Post-build processing for binary package(s). More... | |
void | initSourceHeader (rpmSpec spec) |
Create and initialize header for source package. More... | |
int | processSourceFiles (rpmSpec spec) |
Post-build processing for source package. More... | |
int | parseSpec (rpmts ts, const char *specFile, const char *rootDir, const char *buildRoot, int recursing, const char *passPhrase, const char *cookie, int anyarch, int force) |
Parse spec file into spec control structure. More... | |
rpmRC | buildSpec (rpmts ts, rpmSpec spec, int what, int test) |
Build stages state machine driver. More... | |
rpmRC | checkPackages (char *pkgcheck) |
Check package(s). More... | |
rpmRC | packageBinaries (rpmSpec spec) |
Generate binary package(s). More... | |
rpmRC | packageSources (rpmSpec spec) |
Generate source package. More... | |
This is the only module users of librpmbuild should need to include.
Definition in file rpmbuild.h.
#define PART_BASE 0 |
#define PART_NAME 1 |
Definition at line 42 of file rpmbuild.h.
#define PART_SUBNAME 0 |
Definition at line 41 of file rpmbuild.h.
#define STRIP_COMMENTS (1 << 1) |
Definition at line 82 of file rpmbuild.h.
#define STRIP_NOTHING 0 |
Definition at line 80 of file rpmbuild.h.
#define STRIP_TRAILINGSPACE (1 << 0) |
Definition at line 81 of file rpmbuild.h.
typedef enum rpmBuildFlags_e rpmBuildFlags |
Bit(s) to control buildSpec() operation.
typedef enum rpmParseState_e rpmParseState |
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_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 | only for doScript() |
RPMBUILD_RMSPEC | Remove spec file. |
Definition at line 25 of file rpmbuild.h.
enum rpmParseState_e |
Definition at line 51 of file rpmbuild.h.
void addChangelogEntry | ( | Header | h, |
time_t | time, | ||
const char * | name, | ||
const char * | text | ||
) |
Add changelog entry to header.
h | header |
time | time of change |
name | person who made the change |
text | description of change |
int addReqProv | ( | rpmSpec | spec, |
Header | h, | ||
rpmTag | tagN, | ||
const char * | N, | ||
const char * | EVR, | ||
rpmsenseFlags | Flags, | ||
uint32_t | index | ||
) |
Add dependency to header, filtering duplicates.
spec | spec file control structure |
h | header |
tagN | tag, 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 | (0 always) |
const char* buildHost | ( | void | ) |
Return build hostname.
Build stages state machine driver.
ts | transaction set |
spec | spec file control structure |
what | bit(s) to enable stages of build |
test | don't execute scripts or package if testing |
Referenced by buildForTarget().
rpmRC checkPackages | ( | char * | pkgcheck | ) |
Check package(s).
pkgcheck | program to run |
void closeSpec | ( | rpmSpec | spec | ) |
Stop reading from spec file, freeing resources.
spec | spec file control structure |
Remove all sources assigned to spec file.
spec | spec file control structure |
Referenced by buildForTarget().
rpmRC doScript | ( | rpmSpec | spec, |
rpmBuildFlags | what, | ||
const char * | name, | ||
StringBuf | sb, | ||
int | test | ||
) |
Run a build script, assembled from spec file scriptlet section.
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 |
void freeNames | ( | void | ) |
Destroy uid/gid caches.
Referenced by main().
Destroy package control structure.
pkg | package control structure |
Destroy all packages associated with spec file.
packages | package control structure chain |
rpm_time_t* getBuildTime | ( | void | ) |
Return build time stamp.
gid_t getGidS | ( | const char * | gname | ) |
const char* getGname | ( | gid_t | gid | ) |
Return cached group name from group id.
gid | group id |
const char* getGnameS | ( | const char * | gname | ) |
Return cached group name.
gname | group name |
uid_t getUidS | ( | const char * | uname | ) |
const char* getUname | ( | uid_t | uid | ) |
Return cached user name from user id.
uid | user id |
const char* getUnameS | ( | const char * | uname | ) |
Return cached user name.
uname | user name |
void handleComments | ( | char * | s | ) |
Truncate comment lines.
s | skip white space, truncate line at '#' |
void initSourceHeader | ( | rpmSpec | spec | ) |
Create and initialize header for source package.
spec | spec file control structure |
Referenced by buildForTarget().
rpmParseState isPart | ( | const char * | line | ) |
Check line for section separator, return next parser state.
line | from spec file |
Find sub-package control structure by name.
spec | spec file control structure |
name | (sub-)package name |
flag | if PART_SUBNAME, then 1st package name is prepended |
pkg | package control structure |
Create and initialize package control structure.
spec | spec file control structure |
Generate binary package(s).
spec | spec file control structure |
Generate source package.
spec | spec file control structure |
int parseBuildInstallClean | ( | rpmSpec | spec, |
rpmParseState | parsePart | ||
) |
Parse %build/%install/%clean section(s) of a spec file.
spec | spec file control structure |
parsePart | current rpmParseState |
int parseChangelog | ( | rpmSpec | spec | ) |
Parse %changelog section of a spec file.
spec | spec file control structure |
int parseDescription | ( | rpmSpec | spec | ) |
Parse %description section of a spec file.
spec | spec file control structure |
int parseExpressionBoolean | ( | rpmSpec | spec, |
const char * | expr | ||
) |
Evaluate boolean expression.
spec | spec file control structure |
expr | expression to parse |
char* parseExpressionString | ( | rpmSpec | spec, |
const char * | expr | ||
) |
Evaluate string expression.
spec | spec file control structure |
expr | expression to parse |
int parseFiles | ( | rpmSpec | spec | ) |
Parse %files section of a spec file.
spec | spec file control structure |
int parsePreamble | ( | rpmSpec | spec, |
int | initialPackage | ||
) |
Parse tags from preamble of a spec file.
spec | spec file control structure |
initialPackage |
int parsePrep | ( | rpmSpec | spec | ) |
Parse %prep section of a spec file.
spec | spec file control structure |
rpmRC parseRCPOT | ( | rpmSpec | spec, |
Package | pkg, | ||
const char * | field, | ||
rpmTag | tagN, | ||
int | index, | ||
rpmsenseFlags | tagflags | ||
) |
Parse dependency relations from spec file and/or autogenerated output buffer.
spec | spec file control structure |
pkg | package control structure |
field | text to parse (e.g. "foo < 0:1.2-3, bar = 5:6.7") |
tagN | tag, identifies type of dependency |
index | (0 always) |
tagflags | dependency flags already known from context |
int parseScript | ( | rpmSpec | spec, |
int | parsePart | ||
) |
Parse %pre et al scriptlets from a spec file.
spec | spec file control structure |
parsePart | current rpmParseState |
int parseSpec | ( | rpmts | ts, |
const char * | specFile, | ||
const char * | rootDir, | ||
const char * | buildRoot, | ||
int | recursing, | ||
const char * | passPhrase, | ||
const char * | cookie, | ||
int | anyarch, | ||
int | force | ||
) |
Parse spec file into spec control structure.
ts | transaction set (spec file control in ts->spec) |
specFile | |
rootDir | |
buildRoot | |
recursing | parse is recursive? |
passPhrase | |
cookie | |
anyarch | |
force |
Referenced by buildForTarget().
uint32_t parseUnsignedNum | ( | const char * | line, |
uint32_t * | res | ||
) |
Parse an unsigned number.
line | from spec file |
res | pointer to uint32_t |
int processBinaryFiles | ( | rpmSpec | spec, |
int | installSpecialDoc, | ||
int | test | ||
) |
Post-build processing for binary package(s).
spec | spec file control structure |
installSpecialDoc | |
test | don't execute scripts or package if testing |
int processSourceFiles | ( | rpmSpec | spec | ) |
Post-build processing for source package.
spec | spec file control structure |
int readLine | ( | rpmSpec | spec, |
int | strip | ||
) |
Read next line from spec file.
spec | spec file control structure |
strip | truncate comments? |
Check for inappropriate characters.
All alphanums are considered sane.
spec | spec |
field | string to check |
fsize | size of string to check |
whitelist | string of permitted characters |
int rpmlibNeedsFeature | ( | Header | h, |
const char * | feature, | ||
const char * | featureEVR | ||
) |
Add rpmlib feature dependency.
h | header |
feature | rpm feature name (i.e. "rpmlib(Foo)" for feature Foo) |
featureEVR | rpm feature epoch/version/release |