summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-12-21 20:37:37 +0000
committerjbj <devnull@localhost>2002-12-21 20:37:37 +0000
commit1f6cdca2d549e02f3e65afa27b80cb852e283cd2 (patch)
treec5dc26a5bb2bd0d112194a325221f14b5f0bbd70 /build
parentb2402702ae91a73f7e4a4787b6a170357e219533 (diff)
downloadrpm-1f6cdca2d549e02f3e65afa27b80cb852e283cd2.tar.gz
rpm-1f6cdca2d549e02f3e65afa27b80cb852e283cd2.tar.bz2
rpm-1f6cdca2d549e02f3e65afa27b80cb852e283cd2.zip
- add --enable-posixmutexes when configuring on linux.
- add rpmdb_{deadlock,dump,load,svc,stat,verify} utilities. - include srpm pkgid in binary headers (#71460). - add %check scriptlet to run after %install (#64137). CVS patchset: 5957 CVS date: 2002/12/21 20:37:37
Diffstat (limited to 'build')
-rw-r--r--build/build.c10
-rw-r--r--build/buildio.h7
-rw-r--r--build/pack.c26
-rw-r--r--build/parseBuildInstallClean.c5
-rw-r--r--build/parsePreamble.c83
-rw-r--r--build/parseSpec.c5
-rw-r--r--build/rpmbuild.h65
-rw-r--r--build/rpmspec.h126
-rw-r--r--build/spec.c9
9 files changed, 211 insertions, 125 deletions
diff --git a/build/build.c b/build/build.c
index e5625f96c..a8d8c9810 100644
--- a/build/build.c
+++ b/build/build.c
@@ -96,6 +96,12 @@ int doScript(Spec spec, int what, const char *name, StringBuf sb, int test)
mTemplate = "%{__spec_install_template}";
mPost = "%{__spec_install_post}";
break;
+ case RPMBUILD_CHECK:
+ name = "%check";
+ sb = spec->check;
+ mTemplate = "%{__spec_check_template}";
+ mPost = "%{__spec_check_post}";
+ break;
case RPMBUILD_CLEAN:
name = "%clean";
sb = spec->clean;
@@ -296,6 +302,10 @@ int buildSpec(Spec spec, int what, int test)
(rc = doScript(spec, RPMBUILD_INSTALL, NULL, NULL, test)))
goto exit;
+ if ((what & RPMBUILD_CHECK) &&
+ (rc = doScript(spec, RPMBUILD_CHECK, NULL, NULL, test)))
+ goto exit;
+
if ((what & RPMBUILD_PACKAGESOURCE) &&
(rc = processSourceFiles(spec)))
goto exit;
diff --git a/build/buildio.h b/build/buildio.h
index 06eb6914e..b9a88b9cb 100644
--- a/build/buildio.h
+++ b/build/buildio.h
@@ -48,7 +48,8 @@ extern "C" {
* @warning The first argument (header) is now passed by reference in order to
* return a reloaded contiguous header to the caller.
*
- * @retval hdrp header to write (final header is returned).
+ * @retval *hdrp header to write (final header is returned).
+ * @retval *sigp signature header (or NULL)
* @param fileName file name of package
* @param type RPMLEAD_SOURCE/RPMLEAD_BINARY
* @param csa
@@ -56,7 +57,7 @@ extern "C" {
* @retval cookie generated cookie (i.e build host/time)
* @return 0 on success
*/
-int writeRPM(Header * hdrp,
+int writeRPM(Header * hdrp, /*@null@*/ Header * sigp,
const char * fileName,
int type,
CSA_t csa,
@@ -64,7 +65,7 @@ int writeRPM(Header * hdrp,
/*@out@*/ const char ** cookie)
/*@globals rpmGlobalMacroContext,
fileSystem, internalState @*/
- /*@modifies *hdrp, *cookie, csa, csa->cpioArchiveSize,
+ /*@modifies *hdrp, *sigp, *cookie, csa, csa->cpioArchiveSize,
rpmGlobalMacroContext, fileSystem, internalState @*/;
#ifdef __cplusplus
diff --git a/build/pack.c b/build/pack.c
index 72790698e..5d219831d 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -404,7 +404,7 @@ static int rpmLeadVersion(void)
}
/*@-boundswrite@*/
-int writeRPM(Header *hdrp, const char *fileName, int type,
+int writeRPM(Header *hdrp, Header *sigp, const char *fileName, int type,
CSA_t csa, char *passPhrase, const char **cookie)
{
FD_t fd = NULL;
@@ -423,6 +423,9 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
h = headerLink(*hdrp);
*hdrp = headerFree(*hdrp);
+ if (sigp)
+ *sigp = NULL;
+
#ifdef DYING
if (Fileno(csa->cpioFdIn) < 0) {
csa->cpioArchiveSize = 0;
@@ -585,6 +588,9 @@ int writeRPM(Header *hdrp, const char *fileName, int type,
rpmError(RPMERR_RELOAD, _("Unable to reload signature header.\n"));
goto exit;
}
+ /* Re-reference reallocated header. */
+ if (sigp != NULL)
+ *sigp = headerLink(sig);
/* Open the output file */
fd = Fopen(fileName, "w.ufdio");
@@ -767,6 +773,10 @@ int packageBinaries(Spec spec)
(void) genSourceRpmName(spec);
(void) headerAddEntry(pkg->header, RPMTAG_SOURCERPM, RPM_STRING_TYPE,
spec->sourceRpmName, 1);
+ if (spec->sourcePkgId != NULL) {
+ (void) headerAddEntry(pkg->header, RPMTAG_SOURCEPKGID, RPM_BIN_TYPE,
+ spec->sourcePkgId, 16);
+ }
{ const char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
char *binRpm, *binDir;
@@ -811,7 +821,7 @@ int packageBinaries(Spec spec)
/*@i@*/ csa->cpioList = pkg->cpioList;
/*@=assignexpose =newreftrans@*/
- rc = writeRPM(&pkg->header, fn, RPMLEAD_BINARY,
+ rc = writeRPM(&pkg->header, NULL, fn, RPMLEAD_BINARY,
csa, spec->passPhrase, NULL);
csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageBinaries)");
/*@=type@*/
@@ -845,6 +855,7 @@ int packageSources(Spec spec)
/* XXX this should be %_srpmdir */
{ const char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
+ Header sig;
memset(csa, 0, sizeof(*csa));
csa->cpioArchiveSize = 0;
@@ -854,8 +865,17 @@ int packageSources(Spec spec)
/*@i@*/ csa->cpioList = spec->sourceCpioList;
/*@=assignexpose =newreftrans@*/
- rc = writeRPM(&spec->sourceHeader, fn, RPMLEAD_SOURCE,
+ sig = NULL;
+ rc = writeRPM(&spec->sourceHeader, &sig, fn, RPMLEAD_SOURCE,
csa, spec->passPhrase, &(spec->cookie));
+ if (rc == 0 && sig != NULL) {
+ HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+ const unsigned char * s = NULL;
+ int xx;
+ xx = hge(sig, RPMSIGTAG_MD5, NULL, (void **)&s, NULL);
+ spec->sourcePkgId = s;
+ sig = headerFree(sig);
+ }
csa->cpioFdIn = fdFree(csa->cpioFdIn, "init (packageSources)");
/*@=type@*/
fn = _free(fn);
diff --git a/build/parseBuildInstallClean.c b/build/parseBuildInstallClean.c
index dcca38814..f086f7c17 100644
--- a/build/parseBuildInstallClean.c
+++ b/build/parseBuildInstallClean.c
@@ -23,6 +23,9 @@ int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
} else if (parsePart == PART_INSTALL) {
sbp = &(spec->install);
name = "%install";
+ } else if (parsePart == PART_CHECK) {
+ sbp = &(spec->check);
+ name = "%check";
} else if (parsePart == PART_CLEAN) {
sbp = &(spec->clean);
name = "%clean";
@@ -37,7 +40,7 @@ int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
*sbp = newStringBuf();
- /* There are no options to %build, %install, or %clean */
+ /* There are no options to %build, %install, %check, or %clean */
if ((rc = readLine(spec, STRIP_NOTHING)) > 0)
return PART_NONE;
if (rc)
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 9186a7537..9f88757ef 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -110,7 +110,8 @@ static inline int parseYesNo(const char * s)
}
typedef struct tokenBits_s {
-/*@observer@*/ /*@null@*/ const char * name;
+/*@observer@*/ /*@null@*/
+ const char * name;
rpmsenseFlags bits;
} * tokenBits;
@@ -320,7 +321,8 @@ static int checkForDuplicates(Header h, const char * NVR)
/*@observer@*/ /*@unchecked@*/
static struct optionalTag {
rpmTag ot_tag;
-/*@observer@*/ /*@null@*/ const char * ot_mac;
+/*@observer@*/ /*@null@*/
+ const char * ot_mac;
} optionalTags[] = {
{ RPMTAG_VENDOR, "%{vendor}" },
{ RPMTAG_PACKAGER, "%{packager}" },
@@ -506,11 +508,11 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
multiToken = 1;
switch (tag) {
- case RPMTAG_NAME:
- case RPMTAG_VERSION:
- case RPMTAG_RELEASE:
- case RPMTAG_URL:
- case RPMTAG_RHNPLATFORM:
+ case RPMTAG_NAME:
+ case RPMTAG_VERSION:
+ case RPMTAG_RELEASE:
+ case RPMTAG_URL:
+ case RPMTAG_RHNPLATFORM:
SINGLE_TOKEN_ONLY;
/* These macros are for backward compatibility */
if (tag == RPMTAG_VERSION) {
@@ -530,20 +532,20 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
}
(void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
break;
- case RPMTAG_GROUP:
- case RPMTAG_SUMMARY:
+ case RPMTAG_GROUP:
+ case RPMTAG_SUMMARY:
(void) stashSt(spec, pkg->header, tag, lang);
/*@fallthrough@*/
- case RPMTAG_DISTRIBUTION:
- case RPMTAG_VENDOR:
- case RPMTAG_LICENSE:
- case RPMTAG_PACKAGER:
+ case RPMTAG_DISTRIBUTION:
+ case RPMTAG_VENDOR:
+ case RPMTAG_LICENSE:
+ case RPMTAG_PACKAGER:
if (!*lang)
(void) headerAddEntry(pkg->header, tag, RPM_STRING_TYPE, field, 1);
else if (!(noLang && strcmp(lang, RPMBUILD_DEFAULT_LANG)))
(void) headerAddI18NString(pkg->header, tag, field, lang);
break;
- case RPMTAG_BUILDROOT:
+ case RPMTAG_BUILDROOT:
SINGLE_TOKEN_ONLY;
{ const char * buildRoot = NULL;
const char * buildRootURL = spec->buildRootURL;
@@ -589,7 +591,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
}
buildRootURL = _free(buildRootURL);
} break;
- case RPMTAG_PREFIXES:
+ case RPMTAG_PREFIXES:
addOrAppendListEntry(pkg->header, tag, field);
xx = hge(pkg->header, tag, &type, (void **)&array, &num);
while (num--) {
@@ -604,7 +606,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
}
array = hfd(array, type);
break;
- case RPMTAG_DOCDIR:
+ case RPMTAG_DOCDIR:
SINGLE_TOKEN_ONLY;
if (field[0] != '/') {
rpmError(RPMERR_BADSPEC,
@@ -616,7 +618,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
delMacro(NULL, "_docdir");
addMacro(NULL, "_docdir", NULL, field, RMIL_SPEC);
break;
- case RPMTAG_EPOCH:
+ case RPMTAG_EPOCH:
SINGLE_TOKEN_ONLY;
if (parseNum(field, &num)) {
rpmError(RPMERR_BADSPEC,
@@ -626,38 +628,38 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
}
xx = headerAddEntry(pkg->header, tag, RPM_INT32_TYPE, &num, 1);
break;
- case RPMTAG_AUTOREQPROV:
+ case RPMTAG_AUTOREQPROV:
pkg->autoReq = parseYesNo(field);
pkg->autoProv = pkg->autoReq;
break;
- case RPMTAG_AUTOREQ:
+ case RPMTAG_AUTOREQ:
pkg->autoReq = parseYesNo(field);
break;
- case RPMTAG_AUTOPROV:
+ case RPMTAG_AUTOPROV:
pkg->autoProv = parseYesNo(field);
break;
- case RPMTAG_SOURCE:
- case RPMTAG_PATCH:
+ case RPMTAG_SOURCE:
+ case RPMTAG_PATCH:
SINGLE_TOKEN_ONLY;
macro = NULL;
if ((rc = addSource(spec, pkg, field, tag)))
return rc;
break;
- case RPMTAG_ICON:
+ case RPMTAG_ICON:
SINGLE_TOKEN_ONLY;
if ((rc = addSource(spec, pkg, field, tag)))
return rc;
if ((rc = readIcon(pkg->header, field)))
return RPMERR_BADSPEC;
break;
- case RPMTAG_NOSOURCE:
- case RPMTAG_NOPATCH:
+ case RPMTAG_NOSOURCE:
+ case RPMTAG_NOPATCH:
spec->noSource = 1;
if ((rc = parseNoSource(spec, field, tag)))
return rc;
break;
- case RPMTAG_BUILDPREREQ:
- case RPMTAG_BUILDREQUIRES:
+ case RPMTAG_BUILDPREREQ:
+ case RPMTAG_BUILDREQUIRES:
if ((rc = parseBits(lang, buildScriptBits, &tagflags))) {
rpmError(RPMERR_BADSPEC,
_("line %d: Bad %s: qualifiers: %s\n"),
@@ -667,8 +669,8 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
if ((rc = parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
return rc;
break;
- case RPMTAG_REQUIREFLAGS:
- case RPMTAG_PREREQ:
+ case RPMTAG_REQUIREFLAGS:
+ case RPMTAG_PREREQ:
if ((rc = parseBits(lang, installScriptBits, &tagflags))) {
rpmError(RPMERR_BADSPEC,
_("line %d: Bad %s: qualifiers: %s\n"),
@@ -678,21 +680,21 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
if ((rc = parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
return rc;
break;
- case RPMTAG_BUILDCONFLICTS:
- case RPMTAG_CONFLICTFLAGS:
- case RPMTAG_OBSOLETEFLAGS:
- case RPMTAG_PROVIDEFLAGS:
+ case RPMTAG_BUILDCONFLICTS:
+ case RPMTAG_CONFLICTFLAGS:
+ case RPMTAG_OBSOLETEFLAGS:
+ case RPMTAG_PROVIDEFLAGS:
tagflags = RPMSENSE_ANY;
if ((rc = parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
return rc;
break;
- case RPMTAG_EXCLUDEARCH:
- case RPMTAG_EXCLUSIVEARCH:
- case RPMTAG_EXCLUDEOS:
- case RPMTAG_EXCLUSIVEOS:
+ case RPMTAG_EXCLUDEARCH:
+ case RPMTAG_EXCLUSIVEARCH:
+ case RPMTAG_EXCLUDEOS:
+ case RPMTAG_EXCLUSIVEOS:
addOrAppendListEntry(spec->buildRestrictions, tag, field);
break;
- case RPMTAG_BUILDARCHS:
+ case RPMTAG_BUILDARCHS:
if ((rc = poptParseArgvString(field,
&(spec->BACount),
&(spec->BANames)))) {
@@ -705,7 +707,7 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
spec->BANames = _free(spec->BANames);
break;
- default:
+ default:
rpmError(RPMERR_INTERNAL, _("Internal error: Bogus tag %d\n"), tag);
return RPMERR_INTERNAL;
}
@@ -726,7 +728,8 @@ typedef struct PreambleRec_s {
rpmTag tag;
int len;
int multiLang;
-/*@observer@*/ /*@null@*/ const char * token;
+/*@observer@*/ /*@null@*/
+ const char * token;
} * PreambleRec;
/*@unchecked@*/
diff --git a/build/parseSpec.c b/build/parseSpec.c
index c3537fda1..72eb34af9 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -20,12 +20,14 @@ static int _debug = 0;
static struct PartRec {
int part;
int len;
-/*@observer@*/ /*@null@*/ const char * token;
+/*@observer@*/ /*@null@*/
+ const char * token;
} partList[] = {
{ 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"},
@@ -459,6 +461,7 @@ fprintf(stderr, "*** PS buildRootURL(%s) %p macro set to %s\n", spec->buildRootU
/*@switchbreak@*/ break;
case PART_BUILD:
case PART_INSTALL:
+ case PART_CHECK:
case PART_CLEAN:
parsePart = parseBuildInstallClean(spec, parsePart);
/*@switchbreak@*/ break;
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index 9e8fdc165..2eafbb26c 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -23,17 +23,18 @@ typedef enum rpmBuildFlags_e {
/*@-enummemuse@*/
RPMBUILD_NONE = 0,
/*@=enummemuse@*/
- RPMBUILD_PREP = (1 << 0), /*!< Execute %%prep. */
- RPMBUILD_BUILD = (1 << 1), /*!< Execute %%build. */
- RPMBUILD_INSTALL = (1 << 2), /*!< Execute %%install. */
- RPMBUILD_CLEAN = (1 << 3), /*!< Execute %%clean. */
- RPMBUILD_FILECHECK = (1 << 4), /*!< Check %%files manifest. */
- RPMBUILD_PACKAGESOURCE = (1 << 5), /*!< Create source package. */
- RPMBUILD_PACKAGEBINARY = (1 << 6), /*!< Create binary package(s). */
- RPMBUILD_RMSOURCE = (1 << 7), /*!< Remove source(s) and patch(s). */
- RPMBUILD_RMBUILD = (1 << 8), /*!< Remove build sub-tree. */
- RPMBUILD_STRINGBUF = (1 << 9), /*!< only for doScript() */
- RPMBUILD_RMSPEC = (1 << 10) /*!< Remove spec file. */
+ RPMBUILD_PREP = (1 << 0), /*!< Execute %%prep. */
+ RPMBUILD_BUILD = (1 << 1), /*!< Execute %%build. */
+ RPMBUILD_INSTALL = (1 << 2), /*!< Execute %%install. */
+ RPMBUILD_CHECK = (1 << 3), /*!< Execute %%check. */
+ RPMBUILD_CLEAN = (1 << 4), /*!< Execute %%clean. */
+ RPMBUILD_FILECHECK = (1 << 5), /*!< Check %%files manifest. */
+ RPMBUILD_PACKAGESOURCE = (1 << 6), /*!< Create source package. */
+ RPMBUILD_PACKAGEBINARY = (1 << 7), /*!< Create binary package(s). */
+ RPMBUILD_RMSOURCE = (1 << 8), /*!< Remove source(s) and patch(s). */
+ RPMBUILD_RMBUILD = (1 << 9), /*!< Remove build sub-tree. */
+ RPMBUILD_STRINGBUF = (1 << 10), /*!< only for doScript() */
+ RPMBUILD_RMSPEC = (1 << 11) /*!< Remove spec file. */
} rpmBuildFlags;
/*@=typeuse@*/
@@ -49,25 +50,26 @@ typedef enum rpmBuildFlags_e {
* Spec file parser states.
*/
typedef enum rpmParseState_e {
- PART_NONE = 0, /*!< */
- PART_PREAMBLE = 1, /*!< */
- PART_PREP = 2, /*!< */
- PART_BUILD = 3, /*!< */
- PART_INSTALL = 4, /*!< */
- PART_CLEAN = 5, /*!< */
- PART_FILES = 6, /*!< */
- PART_PRE = 7, /*!< */
- PART_POST = 8, /*!< */
- PART_PREUN = 9, /*!< */
- PART_POSTUN = 10, /*!< */
- PART_DESCRIPTION = 11, /*!< */
- PART_CHANGELOG = 12, /*!< */
- PART_TRIGGERIN = 13, /*!< */
- PART_TRIGGERUN = 14, /*!< */
- PART_VERIFYSCRIPT = 15, /*!< */
- PART_BUILDARCHITECTURES= 16,/*!< */
- PART_TRIGGERPOSTUN = 17, /*!< */
- PART_LAST = 18 /*!< */
+ PART_NONE = 0, /*!< */
+ PART_PREAMBLE = 1, /*!< */
+ PART_PREP = 2, /*!< */
+ PART_BUILD = 3, /*!< */
+ PART_INSTALL = 4, /*!< */
+ PART_CHECK = 5, /*!< */
+ PART_CLEAN = 6, /*!< */
+ PART_FILES = 7, /*!< */
+ PART_PRE = 8, /*!< */
+ PART_POST = 9, /*!< */
+ PART_PREUN = 10, /*!< */
+ PART_POSTUN = 11, /*!< */
+ PART_DESCRIPTION = 12, /*!< */
+ PART_CHANGELOG = 13, /*!< */
+ PART_TRIGGERIN = 14, /*!< */
+ PART_TRIGGERUN = 15, /*!< */
+ PART_VERIFYSCRIPT = 16, /*!< */
+ PART_BUILDARCHITECTURES= 17,/*!< */
+ PART_TRIGGERPOSTUN = 18, /*!< */
+ PART_LAST = 19 /*!< */
} rpmParseState;
#define STRIP_NOTHING 0
@@ -208,7 +210,8 @@ void addChangelogEntry(Header h, time_t time, const char * name,
*/
int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
/*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
- /*@modifies spec->build, spec->install, spec->clean, spec->macros,
+ /*@modifies spec->build, spec->install, spec->check, spec->clean,
+ spec->macros,
spec->fileStack, spec->readStack, spec->line, spec->lineNum,
spec->nextline, spec->nextpeekc, spec->lbuf, spec->sl,
rpmGlobalMacroContext, fileSystem, internalState @*/;
diff --git a/build/rpmspec.h b/build/rpmspec.h
index 89bdf2e17..1f04558f9 100644
--- a/build/rpmspec.h
+++ b/build/rpmspec.h
@@ -8,7 +8,11 @@
/** \ingroup rpmbuild
*/
-typedef struct SpecStruct *Spec;
+typedef struct Spec_s * Spec;
+
+/** \ingroup rpmbuild
+ */
+typedef struct Package_s * Package;
/** \ingroup rpmbuild
*/
@@ -89,91 +93,126 @@ typedef struct speclines_s {
/** \ingroup rpmbuild
* The structure used to store values parsed from a spec file.
*/
-struct SpecStruct {
-/*@only@*/ const char * specFile; /*!< Name of the spec file. */
-/*@only@*/ const char * sourceRpmName;
-/*@only@*/ const char * buildRootURL;
-/*@only@*/ const char * buildSubdir;
-/*@only@*/ const char * rootURL;
+struct Spec_s {
+/*@only@*/
+ const char * specFile; /*!< Name of the spec file. */
+/*@only@*/
+ const char * buildRootURL;
+/*@only@*/
+ const char * buildSubdir;
+/*@only@*/
+ const char * rootURL;
+
+/*@owned@*/ /*@null@*/
+ speclines sl;
+/*@owned@*/ /*@null@*/
+ spectags st;
-/*@owned@*/ /*@null@*/ speclines sl;
-/*@owned@*/ /*@null@*/ spectags st;
-
-/*@owned@*/ struct OpenFileInfo * fileStack;
+/*@owned@*/
+ struct OpenFileInfo * fileStack;
char lbuf[4*BUFSIZ];
char nextpeekc;
-/*@dependent@*/ char * nextline;
-/*@dependent@*/ char * line;
+/*@dependent@*/
+ char * nextline;
+/*@dependent@*/
+ char * line;
int lineNum;
-/*@owned@*/ struct ReadLevelEntry * readStack;
+/*@owned@*/
+ struct ReadLevelEntry * readStack;
-/*@refcounted@*/ Header buildRestrictions;
-/*@owned@*/ /*@null@*/ struct SpecStruct ** BASpecs;
-/*@only@*/ /*@null@*/ const char ** BANames;
+/*@refcounted@*/
+ Header buildRestrictions;
+/*@owned@*/ /*@null@*/
+ Spec * BASpecs;
+/*@only@*/ /*@null@*/
+ const char ** BANames;
int BACount;
- int recursing; /*!< parse is recursive? */
+ int recursing; /*!< parse is recursive? */
int force;
int anyarch;
int gotBuildRootURL;
-/*@null@*/ char * passPhrase;
+/*@null@*/
+ char * passPhrase;
int timeCheck;
-/*@null@*/ const char * cookie;
+/*@null@*/
+ const char * cookie;
-/*@owned@*/ struct Source * sources;
+/*@owned@*/
+ struct Source * sources;
int numSources;
int noSource;
+/*@only@*/
+ const char * sourceRpmName;
+/*@only@*/
+ const unsigned char * sourcePkgId;
/*@refcounted@*/
Header sourceHeader;
rpmfi sourceCpioList;
/*@dependent@*/ /*@null@*/ MacroContext macros;
-/*@only@*/ StringBuf prep; /*!< %prep scriptlet. */
-/*@only@*/ StringBuf build; /*!< %build scriptlet. */
-/*@only@*/ StringBuf install; /*!< %install scriptlet. */
-/*@only@*/ StringBuf clean; /*!< %clean scriptlet. */
+/*@only@*/
+ StringBuf prep; /*!< %prep scriptlet. */
+/*@only@*/
+ StringBuf build; /*!< %build scriptlet. */
+/*@only@*/
+ StringBuf install; /*!< %install scriptlet. */
+/*@only@*/
+ StringBuf check; /*!< %check scriptlet. */
+/*@only@*/
+ StringBuf clean; /*!< %clean scriptlet. */
-/*@owned@*/ struct PackageStruct * packages; /*!< Package list. */
+/*@owned@*/
+ Package packages; /*!< Package list. */
};
/** \ingroup rpmbuild
* The structure used to store values for a package.
*/
-struct PackageStruct {
+struct Package_s {
/*@refcounted@*/
Header header;
+/*@refcounted@*/
+ rpmds this;
rpmfi cpioList;
-/*@owned@*/ struct Source * icon;
+/*@owned@*/
+ struct Source * icon;
int autoReq;
int autoProv;
-/*@only@*/ const char * preInFile; /*!< %pre scriptlet. */
-/*@only@*/ const char * postInFile; /*!< %post scriptlet. */
-/*@only@*/ const char * preUnFile; /*!< %preun scriptlet. */
-/*@only@*/ const char * postUnFile; /*!< %postun scriptlet. */
-/*@only@*/ const char * verifyFile; /*!< %verifyscript scriptlet. */
+/*@only@*/
+ const char * preInFile; /*!< %pre scriptlet. */
+/*@only@*/
+ const char * postInFile; /*!< %post scriptlet. */
+/*@only@*/
+ const char * preUnFile; /*!< %preun scriptlet. */
+/*@only@*/
+ const char * postUnFile; /*!< %postun scriptlet. */
+/*@only@*/
+ const char * verifyFile; /*!< %verifyscript scriptlet. */
-/*@only@*/ StringBuf specialDoc;
+/*@only@*/
+ StringBuf specialDoc;
-/*@only@*/ struct TriggerFileEntry * triggerFiles;
+/*@only@*/
+ struct TriggerFileEntry * triggerFiles;
-/*@only@*/ const char * fileFile;
-/*@only@*/ StringBuf fileList; /* If NULL, package will not be written */
+/*@only@*/
+ const char * fileFile;
+/*@only@*/
+ StringBuf fileList; /* If NULL, package will not be written */
-/*@dependent@*/ struct PackageStruct * next;
+/*@dependent@*/
+ Package next;
};
-/** \ingroup rpmbuild
- */
-typedef struct PackageStruct * Package;
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -207,7 +246,8 @@ extern /*@null@*/ Spec (*freeSpecVec) (Spec spec) /* XXX FIXME */
/** \ingroup rpmbuild
*/
-struct OpenFileInfo * newOpenFileInfo(void) /*@*/;
+struct OpenFileInfo * newOpenFileInfo(void)
+ /*@*/;
/** \ingroup rpmbuild
* @param spec spec file control structure
diff --git a/build/spec.c b/build/spec.c
index 9b830072c..686d90487 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -418,7 +418,6 @@ Spec newSpec(void)
Spec spec = xcalloc(1, sizeof(*spec));
spec->specFile = NULL;
- spec->sourceRpmName = NULL;
spec->sl = newSl();
spec->st = newSt();
@@ -439,6 +438,7 @@ Spec newSpec(void)
spec->prep = NULL;
spec->build = NULL;
spec->install = NULL;
+ spec->check = NULL;
spec->clean = NULL;
spec->sources = NULL;
@@ -446,8 +446,9 @@ Spec newSpec(void)
spec->noSource = 0;
spec->numSources = 0;
+ spec->sourceRpmName = NULL;
+ spec->sourcePkgId = NULL;
spec->sourceHeader = NULL;
-
spec->sourceCpioList = NULL;
spec->gotBuildRootURL = 0;
@@ -484,13 +485,13 @@ Spec freeSpec(Spec spec)
spec->prep = freeStringBuf(spec->prep);
spec->build = freeStringBuf(spec->build);
spec->install = freeStringBuf(spec->install);
+ spec->check = freeStringBuf(spec->check);
spec->clean = freeStringBuf(spec->clean);
spec->buildRootURL = _free(spec->buildRootURL);
spec->buildSubdir = _free(spec->buildSubdir);
spec->rootURL = _free(spec->rootURL);
spec->specFile = _free(spec->specFile);
- spec->sourceRpmName = _free(spec->sourceRpmName);
#ifdef DEAD
{ struct OpenFileInfo *ofi;
@@ -515,6 +516,8 @@ Spec freeSpec(Spec spec)
rl = _free(rl);
}
+ spec->sourceRpmName = _free(spec->sourceRpmName);
+ spec->sourcePkgId = _free(spec->sourcePkgId);
spec->sourceHeader = headerFree(spec->sourceHeader);
if (spec->sourceCpioList) {