parseSpec.c File Reference
RPMBUILD.

Top level dispatcher for spec file parsing. More...

`#include "system.h"`
`#include <rpmio_internal.h>`
`#include <rpmcb.h>`
`#include <argv.h>`
`#include <rpmbuild.h>`
`#include "rpmds.h"`
`#include "rpmts.h"`
`#include "debug.h"`
Include dependency graph for parseSpec.c:

Go to the source code of this file.

## Data Structures

struct | PartRec

## Macros

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

## Functions

static void | initParts (struct PartRec *p)
rpmParseState | isPart (Spec spec)
| Check line for section separator, return next parser state. More...
static int | matchTok (const char *token, const char *line)
void | handleComments (char *s)
| Truncate comment lines. More...
static void | forceIncludeFile (Spec spec, const char *fileName)
static int | restoreFirstChar (Spec spec)
static int | copyNextLineFromOFI (Spec spec, OFI_t *ofi, rpmStripFlags strip)
static int | copyNextLineFinish (Spec spec, int strip)
static int | readLineFromOFI (Spec spec, OFI_t *ofi)
int | readLine (Spec spec, rpmStripFlags strip)
| Read next line from spec file. More...
void | closeSpec (Spec spec)
| Stop reading from spec file, freeing resources. More...
static int | genSourceRpmName (Spec spec)
int | parseSpec (rpmts ts, const char *specFile, const char *rootURL, int recursing, const char *passPhrase, const char *cookie, int anyarch, int force, int verify)
| Parse spec file into spec control structure. More...

## Variables

static struct PartRec | partList []
int | noLang

## Detailed Description

Top level dispatcher for spec file parsing.

Definition in file parseSpec.c.

## Macro Definition Documentation

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

Definition at line 12 of file parseSpec.c.

## Function Documentation

static int copyNextLineFinish | ( | Spec | spec,
|  | int | strip
| ) |  |

static

Definition at line 254 of file parseSpec.c.

References handleComments(), Spec_s::line, Spec_s::nextline, Spec_s::nextpeekc, STRIP_COMMENTS, STRIP_TRAILINGSPACE, and xisspace().

Referenced by readLine().

static int copyNextLineFromOFI | ( | Spec | spec,
|  | OFI_t * | ofi,
|  | rpmStripFlags | strip
| ) |  |

static

Definition at line 175 of file parseSpec.c.

References _, expandMacros(), Spec_s::lbuf, Spec_s::lbuf_len, Spec_s::lbufPtr, Spec_s::lineNum, Spec_s::macros, Spec_s::nextline, ReadLevelEntry::reading, OpenFileInfo::readPtr, Spec_s::readStack, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, and STRIP_NOEXPAND.

Referenced by readLine().

static void forceIncludeFile | ( | Spec | spec,
|  | const char * | fileName
| ) |  |

static

Definition at line 148 of file parseSpec.c.

References OpenFileInfo::fileName, Spec_s::fileStack, newOpenFileInfo(), OpenFileInfo::next, and xstrdup().

Referenced by readLine().

static int genSourceRpmName | ( | Spec | spec | ) |

inline static

Definition at line 492 of file parseSpec.c.

References _free(), Package_s::header, headerNEVRA(), Spec_s::noSource, Spec_s::packages, snprintf(), Spec_s::sourceRpmName, and xstrdup().

Referenced by parseSpec().

static void initParts | ( | struct PartRec * | p | ) |

inline static

Definition at line 57 of file parseSpec.c.

References PartRec::len, and PartRec::token.

Referenced by isPart().

static int matchTok | ( | const char * | token,
|  | const char * | line
| ) |  |

static

Definition at line 117 of file parseSpec.c.

References SKIPNONSPACE, SKIPSPACE, and xstrncasecmp().

Referenced by readLine().

static int readLineFromOFI | ( | Spec | spec,
|  | OFI_t * | ofi
| ) |  |

static

Definition at line 286 of file parseSpec.c.

References _, _free(), Fclose(), OpenFileInfo::fd, fdGetFp(), Ferror(), OpenFileInfo::fileName, Spec_s::fileStack, Fopen(), Fstrerror(), OpenFileInfo::lineNum, Spec_s::lineNum, ReadLevelEntry::next, OpenFileInfo::next, OpenFileInfo::readBuf, OpenFileInfo::readPtr, Spec_s::readStack, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, Spec_s::sl, speclines_s::sl_lines, speclines_s::sl_nalloc, speclines_s::sl_nlines, xrealloc(), and xstrdup().

Referenced by readLine().

static int restoreFirstChar | ( | Spec | spec | ) |

static

Definition at line 161 of file parseSpec.c.

References Spec_s::nextline, and Spec_s::nextpeekc.

Referenced by readLine().

## Variable Documentation

int noLang

Definition at line 61 of file poptBT.c.

struct PartRec partList[]

static

Initial value:
= {
{ PART_PREAMBLE, 0, "%package"},
{ PART_PREP, 0, "%prep"},
{ PART_BUILD, 0, "%build"},
{ PART_INSTALL, 0, "%install"},
{ PART_CHECK, 0, "%check"},
{ PART_CLEAN, 0, "%clean"},
{ PART_PREUN, 0, "%preun"},
{ PART_POSTUN, 0, "%postun"},
{ PART_PRETRANS, 0, "%pretrans"},
{ PART_POSTTRANS, 0, "%posttrans"},
{ PART_PRE, 0, "%pre"},
{ PART_POST, 0, "%post"},
{ PART_FILES, 0, "%files"},
{ PART_CHANGELOG, 0, "%changelog"},
{ PART_DESCRIPTION, 0, "%description"},
{ PART_TRIGGERPOSTUN, 0, "%triggerpostun"},
{ PART_TRIGGERPREIN, 0, "%triggerprein"},
{ PART_TRIGGERUN, 0, "%triggerun"},
{ PART_TRIGGERIN, 0, "%triggerin"},
{ PART_TRIGGERIN, 0, "%trigger"},
{ PART_VERIFYSCRIPT, 0, "%verifyscript"},
{ PART_SANITYCHECK, 0, "%sanitycheck"},
{0, 0, 0}
}

Referenced by isPart().