Report bound port correctly
[beanstalkd.git] / pkg / dist.sh
blobe4797708e16b72cbbe1aaa177b8f732032ea8721
1 #!/usr/bin/env bash
3 set -e
4 set -o pipefail
6 exp() {
7 sed s/@VERSION@/$ver/ | sed s/@PARENT@/$prev/
10 clean() {
11 rm -f "$GIT_INDEX_FILE"
14 mkobj() {
15 git hash-object -w --stdin
18 die() {
19 echo >&2 "$@"
20 exit 2
23 ver=`./vers.sh`
24 case $ver in *+*) die bad ver $ver ;; esac
25 prev=`git describe --abbrev=0 --match=dev* --tags dev$ver^|sed s/^dev//`
26 test -n "$prev" || die no prev ver
27 test -f News || die no News
29 export GIT_INDEX_FILE
30 GIT_INDEX_FILE=`mktemp -t beanstalkd-dist-index`
31 trap clean EXIT
33 git read-tree dev$ver
34 newsobj=`cat News pkg/newstail.in|exp|mkobj`
35 versobj=`echo "printf '$ver'"|mkobj`
36 specobj=`exp <pkg/beanstalkd.spec.in|mkobj`
37 git update-index --add --cacheinfo 100644 $newsobj News
38 git update-index --cacheinfo 100755 $versobj vers.sh
39 git update-index --add --cacheinfo 100644 $specobj beanstalkd.spec
40 tree=`git write-tree`
41 commit=`git commit-tree $tree -p dev$ver -m "release $ver"`
42 git tag -m "beanstalkd version $ver" v$ver $commit
44 git rev-parse --verify gh-pages >/dev/null
45 parent=`git rev-parse --verify gh-pages`
46 git read-tree $parent
47 postobj=`(exp <pkg/bloghead.in; git cat-file blob v$ver:News)|mkobj`
48 post=_posts/`date +%Y-%m-%d`-$ver-release-notes.md
49 git update-index --add --cacheinfo 100644 $postobj $post
50 tree=`git write-tree`
51 commit=`git commit-tree $tree -p $parent -m "announce release $ver"`
52 git update-ref -m "commit: announce release $ver" refs/heads/gh-pages $commit $parent