# build/parsePreamble.c File Reference

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

`#include "system.h"`
`#include <rpmio_internal.h>`
`#include <rpmbuild.h>`
`#include "debug.h"`

Go to the source code of this file.

## Data Structures

struct | tokenBits_s
struct | optionalTag
struct | PreambleRec_s

## Defines

#define | SINGLE_TOKEN_ONLY

## Typedefs

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

## Functions

static void | addOrAppendListEntry (Header h, int_32 tag, char *line)
static int | parseSimplePart (char *line, char **name, int *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 int | checkForRequired (Header h, const char *NVR)
| Check that required tags are present in header.
static int | checkForDuplicates (Header h, const char *NVR)
| Check that no duplicate tags are present in header.
static void | fillOutMainPackage (Header h)
static int | readIcon (Header h, const char *file)
spectag | stashSt (Spec spec, Header h, int tag, const char *lang)
static int | handlePreambleTag (Spec spec, Package pkg, int tag, const char *macro, const char *lang)
static void | initPreambleList (void)
static int | findPreambleTag (Spec spec, int *tag, const char **macro, char *lang)
int | parsePreamble (Spec spec, int initialPackage)
| Parse tags from preamble of a spec file.

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

## Define Documentation

#define SINGLE_TOKEN_ONLY

Value:

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

Definition at line 432 of file parsePreamble.c.

## Typedef Documentation

typedef struct PreambleRec_s * PreambleRec

typedef struct tokenBits_s * tokenBits

## Function Documentation

static void addOrAppendListEntry | ( | Header | h,
|  | int_32 | tag,
|  | char * | line |
| ) |  |  | `[static]`

Definition at line 51 of file parsePreamble.c.

static int 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:
  0 if OK

Definition at line 286 of file parsePreamble.c.

static int checkForRequired | ( | Header | h,
|  | const char * | NVR |
| ) |  |  | `[static]`

Check that required tags are present in header.

Parameters:

  | h | header
  | NVR | package name-version-release

Returns:
  0 if OK

Definition at line 262 of file parsePreamble.c.

static int checkForValidArchitectures | ( | Spec | spec | ) | `[static]`

Definition at line 218 of file parsePreamble.c.

static void fillOutMainPackage | ( | Header | h | ) | `[static]`

Definition at line 324 of file parsePreamble.c.

static char* findLastChar | ( | char * | s | ) | `[inline, static]`

Definition at line 179 of file parsePreamble.c.

static int findPreambleTag | ( | Spec | spec,
|  | int * | tag,
|  | const char ** | macro,
|  | char * | lang |
| ) |  |  | `[static]`

Definition at line 779 of file parsePreamble.c.

static int handlePreambleTag | ( | Spec | spec,
|  | Package | pkg,
|  | int | tag,
|  | const char * | macro,
|  | const char * | lang |
| ) |  |  | `[static]`

Definition at line 445 of file parsePreamble.c.

static void initPreambleList | ( | void |  | ) | `[inline, static]`

Definition at line 768 of file parsePreamble.c.

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

Definition at line 197 of file parsePreamble.c.

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

Definition at line 143 of file parsePreamble.c.

static int parseSimplePart | ( | char * | line,
|  | char ** | name,
|  | int * | flag |
| ) |  |  | `[static]`

Definition at line 69 of file parsePreamble.c.

static int parseYesNo | ( | const char * | s | ) | `[inline, static]`

Definition at line 102 of file parsePreamble.c.

static int readIcon | ( | Header | h,
|  | const char * | file |
| ) |  |  | `[static]`

Definition at line 342 of file parsePreamble.c.

## 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 },
        { NULL, 0 }
    }

Definition at line 133 of file parsePreamble.c.

rpmTag copyTagsDuringParse[]`[static]`

Initial value:

     {
        RPMTAG_EPOCH,
        RPMTAG_VERSION,
        RPMTAG_RELEASE,
        RPMTAG_LICENSE,
        RPMTAG_PACKAGER,
        RPMTAG_DISTRIBUTION,
        RPMTAG_DISTURL,
        RPMTAG_VENDOR,
        RPMTAG_ICON,
        RPMTAG_URL,
        RPMTAG_CHANGELOGTIME,
        RPMTAG_CHANGELOGNAME,
        RPMTAG_CHANGELOGTEXT,
        RPMTAG_PREFIXES,
        RPMTAG_RHNPLATFORM,
        0
    }

Definition at line 17 of file parsePreamble.c.

struct tokenBits_s installScriptBits[]`[static]`

Initial value:

     {
        { "interp",         RPMSENSE_INTERP },
        { "prereq",         RPMSENSE_PREREQ },
        { "preun",          RPMSENSE_SCRIPT_PREUN },
        { "pre",            RPMSENSE_SCRIPT_PRE },
        { "postun",         RPMSENSE_SCRIPT_POSTUN },
        { "post",           RPMSENSE_SCRIPT_POST },
        { "rpmlib",         RPMSENSE_RPMLIB },
        { "verify",         RPMSENSE_SCRIPT_VERIFY },
        { NULL, 0 }
    }

Definition at line 118 of file parsePreamble.c.

int noLang

Definition at line 59 of file poptBT.c.

struct optionalTag optionalTags[]`[static]`

struct PreambleRec_s preambleList[]`[static]`

Definition at line 719 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 39 of file parsePreamble.c.