chiark / gitweb /
Merge subdirmk 0.3
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 13:14:45 +0000 (13:14 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 13:14:45 +0000 (13:14 +0000)
subdirmk/tests/advance-tested [new file with mode: 0755]
subdirmk/tests/make-release [new file with mode: 0755]

diff --git a/subdirmk/tests/advance-tested b/subdirmk/tests/advance-tested
new file mode 100755 (executable)
index 0000000..fc38869
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+# subdirmk - test suite runner helper script
+# Copyright various contributors - see top level README.
+# SPDX-License-Identifier: LGPL-2.0-or-later
+# There is NO WARRANTY.
+
+set -e
+
+branch=$(git symbolic-ref -q HEAD || test $? = 1)
+base=$(git merge-base tested HEAD)
+
+git branch -D test-failed 2>&1 ||:
+
+case "$branch" in
+refs/heads/tested|refs/heads/test-failed)
+       echo >&2 "unexpectedly on branch $branch"; exit 1 ;;
+refs/heads/*)
+       branch=${branch#refs/heads/} ;;
+*)
+       branch='';
+esac
+
+restore-branch () {
+       if [ "$branch" ]; then git checkout $branch; fi
+}
+
+git checkout --detach
+git clean -xdff
+
+if ! git rebase --exec 'tests/check && git branch -f tested' $base; then
+       git branch -f test-failed
+       git rebase --abort
+       echo >&2 '^ ignore previous message from git-rebase!'
+       echo >&2 'Test failed, made local branch ref test-failed'
+       restore-branch
+       exit 1
+fi
+
+restore-branch
diff --git a/subdirmk/tests/make-release b/subdirmk/tests/make-release
new file mode 100755 (executable)
index 0000000..1090feb
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+# subdirmk - release script
+# Copyright various contributors - see top level README.
+# SPDX-License-Identifier: LGPL-2.0-or-later
+# There is NO WARRANTY.
+
+set -e
+
+fail () { echo >&2 "error: $*"; $dryrun exit 1; }
+
+case "$1" in
+-n)    dryrun=: ; shift ;;
+-*)    fail "unknown option $1" ;;
+esac
+
+x () { echo >&2 " $*"; $dryrun "$@"; }
+
+head=$(git rev-parse HEAD~0)
+for branch in master tested; do
+       bv=$(git rev-parse refs/heads/$branch)
+       test $bv = $head || fail "error: HEAD=$head, $branch=$bv"
+done
+
+status=$(git status --porcelain --ignored)
+if [ "$status" ]; then
+       printf >&2 '%s\n' "$status"
+       fail 'tree not sufficiently clean'
+fi
+
+v="$1"
+
+case "$v" in
+subdirmk/*) v=${v#subdirmk/} ;;
+esac
+
+case "$v" in
+[0-9]*.*) ;;
+*) fail 'bad version' ;;
+esac
+
+tag=subdirmk/$v
+key=0x559AE46C2D6B6D3265E7CBA1E3E3392348B50D39
+
+export GPG_TTY=`tty` # wtf
+x git tag -s -u $key -m "subdirmk $v" $tag
+
+x git push origin master $tag
+
+$dryrun echo 'done.'