summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/parseBuildInstallClean.c3
-rw-r--r--build/parseFiles.c1
-rw-r--r--build/parsePreamble.c1
-rw-r--r--build/parsePrep.c1
-rw-r--r--build/parseScript.c1
-rw-r--r--build/parseSpec.c40
-rw-r--r--build/rpmbuild.h121
7 files changed, 94 insertions, 74 deletions
diff --git a/build/parseBuildInstallClean.c b/build/parseBuildInstallClean.c
index c43e722f3..e8147cef1 100644
--- a/build/parseBuildInstallClean.c
+++ b/build/parseBuildInstallClean.c
@@ -6,8 +6,7 @@
#include "rpmbuild.h"
-/** */
-int parseBuildInstallClean(Spec spec, int parsePart)
+int parseBuildInstallClean(Spec spec, rpmParseState parsePart)
{
int nextPart, rc;
StringBuf *sbp = NULL;
diff --git a/build/parseFiles.c b/build/parseFiles.c
index fe6d1293d..a0fb91da8 100644
--- a/build/parseFiles.c
+++ b/build/parseFiles.c
@@ -16,7 +16,6 @@
{ 0, 0, 0, 0, 0, NULL, NULL}
};
-/** */
int parseFiles(Spec spec)
{
int nextPart;
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 8a36fe717..c35b32c08 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -661,7 +661,6 @@ static int findPreambleTag(Spec spec, /*@out@*/int *tag, /*@out@*/char **macro,
return 0;
}
-/** */
int parsePreamble(Spec spec, int initialPackage)
{
int nextPart;
diff --git a/build/parsePrep.c b/build/parsePrep.c
index d28e249c8..a453a3e40 100644
--- a/build/parsePrep.c
+++ b/build/parsePrep.c
@@ -448,7 +448,6 @@ static int doPatchMacro(Spec spec, char *line)
return 0;
}
-/** */
int parsePrep(Spec spec)
{
int nextPart, res, rc;
diff --git a/build/parseScript.c b/build/parseScript.c
index 3e8fdf64d..aede86100 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -56,7 +56,6 @@ static int addTriggerIndex(Package pkg, const char *file, const char *script, co
/* We then pass the remaining arguments to parseRCPOT, along with */
/* an index we just determined. */
-/** */
int parseScript(Spec spec, int parsePart)
{
/* There are a few options to scripts: */
diff --git a/build/parseSpec.c b/build/parseSpec.c
index 2a9446387..f9791d006 100644
--- a/build/parseSpec.c
+++ b/build/parseSpec.c
@@ -10,28 +10,30 @@ static int _debug = 0;
#include <rpmio_internal.h>
#include <rpmbuild.h>
+/**
+ */
static struct PartRec {
int part;
int len;
char *token;
} partList[] = {
- {PART_PREAMBLE, 0, "%package"},
- {PART_PREP, 0, "%prep"},
- {PART_BUILD, 0, "%build"},
- {PART_INSTALL, 0, "%install"},
- {PART_CLEAN, 0, "%clean"},
- {PART_PREUN, 0, "%preun"},
- {PART_POSTUN, 0, "%postun"},
- {PART_PRE, 0, "%pre"},
- {PART_POST, 0, "%post"},
- {PART_FILES, 0, "%files"},
- {PART_CHANGELOG, 0, "%changelog"},
- {PART_DESCRIPTION, 0, "%description"},
- {PART_TRIGGERPOSTUN, 0, "%triggerpostun"},
- {PART_TRIGGERUN, 0, "%triggerun"},
- {PART_TRIGGERIN, 0, "%triggerin"},
- {PART_TRIGGERIN, 0, "%trigger"},
- {PART_VERIFYSCRIPT, 0, "%verifyscript"},
+ { PART_PREAMBLE, 0, "%package"},
+ { PART_PREP, 0, "%prep"},
+ { PART_BUILD, 0, "%build"},
+ { PART_INSTALL, 0, "%install"},
+ { PART_CLEAN, 0, "%clean"},
+ { PART_PREUN, 0, "%preun"},
+ { PART_POSTUN, 0, "%postun"},
+ { PART_PRE, 0, "%pre"},
+ { PART_POST, 0, "%post"},
+ { PART_FILES, 0, "%files"},
+ { PART_CHANGELOG, 0, "%changelog"},
+ { PART_DESCRIPTION, 0, "%description"},
+ { PART_TRIGGERPOSTUN, 0, "%triggerpostun"},
+ { PART_TRIGGERUN, 0, "%triggerun"},
+ { PART_TRIGGERIN, 0, "%triggerin"},
+ { PART_TRIGGERIN, 0, "%trigger"},
+ { PART_VERIFYSCRIPT, 0, "%verifyscript"},
{0, 0, 0}
};
@@ -41,7 +43,7 @@ static inline void initParts(struct PartRec *p)
p->len = strlen(p->token);
}
-int isPart(char *line)
+rpmParseState isPart(const char *line)
{
char c;
struct PartRec *p;
@@ -355,7 +357,7 @@ int parseSpec(Spec *specp, const char *specFile, const char *rootURL,
const char *buildRootURL, int inBuildArch, const char *passPhrase,
char *cookie, int anyarch, int force)
{
- int parsePart = PART_PREAMBLE;
+ rpmParseState parsePart = PART_PREAMBLE;
int initialPackage = 1;
#ifdef DYING
const char *saveArch;
diff --git a/build/rpmbuild.h b/build/rpmbuild.h
index e838bff84..8ef2ea58a 100644
--- a/build/rpmbuild.h
+++ b/build/rpmbuild.h
@@ -15,19 +15,22 @@
/* but this will be needed */
#include "rpmspec.h"
-/* from build/build.h */
-
-#define RPMBUILD_PREP (1 << 0)
-#define RPMBUILD_BUILD (1 << 1)
-#define RPMBUILD_INSTALL (1 << 2)
-#define RPMBUILD_CLEAN (1 << 3)
-#define RPMBUILD_FILECHECK (1 << 4)
-#define RPMBUILD_PACKAGESOURCE (1 << 5)
-#define RPMBUILD_PACKAGEBINARY (1 << 6)
-#define RPMBUILD_RMSOURCE (1 << 7)
-#define RPMBUILD_RMBUILD (1 << 8)
-#define RPMBUILD_STRINGBUF (1 << 9) /* only for doScript() */
-#define RPMBUILD_RMSPEC (1 << 10)
+/**
+ * Bit(s) to control buildSpec() operation.
+ */
+typedef enum rpmBuildFlags_e {
+ 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. */
+} rpmBuildFlags;
/* from build/misc.h */
@@ -40,26 +43,29 @@
#define PART_SUBNAME 0
#define PART_NAME 1
-/* from build/part.h */
-
-#define PART_NONE 0
-#define PART_PREAMBLE 1
-#define PART_PREP 2
-#define PART_BUILD 3
-#define PART_INSTALL 4
-#define PART_CLEAN 5
-#define PART_FILES 6
-#define PART_PRE 7
-#define PART_POST 8
-#define PART_PREUN 9
-#define PART_POSTUN 10
-#define PART_DESCRIPTION 11
-#define PART_CHANGELOG 12
-#define PART_TRIGGERIN 13
-#define PART_TRIGGERUN 14
-#define PART_VERIFYSCRIPT 15
-#define PART_BUILDARCHITECTURES 16
-#define PART_TRIGGERPOSTUN 17
+/**
+ * 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 /*!< */
+} rpmParseState;
/* from build/read.h */
@@ -96,10 +102,9 @@ void freeNames(void);
/* from build/read.h */
-/* returns 0 - success */
-/* 1 - EOF */
-/* <0 - error */
-/** */
+/**
+ * @return 0 on success, 1 on EOF, <0 on error
+ */
int readLine(Spec spec, int strip);
/** */
@@ -110,8 +115,12 @@ void handleComments(char *s);
/* from build/part.h */
-/** */
-int isPart(char *line);
+/**
+ * Check line for section separator, return next parser state.
+ * @param line from spec file
+ * @return next parser state
+ */
+rpmParseState isPart(const char *line);
/* from build/misc.h */
@@ -123,33 +132,47 @@ int parseNum(const char *line, /*@out@*/int *res);
/** */
void addChangelogEntry(Header h, time_t time, const char *name, const char *text);
-/** */
+/**
+ * @return >= 0 next rpmParseState, < 0 on error
+ */
+int parseBuildInstallClean(Spec spec, rpmParseState parsePart);
+
+/**
+ * @return >= 0 next rpmParseState, < 0 on error
+ */
int parseChangelog(Spec spec);
-/** */
+/**
+ * @return >= 0 next rpmParseState, < 0 on error
+ */
int parseDescription(Spec spec);
-/** */
+/**
+ * @return >= 0 next rpmParseState, < 0 on error
+ */
int parseFiles(Spec spec);
-/** */
+/**
+ * @return >= 0 next rpmParseState, < 0 on error
+ */
int parsePreamble(Spec spec, int initialPackage);
-/** */
+/**
+ * @return >= 0 next rpmParseState, < 0 on error
+ */
int parsePrep(Spec spec);
/** */
int parseRCPOT(Spec spec, Package pkg, const char *field, int tag, int index,
int flags);
-/** */
-int parseTrigger(Spec spec, Package pkg, char *field, int tag);
-
-/** */
+/**
+ * @return >= 0 next rpmParseState, < 0 on error
+ */
int parseScript(Spec spec, int parsePart);
/** */
-int parseBuildInstallClean(Spec spec, int parsePart);
+int parseTrigger(Spec spec, Package pkg, char *field, int tag);
/* from build/expression.h */