author | laca |
Tue, 05 Aug 2008 04:33:16 +0000 | |
branch | gnome-2-22 |
changeset 12486 | 7fa2b2b0dddb |
parent 12431 | b5599f15e457 |
child 12494 | 780ba2bc5a6a |
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 |
||
12418 | 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 ] |
|
19 |
if [ $DOW -eq "0" ]; then |
|
20 |
DEBUG_BUILD="--with-debug" |
|
21 |
DEBUG_DIR=.dbg |
|
22 |
fi |
|
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 |
||
11097 | 33 |
PRODNAME="G2.22" |
9398 | 34 |
|
35 |
# directory to copy rpms/srpms to on the remote host |
|
12418 | 36 |
RPMSDIR=/sgnome/pkgs/gnome2.22/S${OSrel}${OSarch}/nightly${DEBUG_DIR} |
11097 | 37 |
LOCKFILE=/sgnome/pkgs/gnome2.22/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 |
|
11097 | 57 |
WEBDIR=build_reports/gnome2.22/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. |
|
12327 | 125 |
pkgtool uninstall-pkgs --with-l10n --with-moz-nss-nspr --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 |
cd $SPECDIR |
|
136 |
||
137 |
# if the script changed during cvs update, restart with the updated script |
|
138 |
if ! /usr/bin/cmp -s ./cron-script.sh $MYNAME; then exec ./cron-script.sh; fi |
|
139 |
||
140 |
# uninstall all pkgs left behind by a previous build |
|
12327 | 141 |
pkgtool uninstall-pkgs --with-l10n --with-moz-nss-nspr --with-sun-branding --with-lcms closed/*.spec *.spec >/dev/null |
9398 | 142 |
# remove-gnome will now remove anything left from uninstall-pkgs in case |
143 |
# or a packaging change for example |
|
9401 | 144 |
$SPECDIR/scripts/remove-gnome --version jds -q -f --no_extras > /dev/null 2>&1 |
9398 | 145 |
|
11858 | 146 |
|
9398 | 147 |
rm -rf /jds/packages/PKGS/* |
148 |
rm -rf /jds/packages/SPKGS/* |
|
149 |
rm -rf /jds/packages/BUILD/* |
|
9401 | 150 |
rm -rf /var/tmp/pkgbuild-*/* |
9398 | 151 |
|
152 |
# if the log directory exists, open a new one with numbered suffix |
|
153 |
NEW_LOGDIR=$LOGDIR |
|
154 |
N=1 |
|
155 |
while [ -d $WEBROOT/$NEW_LOGDIR ]; do |
|
156 |
NEW_LOGDIR=$LOGDIR.$N |
|
157 |
N=`expr $N + 1` |
|
158 |
done |
|
159 |
||
160 |
LOGDIR=$NEW_LOGDIR |
|
161 |
mkdir -p $WEBROOT/$LOGDIR || exit 5 |
|
162 |
||
163 |
mkdir -p $RPMSDIR |
|
164 |
touch $LOCKFILE |
|
165 |
||
166 |
# Rebuild the manpage tarballs |
|
10583 | 167 |
cd $SPECDIR |
168 |
rm -r po-sun/po-sun-tarballs manpages/sun-manpage-tarballs |
|
169 |
make |
|
11406 | 170 |
|
9398 | 171 |
cd $SPECDIR |
172 |
||
173 |
# start the build |
|
9465 | 174 |
pkgtool -v --nightly --date "$RELEASE_DATE" build closed/SUNWevolution-bdb-devel.spec closed/*.spec *.spec \ |
9398 | 175 |
--logdir=$WEBROOT/$LOGDIR \ |
9652 | 176 |
--logdir-url=http://jds.ireland/$LOGDIR \ |
9398 | 177 |
[email protected] \ |
178 |
--prodname="${PRODNAME}/s${OSrel}${OSarch}" \ |
|
12331 | 179 |
--live --with-l10n --with-moz-nss-nspr ${DEBUG_BUILD} \ |
12302 | 180 |
--define "nightly 1" --with-sun-branding --with-lcms \ |
9398 | 181 |
--summary-log=$WEBROOT/$LOGDIR.html \ |
182 |
--summary-title="${PRODNAME} S${OSrel}/${OSarch_full} Nightly Build Report `date +'%d %B %Y'`" \ |
|
9648 | 183 |
--rpm-url=file:///net/jdsserv.ireland/$RPMSDIR/all_pkgs \ |
9398 | 184 |
> /tmp/build.log.$$ 2>&1 |
185 |
||
186 |
# the number of failed pkgs is returned |
|
187 |
FAILED=$? |
|
188 |
||
11798 | 189 |
# Build spec-files-other |
190 |
cd $SPECDIR/../spec-files-other |
|
191 |
||
192 |
pkgtool -v --nightly --date "$RELEASE_DATE" build core/*.spec experimental/*.spec l10n/*.spec \ |
|
193 |
--logdir=$WEBROOT/$LOGDIR \ |
|
194 |
--logdir-url=http://jds.ireland/$LOGDIR \ |
|
195 |
[email protected] \ |
|
196 |
--prodname="${PRODNAME}/s${OSrel}${OSarch}" \ |
|
12331 | 197 |
--live --with-l10n --with-moz-nss-nspr ${DEBUG_BUILD} \ |
11798 | 198 |
--define "nightly 1" --with-sun-branding \ |
199 |
--summary-log=$WEBROOT/$LOGDIR-other.html \ |
|
200 |
--summary-title="${PRODNAME} S${OSrel}/${OSarch_full} SFO Nightly Build Report `date +'%d %B %Y'`" \ |
|
201 |
--rpm-url=file:///net/jdsserv.ireland/$RPMSDIR/all_pkgs \ |
|
202 |
>> /tmp/build.log.$$ 2>&1 |
|
11809 | 203 |
|
204 |
# The number of failed pkgs is returned |
|
205 |
FAILED_OTHER=$? |
|
11798 | 206 |
# End spec-files-other build. |
207 |
||
9398 | 208 |
# rotate rpms dir |
209 |
rm -rf $RPMSDIR.prev |
|
210 |
mv $RPMSDIR $RPMSDIR.prev; mkdir -p $RPMSDIR |
|
211 |
||
212 |
# make dist |
|
12430 | 213 |
/sgnome/tools/re-scripts/jds-build/make-jds-dist.pl -l /sgnome/tools/re-scripts/jds-build/vermillion-stable.lst --nightly /jds/packages/PKGS /jds/dist nightly- > /dev/null 2>&1 |
9398 | 214 |
cp -r /jds/dist/nightly-/${OSarch_full}/* /jds/dist/nightly-/${OSarch_full}/.??* $RPMSDIR |
215 |
chmod a+x $RPMSDIR/install-jds |
|
216 |
mkdir -p $RPMSDIR/all_pkgs |
|
217 |
cd $RPMSDIR/all_pkgs |
|
218 |
ln -s ../*/*.tar.gz . |
|
12418 | 219 |
rm -rf /jds/dist/nightly- |
9398 | 220 |
|
12293 | 221 |
# Send output of make-jds-dist.pl to GNOME RE for review. |
12431
b5599f15e457
Forgot about second location where vermillion-devel.lst was used - changed to vermillion-stable.lst
dcarbery
parents:
12430
diff
changeset
|
222 |
/sgnome/tools/re-scripts/jds-build/make-jds-dist.pl -l /sgnome/tools/re-scripts/jds-build/vermillion-stable.lst --nightly /jds/packages/PKGS /jds/dist nightly- -dryrun 2>&1 | \ |
12293 | 223 |
mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} nightly build: make-jds-dist.pl output" "[email protected]" |
11995 | 224 |
|
9398 | 225 |
ALL_REPORTS=$WEBROOT/$WEBDIR/all_reports.html |
226 |
touch $ALL_REPORTS |
|
227 |
||
228 |
cp $ALL_REPORTS $ALL_REPORTS.old |
|
11809 | 229 |
export FAILED FAILED_OTHER ALL_REPORTS |
9398 | 230 |
|
231 |
# update web page |
|
11809 | 232 |
( echo "<tr><td><a href=/$LOGDIR.html>$DIR_DATE</a></td>"; \ |
233 |
echo " <td>$FAILED package(s) failed</td></tr>"; \ |
|
234 |
echo "<tr><td><a href=/$LOGDIR-other.html>$DIR_DATE</a></td>"; \ |
|
235 |
echo " <td>$FAILED_OTHER SFO package(s) failed</td></tr>"; \ |
|
9398 | 236 |
cat $ALL_REPORTS.old ) > $ALL_REPORTS |
237 |
||
238 |
# Report absolute symlinks. These are blockers for Solaris integration. |
|
239 |
grep 'is an absolute symlink' $WEBROOT/$LOGDIR/*.log >>/tmp/build.log.$$ |
|
240 |
||
241 |
# Count the number of local patches. |
|
9401 | 242 |
patch_count=`ls $SPECDIR/patches/*.diff | wc -l` |
9398 | 243 |
echo "PATCH COUNT: $patch_count local patches used in this build.">>/tmp/build.log.$$ |
244 |
||
245 |
# send warnings, errors and summary in email |
|
246 |
grep -v '^INFO:' /tmp/build.log.$$ | \ |
|
247 |
mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} nightly build: $FAILED pkgs failed" $EMAIL_ADDR |
|
248 |
||
249 |
rm -f /tmp/build.log.$$ |
|
250 |
||
251 |
# Email Beijing team to begin downloading packages. |
|
9648 | 252 |
/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
|
253 |
mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} Development nightly build: $FAILED pkgs failed" "[email protected],[email protected]" |
9398 | 254 |
|
255 |
||
256 |
rm $LOCKFILE |
|
257 |
||
258 |
# find any differences from the prototype files saved after the |
|
259 |
# last milestone build |
|
260 |
cd /jds/spec-files/prototypes/${OSarch_full} |
|
261 |
for f in *.proto; do |
|
262 |
test -f /jds/packages/PKGMAPS/proto/$f || continue |
|
263 |
cmp -s $f /jds/packages/PKGMAPS/proto/$f && continue |
|
264 |
echo $f: |
|
265 |
diff $f /jds/packages/PKGMAPS/proto/$f |
|
266 |
echo |
|
267 |
done > /tmp/proto-changes.$$ |
|
268 |
||
269 |
# if any diffs found mail the result to RE |
|
270 |
test -s /tmp/proto-changes.$$ && { |
|
271 |
( echo "Prototype changes found since the last milestone build:" |
|
272 |
echo |
|
273 |
cat /tmp/proto-changes.$$ ) | \ |
|
274 |
mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} prototype changes" \ |
|
275 |
$EMAIL_ADDR |
|
276 |
} |
|
277 |
||
278 |
rm -f /tmp/proto-changes.$$ |
|
279 |
||
280 |
exit 0 |