Mercurial > hg > sonic-visualiser
annotate deploy/linux/build-and-test-deb.sh @ 2143:27ad597b1180
Update sv-dependency-builds to remove use of hg subrepo
author | Chris Cannam |
---|---|
date | Tue, 04 Dec 2018 10:31:12 +0000 |
parents | f69819b5c248 |
children | 3a4202cae7fe |
rev | line source |
---|---|
Chris@2116 | 1 #!/bin/bash |
Chris@2116 | 2 # |
Chris@2116 | 3 # Docker required |
Chris@2116 | 4 |
Chris@2116 | 5 set -eu |
Chris@2116 | 6 |
Chris@2116 | 7 current=$(hg id | awk '{ print $1; }') |
Chris@2116 | 8 release=$(perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' version.h) |
Chris@2116 | 9 |
Chris@2116 | 10 case "$current" in |
Chris@2116 | 11 *+) 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@2116 | 12 *);; |
Chris@2116 | 13 esac |
Chris@2116 | 14 |
Chris@2116 | 15 echo |
Chris@2116 | 16 echo "Building Debian deb archive from revision $current..." |
Chris@2116 | 17 |
Chris@2116 | 18 dockerdir=deploy/linux/docker |
Chris@2116 | 19 |
Chris@2116 | 20 cat "$dockerdir"/Dockerfile_deb.in | \ |
Chris@2116 | 21 perl -p -e "s/\[\[REVISION\]\]/$current/g" | \ |
Chris@2116 | 22 perl -p -e "s/\[\[RELEASE\]\]/$release/g" > \ |
Chris@2116 | 23 "$dockerdir"/Dockerfile_deb.gen |
Chris@2116 | 24 |
Chris@2116 | 25 cat "$dockerdir"/Dockerfile_test_deb.in | \ |
Chris@2116 | 26 perl -p -e "s/\[\[REVISION\]\]/$current/g" | \ |
Chris@2116 | 27 perl -p -e "s/\[\[RELEASE\]\]/$release/g" > \ |
Chris@2116 | 28 "$dockerdir"/Dockerfile_test_deb.gen |
Chris@2116 | 29 |
Chris@2116 | 30 dockertag="cannam/sonic-visualiser-deb-$current" |
Chris@2116 | 31 |
Chris@2116 | 32 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_deb.gen "$dockerdir" |
Chris@2116 | 33 |
Chris@2116 | 34 outdir="$dockerdir/output" |
Chris@2116 | 35 mkdir -p "$outdir" |
Chris@2116 | 36 |
Chris@2116 | 37 container=$(sudo docker create "$dockertag") |
Chris@2116 | 38 |
Chris@2116 | 39 sudo docker cp "$container":output-deb.tar "$outdir" |
Chris@2116 | 40 sudo docker rm "$container" |
Chris@2116 | 41 |
Chris@2116 | 42 ( cd "$outdir" ; tar xf output-deb.tar && rm -f output-deb.tar ) |
Chris@2116 | 43 |
Chris@2116 | 44 sudo docker build -f "$dockerdir"/Dockerfile_test_deb.gen "$dockerdir" |