Handle %setup archive unpack exit code centrally and consistently

Previously the exit code handling was missing from uncompressed tar-case.
This commit is contained in:
Andreas Scherer 2018-11-26 15:50:15 +02:00 committed by Panu Matilainen
parent a22b5973bd
commit 76c429c317
1 changed files with 9 additions and 16 deletions

View File

@ -207,11 +207,7 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
} }
zipper = rpmGetPath(t, NULL); zipper = rpmGetPath(t, NULL);
if (needtar) { if (needtar) {
rasprintf(&buf, "%s '%s' | %s %s - \n" rasprintf(&buf, "%s '%s' | %s %s -", zipper, fn, tar, taropts);
"STATUS=$?\n"
"if [ $STATUS -ne 0 ]; then\n"
" exit $STATUS\n"
"fi", zipper, fn, tar, taropts);
} else if (needgemspec) { } else if (needgemspec) {
char *gem = rpmGetPath("%{__gem}", NULL); char *gem = rpmGetPath("%{__gem}", NULL);
char *gemspec = NULL; char *gemspec = NULL;
@ -220,20 +216,13 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
rstrlcpy(gemnameversion, sp->source, strlen(sp->source) - 3); rstrlcpy(gemnameversion, sp->source, strlen(sp->source) - 3);
gemspec = rpmGetPath("%{_builddir}/", gemnameversion, ".gemspec", NULL); gemspec = rpmGetPath("%{_builddir}/", gemnameversion, ".gemspec", NULL);
rasprintf(&buf, "%s '%s' && %s spec '%s' --ruby > '%s'\n" rasprintf(&buf, "%s '%s' && %s spec '%s' --ruby > '%s'",
"STATUS=$?\n" zipper, fn, gem, fn, gemspec);
"if [ $STATUS -ne 0 ]; then\n"
" exit $STATUS\n"
"fi", zipper, fn, gem, fn, gemspec);
free(gemspec); free(gemspec);
free(gem); free(gem);
} else { } else {
rasprintf(&buf, "%s '%s'\n" rasprintf(&buf, "%s '%s'", zipper, fn);
"STATUS=$?\n"
"if [ $STATUS -ne 0 ]; then\n"
" exit $STATUS\n"
"fi", zipper, fn);
} }
free(zipper); free(zipper);
} else { } else {
@ -243,7 +232,11 @@ static char *doUntar(rpmSpec spec, uint32_t c, int quietly)
exit: exit:
free(fn); free(fn);
free(tar); free(tar);
return buf; return rstrcat(&buf,
"\nSTATUS=$?\n"
"if [ $STATUS -ne 0 ]; then\n"
" exit $STATUS\n"
"fi");
} }
/** /**