forked from apache/serf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dist.sh
executable file
·85 lines (60 loc) · 1.95 KB
/
dist.sh
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
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
REPOS="https://svn.apache.org/repos/asf/serf"
if test $# != 1; then
echo "USAGE: $0 TAG"
exit 1
fi
version=$1
# provide for examining dist.sh output before creating a tag
if test "${version}" = "trunk"; then
url="${REPOS}/trunk"
else
url="${REPOS}/tags/${version}"
fi
release="serf-${version}"
# on Mac OS, TMPDIR is scary long. we want an unexpanded form in $short
work="${TMPDIR-/tmp}/serf-dist.$$"
short='${TMPDIR}'/serf-dist.$$
echo "Preparing ${release} in ${short} ..."
mkdir "${work}"
cd "${work}"
echo "Exporting latest serf ..."
svn export --quiet "${url}" "${release}" || exit 1
echo "`find ${release} -type f | wc -l` files exported"
prepare_directory()
{
cd "${release}"
# Remove anything that should not be in the distribution
echo "Removing from release: dist.sh"
rm dist.sh
major="`sed -n '/SERF_MAJOR_VERSION/s/[^0-9]*//gp' serf.h`"
minor="`sed -n '/SERF_MINOR_VERSION/s/[^0-9]*//gp' serf.h`"
patch="`sed -n '/SERF_PATCH_VERSION/s/[^0-9]*//gp' serf.h`"
actual_version="${major}.${minor}.${patch}"
cd "${work}"
if test "${version}" != "trunk" -a "${version%%-*}" != "${actual_version}"; then
echo "ERROR: exported version '${actual_version}' does not match '${version}'"
exit 1
fi
}
prepare_directory
tarball="${work}/${release}.tar"
tar -cf "${tarball}" "${release}"
bzip2 "${tarball}"
echo "${short}/${release}.tar.bz2 ready."
# Let's redo everything for a Windows .zip file
echo "Saving ${release} as ${release}.unix"
mv "${release}" "${release}.unix"
echo "Exporting latest serf using CRLF ..."
svn export --native-eol=CRLF --quiet "${url}" "${release}" || exit 1
echo "`find ${release} -type f | wc -l` files exported"
prepare_directory
if ! diff -brq "${release}.unix" "${release}"; then
echo "ERROR: export directories differ."
exit 1
fi
zipfile="${work}/${release}.zip"
zip -9rq "${zipfile}" "${release}"
echo "${short}/${release}.zip ready."
echo "Saving ${release} as ${release}.win"
mv "${release}" "${release}.win"