rpm: rpmbuild.c File Reference

rpm 4.10.0

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

- File List
- Globals

Defines | 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.

## Defines
#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_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 ARGV_t | build_targets = NULL
static struct poptOption | rpmBuildPoptTable []
static int | quiet
static struct poptOption | optionsTable []

## Define 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_ADDSIGN |
  MODE_RESIGN |
  MODE_DELSIGN |
  MODE_UNKNOWN |
  MODE_QUERY |
  MODE_PARSE |

Definition at line 198 of file rpmbuild.c.

## Function Documentation

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

Definition at line 466 of file rpmbuild.c.

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

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 58 of file rpmbuild.c.

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

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

Definition at line 360 of file rpmbuild.c.

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

Referenced by build().

static int checkSpec | ( | rpmts | ts,
|  | rpmSpec | spec
| ) |  | `[static]`

Definition at line 225 of file rpmbuild.c.

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

Referenced by buildForTarget().

static char* getTarSpec | ( | const char * | arg | ) | `[static]`

Definition at line 286 of file rpmbuild.c.

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

Referenced by buildForTarget().

static int isSpecFile | ( | const char * | specfile | ) | `[static]`

Definition at line 239 of file rpmbuild.c.

References rpmlog(), RPMLOG_ERR, and _.

Referenced by getTarSpec(), and buildForTarget().

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

Definition at line 520 of file rpmbuild.c.

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

## Variable Documentation

int _fsm_debug

ARGV_t build_targets = NULL`[static]`

Target platform(s)

Definition at line 56 of file rpmbuild.c.

Referenced by buildArgCallback(), build(), 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().

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 208 of file rpmbuild.c.

const char* program_name

Definition at line 2 of file rpmbuild.c.

int quiet`[static]`

Definition at line 205 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 114 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().