-
Notifications
You must be signed in to change notification settings - Fork 2
/
release.sh
executable file
·160 lines (137 loc) · 3.27 KB
/
release.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/bin/sh
# $Id: release.sh,v 1.2 2005/08/28 15:36:00 lha Exp $
#
package=grid-pkcs11
ftp=/afs/su.se/home/l/h/lha/Public/soft-pkcs11
checkversion=YES
name=`basename $0`
[email protected]:kouril
if [ X"$#" = X0 ]; then
echo "$name [-tag branch] version"
exit 1
fi
while true ; do
case "$1" in
-tag)
shift
if [ X"$#" = X0 ] ; then
echo "missing tagname"; exit 1;
fi
tag_name="$1"
;;
-h*)
echo $name [-tag branch] version
echo $name -tag tupp-0-35-branch 0.35.3pre1
echo $name -tag HEAD 0.36pre1
echo $name 0.36
exit 1
;;
-*)
echo "$name: unknown option $1"
exit 1
;;
*)
break
;;
esac
shift
done
if [ X$# != X1 ]; then
echo "$name: missing version"
exit 1
fi
version="$1"
if expr "$version" : ${package} > /dev/null ; then
echo "version number should not contain \"${package}\""
exit 1
fi
if [ X"${tag_name}" = "X" ]; then
tag_name=${package}-`echo "${version}" | sed 's,\.,-,g'`
fi
echo preparing "${package}-${version}" from tag ${tag_name}
exportfile=${package}-export-log.$$
release_dir=/tmp/release-${package}.$$
mkdir $release_dir
cd $release_dir || exit 1
echo exporting tree...
git clone ${root}/${package} > $exportfile
res=$?
if [ X"$res" != X0 ]; then
echo "git clone failed, check $exportfile"
exit 1
fi
( cd $package && \
git archive --format=tar --prefix="${package}-${version}/" "${tag_name}") | \
tar xf -
res=$?
if [ X"$res" != X0 ]; then
echo "git archive failed"
exit 1
fi
rm $exportfile
ac="notfound"
[ -f "${package}-${version}/configure.in" ] && ac="configure.in"
[ -f "${package}-${version}/configure.ac" ] && ac="configure.ac"
if [ "$ac" = notfound ] ; then
echo "could not find configure, confused"
exit 1
fi
if [ X"$checkversion" = XYES ]; then
echo checking version
chkver=`grep -e '^VERSION=' "${package}-${version}/$ac" | sed 's,[^=]*=,,'`
if [ "X$chkver" = X ]; then
chkver=`grep -e '^AC_INIT(' "${package}-${version}/$ac" | sed 's/[^,]*,[ ]*//;s/[ ]*,.*//'`
fi
if [ "X${chkver}" != "X${version}" ]; then
echo "version mismatch ${chkver} != ${version}"
exit 1
fi
fi
echo "autofooing"
res=0
done=0
if [ -d "${package}-${version}" ] ; then
cd "${package}-${version}"
if [ -f HACKING ]; then
sh HACKING
res=$?
done=1
fi
if [ -f bootstrap.sh ]; then
sh bootstrap.sh
res=$?
done=1
fi
if [ "X$done" = X0 ] ; then
autoreconf -f -i
res=$?
fi
cd ..
fi
if [ X"$res" != X0 ]; then
echo "autofooing failed"
exit 1
fi
echo "removing autom4te cache"
amc="${package}-${version}/autom4te*.cache"
if [ -d ${amc} ] ; then
rm -r ${amc}
fi
if [ -f "${package}-${version}/doc/${package}.texi" ] ; then
echo "generate info documenation"
(cd "${package}-${version}/doc" && makeinfo "${package}.texi")
fi
echo "rolling tar-ball"
tar cf - "${package}-${version}" | gzip -9 > "${package}-${version}.tar.gz"
res=$?
if [ X"$res" != X0 ]; then
echo "creation of tar-ball failed"
exit 1
fi
if [ -d $HOME/.gnupg ] ; then
gpg -b -a ${package}-${version}.tar.gz
fi
echo Done!
echo Dont forget to copy the "${release_dir}/${package}-${version}.tar.gz" file to the ftp-site.
test X"$ftp" != X && echo "cp ${release_dir}/${package}-${version}.tar.gz* $ftp"
exit 0