comparison deploy/linux/build-and-test-deb.sh @ 706:345c12e02e3e

Further Linux build bits
author Chris Cannam
date Wed, 12 Dec 2018 11:12:23 +0000
parents
children
comparison
equal deleted inserted replaced
705:b93d662a12df 706:345c12e02e3e
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/' src/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 grep '^bitbucket.org' ~/.ssh/known_hosts > "$dockerdir"/known_hosts
31 cp ~/.ssh/id_dsa_build "$dockerdir"/id_dsa_build
32 chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_dsa_build
33 trap "rm $dockerdir/known_hosts $dockerdir/id_dsa_build" 0
34
35 dockertag="cannam/easymercurial-deb-$current"
36
37 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_deb.gen "$dockerdir"
38
39 outdir="$dockerdir/output"
40 mkdir -p "$outdir"
41
42 container=$(sudo docker create "$dockertag")
43
44 sudo docker cp "$container":output-deb.tar "$outdir"
45 sudo docker rm "$container"
46
47 ( cd "$outdir" ; tar xf output-deb.tar && rm -f output-deb.tar )
48
49 sudo docker build -t "$dockertag"-test -f "$dockerdir"/Dockerfile_test_deb.gen "$dockerdir"