rpm 5.2.1

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

- File List
- Globals

Data Structures | Macros | Typedefs | Functions | Variables
parsePreamble.c File Reference
RPMBUILD.

Parse tags in global section from spec file. More...

`#include "system.h"`
`#include <rpmio.h>`
`#include <rpmiotypes.h>`
`#include <rpmlog.h>`
`#include <rpmurl.h>`
`#include <argv.h>`
`#include <mire.h>`
`#include <rpmbuild.h>`
`#include "debug.h"`
Include dependency graph for parsePreamble.c:

Go to the source code of this file.

## Data Structures
struct | tokenBits_s
struct | optionalTag
struct | PreambleRec_s

## Macros
#define | _RPMEVR_INTERNAL
#define | _RPMTAG_INTERNAL /* XXX rpmTags->aTags */
#define | SINGLE_TOKEN_ONLY

## Typedefs
typedef struct tokenBits_s * | tokenBits
typedef struct PreambleRec_s * | PreambleRec

## Functions
static void | addOrAppendListEntry (Header h, rpmTag tag, char *line)
static int | parseSimplePart (Spec spec, char **Np, rpmParseState *flag)
static int | parseYesNo (const char *s)
static int | parseBits (const char *s, const tokenBits tokbits, rpmsenseFlags *bp)
static char * | findLastChar (char *s)
static int | isMemberInEntry (Header h, const char *name, rpmTag tag)
static int | checkForValidArchitectures (Spec spec)
static rpmRC | checkForRequired (Header h, const char *NVR)
| Check that required tags are present in header. More...
static rpmRC | checkForDuplicates (Header h, const char *NVR)
| Check that no duplicate tags are present in header. More...
static void | fillOutMainPackage (Header h)
static int | doIcon (Spec spec, Header h)
spectag | stashSt (Spec spec, Header h, rpmTag tag, const char *lang)
| stashSt. More...
static rpmRC | tagValidate (Spec spec, rpmTag tag, const char *value)
static rpmRC | handlePreambleTag (Spec spec, Package pkg, rpmTag tag, const char *macro, const char *lang)
static int | findPreambleTag (Spec spec, rpmTag *tagp, const char **macro, char *lang)
int | parsePreamble (Spec spec, int initialPackage)
| Parse tags from preamble of a spec file. More...

## Variables
static rpmTag | copyTagsDuringParse []
static rpmTag | requiredTags []
static struct tokenBits_s | installScriptBits []
static struct tokenBits_s | buildScriptBits []
static struct optionalTag | optionalTags []
int | noLang
static struct PreambleRec_s | preambleList []

## Detailed Description

Parse tags in global section from spec file.

Definition in file parsePreamble.c.

## Macro Definition Documentation

#define _RPMEVR_INTERNAL

Definition at line 15 of file parsePreamble.c.

#define _RPMTAG_INTERNAL /* XXX rpmTags->aTags */

Definition at line 16 of file parsePreamble.c.

#define SINGLE_TOKEN_ONLY

Value:
if (multiToken) { \
rpmlog(RPMLOG_ERR, _("line %d: Tag takes single token only: %s\n"), \
spec->lineNum, spec->line); \
return RPMRC_FAIL; \
}

Definition at line 553 of file parsePreamble.c.

Referenced by handlePreambleTag().

## Typedef Documentation

typedef struct PreambleRec_s * PreambleRec

typedef struct tokenBits_s * tokenBits

## Function Documentation

static void addOrAppendListEntry | ( | Header | h,
|  | rpmTag | tag,
|  | char * | line
| ) |  |
| static

Definition at line 72 of file parsePreamble.c.

References _free(), alloca(), _HE_s::append, rpmDataType_u::argv, _HE_s::c, headerPut(), _HE_s::p, RPM_STRING_ARRAY_TYPE, _HE_s::t, and _HE_s::tag.

Referenced by handlePreambleTag().

static rpmRC checkForDuplicates | ( | Header | h,
|  | const char * | NVR
| ) |  |
| static

Check that no duplicate tags are present in header.

Parameters

  h | header
  NVR | package name-version-release

Returns
  RPMRC_OK if OK

Definition at line 332 of file parsePreamble.c.

References _, _free(), alloca(), headerFini(), headerInit(), headerNext(), _HE_s::p, rpmDataType_u::ptr, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, _HE_s::tag, and tagName().

Referenced by parsePreamble().

static rpmRC checkForRequired | ( | Header | h,
|  | const char * | NVR
| ) |  |
| static

Check that required tags are present in header.

Parameters

  h | header
  NVR | package name-version-release

Returns
  RPMRC_OK if OK

Definition at line 308 of file parsePreamble.c.

References _, headerIsEntry(), requiredTags, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, and tagName().

Referenced by parsePreamble().

static int checkForValidArchitectures | ( | Spec | spec | ) |
| static

Definition at line 271 of file parsePreamble.c.

References _, _free(), isMemberInEntry(), rpmExpand(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMTAG_EXCLUDEARCH, RPMTAG_EXCLUDEOS, RPMTAG_EXCLUSIVEARCH, RPMTAG_EXCLUSIVEOS, and Spec_s::sourceHeader.

Referenced by parsePreamble().

static int doIcon | ( | Spec | spec,
|  | Header | h
| ) |  |
| static

Definition at line 415 of file parsePreamble.c.

References _, _free(), alloca(), _HE_s::c, F_OK, Fclose(), Ferror(), Source::flags, Fopen(), Fread(), Fstrerror(), headerPut(), Source::next, _HE_s::p, RPM_BIN_TYPE, rpmExpandNumeric(), RPMFILE_ICON, rpmGenPath(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMTAG_GIF, RPMTAG_XPM, Source::source, Spec_s::sources, _HE_s::t, _HE_s::tag, tagValue(), rpmDataType_u::ui8p, URL_IS_DASH, URL_IS_FTP, URL_IS_HKP, URL_IS_HTTP, URL_IS_HTTPS, URL_IS_PATH, URL_IS_UNKNOWN, and urlPath().

Referenced by handlePreambleTag().

static void fillOutMainPackage | ( | Header | h | ) |
| static

Definition at line 378 of file parsePreamble.c.

References _free(), alloca(), _HE_s::c, headerIsEntry(), headerPut(), optionalTags, optionalTag::ot_mac, optionalTag::ot_tag, _HE_s::p, RPM_STRING_TYPE, rpmExpand(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, tagCanonicalize(), and tagGenerate().

Referenced by parsePreamble().

static char* findLastChar | ( | char * | s | ) |
| inline static

Definition at line 224 of file parsePreamble.c.

Referenced by handlePreambleTag().

static int findPreambleTag | ( | Spec | spec,
|  | rpmTag * | tagp,
|  | const char ** | macro,
|  | char * | lang
| ) |  |
| static

Definition at line 1004 of file parsePreamble.c.

References _, _free(), argvSearch(), argvStrcasecmp(), Spec_s::line, PreambleRec_s::multiLang, PreambleRec_s::obsolete, RPMBUILD_DEFAULT_LANG, rpmlog(), RPMLOG_ERR, RPMTAG_PATCH, RPMTAG_SOURCE, rpmTags, SKIPSPACE, PreambleRec_s::tag, tagCanonicalize(), tagGenerate(), tagName(), PreambleRec_s::token, xisspace(), and xstrncasecmp().

Referenced by parsePreamble().

static rpmRC handlePreambleTag | ( | Spec | spec,
|  | Package | pkg,
|  | rpmTag | tag,
|  | const char * | macro,
|  | const char * | lang
| ) |  |
| static

Definition at line 599 of file parsePreamble.c.

References _, _free(), addMacro(), addOrAppendListEntry(), addSource(), alloca(), _HE_s::append, rpmDataType_u::argv, Package_s::autoProv, Package_s::autoReq, Spec_s::BACount, Spec_s::BANames, _HE_s::c, delMacro(), doIcon(), findLastChar(), Package_s::header, headerAddI18NString(), headerGet(), headerPut(), Spec_s::line, Spec_s::lineNum, Spec_s::macros, Package_s::noarch, noLang, Spec_s::noSource, Source::num, _HE_s::p, parseBits(), parseNoSource(), parseNum(), parseRCPOT(), parseYesNo(), rpmDataType_u::ptr, RMIL_OLDSPEC, RMIL_SPEC, Spec_s::rootURL, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPM_UINT32_TYPE, RPMBUILD_DEFAULT_LANG, rpmExpand(), rpmGenPath(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, RPMTAG_AUTOPROV, RPMTAG_AUTOREQ, RPMTAG_AUTOREQPROV, RPMTAG_BUILDARCHS, RPMTAG_BUILDCONFLICTS, RPMTAG_BUILDENHANCES, RPMTAG_BUILDOBSOLETES, RPMTAG_BUILDPLATFORMS, RPMTAG_BUILDPREREQ, RPMTAG_BUILDPROVIDES, RPMTAG_BUILDREQUIRES, RPMTAG_BUILDROOT, RPMTAG_BUILDSUGGESTS, RPMTAG_CLASS, RPMTAG_CONFLICTFLAGS, RPMTAG_CVSID, RPMTAG_DISTEPOCH, RPMTAG_DISTRIBUTION, RPMTAG_DISTTAG, RPMTAG_DOCDIR, RPMTAG_ENHANCESFLAGS, RPMTAG_EPOCH, RPMTAG_EXCLUDEARCH, RPMTAG_EXCLUDEOS, RPMTAG_EXCLUSIVEARCH, RPMTAG_EXCLUSIVEOS, RPMTAG_GROUP, RPMTAG_ICON, RPMTAG_KEYWORDS, RPMTAG_LICENSE, RPMTAG_NAME, RPMTAG_NOPATCH, RPMTAG_NOSOURCE, RPMTAG_OBSOLETEFLAGS, RPMTAG_PACKAGER, RPMTAG_PATCH, RPMTAG_PREFIXES, RPMTAG_PREREQ, RPMTAG_PROVIDEFLAGS, RPMTAG_RELEASE, RPMTAG_REPOTAG, RPMTAG_REQUIREFLAGS, RPMTAG_SOURCE, RPMTAG_SUGGESTSFLAGS, RPMTAG_SUMMARY, RPMTAG_URL, RPMTAG_VARIANTS, RPMTAG_VENDOR, RPMTAG_VERSION, RPMTAG_XMAJOR, RPMTAG_XMINOR, SINGLE_TOKEN_ONLY, SKIPNONSPACE, SKIPSPACE, Spec_s::sourceHeader, stashSt(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, tagName(), tagValidate(), Spec_s::toplevel, rpmDataType_u::ui32p, and urlPath().

Referenced by parsePreamble().

static int isMemberInEntry | ( | Header | h,
|  | const char * | name,
|  | rpmTag | tag
| ) |  |
| static

Definition at line 245 of file parsePreamble.c.

References _free(), alloca(), rpmDataType_u::argv, _HE_s::c, headerGet(), _HE_s::p, rpmDataType_u::ptr, _HE_s::tag, and xstrcasecmp().

Referenced by checkForValidArchitectures().

static int parseBits | ( | const char * | s,
|  | const tokenBits | tokbits,
|  | rpmsenseFlags * | bp
| ) |  |
| static

Definition at line 187 of file parsePreamble.c.

References tokenBits_s::bits, tokenBits_s::name, RPMRC_FAIL, RPMRC_OK, xisalpha(), and xisspace().

Referenced by handlePreambleTag().

static int parseSimplePart | ( | Spec | spec,
|  | char ** | Np,
|  | rpmParseState * | flag
| ) |  |
| static

Definition at line 98 of file parsePreamble.c.

References _free(), Spec_s::line, PART_NAME, PART_SUBNAME, and xstrdup().

Referenced by parsePreamble().

static int parseYesNo | ( | const char * | s | ) |
| inline static

Definition at line 144 of file parsePreamble.c.

References xstrcasecmp().

Referenced by handlePreambleTag().

static rpmRC tagValidate | ( | Spec | spec,
|  | rpmTag | tag,
|  | const char * | value
| ) |  |
| static

Definition at line 564 of file parsePreamble.c.

References _, _free(), Spec_s::line, Spec_s::lineNum, mireFree(), mireNew(), mireRegcomp(), mireRegexec(), mireSetCOptions(), rpmExpand(), rpmlog(), RPMLOG_ERR, RPMMIRE_REGEX, RPMRC_FAIL, RPMRC_OK, and tagName().

Referenced by handlePreambleTag().

## Variable Documentation

struct tokenBits_s buildScriptBits[]
| static

Initial value:
= {
{ "prep", RPMSENSE_SCRIPT_PREP },
{ "build", RPMSENSE_SCRIPT_BUILD },
{ "install", RPMSENSE_SCRIPT_INSTALL },
{ "clean", RPMSENSE_SCRIPT_CLEAN },
{ "hint", RPMSENSE_MISSINGOK },
{ NULL, 0 }
}

Definition at line 176 of file parsePreamble.c.

rpmTag copyTagsDuringParse[]
| static

Initial value:
= {
RPMTAG_EPOCH,
RPMTAG_VERSION,
RPMTAG_RELEASE,
RPMTAG_DISTEPOCH,
RPMTAG_LICENSE,
RPMTAG_GROUP,
RPMTAG_SUMMARY,
RPMTAG_DESCRIPTION,
RPMTAG_PACKAGER,
RPMTAG_DISTRIBUTION,
RPMTAG_DISTURL,
RPMTAG_VENDOR,
RPMTAG_ICON,
RPMTAG_GIF,
RPMTAG_XPM,
RPMTAG_URL,
RPMTAG_CHANGELOGTIME,
RPMTAG_CHANGELOGNAME,
RPMTAG_CHANGELOGTEXT,
RPMTAG_PREFIXES,
RPMTAG_DISTTAG,
RPMTAG_CVSID,
RPMTAG_VARIANTS,
RPMTAG_XMAJOR,
RPMTAG_XMINOR,
RPMTAG_REPOTAG,
RPMTAG_KEYWORDS,
0
}

Definition at line 26 of file parsePreamble.c.

Referenced by parsePreamble().

struct tokenBits_s installScriptBits[]
| static

Initial value:
= {
{ "interp", RPMSENSE_INTERP },
{ "preun", RPMSENSE_SCRIPT_PREUN },
{ "pre", RPMSENSE_SCRIPT_PRE },
{ "postun", RPMSENSE_SCRIPT_POSTUN },
{ "post", RPMSENSE_SCRIPT_POST },
{ "rpmlib", RPMSENSE_RPMLIB },
{ "verify", RPMSENSE_SCRIPT_VERIFY },
{ "hint", RPMSENSE_MISSINGOK },
{ NULL, 0 }
}

Definition at line 161 of file parsePreamble.c.

int noLang

Definition at line 61 of file poptBT.c.

struct optionalTag optionalTags[]
| static

Initial value:
= {
{ RPMTAG_VENDOR, "%{vendor}" },
{ RPMTAG_PACKAGER, "%{packager}" },
{ RPMTAG_DISTEPOCH, "%{distepoch}" },
{ RPMTAG_DISTRIBUTION, "%{distribution}" },
{ RPMTAG_DISTTAG, "%{disttag}" },
{ RPMTAG_DISTURL, "%{disturl}" },
{ 0xffffffff, "%{class}" },
{ -1, NULL }
}

Referenced by fillOutMainPackage().

struct PreambleRec_s preambleList[]
| static

Definition at line 935 of file parsePreamble.c.

rpmTag requiredTags[]
| static

Initial value:
= {
RPMTAG_NAME,
RPMTAG_VERSION,
RPMTAG_RELEASE,
RPMTAG_SUMMARY,
RPMTAG_GROUP,
RPMTAG_LICENSE,
0
}

Definition at line 60 of file parsePreamble.c.

Referenced by checkForRequired().