Commit 5dd11eec authored by Markus Frosch's avatar Markus Frosch
Browse files

rpm: Make sure to exit on subshell errors

For older versions of bash...
parent 4261f85f
Pipeline #9059 passed with stage
in 24 seconds
......@@ -20,7 +20,7 @@ case "$ICINGA_BUILD_OS" in
# Note: force rebuilding here, because zypper is a bit dumb
run-retry-timeout sudo zypper --non-interactive clean --all
run-retry-timeout sudo zypper --non-interactive --no-gpg-checks --gpg-auto-import-keys ref -fs
)
) || exit 1
;;
*)
(
......@@ -33,7 +33,7 @@ case "$ICINGA_BUILD_OS" in
run-retry-timeout sudo yum clean expire-cache
run-retry-timeout sudo yum makecache fast
fi
)
) || exit 1
;;
esac
......@@ -44,7 +44,7 @@ case "$ICINGA_BUILD_OS" in
set -ex
# shellcheck disable=SC2046
run-retry-timeout sudo zypper --non-interactive install $(rpm -qpR "${source_rpm}")
)
) || exit 1
;;
*)
(
......@@ -55,7 +55,7 @@ case "$ICINGA_BUILD_OS" in
set -ex
run-retry-timeout sudo yum-builddep -y "${source_rpm}"
fi
)
) || exit 1
;;
esac
......@@ -87,7 +87,7 @@ eval "$(get_rpmbuild --rebuild "${source_rpm}")"
else
"${RPMBUILD[@]}"
fi
)
) || exit 1
if command -v ccache &>/dev/null && [ -d "${CCACHE_DIR}" ]; then
cached_files="$(find "${CCACHE_DIR}" -type f ! -name ccache.conf ! -name stats | wc -l)"
......@@ -121,4 +121,4 @@ echo "[ Running rpmlint ]"
) || lintrc=$?
done
[ "$lintrc" -eq 0 ]
) || [ "${ICINGA_BUILD_IGNORE_LINT}" -eq 1 ]
) || ([ "${ICINGA_BUILD_IGNORE_LINT}" -eq 1 ] && exit 1) || exit 1
......@@ -7,7 +7,7 @@ set -e
(
set -ex
rm -rf "${BUILDDIR:?}/"
)
) || exit 1
echo "[ git show ]"
GIT_PAGER='cat' git show -s || true
......@@ -22,7 +22,7 @@ echo
mkdir "${BUILDDIR}"/{,SPECS,SOURCES,BUILD,SRPMS,RPMS}
cp -v ./*.spec "${BUILDDIR}/SPECS/"
find . -maxdepth 1 -type f ! -name "*.spec" -exec cp -vt "${BUILDDIR}/SOURCES/" {} \;
)
) || exit 1
if [ -d /etc/rpmdevtools ]; then
if ! grep -Pq ^--netrc /etc/rpmdevtools/curlrc; then
......@@ -45,14 +45,14 @@ if [ "$ICINGA_BUILD_TYPE" == "release" ] ; then
set -ex
cd "${BUILDDIR}/SOURCES/"
run-retry-timeout spectool -g ../SPECS/*.spec
)
) || exit 1
else
echo "[ Creating snapshot tarball ]"
(
set -ex
UPSTREAM_GIT_BRANCH="$ICINGA_BUILD_UPSTREAM_BRANCH" run-retry-timeout ./get_snapshot
mv -t "${BUILDDIR}/SOURCES/" ./*.version ./*.tar*
)
) || exit 1
echo "[ Building snapshot version ]"
(
......@@ -70,7 +70,7 @@ else
-e '0,/^Source0\?: /{s/\(Source0\?\): .*/Source0: '"${tarball}"'/}' \
-e '0,/^%global\s\+\(git_\)\?commit /{s/\(%global\s\+\(git_\)\?commit\).*/%global commit '"${git_commit}"'/}' \
"SPECS/${ICINGA_BUILD_PROJECT}.spec"
)
) || exit 1
fi
......@@ -84,8 +84,7 @@ echo "[ Building source RPM ]"
# (he could test the package in repository)
rpm -qp --queryformat "%{VERSION}-%{RELEASE}" "SRPMS/"*"${ICINGA_BUILD_PROJECT}"*".src.rpm" \
>"${ICINGA_BUILD_PROJECT}-package.version"
)
) || exit 1
echo "[ Running rpmlint ]"
lintconf=(--info --verbose -o "NetworkEnabled True")
......@@ -107,4 +106,4 @@ fi
| tee "${BUILDDIR}/"rpmlint-srpm.log || lintrc=$?
[ "$lintrc" -eq 0 ]
) || [ "${ICINGA_BUILD_IGNORE_LINT}" -eq 1 ]
) || ([ "${ICINGA_BUILD_IGNORE_LINT}" -eq 1 ] && exit 1) || exit 1
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment