32 #define SKIPWHITE(_x) {while(*(_x) && (xisspace(*_x) || *(_x) == ',')) (_x)++;}
33 #define SKIPNONWHITE(_x){while(*(_x) &&!(xisspace(*_x) || *(_x) == ',')) (_x)++;}
120 n = (
char *) he->
p.
str;
127 v = (
char *) he->
p.
str;
162 if (pkg ==
NULL)
return;
194 if (_pkgPool ==
NULL) {
200 memset(((
char *)pkg)+
sizeof(pkg->
_item), 0,
sizeof(*pkg)-
sizeof(pkg->
_item));
216 pkg->triggers =
NULL;
217 pkg->triggerScripts =
NULL;
245 while ((p = packages) !=
NULL) {
261 if ((num == p->
num) && (p->
flags & flag))
return p;
281 for (i = 0; i <
num; i++)
314 return source->
flags;
332 for (f = fe; *f !=
'\0'; f =
fe) {
340 if (*fe !=
'\0') fe++;
365 #if defined(RPM_VENDOR_OPENPKG)
370 const char *mdir =
NULL;
371 const char *fieldp =
NULL;
380 fieldp = spec->
line + strlen(name);
385 fieldp = spec->
line + strlen(name);
396 #if !defined(RPM_VENDOR_OPENPKG)
402 if (fieldp !=
NULL) {
405 num = strtoul(fieldp, &end, 10);
416 if ( p->
num != num )
continue;
435 #if defined(RPM_VENDOR_OPENPKG)
439 p_last = p_last->
next;
452 #if defined(RPM_VENDOR_OPENPKG)
462 (flag & RPMFILE_PATCH) ?
"PATCH" :
"SOURCE", num);
467 const char * what = (flag &
RPMFILE_PATCH) ?
"patches" :
"sources";
538 for (i = 0; i < st->
st_ntags; i++) {
553 if (spec ==
NULL)
return;
632 if (_specPool ==
NULL) {
638 memset(((
char *)spec)+
sizeof(spec->
_item), 0,
sizeof(*spec)-
sizeof(spec->
_item));
644 static const char _spec_line_buffer_size[] =
645 "%{?_spec_line_buffer_size}%{!?_spec_line_buffer_size:100000}";
656 spec->
lbuf[0] =
'\0';
763 fmt[
sizeof(fmt)-1] =
'\0';
764 for (fe = fmt; *fe && *fe !=
'('; fe++)
766 if (*fe ==
'(') *fe =
'\0';
787 msgstr =
_free(msgstr);
791 if (msgstr ==
NULL) {
804 {
char *
buf =
xmalloc(strlen(tn) +
sizeof(
": ") + strlen(msgstr));
828 msgstr =
_free(msgstr);
835 if (strchr(s,
'\n') ==
NULL && s[strlen(s)-1] !=
'\n')
855 if (progTag !=(
rpmTag) 0) {
856 static const char prog[] =
"/bin/sh";
927 if (
parseSpec(ts, specName,
"/", recursing, passPhrase,
928 cookie, anyarch, 1, verify)
932 _(
"query of specfile %s failed, can't parse\n"),
940 printNewSpecfile(spec);
980 if (targets ==
NULL) {
987 _(
"Query specfile for platform(s): %s\n"), targets);
988 for (t = targets; *t !=
'\0'; t =
te) {
990 if ((te = strchr(t,
',')) ==
NULL)
1015 if ((te = strchr(t,
',')) ==
NULL)
1019 target[te-
t] =
'\0';
const char * getSourceDir(rpmfileAttrs attr)
Return the macro directory location from source file flags.
int specSourceNum(SpecSource source)
Return the spec or source patch number.
static void specFini(void *_spec)
static spectags newSt(void)
rpmlog(RPMLOG_ERR,"%s\n", buf)
const char * sourceRpmName
Spec rpmtsSetSpec(rpmts ts, Spec spec)
Set a spec control structure in transaction set.
int parseNum(const char *line, rpmuint32_t *res)
Parse a number.
int SpecSourceCount(Spec spec)
Return the count of source set in specfile.
OpenPGP constants and structures from RFC-2440.
struct OpenFileInfo * next
static spectags freeSt(spectags st)
char * xstrdup(const char *str)
void * rpmluavFree(rpmluav var)
int rpmReadConfigFiles(const char *file, const char *target)
Spec freeSpec(Spec spec)
Destroy a spec file control structure.
Structure(s) used for file info tag sets.
void rpmluavSetListMode(rpmluav var, int flag)
int rpmspecQuery(rpmts ts, QVA_t qva, const char *arg)
Function to query spec file(s).
rpmioItem rpmioLinkPoolItem(rpmioItem item, const char *msg, const char *fn, unsigned ln)
Increment a pool item refcount.
struct rpmts_s * rpmts
The RPM Transaction Set.
rpmRC lookupPackage(Spec spec, const char *name, int flag, Package *pkg)
Find sub-package control structure by name.
const char * specFullSourceName(SpecSource source)
Return a ptr to the full url of the source.
void addMacro(MacroContext mc, const char *n, const char *o, const char *b, int level)
Add macro to context.
rpmfi rpmfiFree(rpmfi fi)
Destroy a file info set.
rpmiob rpmiobFree(rpmiob iob)
Destroy a I/O buffer instance.
Package freePackage(Package pkg)
Destroy a package control structure.
static Package pkgGetPool(rpmioPool pool)
Command line option information.
void rpmluaPushTable(rpmlua _lua, const char *key,...)
void rpmluavSetValue(rpmluav var, rpmluavType type, const void *value)
rpmTag tagValue(const char *tagstr)
Return tag value from name.
sprintf(t," (%u)",(unsigned) dig->nbytes)
static Spec specGetPool(rpmioPool pool)
const char * specSourceName(SpecSource source)
Return a ptr to the source file name.
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.
enum rpmRC_e rpmRC
RPM return codes.
Yet Another syslog(3) API clone.
memset(_r, 0, sizeof(*_r))
struct Package_s * Package
assert(key->size==sizeof(hdrNum))
Package newPackage(Spec spec)
Create and initialize package control structure.
MacroContext rpmGlobalMacroContext
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
int initSourceHeader(Spec spec, rpmiob *sfp)
Create and initialize header for source package.
static speclines freeSl(speclines sl)
static speclines newSl(void)
int specSourceFlags(SpecSource source)
Return flags set for the source.
static struct TriggerFileEntry * freeTriggerFiles(struct TriggerFileEntry *p)
struct rpmluav_s * rpmluav
const char * tagName(rpmTag tag)
Return tag name from value.
rpmuint32_t sstates[RPMSCRIPT_MAX]
struct TriggerFileEntry * triggerFiles
Structure(s) used for dependency tag sets.
SpecSource getSource(Spec spec, int num)
Return a source control structure.
rpmuint32_t smetrics[RPMSCRIPT_MAX]
static int initSourceHeaderScriptlets(Spec spec)
Add expanded build scriptlets to srpm header.
rpmRC(* _parseRCPOT)(Spec spec, Package pkg, const char *field, rpmTag tagN, rpmuint32_t index, rpmsenseFlags tagflags)
pgpDig pgpDigFree(pgpDig dig)
Destroy a container for parsed OpenPGP packates.
const char * rpmGenPath(const char *urlroot, const char *urlmdir, const char *urlfile)
Merge 3 args into path, any or all of which may be a url.
Spec newSpec(void)
Create and initialize Spec structure.
The structure used to store values parsed from a spec file.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
void closeSpec(Spec spec)
Stop reading from spec file, freeing resources.
void rpmluaDelVar(rpmlua _lua, const char *key,...)
struct TriggerFileEntry * next
static int initSourceHeaderScriptlet(Header h, rpmTag progTag, rpmTag scriptTag, rpmiob iob)
Add expanded build scriptlet to srpm header.
struct ReadLevelEntry * readStack
rpmds rpmdsFree(rpmds ds)
Destroy a dependency set.
Routines to read and write packages.
static int _specQuery(rpmts ts, QVA_t qva, const char *specName, const char *target)
Parse a spec file, and query the resultant header.
struct OpenFileInfo * newOpenFileInfo(void)
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
static void pkgFini(void *_pkg)
return strcmp(ame->name, bme->name)
static struct Source * findSource(Spec spec, rpmuint32_t num, int flag)
static int xisdigit(int c)
rpmioPool rpmioNewPool(const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
Create a memory pool.
char * stpcpy(char *dest, const char *src)
void rpmluaSetVar(rpmlua _lua, rpmluav var)
Structures and prototypes used for an "rpmts" transaction set.
tagStore_t tagStoreFree(tagStore_t dbiTags, size_t dbiNTags)
Destroy tagStore array.
Package freePackages(Package packages)
Destroy all packages associated with spec file.
static struct Source * freeSources(struct Source *s)
Destroy source component chain.
int parseNoSource(Spec spec, const char *field, rpmTag tag)
parseNoSource.
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
int addSource(Spec spec, Package pkg, const char *field, rpmTag tag)
addSource.
char * buf
Parse (and execute) macro undefinition.
rpmRC parseRCPOT(Spec spec, Package pkg, const char *field, rpmTag tagN, rpmuint32_t index, rpmsenseFlags tagflags)
Parse dependency relations from spec file and/or autogenerated output buffer.
The structure used to store values for a package.
struct rpmfi_s * rpmfi
File info tag sets from a header, so that a header can be discarded early.
#define RPMBUILD_DEFAULT_LANG
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
struct OpenFileInfo * fileStack
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
struct ReadLevelEntry * next
unsigned char * sourcePkgId
const char * sanityCheckFile
const char * rpmcliTargets