rpm: rpmbuild.c File Reference

rpm 4.11.1-rc1

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

- File List
- Globals

Macros | Enumerations | Functions | Variables
rpmbuild.c File Reference
`#include "system.h"`
`#include <errno.h>`
`#include <libgen.h>`
`#include <ctype.h>`
`#include <rpm/rpmcli.h>`
`#include <rpm/rpmlib.h>`
`#include <rpm/rpmbuild.h>`
`#include <rpm/rpmlog.h>`
`#include <rpm/rpmfileutil.h>`
`#include <rpm/rpmdb.h>`
`#include <rpm/rpmps.h>`
`#include <rpm/rpmts.h>`
`#include "lib/signature.h"`
`#include "cliutils.h"`
`#include "debug.h"`
Include dependency graph for rpmbuild.c:

Go to the source code of this file.

## Macros
#define | POPT_NOLANG -1012
#define | POPT_RMSOURCE -1013
#define | POPT_RMBUILD -1014
#define | POPT_BUILDROOT -1015
#define | POPT_TARGETPLATFORM -1016
#define | POPT_NOBUILD -1017
#define | POPT_RMSPEC -1019
#define | POPT_NODIRTOKENS -1020
#define | POPT_REBUILD 0x4220
#define | POPT_RECOMPILE 0x4320
#define | POPT_BA 0x6261
#define | POPT_BB 0x6262
#define | POPT_BC 0x6263
#define | POPT_BI 0x6269
#define | POPT_BL 0x626c
#define | POPT_BP 0x6270
#define | POPT_BS 0x6273
#define | POPT_TA 0x7461
#define | POPT_TB 0x7462
#define | POPT_TC 0x7463
#define | POPT_TI 0x7469
#define | POPT_TL 0x746c
#define | POPT_TP 0x7470
#define | POPT_TS 0x7473
#define | _anyarch(_f) (((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0)
#define | buildCleanMask (RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)

## Enumerations
enum | modes { MODE_BUILD = (1 << 4), MODE_REBUILD = (1 << 5), MODE_RECOMPILE = (1 << 8), MODE_TARBUILD = (1 << 11), MODE_INITDB = (1 << 0), MODE_REBUILDDB = (1 << 1), MODE_VERIFYDB = (1 << 2), MODE_CHECKSIG = (1 << 0), MODE_IMPORTKEY = (1 << 1), MODE_DELKEY = (1 << 2), MODE_LISTKEY = (1 << 3), MODE_QUERY = (1 << 0), MODE_VERIFY = (1 << 3), MODE_INSTALL = (1 << 1), MODE_ERASE = (1 << 2), MODE_UNKNOWN = 0, MODE_ADDSIGN = (1 << 0), MODE_RESIGN = (1 << 1), MODE_DELSIGN = (1 << 2), MODE_UNKNOWN = 0, MODE_QUERY = (1 << 0), MODE_PARSE = (1 << 1) }

## Functions
static void | buildArgCallback (poptContext con, enum poptCallbackReason reason, const struct poptOption *opt, const char *arg, const void *data)
static int | checkSpec (rpmts ts, rpmSpec spec)
static int | isSpecFile (const char *specfile)
static char * | getTarSpec (const char *arg)
static int | buildForTarget (rpmts ts, const char *arg, BTA_t ba)
static int | build (rpmts ts, const char *arg, BTA_t ba, const char *rcfile)
int | main (int argc, char *argv[])

## Variables
const char * | program_name
static struct rpmBuildArguments_s | rpmBTArgs
int | _fsm_debug
static rpmSpecFlags | spec_flags = 0
static int | noDeps = 0
static int | shortCircuit = 0
static char | buildMode = 0
static char | buildChar = 0
static rpmBuildFlags | nobuildAmount = 0
static ARGV_t | build_targets = NULL
static struct poptOption | rpmBuildPoptTable []
static int | quiet
static struct poptOption | optionsTable []

## Macro Definition Documentation

#define _anyarch | ( |  | _f | ) | (((_f)&(RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL|RPMBUILD_PACKAGEBINARY)) == 0)

Referenced by buildForTarget().

#define buildCleanMask (RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)

Referenced by build().

#define POPT_BA 0x6261

Definition at line 34 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_BB 0x6262

Definition at line 35 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_BC 0x6263

Definition at line 36 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_BI 0x6269

Definition at line 37 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_BL 0x626c

Definition at line 38 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_BP 0x6270

Definition at line 39 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_BS 0x6273

Definition at line 40 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_BUILDROOT -1015

Definition at line 26 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_NOBUILD -1017

Definition at line 28 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_NODIRTOKENS -1020

Definition at line 30 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_NOLANG -1012

Definition at line 23 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_REBUILD 0x4220

Definition at line 32 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_RECOMPILE 0x4320

Definition at line 33 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_RMBUILD -1014

Definition at line 25 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_RMSOURCE -1013

Definition at line 24 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_RMSPEC -1019

Definition at line 29 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_TA 0x7461

Definition at line 41 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_TARGETPLATFORM -1016

Definition at line 27 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_TB 0x7462

Definition at line 42 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_TC 0x7463

Definition at line 43 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_TI 0x7469

Definition at line 44 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_TL 0x746c

Definition at line 45 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_TP 0x7470

Definition at line 46 of file rpmbuild.c.

Referenced by buildArgCallback().

#define POPT_TS 0x7473

Definition at line 47 of file rpmbuild.c.

Referenced by buildArgCallback().

## Enumeration Type Documentation

enum modes

Enumerator
MODE_BUILD |
MODE_REBUILD |
MODE_RECOMPILE |
MODE_TARBUILD |
MODE_INITDB |
MODE_REBUILDDB |
MODE_VERIFYDB |
MODE_CHECKSIG |
MODE_IMPORTKEY |
MODE_DELKEY |
MODE_LISTKEY |
MODE_QUERY |
MODE_VERIFY |
MODE_INSTALL |
MODE_ERASE |
MODE_UNKNOWN |
MODE_ADDSIGN |
MODE_RESIGN |
MODE_DELSIGN |
MODE_UNKNOWN |
MODE_QUERY |
MODE_PARSE |

Definition at line 204 of file rpmbuild.c.

## Function Documentation

static int build | ( | rpmts | ts,
|  | const char * | arg,
|  | BTA_t | ba,
|  | const char * | rcfile
| ) |  |
| static

Definition at line 472 of file rpmbuild.c.

References _, _RPMVSF_NODIGESTS, _RPMVSF_NOSIGNATURES, argvJoin(), build_targets, rpmBuildArguments_s::buildAmount, buildCleanMask, buildForTarget(), rpmcliQueryFlags, rpmExpandNumeric(), rpmFreeMacros(), rpmFreeRpmrc(), rpmReadConfigFiles(), rpmtsSetVSFlags(), RPMVSF_NOHDRCHK, target, VERIFY_DIGEST, VERIFY_HDRCHK, and VERIFY_SIGNATURE.

Referenced by main().

static void buildArgCallback | ( | poptContext | con,
|  | enum poptCallbackReason | reason,
|  | const struct poptOption * | opt,
|  | const char * | arg,
|  | const void * | data
| ) |  |
| static

Definition at line 59 of file rpmbuild.c.

References _, argvSplit(), build_targets, rpmBuildArguments_s::buildAmount, buildChar, buildMode, rpmBuildArguments_s::buildRootOverride, noDeps, rpmBuildArguments_s::pkgFlags, POPT_BA, POPT_BB, POPT_BC, POPT_BI, POPT_BL, POPT_BP, POPT_BS, POPT_BUILDROOT, POPT_NOBUILD, POPT_NODIRTOKENS, POPT_NOLANG, POPT_REBUILD, POPT_RECOMPILE, POPT_RMBUILD, POPT_RMSOURCE, POPT_RMSPEC, POPT_TA, POPT_TARGETPLATFORM, POPT_TB, POPT_TC, POPT_TI, POPT_TL, POPT_TP, POPT_TS, rpmBTArgs, RPMBUILD_NOBUILD, RPMBUILD_PKG_NODIRTOKENS, RPMBUILD_RMBUILD, RPMBUILD_RMSOURCE, RPMBUILD_RMSPEC, RPMCLI_POPT_FORCE, rpmlog(), RPMLOG_ERR, RPMSPEC_FORCE, RPMSPEC_NOLANG, spec_flags, and xstrdup.

static int buildForTarget | ( | rpmts | ts,
|  | const char * | arg,
|  | BTA_t | ba
| ) |  |
| static

Definition at line 366 of file rpmbuild.c.

References _, _anyarch, addMacro(), rpmBuildArguments_s::buildAmount, buildMode, rpmBuildArguments_s::buildRootOverride, checkSpec(), getTarSpec(), isSpecFile(), noDeps, rasprintf(), RMIL_TARBALL, RPMBUILD_RMSOURCE, RPMBUILD_RMSPEC, rpmGenPath(), rpmGetCwd(), rpmlog(), RPMLOG_ERR, rpmMkdirs(), RPMSPEC_ANYARCH, rpmSpecBuild(), rpmSpecFree(), rpmSpecParse(), rpmtsRootDir(), rstreq(), rstrscat(), spec_flags, and xstrdup.

Referenced by build().

static int checkSpec | ( | rpmts | ts,
|  | rpmSpec | spec
| ) |  |
| static

Definition at line 231 of file rpmbuild.c.

References _, rpmlog(), RPMLOG_ERR, rpmpsFree(), rpmpsPrint(), and rpmSpecCheckDeps().

Referenced by buildForTarget().

static char* getTarSpec | ( | const char * | arg | ) |
| static

Definition at line 292 of file rpmbuild.c.

References _, isSpecFile(), rasprintf(), rpmExpand(), rpmGetPath(), rpmlog(), and RPMLOG_ERR.

Referenced by buildForTarget().

static int isSpecFile | ( | const char * | specfile | ) |
| static

Definition at line 245 of file rpmbuild.c.

References _, rpmlog(), and RPMLOG_ERR.

Referenced by buildForTarget(), and getTarSpec().

int main | ( | int | argc,
|  | char * | argv[]
| ) |  |

Definition at line 526 of file rpmbuild.c.

References _, _free, argerror(), argvFree(), build(), build_targets, rpmBuildArguments_s::buildAmount, buildChar, buildMode, rpmBuildArguments_s::buildRootOverride, rpmBuildArguments_s::cookie, finishPipe(), initPipe(), MODE_BUILD, MODE_REBUILD, MODE_RECOMPILE, MODE_TARBUILD, nobuildAmount, printUsage(), RETVAL, rpmBuildArguments_s::rootdir, rpmBTArgs, RPMBUILD_BUILD, RPMBUILD_CHECK, RPMBUILD_CLEAN, RPMBUILD_FILECHECK, RPMBUILD_INSTALL, RPMBUILD_PACKAGEBINARY, RPMBUILD_PACKAGESOURCE, RPMBUILD_PREP, RPMBUILD_RMBUILD, RPMBUILD_RMSOURCE, RPMBUILD_RMSPEC, rpmcliFini(), rpmcliInit(), rpmcliPipeOutput, rpmcliRcfile, rpmcliRootDir, rpmFreeMacros(), rpmInstallSource(), RPMLOG_INFO, RPMLOG_WARNING, rpmReadConfigFiles(), rpmSetVerbosity, rpmtsCreate(), rpmtsFree(), rpmtsSetRootDir(), and shortCircuit.

## Variable Documentation

int _fsm_debug

ARGV_t build_targets = NULL
| static

Target platform(s)

Definition at line 57 of file rpmbuild.c.

Referenced by build(), buildArgCallback(), and main().

char buildChar = 0
| static

Build stage (one of "abcilps ")

Definition at line 55 of file rpmbuild.c.

Referenced by buildArgCallback(), and main().

char buildMode = 0
| static

Build mode (one of "btBC")

Definition at line 54 of file rpmbuild.c.

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

rpmBuildFlags nobuildAmount = 0
| static

Build stage disablers

Definition at line 56 of file rpmbuild.c.

Referenced by main().

int noDeps = 0
| static

from –nodeps

Definition at line 52 of file rpmbuild.c.

Referenced by buildArgCallback(), and buildForTarget().

struct poptOption optionsTable[]
| static

Initial value:
= {
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmBuildPoptTable, 0,
"Build options with [ <specfile> | <tarball> | <source package> ]:" ,
NULL },
{ "quiet", '\0', POPT_ARGFLAG_DOC_HIDDEN, &quiet, 0, NULL, NULL},
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
"Common options for all rpm modes and executables:" ,
NULL },
POPT_AUTOALIAS
POPT_AUTOHELP
POPT_TABLEEND
}

Definition at line 214 of file rpmbuild.c.

const char* program_name

Definition at line 2 of file rpmbuild.c.

int quiet
| static

Definition at line 211 of file rpmbuild.c.

struct rpmBuildArguments_s rpmBTArgs
| static

Definition at line 21 of file rpmbuild.c.

Referenced by buildArgCallback(), and main().

struct poptOption rpmBuildPoptTable[]
| static

Definition at line 115 of file rpmbuild.c.

int shortCircuit = 0
| static

from –short-circuit

Definition at line 53 of file rpmbuild.c.

Referenced by main().

rpmSpecFlags spec_flags = 0
| static

Bit(s) to control spec parsing.

Definition at line 51 of file rpmbuild.c.

Referenced by buildArgCallback(), and buildForTarget().