s3:utils: assign ids to struct to list shares correctly
[Samba.git] / third_party / waf / update.sh
blob16bda84a3f0fb85b9ea085565007916281960ad2
1 #!/bin/bash
3 if [[ $# -lt 1 ]]; then
4 echo "Usage: update.sh VERSION"
5 exit 1
6 fi
8 WAF_VERSION="${1}"
9 WAF_GIT="https://gitlab.com/ita1024/waf.git"
10 WAF_UPDATE_SCRIPT="$(readlink -f "$0")"
11 WAF_SAMBA_DIR="$(dirname "${WAF_UPDATE_SCRIPT}")"
12 WAF_TMPDIR=$(mktemp --tmpdir -d waf-XXXXXXXX)
14 echo "VERSION: ${WAF_VERSION}"
15 echo "GIT URL: ${WAF_GIT}"
16 echo "WAF SAMBA DIR: ${WAF_SAMBA_DIR}"
17 echo "WAF TMP DIR: ${WAF_TMPDIR}"
19 cleanup_tmpdir() {
20 popd 2>/dev/null || true
21 rm -rf "$WAF_TMPDIR"
23 trap cleanup_tmpdir SIGINT
25 cleanup_and_exit() {
26 cleanup_tmpdir
27 if test "$1" = 0 -o -z "$1" ; then
28 exit 0
29 else
30 exit "$1"
34 # Checkout the git tree
35 mkdir -p "${WAF_TMPDIR}"
36 pushd "${WAF_TMPDIR}" || cleanup_and_exit 1
38 git clone "${WAF_GIT}"
39 ret=$?
40 if [ $ret -ne 0 ]; then
41 echo "ERROR: Failed to clone repository"
42 cleanup_and_exit 1
46 pushd waf || cleanup_and_exit 1
47 git checkout -b "waf-${WAF_VERSION}" "waf-${WAF_VERSION}"
48 ret=$?
49 if [ $ret -ne 0 ]; then
50 echo "ERROR: Failed to checkout waf-${WAF_VERSION} repository"
51 cleanup_and_exit 1
53 popd || cleanup_and_exit 1
55 popd || cleanup_and_exit 1
57 # Update waflib
58 pushd "${WAF_SAMBA_DIR}" || cleanup_and_exit 1
59 pwd
61 rm -rf waflib/
62 rsync -av "${WAF_TMPDIR}/waf/waflib" .
63 ret=$?
64 if [ $ret -ne 0 ]; then
65 echo "ERROR: Failed copy waflib"
66 cleanup_and_exit 1
68 chmod -x waflib/Context.py
70 git add waflib
72 popd || cleanup_and_exit 1
74 echo
75 echo "Now please change VERSION in buildtools/bin/waf and"
76 echo "Context.HEXVERSION in buildtools/wafsamba/wafsamba.py"
77 echo
79 cleanup_and_exit 0