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