annotate deploy/linux/build-and-test-appimage.sh @ 1967:cbf8ea8e6571 checker_errorcode

Further error handling in checker
author Chris Cannam
date Thu, 30 Aug 2018 12:33:25 +0100
parents d7593016cad3
children f69819b5c248
rev   line source
Chris@1924 1 #!/bin/bash
Chris@1924 2 #
Chris@1924 3 # Docker required
Chris@1924 4
Chris@1924 5 set -eu
Chris@1924 6
Chris@1924 7 current=$(hg id | awk '{ print $1; }')
Chris@1924 8
Chris@1924 9 case "$current" in
Chris@1924 10 *+) echo "ERROR: Current working copy has been modified - unmodified copy required so we know we can check it out separately and obtain the same contents"; exit 2;;
Chris@1924 11 *);;
Chris@1924 12 esac
Chris@1924 13
Chris@1924 14 echo
Chris@1926 15 echo "Building appimage from revision $current..."
Chris@1924 16
Chris@1924 17 dockerdir=deploy/linux/docker
Chris@1924 18
Chris@1924 19 cat "$dockerdir"/Dockerfile_appimage.in | \
Chris@1924 20 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \
Chris@1924 21 "$dockerdir"/Dockerfile_appimage.gen
Chris@1924 22
Chris@1924 23 cat "$dockerdir"/Dockerfile_test_appimage.in | \
Chris@1924 24 perl -p -e "s/\[\[REVISION\]\]/$current/g" > \
Chris@1924 25 "$dockerdir"/Dockerfile_test_appimage.gen
Chris@1924 26
Chris@1925 27 dockertag="cannam/sonic-visualiser-appimage-$current"
Chris@1925 28
Chris@1925 29 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_appimage.gen "$dockerdir"
Chris@1925 30
Chris@1925 31 outdir="$dockerdir/output"
Chris@1925 32 mkdir -p "$outdir"
Chris@1925 33
Chris@1925 34 container=$(sudo docker create "$dockertag")
Chris@1925 35
Chris@1925 36 sudo docker cp "$container":output.tar "$outdir"
Chris@1925 37 sudo docker rm "$container"
Chris@1925 38
Chris@1925 39 ( cd "$outdir" ; tar xf output.tar && rm -f output.tar )
Chris@1924 40
Chris@1924 41 sudo docker build -f "$dockerdir"/Dockerfile_test_appimage.gen "$dockerdir"