rpm 5.2.1

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

- File List
- Globals

Macros | Functions | Variables
spec.c File Reference
RPMBUILD.

Handle spec data structure. More...

`#include "system.h"`
`#include <rpmio.h>`
`#include <rpmiotypes.h>`
`#include <rpmlog.h>`
`#include "buildio.h"`
`#include "rpmds.h"`
`#include "rpmfi.h"`
`#include "rpmts.h"`
`#include "rpmlua.h"`
`#include "debug.h"`
Include dependency graph for spec.c:

Go to the source code of this file.

## Macros
#define | SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
#define | SKIPNONWHITE(_x) {while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}

## Functions
static struct TriggerFileEntry * | freeTriggerFiles (struct TriggerFileEntry *p)
static struct Source * | freeSources (struct Source *s)
| Destroy source component chain. More...
rpmRC | lookupPackage (Spec spec, const char *name, int flag, Package *pkg)
| Find sub-package control structure by name. More...
Package | newPackage (Spec spec)
| Create and initialize package control structure. More...
Package | freePackage (Package pkg)
| Destroy package control structure. More...
Package | freePackages (Package packages)
| Destroy all packages associated with spec file. More...
static struct Source * | findSource (Spec spec, rpmuint32_t num, int flag)
int | SpecSourceCount (Spec spec)
| Return the count of source set in specfile. More...
SpecSource | getSource (Spec spec, int num)
| Return a source control structure. More...
const char * | specSourceName (SpecSource source)
| Return a ptr to the source file name. More...
const char * | specFullSourceName (SpecSource source)
| Return a ptr to the full url of the source. More...
int | specSourceNum (SpecSource source)
| Return the spec or source patch number. More...
int | specSourceFlags (SpecSource source)
| Return flags set for the source. More...
int | parseNoSource (Spec spec, const char *field, rpmTag tag)
| parseNoSource. More...
int | addSource (Spec spec, Package pkg, const char *field, rpmTag tag)
| addSource. More...
static speclines | newSl (void)
static speclines | freeSl (speclines sl)
static spectags | newSt (void)
static spectags | freeSt (spectags st)
Spec | newSpec (void)
| Create and initialize Spec structure. More...
Spec | freeSpec (Spec spec)
| Destroy Spec structure. More...
struct OpenFileInfo * | newOpenFileInfo (void)
static void | printNewSpecfile (Spec spec)
| Print copy of spec file, filling in Group/Description/Summary from specspo. More...
static int | initSourceHeaderScriptlet (Header h, rpmTag progTag, rpmTag scriptTag, rpmiob iob)
| Add expanded build scriptlet to srpm header. More...
static int | initSourceHeaderScriptlets (Spec spec)
| Add expanded build scriptlets to srpm header. More...
static int | _specQuery (rpmts ts, QVA_t qva, const char *specName, const char *target)
| Parse a spec file, and query the resultant header. More...
int | rpmspecQuery (rpmts ts, QVA_t qva, const char *arg)
| Function to query spec file(s). More...

## Variables
int | specedit

## Detailed Description

Handle spec data structure.

Definition in file spec.c.

## Macro Definition Documentation

#define SKIPNONWHITE | ( |  | _x | ) | {while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}

Definition at line 25 of file spec.c.

Referenced by parseNoSource().

#define SKIPWHITE | ( |  | _x | ) | {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}

Definition at line 24 of file spec.c.

Referenced by parseNoSource().

## Function Documentation

static int _specQuery | ( | rpmts | ts,
|  | QVA_t | qva,
|  | const char * | specName,
|  | const char * | target
| ) |  |
| static

Parse a spec file, and query the resultant header.

Parameters

  ts | rpm transaction
  qva | query args
  specName | specfile to parse
  target | cpu-vender-os platform for query (NULL is current)

Returns
  0 on success

Definition at line 865 of file spec.c.

References _, Package_s::fileList, freeSpec(), Package_s::header, initSourceHeader(), initSourceHeaderScriptlets(), Package_s::next, Spec_s::packages, parseSpec(), printNewSpecfile(), rpmQVKArguments_s::qva_showPackage, rpmQVKArguments_s::qva_source, rpmlog(), RPMLOG_ERR, RPMQV_SPECFILE, RPMQV_SPECSRPM, rpmtsSetSpec(), Spec_s::sourceHeader, and specedit.

Referenced by rpmspecQuery().

static struct Source* findSource | ( | Spec | spec,
|  | rpmuint32_t | num,
|  | int | flag
| ) |  |
| static read

Definition at line 227 of file spec.c.

References Source::flags, Source::next, Source::num, and Spec_s::sources.

Referenced by parseNoSource().

static speclines freeSl | ( | speclines | sl | ) |
| inline static

Definition at line 486 of file spec.c.

References _free(), speclines_s::sl_lines, and speclines_s::sl_nlines.

Referenced by freeSpec().

static struct Source* freeSources | ( | struct Source * | s | ) |
| static read

Destroy source component chain.

Parameters

  s | source component chain

Returns
  NULL always

Definition at line 56 of file spec.c.

References _free(), Source::fullSource, and Source::next.

Referenced by freeSpec().

static spectags freeSt | ( | spectags | st | ) |
| inline static

Definition at line 516 of file spec.c.

References _free(), spectags_s::st_ntags, spectags_s::st_t, spectag_s::t_lang, and spectag_s::t_msgid.

Referenced by freeSpec().

static struct TriggerFileEntry* freeTriggerFiles | ( | struct TriggerFileEntry * | p | ) |
| static read

Parameters

  p | trigger entry chain

Returns
  NULL always

Definition at line 34 of file spec.c.

References _free(), TriggerFileEntry::fileName, TriggerFileEntry::next, TriggerFileEntry::prog, and TriggerFileEntry::script.

Referenced by freePackage().

static int initSourceHeaderScriptlet | ( | Header | h,
|  | rpmTag | progTag,
|  | rpmTag | scriptTag,
|  | rpmiob | iob
| ) |  |
| static

Add expanded build scriptlet to srpm header.

Parameters

  h | srpm header
  progTag | interpreter tag (0 disables)
  scriptTag | script tag (0 disables)
  iob | script body sting buf (NULL disables)

Returns
  0 always

Definition at line 802 of file spec.c.

References alloca(), _HE_s::c, headerPut(), _HE_s::p, prog, RPM_STRING_TYPE, rpmiobStr(), rpmDataType_u::str, _HE_s::t, and _HE_s::tag.

Referenced by initSourceHeaderScriptlets().

static int initSourceHeaderScriptlets | ( | Spec | spec | ) |
| static

Add expanded build scriptlets to srpm header.

Parameters

  spec | spec file control structure

Returns
  0 always

Definition at line 833 of file spec.c.

References Spec_s::build, Spec_s::check, Spec_s::clean, initSourceHeaderScriptlet(), Spec_s::install, Spec_s::prep, Spec_s::sourceHeader, and tagValue().

Referenced by _specQuery().

static speclines newSl | ( | void |  | ) |
| inline static

Definition at line 471 of file spec.c.

References speclines_s::sl_lines, speclines_s::sl_nalloc, speclines_s::sl_nlines, specedit, and xmalloc().

Referenced by newSpec().

static spectags newSt | ( | void |  | ) |
| inline static

Definition at line 501 of file spec.c.

References specedit, spectags_s::st_nalloc, spectags_s::st_ntags, spectags_s::st_t, and xmalloc().

Referenced by newSpec().

static void printNewSpecfile | ( | Spec | spec | ) |
| static

Print copy of spec file, filling in Group/Description/Summary from specspo.

Parameters

  spec | spec file control structure

Definition at line 688 of file spec.c.

References _, _free(), alloca(), Package_s::header, headerGet(), headerSprintf(), Package_s::next, _HE_s::p, Spec_s::packages, rpmDataType_u::ptr, RPMBUILD_DEFAULT_LANG, rpmHeaderFormats, rpmlog(), RPMLOG_ERR, RPMTAG_DESCRIPTION, RPMTAG_GROUP, RPMTAG_NAME, RPMTAG_SUMMARY, Spec_s::sl, speclines_s::sl_lines, speclines_s::sl_nlines, Spec_s::st, spectags_s::st_ntags, spectags_s::st_t, stpcpy(), rpmDataType_u::str, spectag_s::t_lang, spectag_s::t_msgid, spectag_s::t_nlines, spectag_s::t_startx, spectag_s::t_tag, _HE_s::tag, tagName(), xmalloc(), and xstrdup().

Referenced by _specQuery().

## Variable Documentation

int specedit

Definition at line 22 of file poptQV.c.

Referenced by _specQuery(), newSl(), and newSt().