diff options
author | 2015-03-03 18:59:58 +0000 | |
---|---|---|
committer | 2015-03-03 18:59:58 +0000 | |
commit | 7266717147d7998b86386f3e73667f0460b2a57a (patch) | |
tree | 53cd6a7f7e45624a130237f3ecae34c16f0f65d3 /bin | |
parent | Add new_* pages (diff) | |
download | ruby-tinderbox-7266717147d7998b86386f3e73667f0460b2a57a.tar.gz ruby-tinderbox-7266717147d7998b86386f3e73667f0460b2a57a.tar.bz2 ruby-tinderbox-7266717147d7998b86386f3e73667f0460b2a57a.zip |
Change the format used to store log files on disk.
This allows packages to be linked to the sha1 sum of their ebuilds to
prevent mixed information when ebuilds are edited but not bumped. It
also lays the groundwork for including information about hypothetical
build situations, next_target, next_keyword, ect.
The db schema, web interface, and docker glue will need to be updated to
account for this new layout.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/get_stage3.sh | 11 | ||||
-rw-r--r-- | bin/make.conf | 11 | ||||
-rwxr-xr-x | bin/provision.sh | 17 | ||||
-rwxr-xr-x | bin/repoman.sh | 72 | ||||
-rwxr-xr-x | bin/tinder.sh | 105 |
5 files changed, 216 insertions, 0 deletions
diff --git a/bin/get_stage3.sh b/bin/get_stage3.sh new file mode 100755 index 0000000..da04ec2 --- /dev/null +++ b/bin/get_stage3.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +DIST_MIRROR="http://mirror.bytemark.co.uk/gentoo/" +LATEST_STAGE3=$(curl -s $DIST_MIRROR/releases/amd64/autobuilds/latest-stage3-amd64.txt | tail -1 | awk '{print $1}') +STAGE3_URI="$DIST_MIRROR/releases/amd64/autobuilds/$LATEST_STAGE3" + +if [[ ! -f "$SCRIPT_DIR/../cache/stage3-amd64.tar.bz2" ]]; then + curl -o "$SCRIPT_DIR/../cache/stage3-amd64.tar.bz2" $STAGE3_URI +fi diff --git a/bin/make.conf b/bin/make.conf new file mode 100644 index 0000000..f16dbb7 --- /dev/null +++ b/bin/make.conf @@ -0,0 +1,11 @@ +CFLAGS="-O2 -pipe" +CXXFLAGS="" +CHOST="x86_64-pc-linux-gnu" + +USE="mmx sse sse2 -perl -python" +RUBY_TARGETS="ruby19 ruby20 ruby21 ruby22" + +GENTOO_MIRRORS="http://mirror.bytemark.co.uk/gentoo/" +SYNC="rsync://mirror.bytemark.co.uk/gentoo-portage" +EMERGE_DEFAULT_OPTS="--color=n --nospinner" +PORTDIR_OVERLAY="/ruby-tinderbox/overlay" diff --git a/bin/provision.sh b/bin/provision.sh new file mode 100755 index 0000000..7cc5510 --- /dev/null +++ b/bin/provision.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +emerge-webrsync +emerge --metadata +cp "$SCRIPT_DIR/make.conf" /etc/portage/make.conf + +RUBIES="dev-lang/ruby:1.9 dev-lang/ruby:2.0 dev-lang/ruby:2.1 dev-lang/ruby:2.2" +set +e +emerge --pretend --quiet $RUBIES +if [[ $? == 1 ]]; then + emerge --autounmask-write $RUBIES + etc-update --automode -5 +fi +set -e +emerge --noreplace --quiet $RUBIES diff --git a/bin/repoman.sh b/bin/repoman.sh new file mode 100755 index 0000000..060d48e --- /dev/null +++ b/bin/repoman.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail +[[ $(whoami) == 'root' ]] || exit 1 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +function ENV_SETUP() { + if [[ ! -d $SCRIPT_DIR/ci-logs/ ]]; then + mkdir "$SCRIPT_DIR/ci-logs" + fi +} + +function SETUP() { + mkdir -p "$SCRIPT_DIR/overlay" + mkdir -p "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" + cp "/usr/portage/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" + cp "/usr/portage/$CATEGORY/$NAME/metadata.xml" "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" +} + +function REPOMAN() { + cd "$SCRIPT_DIR/overlay/$CATEGORY/$NAME" + repoman scan || true + repoman manifest + repoman full > /tmp/repoman_log_current || true + echo $? > /tmp/repoman_result_current + + sed -i -e "/^USE_RUBY/s/$CURR_TARGET/$CURR_TARGET $NEXT_TARGET/" "$NAME-$VERSION.ebuild" + repoman manifest + repoman full > /tmp/repoman_log_next || true + echo $? > /tmp/repoman_result_next + + LOG +} + +function LOG() { + DATE=$(date +%s) + SHA1=$(sha1sum "/usr/portage/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" | awk '{print $1}') + mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE" + mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE" + + cp /tmp/repoman_log_current "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE/repoman_log" + cp /tmp/repoman_result_current "$SCRIPT_DIR/ci-logs/$SHA1/current_target/repomans/$DATE/repoman_result" + cp /tmp/repoman_log_next "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE/repoman_log" + cp /tmp/repoman_result_next "$SCRIPT_DIR/ci-logs/$SHA1/next_target/repomans/$DATE/repoman_result" + + chmod 755 -R "$SCRIPT_DIR/ci-logs" +} + +function CLEANUP() { + rm /tmp/repoman_log_current + rm /tmp/repoman_result_current + rm /tmp/repoman_log_next + rm /tmp/repoman_result_next + rm -r "$SCRIPT_DIR/overlay" +} + +ENV_SETUP + +PKG_ARR=($(qatom $1)) +CATEGORY="${PKG_ARR[0]}" +NAME="${PKG_ARR[1]}" +if [[ ${PKG_ARR[3]:=foo} == 'foo' ]]; then + VERSION="${PKG_ARR[2]}" +else + VERSION="${PKG_ARR[2]}-${PKG_ARR[3]}" +fi + +PACKAGE=$1 +CURR_TARGET=$2 +NEXT_TARGET=$3 +SETUP +REPOMAN +CLEANUP diff --git a/bin/tinder.sh b/bin/tinder.sh new file mode 100755 index 0000000..eb6d383 --- /dev/null +++ b/bin/tinder.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash +set -o errexit -o nounset -o pipefail +[[ $(whoami) == 'root' ]] || exit 1 +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + +function ENV_SETUP() { + eselect news read --quiet all + eselect ruby set 1 + if [[ ! -d /etc/portage/env/ ]]; then + mkdir /etc/portage/env/ + fi + echo 'FEATURES="${FEATURES} test keepwork"' > /etc/portage/env/test + + if [[ ! -d $SCRIPT_DIR/ci-logs/ ]]; then + mkdir "$SCRIPT_DIR/ci-logs" + fi +} + +function SETUP () { + cp /var/lib/portage/world /var/lib/portage/world.original + echo "" > /etc/portage/package.accept_keywords + echo "=$PACKAGE doc" > /etc/portage/package.use + echo "=$PACKAGE test" > /etc/portage/package.env + + if [[ -e /usr/portage/packages/$PACKAGE.tbz2 ]]; then + rm "/usr/portage/packages/$PACKAGE.tbz2" + fi + + set +e + emerge --pretend --quiet "=$PACKAGE" + if [[ $? == 1 ]]; then + emerge --autounmask-write "=$PACKAGE" + etc-update --automode -5 + fi + set -e +} + +function EMERGE() { + set +e + timeout 1000 emerge --usepkg --buildpkg "=$PACKAGE" + LOG "$?" + set -e +} + +function LOG() { + DATE=$(date +%s) + SHA1=$(sha1sum "/usr/portage/$CATEGORY/$NAME/$NAME-$VERSION.ebuild" | awk '{print $1}') + mkdir -p "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE" + + emerge --info "=$PACKAGE" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/emerge-info" + emerge -pqv "=$PACKAGE" > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/emerge-pqv" + cp "/var/tmp/portage/$PACKAGE/temp/build.log" "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/build.log" + cp "/var/tmp/portage/$PACKAGE/temp/environment" "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/environment" + gem list > "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/gem-list" + + if [[ $1 == 0 ]]; then + RESULT="\e[0;32mBUILD SUCCEEDED\e[0m" + touch "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/succeeded" + elif [[ $1 == 1 ]]; then + RESULT="\e[0;31mBUILD FAILED\e[0m" + touch "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/failed" + elif [[ $1 == 124 ]]; then + RESULT="\e[0;31mBUILD TIMED OUT\e[0m" + touch "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/timedout" + else + RESULT="\e[0;31mBUILD UNKNOWN\e[0m" + touch "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE/unknown" + fi + + chmod 755 -R "$SCRIPT_DIR/ci-logs/$SHA1/$TYPE/builds/$DATE" +} + +function CLEANUP() { + mv /var/lib/portage/world.original /var/lib/portage/world + rm -r /var/tmp/portage/* || true + emerge --depclean --quiet + echo -e "$PACKAGE : $RESULT" +} + +ENV_SETUP + +PKG_ARR=($(qatom $1)) +CATEGORY="${PKG_ARR[0]}" +NAME="${PKG_ARR[1]}" +if [[ ${PKG_ARR[3]:=foo} == 'foo' ]]; then + VERSION="${PKG_ARR[2]}" +else + VERSION="${PKG_ARR[2]}-${PKG_ARR[3]}" +fi + +if [[ $# -eq 1 ]]; then + TYPE='current_target' + PACKAGE=$1 + SETUP + EMERGE + CLEANUP +elif [[ $# -eq 3 ]]; then + TYPE='next_target' + PACKAGE=$1 + CURR_TARGET=$2 + NEXT_TARGET=$3 + SETUP + EMERGE + CLEANUP +fi |