unlink defer torture test
[kai/samba-autobuild/.git] / lib / talloc / script / release-script.sh
1 #!/bin/bash
2
3 if [ "$1" = "" ]; then
4     echo "Please provide version string, eg: 1.2.0"
5     exit 1
6 fi
7
8 if [ ! -d "lib/talloc" ]; then
9     echo "Run this script from the samba base directory."
10     exit 1
11 fi
12
13 # Check exports and signatures are up to date
14 pushd lib/talloc
15 ./script/abi_checks.sh talloc talloc.h
16 abicheck=$?
17 popd
18 if [ ! "$abicheck" = "0" ]; then
19     echo "ERROR: ABI Checks produced warnings!"
20     exit 1
21 fi
22
23 git clean -f -x -d lib/talloc
24 git clean -f -x -d lib/replace
25
26 curbranch=`git-branch |grep "^*" | tr -d "* "`
27
28 version=$1
29 strver=`echo ${version} | tr "." "-"`
30
31 # Checkout the release tag
32 git branch -f talloc-release-script-${strver} talloc-${strver}
33 if [ ! "$?" = "0" ];  then
34     echo "Unable to checkout talloc-${strver} release"
35     exit 1
36 fi
37
38 git checkout talloc-release-script-${strver}
39
40 # Test configure agrees with us
41 confver=`grep "^AC_INIT" lib/talloc/configure.ac | tr -d "AC_INIT(talloc, " | tr -d ")"`
42 if [ ! "$confver" = "$version" ]; then
43     echo "Wrong version, requested release for ${version}, found ${confver}"
44     exit 1
45 fi
46
47 # Now build tarball
48 cp -a lib/talloc talloc-${version}
49 cp -a lib/replace talloc-${version}/libreplace
50 pushd talloc-${version}
51 ./autogen.sh
52 popd
53 tar cvzf talloc-${version}.tar.gz talloc-${version}
54 rm -fr talloc-${version}
55
56 #Clean up
57 git checkout $curbranch
58 git branch -d talloc-release-script-${strver}