containers-gem-compiler/bulk-compiler.sh

66 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
set -e
set -o pipefail
test -n "${HTTP_BASIC_USER}"
test -n "${HTTP_BASIC_PASSWORD}"
test -n "${SUTTY}"
test -n "${PLATFORM}"
source /etc/os-release
OS_VERSION="$(os-version)"
install -dm 755 -o builder -g builder cache gems
echo "1..$(find build/ -type f | grep -v /.keep | wc -l)"
find build/ -type f | grep -v /.keep | nl |
sed -re "s|\tbuild/([^/]+)/(.*)|&\tbuilt/${ID}/${OS_VERSION}/\1/\2\tfailed/${ID}/${OS_VERSION}/\1/\2\t\1\t\2|" |
while read NUMBER BUILD BUILT FAILED GEM_NAME GEM_VERSION; do
if test -f "${BUILT}" ; then
echo "ok ${NUMBER} - ${GEM_NAME} ${GEM_VERSION} already built, skipping"
continue
fi
if test -f "${FAILED}" ; then
echo "not ok ${NUMBER} - ${GEM_NAME} ${GEM_VERSION} failed previously"
continue
fi
unset EXTRA_PKGS EXTRA_GEMS GEM_COMPILER_FLAGS CMAKE_FLAGS
source "${BUILD}"
set +e
echo '```' > build_log
HTTP_BASIC_USER="${HTTP_BASIC_USER}" \
HTTP_BASIC_PASSWORD="${HTTP_BASIC_PASSWORD}" \
SUTTY="${SUTTY}" \
PLATFORM="${PLATFORM}" \
GEM_NAME="${GEM_NAME}" \
GEM_VERSION="${GEM_VERSION}" \
EXTRA_PKGS="${EXTRA_PKGS}" \
EXTRA_GEMS="${EXTRA_GEMS}" \
GEM_COMPILER_FLAGS="${GEM_COMPILER_FLAGS}" \
CMAKE_FLAGS="${CMAKE_FLAGS}" \
/usr/local/bin/bootstrap 2>&1 | tee -a build_log
status=$?
echo '```' >> build_log
if test $status -ne 0 ; then
BUILT="${FAILED}"
echo "not ok ${NUMBER} - ${GEM_NAME} ${GEM_VERSION} build failed"
tea issue create -t "${ID} ${OS_VERSION} ${GEM_NAME} ${GEM_VERSION} build failed" -d "$(cat build_log)"
fi
set -e
dirname "${BUILT}" | xargs mkdir -p
touch "${BUILT}"
done