author | laca |
Wed, 30 Jul 2003 02:42:58 +0000 | |
changeset 852 | 024538443c93 |
parent 851 | c38c68789066 |
child 853 | e2a6c954649e |
permissions | -rwxr-xr-x |
482 | 1 |
#!/bin/bash |
2 |
||
850 | 3 |
# host to rcp the rpms to |
482 | 4 |
RHOST=blader |
850 | 5 |
|
6 |
# user to rcp as (has to have root@<this host> in it's .rhosts file) |
|
482 | 7 |
RUSER=gbuild |
850 | 8 |
|
9 |
# directory to copy rpms/srpms to on the remote host |
|
482 | 10 |
RPMSDIR=/sgnome/pkgs/gnome-2.2/rpms/nightly |
11 |
SRPMSDIR=/sgnome/pkgs/gnome-2.2/srpms/nightly |
|
850 | 12 |
|
13 |
# reply-to/to address to send the build log as/to |
|
482 | 14 |
[email protected] |
15 |
[email protected] |
|
850 | 16 |
|
17 |
# date format used by the nightlies (passed to date on the cmd line) |
|
482 | 18 |
DATE_FMT="%y%m%d" |
850 | 19 |
|
20 |
# ------------ nothing to configure below this line -------------- |
|
21 |
||
482 | 22 |
MYNAME="$0" |
852 | 23 |
MYDIR=$(cd `dirname $0`; pwd) |
482 | 24 |
|
850 | 25 |
if [ "x$1" != x ]; then |
26 |
SPECDIR="$1" |
|
27 |
else |
|
28 |
SPECDIR="$MYDIR" |
|
29 |
fi |
|
30 |
||
31 |
# remove temporary files on exit |
|
482 | 32 |
clean_up () { |
33 |
case "$MYNAME" in |
|
34 |
/tmp/cron-script.copy.* ) |
|
35 |
rm -f $MYNAME |
|
36 |
;; |
|
37 |
esac |
|
38 |
} |
|
39 |
||
40 |
trap clean_up HUP INT TERM QUIT EXIT |
|
41 |
||
850 | 42 |
# make a copy of the cron script in /tmp and execute that in order to |
43 |
# avoid disasters caused by cvs update. |
|
485 | 44 |
case "$MYNAME" in |
45 |
/tmp/cron-script.copy.* ) |
|
46 |
;; |
|
47 |
*) |
|
482 | 48 |
cp $MYNAME /tmp/cron-script.copy.$$ |
49 |
chmod 755 /tmp/cron-script.copy.$$ |
|
50 |
cd /tmp |
|
850 | 51 |
exec /tmp/cron-script.copy.$$ "$MYDIR" |
482 | 52 |
;; |
53 |
esac |
|
54 |
||
55 |
||
56 |
DATE=`date +$DATE_FMT` |
|
57 |
||
58 |
fatal_error () { |
|
59 |
echo "ERROR: $*" |
|
60 |
exit 1 |
|
61 |
} |
|
62 |
||
63 |
cd $SPECDIR || fatal_error "$SPECDIR not found" |
|
64 |
||
606
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
65 |
cvs -q up -Pd > /dev/null 2>&1 || fatal_error "CVS update failed" |
482 | 66 |
|
850 | 67 |
# if the script changed during cvs update, restart with the updated script |
608 | 68 |
if ! /usr/bin/cmp -s ./cron-script.sh $MYNAME; then exec ./cron-script.sh; fi |
482 | 69 |
|
70 |
rm -f GNOME*Template*.spec |
|
71 |
||
850 | 72 |
# uninstall all pkgs left behind by a previous build |
484 | 73 |
./build-gnome2 -q uninstall-pkgs *.spec |
482 | 74 |
|
75 |
rm -f /usr/src/packages/SRPMS/* /usr/src/packages/RPMS/*/* |
|
76 |
||
609 | 77 |
WEBROOT=/scde/web/docs |
78 |
WEBDIR=gnome/releng/2.2/mercury/nightly |
|
648 | 79 |
LOGDIR=$WEBDIR/`date +%Y-%m-%d` |
850 | 80 |
|
81 |
# if the log directory exists, open a new one with numbered suffix |
|
82 |
NEW_LOGDIR=$LOGDIR |
|
83 |
N=1 |
|
851 | 84 |
while [ -d $WEBROOT/$LOGDIR ]; do |
850 | 85 |
NEW_LOGDIR=$LOGDIR.$N |
86 |
N=`expr $N + 1` |
|
87 |
done |
|
88 |
||
89 |
LOGDIR=$NEW_LOGDIR |
|
648 | 90 |
mkdir -p $WEBROOT/$LOGDIR |
606
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
91 |
|
850 | 92 |
# start the build |
607 | 93 |
./build-gnome2 -v --nightly --date "$DATE" build *.spec \ |
609 | 94 |
--logdir=$WEBROOT/$LOGDIR \ |
95 |
--logdir-url=`date +%Y-%m-%d` \ |
|
786
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
96 |
--good-build-dir=/sgnome/pkgs/gnome-2.2/rpms \ |
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
97 |
--good-rpms-copy-dir=/tmp/old-rpms-used.$$ \ |
609 | 98 |
--summary-log=$WEBROOT/$LOGDIR.html \ |
608 | 99 |
--summary-title="Nightly Build Report `date +'%d %B %Y'`" \ |
606
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
100 |
--rpm-url=file:///net/dtserv1.ireland/dtserv1/sgnome/buildenv/sgnome/pkgs/gnome-2.2/rpms/nightly \ |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
101 |
--srpm-url=file:///net/dtserv1.ireland/dtserv1/sgnome/buildenv/sgnome/pkgs/gnome-2.2/srpms/nightly > /tmp/build.log.$$ 2>&1 |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
102 |
|
850 | 103 |
# the number of failed pkgs is returned |
606
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
104 |
FAILED=$? |
482 | 105 |
|
850 | 106 |
# rotate rpms dir |
107 |
echo '' | rsh $RHOST -l $RUSER "rm -f $RPMSDIR.prev/*; rmdir $RPMSDIR.prev" |
|
108 |
echo '' | rsh $RHOST -l $RUSER "mv $RPMSDIR $RPMSDIR.prev; mkdir -p $RPMSDIR" |
|
109 |
||
110 |
# copy new rpms |
|
786
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
111 |
echo '' | rcp `./build-gnome2 --nightly --date "$DATE" install-order \ |
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
112 |
--full-path \ |
482 | 113 |
*.spec` $RUSER@$RHOST:$RPMSDIR |
114 |
||
786
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
115 |
if [ -d /tmp/old-rpms-used.$$ ]; then |
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
116 |
echo '' | rcp /tmp/old-rpms-used.$$/*.rpm $RUSER@$RHOST:$RPMSDIR |
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
117 |
rm -rf /tmp/old-rpms-used.$$ |
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
118 |
fi |
164d94045f68
added support for using known good rpms when a component fails to build.
laca
parents:
648
diff
changeset
|
119 |
|
850 | 120 |
# rotate srpms dir |
121 |
echo '' | rsh $RHOST -l $RUSER "rm -f $SRPMSDIR.prev/*; rmdir $SRPMSDIR.prev" |
|
122 |
echo '' | rsh $RHOST -l $RUSER "mv $SRPMSDIR $SRPMSDIR.prev; mkdir -p $SRPMSDIR" |
|
123 |
# copy new srpms |
|
581 | 124 |
echo '' | rcp /usr/src/packages/SRPMS/*.$DATE.src.rpm \ |
482 | 125 |
$RUSER@$RHOST:$SRPMSDIR |
606
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
126 |
|
609 | 127 |
ALL_REPORTS=$WEBROOT/$WEBDIR/all_reports.html |
606
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
128 |
touch $ALL_REPORTS |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
129 |
|
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
130 |
cp $ALL_REPORTS $ALL_REPORTS.old |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
131 |
export FAILED ALL_REPORTS |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
132 |
|
850 | 133 |
# update web page |
644 | 134 |
( echo "<TR><TD><A HREF=/$LOGDIR.html>`date +%Y-%m-%d`</A></TD>"; \ |
606
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
135 |
echo " <TD>$FAILED package(s) failed</TD></TR>"; \ |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
136 |
cat $ALL_REPORTS.old ) > $ALL_REPORTS |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
137 |
|
850 | 138 |
# send log by email |
606
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
139 |
cat /tmp/build.log.$$ | \ |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
140 |
mail -s "mercury nightly build: $FAILED pkgs failed" \ |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
141 |
-R $REPLY_TO $EMAIL_ADDR |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
142 |
|
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
143 |
rm -f /tmp/build.log.$$ |
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
144 |
|
53d75f521e46
added some command line options to the build script for use in the nightly builds.
laca
parents:
581
diff
changeset
|
145 |
exit 0 |