File: release

package info (click to toggle)
faumachine 20100527-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 53,836 kB
  • ctags: 20,552
  • sloc: ansic: 179,550; asm: 3,645; makefile: 3,611; perl: 2,103; sh: 1,529; python: 600; xml: 563; lex: 210; vhdl: 204
file content (249 lines) | stat: -rwxr-xr-x 6,266 bytes parent folder | download | duplicates (2)
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#!/bin/sh
#
# $Id: release,v 1.62 2009-01-28 17:20:10 potyra Exp $
#
# Copyright (C) 2003-2009 FAUmachine Team <info@faumachine.org>.
# This program is free software. You can redistribute it and/or modify it
# under the terms of the GNU General Public License, either version 2 of
# the License, or (at your option) any later version. See COPYING.

set -e

build=$(cd ${0%release}; pwd)/build.sh
askbuild=yes


if [ ! -f /etc/debian_version ]; then
	echo "Please run this script on one of the debian machines"
	exit 1
fi

# only do something if we are in a FAUmachine working dir
if [ ! -d node-pc ]; then
	cat <<EOF
Please specify the version to release or start this script from a
FAUmachine working directory to release the current version.
EOF
	exit 1
fi

version=$1
if [ ! "$version" ]; then
	version=HEAD
fi
if [ $version = HEAD ] ; then
	version_date=`date +'%Y%m%d'`
	version_cvs=HEAD
else
	version_date=${version}
	version_cvs=v${version_date}
fi

if [ $version != HEAD ] ; then
	# check that the tag exists
	$build testtag --release=$version || {
		# now ask if the current dir should be tagged
		echo "There is no cvs tag \"v$version\"!"
		echo
		echo "Press return to automatically tag the sources in the current directory."
		echo "The new tag name will be \"v$version\"."
		read
		cvs tag -F v$version
		echo
	}
fi

echo "going to build release \"$version\"..."

mkdir $version
cd $version

# FIXME: CVS tags cannot contain '.', '_' is used instead
# make that work in release and build.sh scripts later
# (not needed for simple HEAD or 20030704 version numbers)

# build source packages
$build tar --release=$version
$build deb --release=$version --srctar=`pwd`/faumachine-${version_date}.tar.gz
$build rpm --release=$version --srctar=`pwd`/faumachine-${version_date}.tar.gz

declare -a dist
declare -a host
declare -a rpmbuild
declare -a tmpdir
declare -a lkm

# Debian hosts
dist[0]=debian40-x86
host[0]=faui31e
tmpdir[0]=/export/home.local/$USER

dist[1]=debian40-x86_64
host[1]=faui31f
tmpdir[1]=/export/home.local/$USER

# Ubuntu host
dist[2]=ubuntu710
host[2]=faui31l
tmpdir[2]=/export/home.local/$USER

# FedoraCore hosts
dist[3]=fc6
host[3]=131.188.33.98
rpmbuild[3]=rpmbuild
tmpdir[3]=/home/$USER

# SuSE hosts
dist[4]=suse103
host[4]=131.188.33.112
rpmbuild[4]=rpmbuild
tmpdir[4]=/home/$USER

# OpenBSD hosts
dist[5]=openbsd36
host[5]=131.188.33.29
tmpdir[5]=/export/home.local/${USER}
lkm[5]=yes

for i in `seq 0 5` ; do
(
	echo ""
	echo "**** Building binaries for ${dist[$i]} ****"
	echo ""

	mkdir -p ${dist[$i]}
	tmp=${tmpdir[$i]}/build-faumachine-${version_date}-$$

	case ${dist[$i]} in
	debian*|ubuntu*)
		# build debian/ubuntu binary
		scp faumachine_0.${version_date}.1.dsc \
			faumachine_0.${version_date}.1.tar.gz \
			${host[$i]}:${tmpdir[$i]}

		ssh ${host[$i]} " \
			cd ${tmpdir[$i]}; \
			dpkg-source -x faumachine_0.${version_date}.1.dsc; \
			cd faumachine-0.${version_date}.1; \
			debuild binary; \
			cd .."

		scp ${host[$i]}:${tmpdir[$i]}/faumachine'*'_0.${version_date}.1_'*'.deb \
			${dist[$i]}

		ssh ${host[$i]} " \
			cd ${tmpdir[$i]}; \
			rm faumachine*_0.${version_date}.1_*.deb; \
			rm faumachine*_0.${version_date}.1*; \
			rm -rf faumachine-0.${version_date}.1"
		;;

	fc*|suse*)
		ssh ${host[$i]} " \
			rm -rf ${tmpdir[$i]}/build-faumachine-*; \
			set -x ;\
			mkdir -p ${tmp}; cd ${tmp}; \
			mkdir -p SRPMS BUILD RPMS; \
			mkdir -p RPMS/athlon RPMS/i{3,4,5,6}86 RPMS/noarch ;\
			mv ~/.rpmmacros ~/.rpmmacros.tmp-before-script 2>/dev/null || true; \
			echo %_topdir ${tmp} > ~/.rpmmacros; \
			exit \$?"

		scp faumachine-${version_date}-1.src.rpm ${host[$i]}:${tmp}/SRPMS

		ssh ${host[$i]} " \
			set -x; \
			cd ${tmp}; \
			rpm -hiv SRPMS/faumachine-${version_date}-1.src.rpm; \
			. /etc/profile; \
			export PATH=${PATH}:/usr/X11R6/bin:/usr/local/bin/qt3/bin; \
			export PKG_CONFIG_PATH=/opt/gnome/lib/pkgconfig; \
			${rpmbuild[$i]} --clean -bb SPECS/faumachine.spec; \
			exit \$?"

		scp ${host[$i]}:${tmp}/RPMS/*/faumachine-${version_date}-1.*.rpm ${dist[$i]}/

		ssh ${host[$i]} " \
			set -x; \
			rm ~/.rpmmacros; \
			mv ~/.rpmmacros.tmp-before-script ~/.rpmmacros 2>/dev/null || true; \
			rm -rf ${tmp}; \
			exit 0"
		;;

	openbsd*ports*)
		# scp faumachine-core-$version.tar.gz ${host[$i]}:/usr/ports/distfiles
		# 
		# ssh ${host[$i]} " \
		# 	set -x; \
		# 	cd /usr/ports/emulators/FAUmachine; \
		# 	make clean; \
		# 	make; \
		# 	exit \$?"
		# scp ${host[$i]}:/usr/ports/packages/i386/all/faumachine-HEAD.tgz ${dist[$i]}
		;;

	openbsd*)
		ssh ${host[$i]} " \
			set -x; \
			rm -rf ${tmpdir[$i]}/faumachine-${version_date}; \
			mkdir -p ${tmp}/tar; \
			exit \$?"

		scp faumachine-${version_date}.tar.gz ${host[$i]}:${tmp}/tar

		ssh ${host[$i]} " \
			set -x; \
			cd ${tmp}; \
			tar xzf tar/faumachine-${version_date}.tar.gz; \
			cd faumachine-${version_date}; \
			export AUTOMAKE_VERSION=1.9; \
			export AUTOCONF_VERSION=2.59; \
			./autogen.sh; \
			./configure --prefix=/usr/local --disable-build-hefkg; \
			gmake; \
			gmake install DESTDIR=\`pwd\`/faumachine-${version_date}-i386; \
			cd faumachine-${version_date}-i386/; \
			tar zcvf ../../tar/faumachine-${version_date}.i386.tar.gz .; \
			exit \$?"

		scp ${host[$i]}:${tmp}/tar/faumachine-${version_date}.i386.tar.gz ${dist[$i]}

		if [ ${lkm[$i]} = yes ] ; then \
			ssh ${host[$i]} " \
				set -ex; \
				cd ${tmp}/faumachine-${version_date}/opt-openbsd/opt-openbsd-3.6/src/sys/compat/faumachine; \
				make obj; \
				make depend; \
				make; \
				cd ${tmp}; \
				mkdir -p usr/lkm; \
				cp faumachine-${version_date}/opt-openbsd/opt-openbsd-3.6/src/sys/compat/faumachine/obj/faumachine.o usr/lkm; \
				tar zcvf tar/openbsd-faumlkm-${version_date}.i386.tar.gz usr"

			scp ${host[$i]}:${tmp}/tar/openbsd-faumlkm-${version_date}.i386.tar.gz ${dist[$i]}
		fi
	
		ssh ${host[$i]} " \
			set -x; \
			rm -rf ${tmp}; \
			exit 0"
		;;

	*)
		echo "Unknown distribution ${dist[$i]}" 1>&2
		exit 1
		;;
	esac

	echo ""
	echo "**** Building binaries for ${dist[$i]} done ****"
	echo ""
) > build.${dist[$i]}.log 2>&1 &
done
wait

echo
echo "All release files are located in the new directory \"$version\"."
echo "Please add this directory to the www tree and run 'make'"
echo "to publish this release."