-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrelease
executable file
·73 lines (62 loc) · 1.78 KB
/
release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
#
# Copyright 2014 The Sporting Exchange Limited. All rights reserved.
# Use of this source code is governed by a free license that can be
# found in the LICENSE file.
# release generates a tarball for end users.
#
# usage: release [version=STRING]
#
# version is an optional version string.
version=
eval $*
d=$(mktemp -d /tmp/release.XXXXXX) || exit
d=$d/tsp
mkdir $d || exit
# Make the sources self-contained (independent of $GOPATH).
git clone -q . $d || exit
(
cd $d || exit
mkdir -p src/opentsp.org || exit
mv cmd/ contrib/ internal/ src/opentsp.org || exit
)
if [ -z "$version" ]
then
version=$(git rev-parse HEAD | cut -c 1-7)
fi
newd=$(dirname $d)/tsp-$version
mv $d $newd || exit
d=$newd
rm -rf $d/.git
rm -f $d/doc/_*.html || exit
rm -f $d/doc/download.html || exit
rm -f $d/doc/index.html || exit
rm $d/release || exit
# Generate global Makefile.
cat >$d/Makefile << 'EOF'
# Copyright 2014 The Sporting Exchange Limited. All rights reserved.
# Use of this source code is governed by a free license that can be
# found in the LICENSE file.
export GOPATH = $(shell pwd)
.PHONY: build install rpm
build:
go install opentsp.org/...
go vet opentsp.org/...
go test opentsp.org/...
install:
make -C src/opentsp.org/cmd/collect-statse install
make -C src/opentsp.org/cmd/tsp-aggregator install
make -C src/opentsp.org/cmd/tsp-controller install
make -C src/opentsp.org/cmd/tsp-forwarder install
make -C src/opentsp.org/cmd/tsp-poller install
make -C src/opentsp.org/contrib/collect-netscaler install
rpm:
make -C src/opentsp.org/contrib/collect-netscaler/dist rpm
make -C src/opentsp.org/contrib/rpm rpm
EOF
[ $? -eq 0 ] || exit
# Generate the tarball.
out=/tmp/$(basename $d).tar.gz
tar -c -z -C $(dirname $d) -f $out $(basename $d) || exit
echo $out || exit
rm -rf $d || exit