comparison deploy/linux/build-and-test-deb.sh @ 2116:f69819b5c248

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