blob: 138953ab188bf84d57cd0dcf75b1882a0b157f87 (
plain)
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
|
#!/bin/bash
#helper functions
function copy_to_bmachine
{
if [ x$local_build = x1 ]; then
cp $1 $2
else
scp $1 $owner@$bmachine:$2
fi
}
function copy_from_bmachine
{
if [ x$local_build = x1 ]; then
cp $1 $2
else
scp $owner@$bmachine:$1 $2
fi
}
function run_command
{
if [ x$local_build = x1 ]; then
bash $1
else
cat $1 | ssh $owner@$bmachine bash
fi
}
#Supply defaults
# We built on one of two machines
bmachine=work
smachine=work
owner=my
# Hard path!!
bpath=`/bin/pwd`
rpmdir="/usr/src/redhat"
logdir="$bpath/Logs"
###### Perl STUFF #####
# Perl version numbers. Should be autodetected from the files in the
# Perl-mysql-modules/ directory.
DBI_VERSION="1.14"
DATA_SHOWTABLE_VERSION="3.3"
DBD_MYSQL_VERSION="1.2215"
MAKERPM="$rpmdir/SOURCES/makerpm.pl"
#######################
AM_MAKEFLAGS="-j 2"
VER=`grep "AM_INIT_AUTOMAKE(mysql, " $bpath/configure.in | \
sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;'`
VER_NO_DASH=`echo $VER | sed -e "s|-.*$||"`
tarball=$bpath/mysql-$VER.tar.gz
while test $# -gt 0; do
case "$1" in
--rpmdir=*)
rpmdir=`echo $1 | sed -e "s;--rpmdir=;;"`
;;
--smachine=*)
smachine=`echo $1 | sed -e "s;--smachine=;;"`
;;
--bmachine=*)
bmachine=`echo $1 | sed -e "s;--bmachine=;;"`
;;
--owner=*)
owner=`echo $1 | sed -e "s;--owner=;;"`
;;
--tarball=*)
tarball=`echo $1 | sed -e "s;--tarball=;;"`
;;
--logdir=*)
logdir=`echo $1 | sed -e "s;--logdir=;;"`
;;
--local )
local_build=1
;;
--skip-perl )
skip_perl=1
;;
* ) break ;;
esac
shift
done
echo "Removing old MySQL packages"
rm -rf $rpmdir/BUILD/mysql-*
rm -f $rpmdir/SOURCES/mysql-*
rm -f $rpmdir/SRPMS/MySQL-*
rm -f $rpmdir/SPEC/mysql-*
if [ ! -d "$logdir" ]; then
echo "$logdir does not exist, creating"
mkdir -p $logdir
fi
if [ ! -f "$tarball" ]; then
echo "Tarball file $tarball does not exist, please make one first"
exit 1
fi
echo "Building RPM for MySQL version $VER on $bmachine"
log=$logdir/Log-RPM-`date +%y%m%d-%H%M`
(
set -x
# Copy MySQL source and spec files
#Sasha: I left the scp stuff commented out instead of deleted to make it
#easy to revert in a hurry, if there is a need. Once everything is tested
#and works perfectly, the scp stuff should be deleted to avoid confusion
#scp $bpath/mysql-$VER.tar.gz $owner@$bmachine:$rpmdir/SOURCES
copy_to_bmachine $tarball $rpmdir/SOURCES
#scp $bpath/Docs/Images/mysql-logo.gif $owner@$bmachine:$rpmdir/SOURCES/mysql.gif
copy_to_bmachine $bpath/Docs/Images/mysql-logo.gif $rpmdir/SOURCES/mysql.gif
#scp $bpath/support-files/mysql-$VER.spec $owner@$bmachine:$rpmdir/SPECS
copy_to_bmachine $bpath/support-files/mysql-$VER.spec $rpmdir/SPECS
# Copy perl things. Has to be uncompressed since Compress.pm is not
# installed yet. Set CEXT to .gz when we support compression.
CEXT=
#scp $bpath/Perl-mysql-modules/To-SOURCES/* $owner@$bmachine:$rpmdir/SOURCES
# This had to be installed on the target machince!
# http://www.perl.com/CPAN/modules/by-module/Archive/Archive-Tar-0.21.tar.gz
# cd /usr/lib/perl5/site_perl/5.005; ln -s ../* .; rm -f 5.005
TMP_SCRIPT_MYSQL=00-temp-for-do-rpm.$$
cat > $logdir/$TMP_SCRIPT_MYSQL <<END
set -x
# Check environment
export MYSQL_BUILD_PATH="/usr/cygnus/redhat-980810/H-i386-pc-linux-gnu/bin/:/usr/bin:/bin"
export MYSQL_BUILD_CFLAGS="-O6 -fno-omit-frame-pointer -mpentium"
export MYSQL_BUILD_CXXFLAGS="-O6 -fno-omit-frame-pointer \
-felide-constructors -fno-exceptions -fno-rtti -mpentium"
gcc -v
# Make RPM
rpm -ba $rpmdir/SPECS/mysql-$VER.spec
rm -f /tmp/$TMP_SCRIPT_MYSQL
END
if [ ! x$skip_perl=x1 ]; then
TMP_SCRIPT_PERL=00-temp-for-perl-rpm.$$
cat > $logdir/$TMP_SCRIPT_PERL <<END
set -x
# First clean up so we do not get old versions when wildcard matching
rm -f $rpmdir/SOURCES/DBI-*.spec
rm -f $rpmdir/RPMS/i386/Perl-*.rpm
rm -f $rpmdir/SRPMS/Perl-*.rpm
rm -f $rpmdir/RPMS/i386/MySQL*-$VER_NO_DASH*.rpm
rm -f $rpmdir/SRPMS/MySQL*-$VER_NO_DASH*.rpm
chmod a+x ${MAKERPM}
rm
${MAKERPM} --verbose --package-name=DBI --package-version ${DBI_VERSION} \
--specs --source=DBI-${DBI_VERSION}.tar$CEXT
rpm -ba $rpmdir/SPECS/DBI-${DBI_VERSION}.spec
${MAKERPM} --verbose --package-name=Data-ShowTable \
--package-version ${DATA_SHOWTABLE_VERSION} \
--specs --source=Data-ShowTable-${DATA_SHOWTABLE_VERSION}.tar$CEXT
rpm -ba $rpmdir/SPECS/Data-ShowTable-${DATA_SHOWTABLE_VERSION}.spec
for v in ${DBD_MYSQL_VERSION}; do
${MAKERPM}
--specs \
--source=Msql-Mysql-modules-$v.tar$CEXT \
--setup-dir=Msql-Mysql-modules-$v \
--package-name=DBD-mysql \
--package-version=$v \
--makemakeropts='--noprompt --mysql-install --mysql-install-nodbd \
--nomsql-install --nomsql1-install' \
--require=perl-Data-ShowTable --require=perl-DBI
rpm -ba $rpmdir/SPECS/DBD-mysql-$v.spec
done
for srcrpm in $rpmdir/SRPMS/perl-*.src.rpm
do
rpm --rebuild $srcrpm
done
rm -f /tmp/$TMP_SCRIPT_PERL
END
fi
# scp $bpath/Logs/$TMP_SCRIPT_MYSQL $owner@$bmachine:/tmp/$TMP_SCRIPT_MYSQL
# ssh $bmachine -l $owner bash $bpath/Logs/$TMP_SCRIPT_MYSQL
cmd=$logdir/$TMP_SCRIPT_MYSQL
run_command $cmd
if [ $? != 0 ]; then
echo "$cmd failed, perhaps the following will help figure out why:"
tail $log
fi
if [ ! x$local_build=x1 ]; then
# Build perl RPM (we currently need to be root to do this and that is
# not possible)
#scp $bpath/Logs/$TMP_SCRIPT_PERL $owner@$bmachine:/tmp/$TMP_SCRIPT_PERL
#ssh $bmachine -l root bash /tmp/$TMP_SCRIPT_PERL
# Copy RPMs back to the source dir. We must do this here since the
# $bmachine may not have permission to access $smachine.
scp $owner@$bmachine:$rpmdir/RPMS/i386/MySQL*-$VER_NO_DASH*.rpm $bpath/NEW-RPMS
scp $owner@$bmachine:$rpmdir/SRPMS/MySQL*-$VER_NO_DASH*.rpm $bpath/NEW-RPMS
# And the perl ones
#scp $owner@$bmachine:$rpmdir/RPMS/i386/Perl*-*.rpm $bpath/NEW-RPMS
#scp $owner@$bmachine:$rpmdir/SRPMS/Perl*-*.rpm $bpath/NEW-RPMS
fi
) > $log 2>&1
|