reorganize build script

This commit is contained in:
f 2021-09-29 15:54:40 -03:00
parent 1aa8a03198
commit b244a0ece0

34
gemcompiler.sh Normal file → Executable file
View file

@ -1,16 +1,30 @@
#!/bin/sh
set -e
export PATH=usr/lib/ccache/bin:$PATH
PLATFORM=`ruby -e "puts RbConfig::CONFIG['arch']"`
# CCache
export PATH=/usr/lib/ccache/bin:$PATH
cd /srv/gems
source /etc/os-release
alpine_version="${VERSION_ID%.*}"
platform="`ruby -e "puts RbConfig::CONFIG['arch']"`"
gems_dir="${GEMS_DIR:-/srv/gems}"
cache_dir="${gems_dir}/cache"
release_dir="${RELEASE_DIR:-${gems_dir}/${alpine_version}}"
test -f ${GEM}-${VERSION}.gem \
|| gem fetch --source=https://${SUTTY} --platform=ruby \
--version ${VERSION} ${GEM}
mkdir -p "${cache_dir}" "${release_dir}"
test -f ${GEM}-${VERSION}-${PLATFORM}.gem \
|| gem compile -V --prune --strip "strip --strip-unneeded" ${GEM}-${VERSION}.gem
gem="${GEM}-${VERSION}.gem"
release="${GEM}-${VERSION}-${platform}.gem"
gem inabox -o ${GEM}-${VERSION}-${PLATFORM}.gem \
--host https://${HTTP_BASIC_USER}:${HTTP_BASIC_PASSWORD}@gems.${SUTTY}
if ! test -f "${cache_dir}/${gem}" ; then
cd "${cache_dir}"
gem fetch --source=https://gems.${SUTTY} --platform=ruby --version ${VERSION} ${GEM}
fi
if ! test -f "${release_dir}/${release}"; then
cd "${release_dir}"
gem compile -V --prune --strip "strip --strip-unneeded" "${cache_dir}/${gem}"
fi
test -f "${release_dir}/${release}" \
&& gem inabox -o "${release_dir}/${release}" --host https://${HTTP_BASIC_USER}:${HTTP_BASIC_PASSWORD}@gems.${SUTTY}