Rename parseBuildInstallClean() to something more generic

This commit is contained in:
Florian Festi 2018-10-26 10:46:03 +02:00
parent c4f285cff8
commit d6c4fff202
4 changed files with 10 additions and 22 deletions

View File

@ -14,7 +14,7 @@ usrlibdir = $(libdir)
usrlib_LTLIBRARIES = librpmbuild.la
librpmbuild_la_SOURCES = \
build.c expression.c files.c misc.c pack.c \
parseBuildInstallClean.c parseChangelog.c parseDescription.c \
parseSimpleScript.c parseChangelog.c parseDescription.c \
parseFiles.c parsePreamble.c parsePrep.c parseReqs.c parseScript.c \
parseSpec.c reqprov.c rpmfc.c spec.c \
parsePolicies.c policies.c \

View File

@ -9,27 +9,9 @@
#include "debug.h"
int parseBuildInstallClean(rpmSpec spec, int parsePart)
int parseSimpleScript(rpmSpec spec, const char * name, StringBuf *sbp)
{
int nextPart, rc, res = PART_ERROR;
StringBuf *sbp = NULL;
const char *name = NULL;
if (parsePart == PART_BUILD) {
sbp = &(spec->build);
name = "%build";
} 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";
} else {
goto exit; /* programmer error */
}
if (*sbp != NULL) {
rpmlog(RPMLOG_ERR, _("line %d: second %s\n"),

View File

@ -798,10 +798,16 @@ static rpmSpec parseSpec(const char *specFile, rpmSpecFlags flags,
parsePart = parsePrep(spec);
break;
case PART_BUILD:
parsePart = parseSimpleScript(spec, "%build", &(spec->build));
break;
case PART_INSTALL:
parsePart = parseSimpleScript(spec, "%install", &(spec->check));
break;
case PART_CHECK:
parsePart = parseSimpleScript(spec, "%check", &(spec->check));
break;
case PART_CLEAN:
parsePart = parseBuildInstallClean(spec, parsePart);
parsePart = parseSimpleScript(spec, "%clean", &(spec->clean));
break;
case PART_CHANGELOG:
parsePart = parseChangelog(spec);

View File

@ -234,7 +234,7 @@ int isPart(const char * line) ;
* @return >= 0 next rpmParseState, < 0 on error
*/
RPM_GNUC_INTERNAL
int parseBuildInstallClean(rpmSpec spec, int parsePart);
int parseSimpleScript(rpmSpec spec, const char * name, StringBuf *sbp);
/** \ingroup rpmbuild
* Parse %%changelog section of a spec file.