author | davelam |
Thu, 11 Sep 2008 06:45:32 +0000 | |
changeset 13535 | eec7aab74608 |
parent 13356 | 8322c38bcccb |
child 13995 | f897929a88e3 |
child 14453 | fcdf5dd70dd6 |
permissions | -rwxr-xr-x |
9398 | 1 |
#!/bin/bash |
2 |
||
3 |
# Sample usage in crontab: |
|
4 |
# Run, Mon-Fri at 1:30am. Add to build user's crontab. |
|
9401 | 5 |
# 30 1 * * 1-5 . /jds/cbe/bin/env.sh; cd /jds/spec-files; I_KNOW_WHAT_IM_DOING=yes ./cron-script.sh |
9398 | 6 |
# |
7 |
# The same with a jail. Add to root's crontab. Example assumes 'gbuild' is the |
|
8 |
# build user |
|
9401 | 9 |
# 30 1 * * 1-5 /usr/sbin/chroot /path/to/jail/root /usr/bin/su - gbuild -c ". /jds/cbe/bin/env.sh; cd /jds/spec-files; I_KNOW_WHAT_IM_DOING=yes ./cron-script.sh" |
9398 | 10 |
# |
11 |
# $Id$ |
|
12 |
||
13 |
||
12735 | 14 |
# Determine whether to do debug or non-debug build. |
15 |
# On 'even' days of the week (Sun, Tues, Thur, Sat) to a debug build. |
|
16 |
DEBUG_BUILD= |
|
17 |
DEBUG_DIR= |
|
18 |
DOW=$[ $(date +"%w") % 2 ] |
|
13278 | 19 |
#if [ $DOW -eq "0" ]; then |
20 |
# DEBUG_BUILD="--with-debug" |
|
21 |
# DEBUG_DIR=.dbg |
|
22 |
#fi |
|
12735 | 23 |
|
9398 | 24 |
OSrel=`uname -r | cut -f2 -d.` |
25 |
OSarch_full=`uname -p` |
|
26 |
if [ "x$OSarch_full" = "xsparc" ]; then |
|
27 |
OSarch=s |
|
28 |
else |
|
29 |
OSarch_full=x86 |
|
30 |
OSarch=x |
|
31 |
fi |
|
32 |
||
12509 | 33 |
PRODNAME="G2.24" |
9398 | 34 |
|
35 |
# directory to copy rpms/srpms to on the remote host |
|
12735 | 36 |
RPMSDIR=/sgnome/pkgs/gnome2.24/S${OSrel}${OSarch}/nightly${DEBUG_DIR} |
12509 | 37 |
LOCKFILE=/sgnome/pkgs/gnome2.24/S${OSrel}${OSarch}/.build.lock |
9398 | 38 |
|
39 |
# reply-to/to address to send the build log as/to |
|
40 |
[email protected] |
|
41 |
[email protected] |
|
42 |
||
43 |
# date format appended to the Release tag in the spec files |
|
44 |
# (passed to the date command on the cmd line) |
|
45 |
RELEASE_DATE_FMT="%y%m%d" |
|
46 |
||
47 |
# date format used for naming the directories |
|
48 |
DIR_DATE_FMT="%Y-%m-%d" |
|
49 |
||
50 |
RELEASE_DATE=`date +$RELEASE_DATE_FMT` |
|
51 |
DIR_DATE=`date +$DIR_DATE_FMT` |
|
52 |
||
53 |
# document root of the web server |
|
9652 | 54 |
WEBROOT=/net/jdsserv.ireland/webroots/jds.ireland/htdocs |
9398 | 55 |
|
56 |
# subdir to keep logs and reports on the webserver |
|
12509 | 57 |
WEBDIR=build_reports/gnome2.24/nightly/S${OSrel}${OSarch} |
9398 | 58 |
LOGDIR=$WEBDIR/$DIR_DATE |
59 |
||
60 |
# ------------ nothing to configure below this line -------------- |
|
61 |
||
62 |
if [ "x$I_KNOW_WHAT_IM_DOING" != xyes ]; then |
|
63 |
echo " ,---------------------------------------------------------------." |
|
64 |
echo "| This script is intended to be run from cron for producing |" |
|
65 |
echo "| official nightly builds. It will mail responsible engineers |" |
|
66 |
echo "| if any build failure occurs, sends build reports to v" |
|
67 |
echo "| RE and update web pages." |
|
68 |
echo "|" |
|
69 |
echo "| Don't run it unless you know what you are doing. Thanks." |
|
70 |
echo "|" |
|
71 |
echo "| Mail [email protected] if you need more info." |
|
72 |
echo "\`------> +" |
|
73 |
exit 1 |
|
74 |
fi |
|
75 |
||
76 |
MYNAME="$0" |
|
77 |
MYDIR=$(cd `dirname $0`; pwd) |
|
78 |
||
79 |
if [ "x$1" != x ]; then |
|
80 |
SPECDIR="$1" |
|
81 |
else |
|
82 |
SPECDIR="$MYDIR" |
|
83 |
fi |
|
84 |
||
85 |
# remove temporary files on exit |
|
86 |
clean_up () { |
|
87 |
case "$MYNAME" in |
|
88 |
/tmp/cron-script.copy.* ) |
|
89 |
rm -f $MYNAME |
|
90 |
;; |
|
91 |
esac |
|
92 |
exit |
|
93 |
} |
|
94 |
||
95 |
trap clean_up HUP INT TERM QUIT EXIT |
|
96 |
||
97 |
# make a copy of the cron script in /tmp and execute that in order to |
|
98 |
# avoid disasters caused by cvs update. |
|
99 |
case "$MYNAME" in |
|
100 |
/tmp/cron-script.copy.* ) |
|
101 |
;; |
|
102 |
*) |
|
103 |
cp $MYNAME /tmp/cron-script.copy.$$ |
|
104 |
chmod 755 /tmp/cron-script.copy.$$ |
|
105 |
cd /tmp |
|
106 |
exec /tmp/cron-script.copy.$$ "$MYDIR" |
|
107 |
;; |
|
108 |
esac |
|
109 |
||
110 |
fatal_error () { |
|
111 |
echo "ERROR: $*" |
|
112 |
exit 1 |
|
113 |
} |
|
114 |
||
12047 | 115 |
# Update spec-files-other files and uninstall packages. |
116 |
cd $SPECDIR/../spec-files-other |
|
117 |
||
118 |
# Revert any local changes |
|
119 |
svn revert -R . |
|
120 |
||
121 |
# checkout-out SVN copy *MUST* be read-only, or "update" needs passwd |
|
122 |
svn -q up > /dev/null 2>&1 || fatal_error "SVN update of spec-files-other failed" |
|
123 |
||
124 |
# Uninstall the spec-files-other packages. |
|
12649 | 125 |
pkgtool uninstall-pkgs --with-l10n --with-sun-branding core/*.spec experimental/*.spec l10n/*.spec |
12047 | 126 |
|
127 |
# Uninstall and cleanup spec-files packages. |
|
9398 | 128 |
cd $SPECDIR || fatal_error "$SPECDIR not found" |
129 |
||
130 |
#revert any local changes |
|
131 |
svn revert -R . |
|
132 |
||
133 |
# checkout-out SVN copy *MUST* be read-only, or "update" needs passwd |
|
134 |
svn -q up > /dev/null 2>&1 || fatal_error "SVN update failed" |
|
135 |
||
13356 | 136 |
# change some components to use Sun Studio 12 to |
137 |
# workaround the compiler related issue |
|
138 |
ss12_env_fl=/home/gbuild/dave/env.sh.ss12.cconly |
|
13535 | 139 |
ss12_specs="SUNWfirefox.spec |
140 |
SUNWPython25.spec |
|
141 |
../spec-files-other/core/SUNWbrasero.spec" |
|
13356 | 142 |
if [ -f $ss12_env_fl ]; then |
13535 | 143 |
cd $SPECDIR |
144 |
IFS_save=$IFS |
|
145 |
IFS=" |
|
146 |
" |
|
13356 | 147 |
for spec in $ss12_specs; do |
148 |
sed -e "/^%build/a\\ |
|
149 |
source $ss12_env_fl" \ |
|
150 |
-e "/^%install/a\\ |
|
151 |
source $ss12_env_fl" $spec > ${spec}.tmp.$$ |
|
152 |
mv ${spec}.tmp.$$ $spec |
|
153 |
done |
|
13535 | 154 |
IFS=$IFS_save |
13356 | 155 |
fi |
156 |
||
9398 | 157 |
# if the script changed during cvs update, restart with the updated script |
13535 | 158 |
cd $SPECDIR |
9398 | 159 |
if ! /usr/bin/cmp -s ./cron-script.sh $MYNAME; then exec ./cron-script.sh; fi |
160 |
||
161 |
# uninstall all pkgs left behind by a previous build |
|
12649 | 162 |
pkgtool uninstall-pkgs --with-l10n --with-sun-branding --with-lcms closed/*.spec *.spec >/dev/null |
9398 | 163 |
# remove-gnome will now remove anything left from uninstall-pkgs in case |
164 |
# or a packaging change for example |
|
9401 | 165 |
$SPECDIR/scripts/remove-gnome --version jds -q -f --no_extras > /dev/null 2>&1 |
9398 | 166 |
|
11858 | 167 |
|
9398 | 168 |
rm -rf /jds/packages/PKGS/* |
169 |
rm -rf /jds/packages/SPKGS/* |
|
170 |
rm -rf /jds/packages/BUILD/* |
|
9401 | 171 |
rm -rf /var/tmp/pkgbuild-*/* |
9398 | 172 |
|
173 |
# if the log directory exists, open a new one with numbered suffix |
|
174 |
NEW_LOGDIR=$LOGDIR |
|
175 |
N=1 |
|
176 |
while [ -d $WEBROOT/$NEW_LOGDIR ]; do |
|
177 |
NEW_LOGDIR=$LOGDIR.$N |
|
178 |
N=`expr $N + 1` |
|
179 |
done |
|
180 |
||
181 |
LOGDIR=$NEW_LOGDIR |
|
182 |
mkdir -p $WEBROOT/$LOGDIR || exit 5 |
|
183 |
||
184 |
mkdir -p $RPMSDIR |
|
185 |
touch $LOCKFILE |
|
186 |
||
187 |
# Rebuild the manpage tarballs |
|
10583 | 188 |
cd $SPECDIR |
189 |
rm -r po-sun/po-sun-tarballs manpages/sun-manpage-tarballs |
|
190 |
make |
|
13055 | 191 |
cd $SPECDIR/../spec-files-other/manpages |
192 |
rm -r sun-manpage-tarballs |
|
13048 | 193 |
make |
11406 | 194 |
|
9398 | 195 |
cd $SPECDIR |
196 |
||
197 |
# start the build |
|
9465 | 198 |
pkgtool -v --nightly --date "$RELEASE_DATE" build closed/SUNWevolution-bdb-devel.spec closed/*.spec *.spec \ |
9398 | 199 |
--logdir=$WEBROOT/$LOGDIR \ |
9652 | 200 |
--logdir-url=http://jds.ireland/$LOGDIR \ |
9398 | 201 |
[email protected] \ |
202 |
--prodname="${PRODNAME}/s${OSrel}${OSarch}" \ |
|
12331 | 203 |
--live --with-l10n --with-moz-nss-nspr ${DEBUG_BUILD} \ |
12725 | 204 |
--define "nightly 1" --with-sun-branding --with-lcms --with-moz-nss-nspr \ |
9398 | 205 |
--summary-log=$WEBROOT/$LOGDIR.html \ |
206 |
--summary-title="${PRODNAME} S${OSrel}/${OSarch_full} Nightly Build Report `date +'%d %B %Y'`" \ |
|
9648 | 207 |
--rpm-url=file:///net/jdsserv.ireland/$RPMSDIR/all_pkgs \ |
9398 | 208 |
> /tmp/build.log.$$ 2>&1 |
209 |
||
210 |
# the number of failed pkgs is returned |
|
211 |
FAILED=$? |
|
212 |
||
11798 | 213 |
# Build spec-files-other |
214 |
cd $SPECDIR/../spec-files-other |
|
215 |
||
216 |
pkgtool -v --nightly --date "$RELEASE_DATE" build core/*.spec experimental/*.spec l10n/*.spec \ |
|
217 |
--logdir=$WEBROOT/$LOGDIR \ |
|
218 |
--logdir-url=http://jds.ireland/$LOGDIR \ |
|
219 |
[email protected] \ |
|
220 |
--prodname="${PRODNAME}/s${OSrel}${OSarch}" \ |
|
12649 | 221 |
--live --with-l10n ${DEBUG_BUILD} \ |
11798 | 222 |
--define "nightly 1" --with-sun-branding \ |
223 |
--summary-log=$WEBROOT/$LOGDIR-other.html \ |
|
224 |
--summary-title="${PRODNAME} S${OSrel}/${OSarch_full} SFO Nightly Build Report `date +'%d %B %Y'`" \ |
|
225 |
--rpm-url=file:///net/jdsserv.ireland/$RPMSDIR/all_pkgs \ |
|
226 |
>> /tmp/build.log.$$ 2>&1 |
|
11809 | 227 |
|
228 |
# The number of failed pkgs is returned |
|
229 |
FAILED_OTHER=$? |
|
11798 | 230 |
# End spec-files-other build. |
231 |
||
9398 | 232 |
# rotate rpms dir |
233 |
rm -rf $RPMSDIR.prev |
|
234 |
mv $RPMSDIR $RPMSDIR.prev; mkdir -p $RPMSDIR |
|
235 |
||
236 |
# make dist |
|
12725 | 237 |
/sgnome/tools/re-scripts/jds-build/make-jds-dist.pl -l /sgnome/tools/re-scripts/jds-build/vermillion-devel.lst --nightly /jds/packages/PKGS /jds/dist nightly- > /dev/null 2>&1 |
9398 | 238 |
cp -r /jds/dist/nightly-/${OSarch_full}/* /jds/dist/nightly-/${OSarch_full}/.??* $RPMSDIR |
239 |
chmod a+x $RPMSDIR/install-jds |
|
240 |
mkdir -p $RPMSDIR/all_pkgs |
|
241 |
cd $RPMSDIR/all_pkgs |
|
242 |
ln -s ../*/*.tar.gz . |
|
12735 | 243 |
rm -rf /jds/dist/nightly- |
9398 | 244 |
|
12293 | 245 |
# Send output of make-jds-dist.pl to GNOME RE for review. |
12725 | 246 |
/sgnome/tools/re-scripts/jds-build/make-jds-dist.pl -l /sgnome/tools/re-scripts/jds-build/vermillion-devel.lst --nightly /jds/packages/PKGS /jds/dist nightly- -dryrun 2>&1 | \ |
12293 | 247 |
mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} nightly build: make-jds-dist.pl output" "[email protected]" |
11995 | 248 |
|
9398 | 249 |
ALL_REPORTS=$WEBROOT/$WEBDIR/all_reports.html |
250 |
touch $ALL_REPORTS |
|
251 |
||
252 |
cp $ALL_REPORTS $ALL_REPORTS.old |
|
11809 | 253 |
export FAILED FAILED_OTHER ALL_REPORTS |
9398 | 254 |
|
255 |
# update web page |
|
11809 | 256 |
( echo "<tr><td><a href=/$LOGDIR.html>$DIR_DATE</a></td>"; \ |
257 |
echo " <td>$FAILED package(s) failed</td></tr>"; \ |
|
258 |
echo "<tr><td><a href=/$LOGDIR-other.html>$DIR_DATE</a></td>"; \ |
|
259 |
echo " <td>$FAILED_OTHER SFO package(s) failed</td></tr>"; \ |
|
9398 | 260 |
cat $ALL_REPORTS.old ) > $ALL_REPORTS |
261 |
||
262 |
# Report absolute symlinks. These are blockers for Solaris integration. |
|
263 |
grep 'is an absolute symlink' $WEBROOT/$LOGDIR/*.log >>/tmp/build.log.$$ |
|
264 |
||
265 |
# Count the number of local patches. |
|
9401 | 266 |
patch_count=`ls $SPECDIR/patches/*.diff | wc -l` |
9398 | 267 |
echo "PATCH COUNT: $patch_count local patches used in this build.">>/tmp/build.log.$$ |
268 |
||
269 |
# send warnings, errors and summary in email |
|
270 |
grep -v '^INFO:' /tmp/build.log.$$ | \ |
|
271 |
mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} nightly build: $FAILED pkgs failed" $EMAIL_ADDR |
|
272 |
||
273 |
rm -f /tmp/build.log.$$ |
|
274 |
||
275 |
# Email Beijing team to begin downloading packages. |
|
9648 | 276 |
/usr/bin/echo "*Date: `date '+%Y-%m-%d'`*\n${PRODNAME} S${OSrel} ${OSarch_full} Development nightly build finished: jdsserv.ireland:${RPMSDIR}/download" | |
11309
22f4fb76dac8
Add [email protected] in notification email list for new download server in BJ site
davelam
parents:
11097
diff
changeset
|
277 |
mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} Development nightly build: $FAILED pkgs failed" "[email protected],[email protected]" |
9398 | 278 |
|
279 |
||
280 |
rm $LOCKFILE |
|
281 |
||
282 |
# find any differences from the prototype files saved after the |
|
283 |
# last milestone build |
|
284 |
cd /jds/spec-files/prototypes/${OSarch_full} |
|
285 |
for f in *.proto; do |
|
286 |
test -f /jds/packages/PKGMAPS/proto/$f || continue |
|
287 |
cmp -s $f /jds/packages/PKGMAPS/proto/$f && continue |
|
288 |
echo $f: |
|
289 |
diff $f /jds/packages/PKGMAPS/proto/$f |
|
290 |
echo |
|
291 |
done > /tmp/proto-changes.$$ |
|
292 |
||
293 |
# if any diffs found mail the result to RE |
|
294 |
test -s /tmp/proto-changes.$$ && { |
|
295 |
( echo "Prototype changes found since the last milestone build:" |
|
296 |
echo |
|
297 |
cat /tmp/proto-changes.$$ ) | \ |
|
298 |
mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} prototype changes" \ |
|
299 |
$EMAIL_ADDR |
|
300 |
} |
|
301 |
||
302 |
rm -f /tmp/proto-changes.$$ |
|
303 |
||
304 |
exit 0 |