cron-script.sh
author laca
Sat, 04 Jun 2005 22:46:08 +0000
branchgnome-2-10
changeset 19365 cf6ebcb9c095
parent 5216 8d8ac459facf
child 19377 27a5aa8e43a4
permissions -rwxr-xr-x
2005-06-04 Laszlo Peter <[email protected]> * SunDesktopVersion.spec: use %define's instead of a static tarball. set the product version to JDS3.2 build 1 * blueprint.spec: disable l10n for now (FIXME) * build-gnome2: update default tarball dir * continuous_build.sh: update directories and product name * cron-script.sh: update directories and product name * freetts.spec: update JAVA_HOME to latest * gnome-cups-manager.spec: disable l10n for now (FIXME) * gnome-menus.spec: 2 part giga hack to avoid conflict with SuSE applications.menu. (FIXME) * gnome-panel.spec: add gnome-menus dependencies * gnome-speech.spec: update JAVA_HOME and add %{_datadir}/gnome-speech * j2re-integration.spec: update j2redefault to point to latest jdk * java-access-bridge.spec: update jdk version * librsvg.spec: make it build without mozilla (FIXME) * libtool.spec: remove /usr/share/info/dir to avoid conflict with GNU info rpm * libwnck.spec: disable l10n for now (FIXME), add gtk-doc * libxslt.spec: add libtool buildreq * metacity.spec: disable l10n for now (FIXME), remove non-existant pixmap from %files * scrollkeeper.spec: disable l10n (FIXME) * sun-gdm-themes.spec: disable l10n (FIXME) * usermode.spec: disable l10n (FIXME)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
     1
#!/bin/bash
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
     2
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
     3
# host to rcp the rpms to
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
     4
RHOST=blader
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
     5
9cb957222a98 added comments
laca
parents: 786
diff changeset
     6
# user to rcp as (has to have root@<this host> in it's .rhosts file)
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
     7
RUSER=gbuild
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
     8
9cb957222a98 added comments
laca
parents: 786
diff changeset
     9
# directory to copy rpms/srpms to on the remote host
19365
cf6ebcb9c095 2005-06-04 Laszlo Peter <[email protected]>
laca
parents: 5216
diff changeset
    10
RPMSDIR=/sgnome/pkgs/gnome2.10/rpms/nightly
cf6ebcb9c095 2005-06-04 Laszlo Peter <[email protected]>
laca
parents: 5216
diff changeset
    11
SRPMSDIR=/sgnome/pkgs/gnome2.10/srpms/nightly
cf6ebcb9c095 2005-06-04 Laszlo Peter <[email protected]>
laca
parents: 5216
diff changeset
    12
LOCKFILE=/sgnome/pkgs/gnome2.10/rpms/.build.lock
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
    13
9cb957222a98 added comments
laca
parents: 786
diff changeset
    14
# reply-to/to address to send the build log as/to
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    15
[email protected]
1058
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    16
[email protected]
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    17
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    18
# date format appended to the Release tag in the spec files
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    19
# (passed to the date command on the cmd line)
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    20
RELEASE_DATE_FMT="%y%m%d"
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    21
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    22
# date format used for naming the directories
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    23
DIR_DATE_FMT="%Y-%m-%d"
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
    24
1058
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    25
RELEASE_DATE=`date +$RELEASE_DATE_FMT`
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    26
DIR_DATE=`date +$DIR_DATE_FMT`
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    27
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    28
# document root of the web server
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    29
WEBROOT=/scde/web/docs
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    30
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    31
# subdir to keep logs and reports on the webserver
19365
cf6ebcb9c095 2005-06-04 Laszlo Peter <[email protected]>
laca
parents: 5216
diff changeset
    32
WEBDIR=gnome/releng/jds/gnome2.10/nightly
1058
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
    33
LOGDIR=$WEBDIR/$DIR_DATE
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
    34
9cb957222a98 added comments
laca
parents: 786
diff changeset
    35
# ------------ nothing to configure below this line --------------
9cb957222a98 added comments
laca
parents: 786
diff changeset
    36
1521
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    37
#if [ "x$I_KNOW_WHAT_IM_DOING" != xyes ]; then
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    38
#    echo " ,---------------------------------------------------------------."
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    39
#    echo "| This script is intended to be run from cron for producing      |"
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    40
#    echo "| official nightly builds. It will mail responsible engineers    |"
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    41
#    echo "| if any build failure occurs, sends build reports to            v"
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    42
#    echo "| RE and update web pages."
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    43
#    echo "|"
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    44
#    echo "| Don't run it unless you know what you are doing. Thanks."
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    45
#    echo "|"
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    46
#    echo "| Mail [email protected] if you need more info."
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    47
#    echo "\`------>                                                         +"
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    48
#    exit 1
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    49
#fi
281281f01ef5 *** empty log message ***
laca
parents: 1418
diff changeset
    50
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    51
MYNAME="$0"
852
024538443c93 *** empty log message ***
laca
parents: 851
diff changeset
    52
MYDIR=$(cd `dirname $0`; pwd)
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    53
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
    54
if [ "x$1" != x ]; then
9cb957222a98 added comments
laca
parents: 786
diff changeset
    55
    SPECDIR="$1"
9cb957222a98 added comments
laca
parents: 786
diff changeset
    56
else
9cb957222a98 added comments
laca
parents: 786
diff changeset
    57
    SPECDIR="$MYDIR"
9cb957222a98 added comments
laca
parents: 786
diff changeset
    58
fi
9cb957222a98 added comments
laca
parents: 786
diff changeset
    59
9cb957222a98 added comments
laca
parents: 786
diff changeset
    60
# remove temporary files on exit
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    61
clean_up () {
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    62
  case "$MYNAME" in
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    63
  /tmp/cron-script.copy.* )
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    64
        rm -f $MYNAME
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    65
        ;;
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    66
  esac
853
e2a6c954649e *** empty log message ***
laca
parents: 852
diff changeset
    67
  exit
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    68
}
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    69
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    70
trap clean_up HUP INT TERM QUIT EXIT
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    71
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
    72
# make a copy of the cron script in /tmp and execute that in order to
9cb957222a98 added comments
laca
parents: 786
diff changeset
    73
# avoid disasters caused by cvs update.
485
e7fdca492320 *** empty log message ***
laca
parents: 484
diff changeset
    74
case "$MYNAME" in
e7fdca492320 *** empty log message ***
laca
parents: 484
diff changeset
    75
    /tmp/cron-script.copy.* )
e7fdca492320 *** empty log message ***
laca
parents: 484
diff changeset
    76
        ;;
e7fdca492320 *** empty log message ***
laca
parents: 484
diff changeset
    77
    *)
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    78
        cp $MYNAME /tmp/cron-script.copy.$$
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    79
        chmod 755 /tmp/cron-script.copy.$$
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    80
        cd /tmp
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
    81
        exec /tmp/cron-script.copy.$$ "$MYDIR"
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    82
        ;;
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    83
esac
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    84
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    85
fatal_error () {
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    86
  echo "ERROR: $*"
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    87
  exit 1
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    88
}
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    89
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    90
cd $SPECDIR || fatal_error "$SPECDIR not found"
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    91
606
53d75f521e46 added some command line options to the build script for use in the nightly builds.
laca
parents: 581
diff changeset
    92
cvs -q up -Pd > /dev/null 2>&1 || fatal_error "CVS update failed"
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    93
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
    94
# if the script changed during cvs update, restart with the updated script
608
7e58689b0c2d more typos...
laca
parents: 607
diff changeset
    95
if ! /usr/bin/cmp -s ./cron-script.sh $MYNAME; then exec ./cron-script.sh; fi
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    96
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
    97
# uninstall all pkgs left behind by a previous build
484
14ebefcf083e remove pkgs quietly
laca
parents: 482
diff changeset
    98
./build-gnome2 -q uninstall-pkgs *.spec
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
    99
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
   100
rm -f /usr/src/packages/SRPMS/* /usr/src/packages/RPMS/*/*
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
   101
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
   102
# if the log directory exists, open a new one with numbered suffix
9cb957222a98 added comments
laca
parents: 786
diff changeset
   103
NEW_LOGDIR=$LOGDIR
9cb957222a98 added comments
laca
parents: 786
diff changeset
   104
N=1
853
e2a6c954649e *** empty log message ***
laca
parents: 852
diff changeset
   105
while [ -d $WEBROOT/$NEW_LOGDIR ]; do
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
   106
    NEW_LOGDIR=$LOGDIR.$N
9cb957222a98 added comments
laca
parents: 786
diff changeset
   107
    N=`expr $N + 1`
9cb957222a98 added comments
laca
parents: 786
diff changeset
   108
done
9cb957222a98 added comments
laca
parents: 786
diff changeset
   109
9cb957222a98 added comments
laca
parents: 786
diff changeset
   110
LOGDIR=$NEW_LOGDIR
648
4db632d73e31 *** empty log message ***
laca
parents: 647
diff changeset
   111
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
   112
1351
a6141f0beecb add lockfile stuff
re
parents: 1181
diff changeset
   113
echo '' | rsh $RHOST -l $RUSER "touch $LOCKFILE"
a6141f0beecb add lockfile stuff
re
parents: 1181
diff changeset
   114
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
   115
# start the build
1058
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
   116
./build-gnome2 -v --nightly --date "$RELEASE_DATE" build --target i586 *.spec \
609
b705c778bcb2 build report fixes
laca
parents: 608
diff changeset
   117
        --logdir=$WEBROOT/$LOGDIR \
2749
laca
parents: 2747
diff changeset
   118
        --logdir-url=http://gnome.ireland/$LOGDIR \
1418
d6ff07e7887d 2003-11-18 Laszlo Peter <[email protected]>
laca
parents: 1351
diff changeset
   119
	--mail-errors-file=MAINTAINERS \
d6ff07e7887d 2003-11-18 Laszlo Peter <[email protected]>
laca
parents: 1351
diff changeset
   120
	[email protected] \
19365
cf6ebcb9c095 2005-06-04 Laszlo Peter <[email protected]>
laca
parents: 5216
diff changeset
   121
        --prodname="G2.10/Linux" \
cf6ebcb9c095 2005-06-04 Laszlo Peter <[email protected]>
laca
parents: 5216
diff changeset
   122
        --good-build-dir=/sgnome/pkgs/gnome2.10/rpms \
786
164d94045f68 added support for using known good rpms when a component fails to build.
laca
parents: 648
diff changeset
   123
        --good-rpms-copy-dir=/tmp/old-rpms-used.$$ \
609
b705c778bcb2 build report fixes
laca
parents: 608
diff changeset
   124
        --summary-log=$WEBROOT/$LOGDIR.html \
608
7e58689b0c2d more typos...
laca
parents: 607
diff changeset
   125
        --summary-title="Nightly Build Report `date +'%d %B %Y'`" \
1418
d6ff07e7887d 2003-11-18 Laszlo Peter <[email protected]>
laca
parents: 1351
diff changeset
   126
        --rpm-url=file:///net/dtserv1.ireland/dtserv1/sgnome/buildenv$RPMSDIR \
d6ff07e7887d 2003-11-18 Laszlo Peter <[email protected]>
laca
parents: 1351
diff changeset
   127
        --srpm-url=file:///net/dtserv1.ireland/dtserv1/sgnome/buildenv$SRPMSDIR  > /tmp/build.log.$$ 2>&1
606
53d75f521e46 added some command line options to the build script for use in the nightly builds.
laca
parents: 581
diff changeset
   128
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
   129
# 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
   130
FAILED=$?
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
   131
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
   132
# rotate rpms dir
9cb957222a98 added comments
laca
parents: 786
diff changeset
   133
echo '' | rsh $RHOST -l $RUSER "rm -f $RPMSDIR.prev/*; rmdir $RPMSDIR.prev"
9cb957222a98 added comments
laca
parents: 786
diff changeset
   134
echo '' | rsh $RHOST -l $RUSER "mv $RPMSDIR $RPMSDIR.prev; mkdir -p $RPMSDIR"
9cb957222a98 added comments
laca
parents: 786
diff changeset
   135
9cb957222a98 added comments
laca
parents: 786
diff changeset
   136
# copy new rpms
1058
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
   137
echo '' | rcp `./build-gnome2 --nightly --date "$RELEASE_DATE" install-order \
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
   138
    --full-path --target i586 \
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
   139
    *.spec` $RUSER@$RHOST:$RPMSDIR
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
   140
786
164d94045f68 added support for using known good rpms when a component fails to build.
laca
parents: 648
diff changeset
   141
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
   142
    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
   143
    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
   144
fi
164d94045f68 added support for using known good rpms when a component fails to build.
laca
parents: 648
diff changeset
   145
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
   146
# rotate srpms dir
9cb957222a98 added comments
laca
parents: 786
diff changeset
   147
echo '' | rsh $RHOST -l $RUSER "rm -f $SRPMSDIR.prev/*; rmdir $SRPMSDIR.prev"
9cb957222a98 added comments
laca
parents: 786
diff changeset
   148
echo '' | rsh $RHOST -l $RUSER "mv $SRPMSDIR $SRPMSDIR.prev; mkdir -p $SRPMSDIR"
9cb957222a98 added comments
laca
parents: 786
diff changeset
   149
# copy new srpms
2861
612e693a5ff0 2004-05-25 Laszlo Peter <[email protected]>
laca
parents: 2749
diff changeset
   150
echo '' | rcp /usr/src/packages/SRPMS/*.$RELEASE_DATE.*src.rpm \
482
0b7e38d38dac added laca's build scripts
laca
parents:
diff changeset
   151
	$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
   152
609
b705c778bcb2 build report fixes
laca
parents: 608
diff changeset
   153
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
   154
touch $ALL_REPORTS
53d75f521e46 added some command line options to the build script for use in the nightly builds.
laca
parents: 581
diff changeset
   155
53d75f521e46 added some command line options to the build script for use in the nightly builds.
laca
parents: 581
diff changeset
   156
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
   157
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
   158
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
   159
# update web page
1058
219c9b3fae9f 2003-08-14 Laszlo Peter <[email protected]>
laca
parents: 853
diff changeset
   160
( echo "<TR><TD><A HREF=/$LOGDIR.html>$DIR_DATE</A></TD>"; \
606
53d75f521e46 added some command line options to the build script for use in the nightly builds.
laca
parents: 581
diff changeset
   161
  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
   162
  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
   163
850
9cb957222a98 added comments
laca
parents: 786
diff changeset
   164
# 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
   165
cat /tmp/build.log.$$ | \
19365
cf6ebcb9c095 2005-06-04 Laszlo Peter <[email protected]>
laca
parents: 5216
diff changeset
   166
    mail -s "G2.10/Linux nightly build: $FAILED pkgs failed" \
606
53d75f521e46 added some command line options to the build script for use in the nightly builds.
laca
parents: 581
diff changeset
   167
         -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
   168
53d75f521e46 added some command line options to the build script for use in the nightly builds.
laca
parents: 581
diff changeset
   169
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
   170
1351
a6141f0beecb add lockfile stuff
re
parents: 1181
diff changeset
   171
echo '' | rsh $RHOST -l $RUSER "rm $LOCKFILE"
a6141f0beecb add lockfile stuff
re
parents: 1181
diff changeset
   172
606
53d75f521e46 added some command line options to the build script for use in the nightly builds.
laca
parents: 581
diff changeset
   173
exit 0