rpm
5.4.15
|
Handle spec data structure. More...
#include "system.h"
#include <rpmio.h>
#include <rpmiotypes.h>
#include <rpmlog.h>
#include <rpmpgp.h>
#include "buildio.h"
#include "rpmds.h"
#include "rpmfi.h"
#include "rpmts.h"
#include "rpmlua.h"
#include "debug.h"
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 *pkgp) |
Find sub-package control structure by name. More... | |
static void | pkgFini (void *_pkg) |
static Package | pkgGetPool (rpmioPool pool) |
Package | newPackage (Spec spec) |
Create and initialize 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) |
static void | specFini (void *_spec) |
static Spec | specGetPool (rpmioPool pool) |
Spec | newSpec (void) |
Create and initialize 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 | _pkg_debug |
int | _spec_debug |
int | specedit |
rpmioPool | _pkgPool |
rpmioPool | _specPool |
Handle spec data structure.
Definition in file spec.c.
#define SKIPNONWHITE | ( | _x | ) | {while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;} |
Definition at line 33 of file spec.c.
Referenced by parseNoSource().
#define SKIPWHITE | ( | _x | ) | {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;} |
Definition at line 32 of file spec.c.
Referenced by parseNoSource().
Parse a spec file, and query the resultant header.
ts | rpm transaction |
qva | query args |
specName | specfile to parse |
target | cpu-vender-os platform for query (NULL is current) |
Definition at line 911 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().
addSource.
spec | spec file control structure |
pkg | package control |
field | field to parse |
tag | tag |
Definition at line 361 of file spec.c.
References _, _free(), addMacro(), Source::flags, Source::fullSource, getSourceDir(), Spec_s::line, Spec_s::lineNum, Spec_s::macros, name, Source::next, Source::num, num, Spec_s::numSources, Spec_s::recursing, RMIL_SPEC, RPMFILE_ICON, RPMFILE_PATCH, RPMFILE_SOURCE, rpmGenPath(), rpmlog(), RPMLOG_ERR, rpmluaPop(), rpmluaPushTable(), rpmluaSetVar(), RPMLUAV_STRING, rpmluavFree(), rpmluavNew(), rpmluavSetListMode(), rpmluavSetValue(), RPMRC_FAIL, RPMRC_OK, RPMTAG_ICON, RPMTAG_PATCH, RPMTAG_SOURCE, SKIPSPACE, Source::source, Spec_s::sources, xmalloc, and xstrdup().
Referenced by handlePreambleTag().
|
static |
Definition at line 255 of file spec.c.
References Source::flags, Source::next, Source::num, and Spec_s::sources.
Referenced by parseNoSource().
Destroy all packages associated with spec file.
packages | package control structure chain |
Definition at line 241 of file spec.c.
References freePackage(), and Package_s::next.
Referenced by parsePreamble(), and specFini().
Definition at line 503 of file spec.c.
References _free(), i, speclines_s::sl_lines, and speclines_s::sl_nlines.
Referenced by specFini().
Destroy source component chain.
s | source component chain |
Definition at line 64 of file spec.c.
References _free(), Source::fullSource, and Source::next.
Referenced by specFini().
Definition at line 533 of file spec.c.
References _free(), i, spectags_s::st_ntags, spectags_s::st_t, spectag_s::t_lang, and spectag_s::t_msgid.
Referenced by specFini().
|
static |
p | trigger entry chain |
Definition at line 42 of file spec.c.
References _free(), TriggerFileEntry::fileName, TriggerFileEntry::next, TriggerFileEntry::prog, and TriggerFileEntry::script.
Referenced by pkgFini().
SpecSource getSource | ( | Spec | spec, |
int | num | ||
) |
Return a source control structure.
spec | spec file control structure |
num | the number of the wanted source (starting from 0) |
Definition at line 275 of file spec.c.
References i, Source::next, num, and Spec_s::sources.
|
static |
Add expanded build scriptlet to srpm header.
h | srpm header |
progTag | interpreter tag (0 disables) |
scriptTag | script tag (0 disables) |
iob | script body sting buf (NULL disables) |
Definition at line 848 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 |
Add expanded build scriptlets to srpm header.
spec | spec file control structure |
Definition at line 879 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().
Find sub-package control structure by name.
spec | spec file control structure |
name | (sub-)package name |
flag | if PART_SUBNAME, then 1st package name is prepended |
pkg | package control structure |
Definition at line 78 of file spec.c.
References _free(), alloca(), Package_s::header, headerGet(), Package_s::next, _HE_s::p, Spec_s::packages, PART_SUBNAME, rpmDataType_u::ptr, rpmExpand(), RPMRC_FAIL, RPMRC_OK, RPMTAG_NAME, RPMTAG_VERSION, rpmDataType_u::str, _HE_s::tag, v, xisdigit(), and xstrdup().
Referenced by parseDescription(), parseFiles(), parsePreamble(), and parseScript().
struct OpenFileInfo* newOpenFileInfo | ( | void | ) |
Definition at line 713 of file spec.c.
References OpenFileInfo::fd, OpenFileInfo::fileName, OpenFileInfo::lineNum, OpenFileInfo::next, OpenFileInfo::readBuf, OpenFileInfo::readPtr, and xmalloc.
Referenced by forceIncludeFile(), and parseSpec().
Create and initialize package control structure.
spec | spec file control structure |
Definition at line 204 of file spec.c.
References _rpmbuildFlags, Package_s::autoProv, Package_s::autoReq, Package_s::ds, Package_s::fi, Package_s::fileFile, Package_s::fileList, Package_s::header, headerNew(), Package_s::next, pkgGetPool(), Package_s::postInFile, Package_s::postUnFile, Package_s::preInFile, Package_s::preUnFile, rpmioLinkPoolItem(), Package_s::sanityCheckFile, Package_s::specialDoc, Package_s::triggerFiles, and Package_s::verifyFile.
Referenced by parsePreamble().
|
inlinestatic |
Definition at line 488 of file spec.c.
References speclines_s::sl_lines, speclines_s::sl_nalloc, speclines_s::sl_nlines, specedit, and xmalloc.
Referenced by newSpec().
Spec newSpec | ( | void | ) |
Create and initialize Spec structure.
Definition at line 642 of file spec.c.
References Spec_s::_parseRCPOT, Spec_s::anyarch, Spec_s::BACount, Spec_s::BANames, Spec_s::BASpecs, Spec_s::build, Spec_s::buildSubdir, Spec_s::check, Spec_s::clean, Spec_s::cookie, Spec_s::dig, Spec_s::fi, Spec_s::fileStack, Spec_s::foo, Spec_s::force, headerNew(), Spec_s::install, Spec_s::lbuf, Spec_s::lbuf_len, Spec_s::line, Spec_s::lineNum, Spec_s::macros, newSl(), newSt(), ReadLevelEntry::next, Spec_s::nextline, Spec_s::nextpeekc, Spec_s::nfoo, Spec_s::noSource, Spec_s::numSources, Spec_s::packages, parseRCPOT(), Spec_s::passPhrase, Spec_s::prep, ReadLevelEntry::reading, Spec_s::readStack, Spec_s::recursing, Spec_s::rootURL, rpmExpandNumeric(), rpmGlobalMacroContext, rpmioLinkPoolItem(), Spec_s::sl, Spec_s::smetrics, Spec_s::sourceHeader, Spec_s::sourcePkgId, Spec_s::sourceRpmName, Spec_s::sources, Spec_s::specFile, specGetPool(), Spec_s::sstates, Spec_s::st, Spec_s::timeCheck, Spec_s::toplevel, and xmalloc.
Referenced by parseSpec().
|
inlinestatic |
Definition at line 518 of file spec.c.
References specedit, spectags_s::st_nalloc, spectags_s::st_ntags, spectags_s::st_t, and xmalloc.
Referenced by newSpec().
parseNoSource.
spec | spec file control structure |
field | field to parse |
tag | tag |
Definition at line 317 of file spec.c.
References _, field, findSource(), Source::flags, Spec_s::lineNum, name, num, parseNum(), RPMFILE_GHOST, RPMFILE_PATCH, RPMFILE_SOURCE, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, RPMTAG_NOSOURCE, SKIPNONWHITE, and SKIPWHITE.
Referenced by handlePreambleTag().
|
static |
Definition at line 157 of file spec.c.
References _free(), Package_s::ds, fi, Package_s::fi, Package_s::fileFile, Package_s::fileList, freeTriggerFiles(), Package_s::header, headerFree(), Package_s::postInFile, Package_s::postUnFile, Package_s::preInFile, Package_s::preUnFile, rpmdsFree(), rpmfiFree(), rpmiobFree(), Package_s::sanityCheckFile, Package_s::specialDoc, Package_s::triggerFiles, and Package_s::verifyFile.
Referenced by pkgGetPool().
Definition at line 190 of file spec.c.
References Package_s::_item, _pkg_debug, _pkgPool, pkgFini(), rpmioGetPool(), and rpmioNewPool().
Referenced by newPackage().
|
static |
Print copy of spec file, filling in Group/Description/Summary from specspo.
spec | spec file control structure |
Definition at line 733 of file spec.c.
References _, _free(), alloca(), errstr, Package_s::header, headerGet(), headerSprintf(), i, j, 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().
Function to query spec file(s).
ts | transaction set |
qva | parsed query/verify options |
arg | query argument |
Definition at line 968 of file spec.c.
References _, _specQuery(), alloca(), rpmQVKArguments_s::qva_showPackage, rpmcliTargets, rpmFreeMacros(), rpmFreeRpmrc(), rpmlog(), RPMLOG_DEBUG, and rpmReadConfigFiles().
Referenced by main().
|
static |
Definition at line 547 of file spec.c.
References _free(), Spec_s::BACount, Spec_s::BANames, Spec_s::BASpecs, Spec_s::build, Spec_s::buildSubdir, Spec_s::check, Spec_s::clean, closeSpec(), Spec_s::cookie, Spec_s::dig, fi, Spec_s::fi, Spec_s::foo, freePackages(), freeSl(), freeSources(), freeSpec(), freeSt(), headerFree(), Spec_s::install, Spec_s::lbuf, ReadLevelEntry::next, Spec_s::nfoo, Spec_s::packages, Spec_s::parsed, Spec_s::passPhrase, pgpDigFree(), Spec_s::prep, Spec_s::readStack, Spec_s::recursing, Spec_s::rootURL, rpmfiFree(), rpmiobFree(), rpmluaDelVar(), Spec_s::sl, Spec_s::sourceHeader, Spec_s::sourcePkgId, Spec_s::sourceRpmName, Spec_s::sources, Spec_s::specFile, Spec_s::st, and tagStoreFree().
Referenced by specGetPool().
const char* specFullSourceName | ( | SpecSource | source | ) |
Return a ptr to the full url of the source.
source | SpecSource control structure |
Definition at line 298 of file spec.c.
References Source::fullSource.
Definition at line 628 of file spec.c.
References Spec_s::_item, _spec_debug, _specPool, rpmioGetPool(), rpmioNewPool(), and specFini().
Referenced by newSpec().
int SpecSourceCount | ( | Spec | spec | ) |
Return the count of source set in specfile.
spec | spec file control structure |
Definition at line 268 of file spec.c.
References Spec_s::numSources.
int specSourceFlags | ( | SpecSource | source | ) |
Return flags set for the source.
source | SpecSource control structure |
Definition at line 312 of file spec.c.
References Source::flags.
const char* specSourceName | ( | SpecSource | source | ) |
Return a ptr to the source file name.
source | SpecSource control structure |
Definition at line 291 of file spec.c.
References Source::source.
int specSourceNum | ( | SpecSource | source | ) |
Return the spec or source patch number.
source | SpecSource control structure |
Definition at line 305 of file spec.c.
References Source::num.
int _pkg_debug |
Definition at line 23 of file spec.c.
Referenced by pkgGetPool().
rpmioPool _pkgPool |
Definition at line 188 of file spec.c.
Referenced by main(), and pkgGetPool().
int _spec_debug |
Definition at line 26 of file spec.c.
Referenced by specGetPool().
rpmioPool _specPool |
Definition at line 626 of file spec.c.
Referenced by main(), and specGetPool().
int specedit |
Definition at line 22 of file poptQV.c.
Referenced by _specQuery(), newSl(), and newSt().