|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -ex |
| 4 | + |
| 5 | +PROJNAME=clean |
| 6 | +URL=https://gitlab.science.ru.nl/clean-and-itasks/clean-build.git |
| 7 | + |
| 8 | +VERSION=$1 |
| 9 | +if echo ${VERSION} | grep 'trunk'; then |
| 10 | + VERSION=trunk-$(date +%Y%m%d) |
| 11 | + BRANCH=master |
| 12 | + LAST_REVISION="${3}" |
| 13 | + |
| 14 | + CHECKURL2=https://gitlab.science.ru.nl/clean-and-itasks/clean-libraries.git |
| 15 | + CHECKURL3=https://gitlab.science.ru.nl/clean-compiler-and-rts/compiler.git |
| 16 | + CHECKURL4=https://gitlab.science.ru.nl/clean-and-itasks/clm.git |
| 17 | + |
| 18 | + REVISION1=$(git ls-remote --heads "${URL}" "refs/heads/${BRANCH}" | cut -f 1) |
| 19 | + REVISION2=$(git ls-remote --heads "${CHECKURL2}" "refs/heads/master" | cut -f 1) |
| 20 | + REVISION3=$(git ls-remote --heads "${CHECKURL3}" "refs/heads/master" | cut -f 1) |
| 21 | + REVISION4=$(git ls-remote --heads "${CHECKURL4}" "refs/heads/master" | cut -f 1) |
| 22 | + REVISION=${REVISION1}-${REVISION2}-${REVISION3}-${REVISION4} |
| 23 | + echo "ce-build-revision:${REVISION}" |
| 24 | + |
| 25 | + if [[ "${REVISION}" == "${LAST_REVISION}" ]]; then |
| 26 | + echo "ce-build-status:SKIPPED" |
| 27 | + exit |
| 28 | + fi |
| 29 | +else |
| 30 | + echo "Only builds trunk" |
| 31 | + exit |
| 32 | +fi |
| 33 | + |
| 34 | +PROJVERSION=${PROJNAME}-${VERSION} |
| 35 | + |
| 36 | +OUTPUT=/root/${PROJVERSION}.tar.xz |
| 37 | +S3OUTPUT="" |
| 38 | +if echo $2 | grep s3://; then |
| 39 | + S3OUTPUT=$2 |
| 40 | +else |
| 41 | + OUTPUT=${2-/root/${PROJVERSION}.tar.xz} |
| 42 | +fi |
| 43 | + |
| 44 | +STARTDIR=$(pwd) |
| 45 | +DIR=${STARTDIR}/${PROJNAME} |
| 46 | +git clone --depth 1 -b ${BRANCH} ${URL} ${DIR} |
| 47 | + |
| 48 | +export CLEANDATE="$(date +%Y-%m-%d)" |
| 49 | + |
| 50 | +PREFIX=/root/clean/build |
| 51 | +cd ${DIR} |
| 52 | + |
| 53 | +./generic/cleanup.sh |
| 54 | +./generic/setup.sh clean-bundle-complete linux x64 |
| 55 | +${STARTDIR}/custom-clean-fetch.sh clean-bundle-complete linux x64 |
| 56 | +./generic/build.sh clean-bundle-complete linux x64 |
| 57 | + |
| 58 | +export XZ_DEFAULTS="-T 0" |
| 59 | + |
| 60 | +tar Jcf ${OUTPUT} --transform "s,^./,./${PROJVERSION}/," -C ${PREFIX}/clean . |
| 61 | + |
| 62 | +if [[ ! -z "${S3OUTPUT}" ]]; then |
| 63 | + s3cmd put --rr ${OUTPUT} ${S3OUTPUT} |
| 64 | +fi |
0 commit comments