diff options
author | root <devnull@localhost> | 1996-09-02 01:58:13 +0000 |
---|---|---|
committer | root <devnull@localhost> | 1996-09-02 01:58:13 +0000 |
commit | c3b58424648442e4e4ca29631f00c50811f464a2 (patch) | |
tree | 5682bc2397029b6485872f9632e18061bf910bdf /build | |
parent | d4f868b78020287b3b1dfb3fe82808d97c6ea63b (diff) | |
download | rpm-c3b58424648442e4e4ca29631f00c50811f464a2.tar.gz rpm-c3b58424648442e4e4ca29631f00c50811f464a2.tar.bz2 rpm-c3b58424648442e4e4ca29631f00c50811f464a2.zip |
--test for building
CVS patchset: 1015
CVS date: 1996/09/02 01:58:13
Diffstat (limited to 'build')
-rw-r--r-- | build/build.c | 48 | ||||
-rw-r--r-- | build/build.h | 7 |
2 files changed, 33 insertions, 22 deletions
diff --git a/build/build.c b/build/build.c index 03d6e7a84..611d5c17c 100644 --- a/build/build.c +++ b/build/build.c @@ -33,8 +33,8 @@ struct Script { struct Script *openScript(Spec spec, int builddir, char *name); void writeScript(struct Script *script, char *s); int execScript(struct Script *script); -void freeScript(struct Script *script); -int execPart(Spec s, char *sb, char *name, int builddir); +void freeScript(struct Script *script, int test); +int execPart(Spec s, char *sb, char *name, int builddir, int test); static int doSetupMacro(Spec spec, StringBuf sb, char *line); static int doPatchMacro(Spec spec, StringBuf sb, char *line); static char *do_untar(Spec spec, int c); @@ -138,24 +138,27 @@ int execScript(struct Script *script) return 0; } -void freeScript(struct Script *script) +void freeScript(struct Script *script, int test) { if (script->file) fclose(script->file); - unlink(script->name); + if (! test) + unlink(script->name); free(script->name); free(script); } -int execPart(Spec s, char *sb, char *name, int builddir) +int execPart(Spec s, char *sb, char *name, int builddir, int test) { struct Script *script; message(MESS_DEBUG, "RUNNING: %s\n", name); script = openScript(s, builddir, name); writeScript(script, sb); - execScript(script); - freeScript(script); + if (!test) { + execScript(script); + } + freeScript(script, test); return 0; } @@ -169,7 +172,7 @@ static void doSweep(Spec s) sprintf(buf, "rm -rf %s\n", build_subdir); writeScript(script, buf); execScript(script); - freeScript(script); + freeScript(script, 0); } } @@ -586,7 +589,7 @@ static int checkSources(Spec s) return 0; } -int execPrep(Spec s, int really_exec) +int execPrep(Spec s, int really_exec, int test) { char **lines, **lines1, *p; StringBuf out; @@ -618,30 +621,30 @@ int execPrep(Spec s, int really_exec) freeSplitString(lines1); res = 0; if (really_exec) { - res = execPart(s, getStringBuf(out), "%prep", 0); + res = execPart(s, getStringBuf(out), "%prep", 0, test); } freeStringBuf(out); return res; } -int execBuild(Spec s) +int execBuild(Spec s, int test) { - return execPart(s, getStringBuf(s->build), "%build", 1); + return execPart(s, getStringBuf(s->build), "%build", 1, test); } -int execInstall(Spec s) +int execInstall(Spec s, int test) { int res; - if ((res = execPart(s, getStringBuf(s->install), "%install", 1))) { + if ((res = execPart(s, getStringBuf(s->install), "%install", 1, test))) { return res; } - return execPart(s, getStringBuf(s->doc), "special doc", 1); + return execPart(s, getStringBuf(s->doc), "special doc", 1, test); } int execClean(Spec s) { - return execPart(s, getStringBuf(s->clean), "%clean", 1); + return execPart(s, getStringBuf(s->clean), "%clean", 1, 0); } int verifyList(Spec s) @@ -651,11 +654,14 @@ int verifyList(Spec s) int doBuild(Spec s, int flags, char *passPhrase) { + int test; + + test = flags & RPMBUILD_TEST; strcpy(build_subdir, "."); /* We always need to parse the %prep section */ - if (execPrep(s, (flags & RPMBUILD_PREP))) { + if (execPrep(s, (flags & RPMBUILD_PREP), test)) { return 1; } @@ -663,17 +669,21 @@ int doBuild(Spec s, int flags, char *passPhrase) return verifyList(s); if (flags & RPMBUILD_BUILD) { - if (execBuild(s)) { + if (execBuild(s, test)) { return 1; } } if (flags & RPMBUILD_INSTALL) { - if (execInstall(s)) { + if (execInstall(s, test)) { return 1; } } + if (test) { + return 0; + } + markBuildTime(); if (flags & RPMBUILD_BINARY) { diff --git a/build/build.h b/build/build.h index fe3aac698..aa984a5f3 100644 --- a/build/build.h +++ b/build/build.h @@ -4,9 +4,9 @@ #include "spec.h" int doBuild(Spec s, int flags, char *passPhrase); -int execPrep(Spec s, int really_exec); -int execBuild(Spec s); -int execInstall(Spec s); +int execPrep(Spec s, int really_exec, int test); +int execBuild(Spec s, int test); +int execInstall(Spec s, int test); int execClean(Spec s); int verifyList(Spec s); @@ -20,5 +20,6 @@ extern char build_subdir[1024]; #define RPMBUILD_SWEEP (1 << 5) #define RPMBUILD_LIST (1 << 6) #define RPMBUILD_RMSOURCE (1 << 7) +#define RPMBUILD_TEST (1 << 8) #endif _BUILD_H_ |