Mercurial > hg > easyhg
annotate deploy/linux/build-and-test-deb.sh @ 711:87d423722656
Further deb packaging fixes, including undoing the last change, which appears to be not permitted
author | Chris Cannam |
---|---|
date | Wed, 12 Dec 2018 11:44:21 +0000 |
parents | 345c12e02e3e |
children |
rev | line source |
---|---|
Chris@706 | 1 #!/bin/bash |
Chris@706 | 2 # |
Chris@706 | 3 # Docker required |
Chris@706 | 4 |
Chris@706 | 5 set -eu |
Chris@706 | 6 |
Chris@706 | 7 current=$(hg id | awk '{ print $1; }') |
Chris@706 | 8 release=$(perl -p -e 's/^[^"]*"([^"]*)".*$/$1/' src/version.h) |
Chris@706 | 9 |
Chris@706 | 10 case "$current" in |
Chris@706 | 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@706 | 12 *);; |
Chris@706 | 13 esac |
Chris@706 | 14 |
Chris@706 | 15 echo |
Chris@706 | 16 echo "Building Debian deb archive from revision $current..." |
Chris@706 | 17 |
Chris@706 | 18 dockerdir=deploy/linux/docker |
Chris@706 | 19 |
Chris@706 | 20 cat "$dockerdir"/Dockerfile_deb.in | \ |
Chris@706 | 21 perl -p -e "s/\[\[REVISION\]\]/$current/g" | \ |
Chris@706 | 22 perl -p -e "s/\[\[RELEASE\]\]/$release/g" > \ |
Chris@706 | 23 "$dockerdir"/Dockerfile_deb.gen |
Chris@706 | 24 |
Chris@706 | 25 cat "$dockerdir"/Dockerfile_test_deb.in | \ |
Chris@706 | 26 perl -p -e "s/\[\[REVISION\]\]/$current/g" | \ |
Chris@706 | 27 perl -p -e "s/\[\[RELEASE\]\]/$release/g" > \ |
Chris@706 | 28 "$dockerdir"/Dockerfile_test_deb.gen |
Chris@706 | 29 |
Chris@706 | 30 grep '^bitbucket.org' ~/.ssh/known_hosts > "$dockerdir"/known_hosts |
Chris@706 | 31 cp ~/.ssh/id_dsa_build "$dockerdir"/id_dsa_build |
Chris@706 | 32 chmod 600 "$dockerdir"/known_hosts "$dockerdir"/id_dsa_build |
Chris@706 | 33 trap "rm $dockerdir/known_hosts $dockerdir/id_dsa_build" 0 |
Chris@706 | 34 |
Chris@706 | 35 dockertag="cannam/easymercurial-deb-$current" |
Chris@706 | 36 |
Chris@706 | 37 sudo docker build -t "$dockertag" -f "$dockerdir"/Dockerfile_deb.gen "$dockerdir" |
Chris@706 | 38 |
Chris@706 | 39 outdir="$dockerdir/output" |
Chris@706 | 40 mkdir -p "$outdir" |
Chris@706 | 41 |
Chris@706 | 42 container=$(sudo docker create "$dockertag") |
Chris@706 | 43 |
Chris@706 | 44 sudo docker cp "$container":output-deb.tar "$outdir" |
Chris@706 | 45 sudo docker rm "$container" |
Chris@706 | 46 |
Chris@706 | 47 ( cd "$outdir" ; tar xf output-deb.tar && rm -f output-deb.tar ) |
Chris@706 | 48 |
Chris@706 | 49 sudo docker build -t "$dockertag"-test -f "$dockerdir"/Dockerfile_test_deb.gen "$dockerdir" |