rpm: rpmbuild.c File Reference

rpm 4.13.0

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_BUILDINPLACE -1021
#define | POPT_REBUILD 0x4262 /* Bb */
#define | POPT_RECOMPILE 0x4369 /* Ci */
#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_RA 0x4261
#define | POPT_RB 0x4262
#define | POPT_RC 0x4263
#define | POPT_RI 0x4269
#define | POPT_RL 0x426c
#define | POPT_RP 0x4270
#define | POPT_RS 0x4273
#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_EXPORTDB = (1 << 3), MODE_IMPORTDB = (1 << 4), 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 int | buildInPlace = 0
static struct poptOption | rpmBuildPoptTable []
static int | quiet
static struct poptOption | optionsTable []

## Macro Definition Documentation

## ◆ _anyarch

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

Referenced by buildForTarget().

## ◆ buildCleanMask

#define buildCleanMask (RPMBUILD_RMSOURCE|RPMBUILD_RMSPEC)

Referenced by build().

## ◆ POPT_BA

#define POPT_BA 0x6261

Definition at line 35 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_BB

#define POPT_BB 0x6262

Definition at line 36 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_BC

#define POPT_BC 0x6263

Definition at line 37 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_BI

#define POPT_BI 0x6269

Definition at line 38 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_BL

#define POPT_BL 0x626c

Definition at line 39 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_BP

#define POPT_BP 0x6270

Definition at line 40 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_BS

#define POPT_BS 0x6273

Definition at line 41 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_BUILDINPLACE

#define POPT_BUILDINPLACE -1021

Definition at line 31 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_BUILDROOT

#define POPT_BUILDROOT -1015

Definition at line 26 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_NOBUILD

#define POPT_NOBUILD -1017

Definition at line 28 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_NODIRTOKENS

#define POPT_NODIRTOKENS -1020

Definition at line 30 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_NOLANG

#define POPT_NOLANG -1012

Definition at line 23 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RA

#define POPT_RA 0x4261

Definition at line 42 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RB

#define POPT_RB 0x4262

Definition at line 43 of file rpmbuild.c.

## ◆ POPT_RC

#define POPT_RC 0x4263

Definition at line 44 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_REBUILD

#define POPT_REBUILD 0x4262 /* Bb */

Definition at line 33 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RECOMPILE

#define POPT_RECOMPILE 0x4369 /* Ci */

Definition at line 34 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RI

#define POPT_RI 0x4269

Definition at line 45 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RL

#define POPT_RL 0x426c

Definition at line 46 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RMBUILD

#define POPT_RMBUILD -1014

Definition at line 25 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RMSOURCE

#define POPT_RMSOURCE -1013

Definition at line 24 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RMSPEC

#define POPT_RMSPEC -1019

Definition at line 29 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RP

#define POPT_RP 0x4270

Definition at line 47 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_RS

#define POPT_RS 0x4273

Definition at line 48 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_TA

#define POPT_TA 0x7461

Definition at line 49 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_TARGETPLATFORM

#define POPT_TARGETPLATFORM -1016

Definition at line 27 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_TB

#define POPT_TB 0x7462

Definition at line 50 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_TC

#define POPT_TC 0x7463

Definition at line 51 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_TI

#define POPT_TI 0x7469

Definition at line 52 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_TL

#define POPT_TL 0x746c

Definition at line 53 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_TP

#define POPT_TP 0x7470

Definition at line 54 of file rpmbuild.c.

Referenced by buildArgCallback().

## ◆ POPT_TS

#define POPT_TS 0x7473

Definition at line 55 of file rpmbuild.c.

Referenced by buildArgCallback().

## Enumeration Type Documentation

## ◆ modes

enum modes

Enumerator
MODE_BUILD |
MODE_REBUILD |
MODE_RECOMPILE |
MODE_TARBUILD |
MODE_INITDB |
MODE_REBUILDDB |
MODE_VERIFYDB |
MODE_EXPORTDB |
MODE_IMPORTDB |
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 250 of file rpmbuild.c.

## Function Documentation

## ◆ build()

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

Definition at line 533 of file rpmbuild.c.

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

Referenced by main().

## ◆ buildArgCallback()

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

Definition at line 68 of file rpmbuild.c.

References _, argvSplit(), build_targets, rpmBuildArguments_s::buildAmount, buildChar, buildInPlace, buildMode, rpmBuildArguments_s::buildRootOverride, noDeps, rpmBuildArguments_s::pkgFlags, POPT_BA, POPT_BB, POPT_BC, POPT_BI, POPT_BL, POPT_BP, POPT_BS, POPT_BUILDINPLACE, POPT_BUILDROOT, POPT_NOBUILD, POPT_NODIRTOKENS, POPT_NOLANG, POPT_RA, POPT_RC, POPT_REBUILD, POPT_RECOMPILE, POPT_RI, POPT_RL, POPT_RMBUILD, POPT_RMSOURCE, POPT_RMSPEC, POPT_RP, POPT_RS, 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, rpmDefineMacro(), rpmlog(), RPMLOG_ERR, RPMSPEC_FORCE, RPMSPEC_NOLANG, spec_flags, and xstrdup.

## ◆ buildForTarget()

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

Definition at line 420 of file rpmbuild.c.

References _, _anyarch, addMacro(), rpmBuildArguments_s::buildAmount, buildInPlace, 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().

## ◆ checkSpec()

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

Definition at line 277 of file rpmbuild.c.

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

Referenced by buildForTarget().

## ◆ getTarSpec()

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

Definition at line 338 of file rpmbuild.c.

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

Referenced by buildForTarget().

## ◆ isSpecFile()

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

Definition at line 291 of file rpmbuild.c.

References _, rpmlog(), and RPMLOG_ERR.

Referenced by buildForTarget(), and getTarSpec().

## ◆ main()

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

Definition at line 591 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

## ◆ _fsm_debug

int _fsm_debug

## ◆ build_targets

ARGV_t build_targets = NULL
| static

Target platform(s)

Definition at line 65 of file rpmbuild.c.

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

## ◆ buildChar

char buildChar = 0
| static

Build stage (one of "abcilps ")

Definition at line 63 of file rpmbuild.c.

Referenced by buildArgCallback(), and main().

## ◆ buildInPlace

int buildInPlace = 0
| static

from –build-in-place

Definition at line 66 of file rpmbuild.c.

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

## ◆ buildMode

char buildMode = 0
| static

Build mode (one of "btBC")

Definition at line 62 of file rpmbuild.c.

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

## ◆ nobuildAmount

rpmBuildFlags nobuildAmount = 0
| static

Build stage disablers

Definition at line 64 of file rpmbuild.c.

Referenced by main().

## ◆ noDeps

int noDeps = 0
| static

from –nodeps

Definition at line 60 of file rpmbuild.c.

Referenced by buildArgCallback(), and buildForTarget().

## ◆ optionsTable

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
}
rpmBuildPoptTable
static struct poptOption rpmBuildPoptTable[]
Definition: rpmbuild.c:135
rpmcliAllPoptTable
struct poptOption rpmcliAllPoptTable[]
Popt option table for options shared by all modes and executables.
quiet
static int quiet
Definition: rpmbuild.c:257

Definition at line 260 of file rpmbuild.c.

## ◆ program_name

const char* program_name

Definition at line 2 of file rpmbuild.c.

## ◆ quiet

int quiet
| static

Definition at line 257 of file rpmbuild.c.

## ◆ rpmBTArgs

struct rpmBuildArguments_s rpmBTArgs
| static

Definition at line 21 of file rpmbuild.c.

Referenced by buildArgCallback(), and main().

## ◆ rpmBuildPoptTable

struct poptOption rpmBuildPoptTable[]
| static

Definition at line 135 of file rpmbuild.c.

## ◆ shortCircuit

int shortCircuit = 0
| static

from –short-circuit

Definition at line 61 of file rpmbuild.c.

Referenced by main().

## ◆ spec_flags

rpmSpecFlags spec_flags = 0
| static

Bit(s) to control spec parsing.

Definition at line 59 of file rpmbuild.c.

Referenced by buildArgCallback(), and buildForTarget().