diff options
author | root <devnull@localhost> | 1996-02-22 19:33:08 +0000 |
---|---|---|
committer | root <devnull@localhost> | 1996-02-22 19:33:08 +0000 |
commit | 9599f0fa43edbe7745652ad4aa88c016aae5f259 (patch) | |
tree | 90e9f66acb4cf954d220577b7540209ab543c464 /rpm.c | |
parent | 23e9920a5fb09622b04cb9d0a4c954b6e4ad376c (diff) | |
download | rpm-9599f0fa43edbe7745652ad4aa88c016aae5f259.tar.gz rpm-9599f0fa43edbe7745652ad4aa88c016aae5f259.tar.bz2 rpm-9599f0fa43edbe7745652ad4aa88c016aae5f259.zip |
stop builds on error
CVS patchset: 400
CVS date: 1996/02/22 19:33:08
Diffstat (limited to 'rpm.c')
-rwxr-xr-x | rpm.c | 22 |
1 files changed, 17 insertions, 5 deletions
@@ -30,7 +30,7 @@ void printHelp(void); void printVersion(void); void printBanner(void); void printUsage(void); -void build(char * arg, int buildAmount, char *passPhrase); +int build(char * arg, int buildAmount, char *passPhrase); void printVersion(void) { printf("RPM version %s\n", version); @@ -139,10 +139,11 @@ void printHelp(void) { puts(" --check-sig <pkg>+ - verify PGP signature"); } -void build(char * arg, int buildAmount, char *passPhrase) { +int build(char * arg, int buildAmount, char *passPhrase) { FILE *f; Spec s; char * specfile; + int res = 0; if (arg[0] == '/') { specfile = arg; @@ -154,22 +155,29 @@ void build(char * arg, int buildAmount, char *passPhrase) { strcat(specfile, arg); } - f = fopen(specfile, "r"); + if (!(f = fopen(specfile, "r"))) { + fprintf(stderr, "unable to open: %s\n", specfile); + return 1; + } s = parseSpec(f, specfile); fclose(f); if (s) { if (doBuild(s, buildAmount, passPhrase)) { fprintf(stderr, "Build failed.\n"); + res = 1; } freeSpec(s); } else { /* Spec parse failed -- could be Exclude: Exclusive: */ + res = 1; if (errCode() == RPMERR_BADARCH) { fprintf(stderr, "%s doesn't build on this architecture\n", arg); } else { fprintf(stderr, "Build failed.\n"); } } + + return res; } int main(int argc, char ** argv) { @@ -506,7 +514,9 @@ int main(int argc, char ** argv) { if (doSourceInstall("/", argv[optind++], &specFile)) exit(-1); - build(specFile, buildAmount, passPhrase); + if (build(specFile, buildAmount, passPhrase)) { + exit(-1); + } } break; @@ -521,7 +531,9 @@ int main(int argc, char ** argv) { argerror("no spec files given for build"); while (optind < argc) - build(argv[optind++], buildAmount, passPhrase); + if (build(argv[optind++], buildAmount, passPhrase)) { + exit(-1); + } break; case MODE_UNINSTALL: |