summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-05-05 09:51:14 +0300
committerPanu Matilainen <pmatilai@redhat.com>2008-05-05 09:51:14 +0300
commitdc61ca3b65f74e850184ead6e6985842ae7b767b (patch)
treec0e654a4c27dd6611f71de2efaf0a9841732a409 /build
parentfc728e489f707ad1823e55b311944f1dff8ec65e (diff)
downloadrpm-dc61ca3b65f74e850184ead6e6985842ae7b767b.tar.gz
rpm-dc61ca3b65f74e850184ead6e6985842ae7b767b.tar.bz2
rpm-dc61ca3b65f74e850184ead6e6985842ae7b767b.zip
Start cleaning up the rpmerr removal mess of build/ return codes
- define PART_ERROR for error returns from various parse bits, teach parseSpec() about it - streamline parseSpec() exists
Diffstat (limited to 'build')
-rw-r--r--build/parseSpec.c22
-rw-r--r--build/rpmbuild.h1
2 files changed, 12 insertions, 11 deletions
diff --git a/build/parseSpec.c b/build/parseSpec.c
index 539c8efac..011748958 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -468,9 +468,10 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
/* which handles the initial entry into a spec file. */
/* LCL: parsePart is modified @*/
- while (parsePart > PART_NONE) {
+ while (parsePart != PART_NONE) {
int goterror = 0;
switch (parsePart) {
+ case PART_ERROR: /* fallthrough */
default:
goterror = 1;
break;
@@ -519,8 +520,7 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
}
if (goterror || parsePart >= PART_LAST) {
- spec = freeSpec(spec);
- return parsePart;
+ goto errxit;
}
if (parsePart == PART_BUILDARCHITECTURES) {
@@ -545,8 +545,7 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
|| (spec->BASpecs[index] = rpmtsSetSpec(ts, NULL)) == NULL)
{
spec->BACount = index;
- spec = freeSpec(spec);
- return RPMRC_FAIL;
+ goto errxit;
}
delMacro(NULL, "_target_cpu");
index++;
@@ -556,8 +555,7 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
if (! index) {
rpmlog(RPMLOG_ERR,
_("No compatible architectures found for build\n"));
- spec = freeSpec(spec);
- return RPMRC_FAIL;
+ goto errxit;
}
/*
@@ -592,10 +590,8 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
if (!headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
const char * name;
(void) headerNVR(pkg->header, &name, NULL, NULL);
- rpmlog(RPMLOG_ERR, _("Package has no %%description: %s\n"),
- name);
- spec = freeSpec(spec);
- return RPMRC_FAIL;
+ rpmlog(RPMLOG_ERR, _("Package has no %%description: %s\n"), name);
+ goto errxit;
}
(void) headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
@@ -617,4 +613,8 @@ int parseSpec(rpmts ts, const char *specFile, const char *rootDir,
(void) rpmtsSetSpec(ts, spec);
return 0;
+
+errxit:
+ spec = freeSpec(spec);
+ return PART_ERROR;
}
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index 90e6ad22b..a18afce12 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -49,6 +49,7 @@ typedef enum rpmBuildFlags_e {
* */
#define PART_BASE 0
typedef enum rpmParseState_e {
+ PART_ERROR = -1, /*!< */
PART_NONE = 0+PART_BASE, /*!< */
/* leave room for RPMRC_NOTFOUND returns. */
PART_PREAMBLE = 11+PART_BASE, /*!< */