annotate deploy/linux/build-and-test-deb.sh @ 2474:266d2fc815f4 audio-source-refactor

Minor subrepo fixes
author Chris Cannam
date Mon, 23 Mar 2020 14:16:11 +0000
parents 6845d7dafebf
children
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@2353 30 fgrep 'hg.sr.ht' ~/.ssh/known_hosts > "$dockerdir"/known_hosts
Chris@2353 31 cp ~/.ssh/id_rsa_build "$dockerdir"/id_rsa_build
Chris@2353 32 chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_rsa_build
Chris@2353 33 trap "rm $dockerdir/known_hosts $dockerdir/id_rsa_build" 0
Chris@2144 34
Chris@2116 35 dockertag="cannam/sonic-visualiser-deb-$current"
Chris@2116 36
Chris@2116 37 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_deb.gen "$dockerdir"
Chris@2116 38
Chris@2116 39 outdir="$dockerdir/output"
Chris@2116 40 mkdir -p "$outdir"
Chris@2116 41
Chris@2116 42 container=$(sudo docker create "$dockertag")
Chris@2116 43
Chris@2116 44 sudo docker cp "$container":output-deb.tar "$outdir"
Chris@2116 45 sudo docker rm "$container"
Chris@2116 46
Chris@2116 47 ( cd "$outdir" ; tar xf output-deb.tar && rm -f output-deb.tar )
Chris@2116 48
Chris@2116 49 sudo docker build -f "$dockerdir"/Dockerfile_test_deb.gen "$dockerdir"