cron-script.sh
changeset 9401 72746c79ffd2
parent 9398 3f67e766856b
child 9404 c0539fbad27d
equal deleted inserted replaced
9400:f3c0f4f1c2ee 9401:72746c79ffd2
     1 #!/bin/bash
     1 #!/bin/bash
     2 
     2 
     3 # Sample usage in crontab:
     3 # Sample usage in crontab:
     4 # Run, Mon-Fri at 1:30am. Add to build user's crontab.
     4 # Run, Mon-Fri at 1:30am. Add to build user's crontab.
     5 #   30 1 * * 1-5 . /jds/cbe/bin/env.sh; cd /jds/spec-files/Solaris; I_KNOW_WHAT_IM_DOING=yes ./cron-script.sh
     5 #   30 1 * * 1-5 . /jds/cbe/bin/env.sh; cd /jds/spec-files; I_KNOW_WHAT_IM_DOING=yes ./cron-script.sh
     6 #
     6 #
     7 # The same with a jail. Add to root's crontab. Example assumes 'gbuild' is the
     7 # The same with a jail. Add to root's crontab. Example assumes 'gbuild' is the
     8 # build user
     8 # build user
     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/Solaris; I_KNOW_WHAT_IM_DOING=yes ./cron-script.sh"
     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"
    10 #
    10 #
    11 # $Id$
    11 # $Id$
    12 
    12 
    13 
    13 
    14 OSrel=`uname -r | cut -f2 -d.`
    14 OSrel=`uname -r | cut -f2 -d.`
   102   exit 1
   102   exit 1
   103 }
   103 }
   104 
   104 
   105 cd $SPECDIR || fatal_error "$SPECDIR not found"
   105 cd $SPECDIR || fatal_error "$SPECDIR not found"
   106 
   106 
   107 cd ..
       
   108 
       
   109 #revert any local changes
   107 #revert any local changes
   110 svn revert -R .
   108 svn revert -R .
   111 
   109 
   112 #cvs -q up -Pd > /dev/null 2>&1 || fatal_error "CVS update failed"
       
   113 # checkout-out SVN copy *MUST* be read-only, or "update" needs passwd
   110 # checkout-out SVN copy *MUST* be read-only, or "update" needs passwd
   114 svn -q up > /dev/null 2>&1 || fatal_error "SVN update failed"
   111 svn -q up > /dev/null 2>&1 || fatal_error "SVN update failed"
   115 cd $SPECDIR
   112 cd $SPECDIR
   116 
   113 
   117 # if the script changed during cvs update, restart with the updated script
   114 # if the script changed during cvs update, restart with the updated script
   119 
   116 
   120 # uninstall all pkgs left behind by a previous build
   117 # uninstall all pkgs left behind by a previous build
   121 pkgtool uninstall-pkgs --with-l10n --with-tjds *.spec >/dev/null
   118 pkgtool uninstall-pkgs --with-l10n --with-tjds *.spec >/dev/null
   122 # remove-gnome will now remove anything left from uninstall-pkgs in case
   119 # remove-gnome will now remove anything left from uninstall-pkgs in case
   123 # or a packaging change for example
   120 # or a packaging change for example
   124 ./remove-gnome --version jds -q -f --no_extras > /dev/null 2>&1
   121 $SPECDIR/scripts/remove-gnome --version jds -q -f --no_extras > /dev/null 2>&1
   125 
   122 
   126 rm -rf /jds/packages/PKGS/*
   123 rm -rf /jds/packages/PKGS/*
   127 rm -rf /jds/packages/SPKGS/*
   124 rm -rf /jds/packages/SPKGS/*
   128 rm -rf /jds/packages/BUILD/*
   125 rm -rf /jds/packages/BUILD/*
   129 rm -rf /var/tmp/*-build
   126 rm -rf /var/tmp/pkgbuild-*/*
   130 
   127 
   131 # if the log directory exists, open a new one with numbered suffix
   128 # if the log directory exists, open a new one with numbered suffix
   132 NEW_LOGDIR=$LOGDIR
   129 NEW_LOGDIR=$LOGDIR
   133 N=1
   130 N=1
   134 while [ -d $WEBROOT/$NEW_LOGDIR ]; do
   131 while [ -d $WEBROOT/$NEW_LOGDIR ]; do
   143 touch $LOCKFILE
   140 touch $LOCKFILE
   144 
   141 
   145 # Rebuild the manpage tarballs
   142 # Rebuild the manpage tarballs
   146 cd $SPECDIR/manpages
   143 cd $SPECDIR/manpages
   147 make
   144 make
   148 cd $SPECDIR/../po-sun
   145 cd $SPECDIR/po-sun
   149 make clean
   146 make clean
   150 make
   147 make
   151 cd $SPECDIR
   148 cd $SPECDIR
   152 
   149 
   153 # start the build
   150 # start the build
   154 pkgtool -v --nightly --date "$RELEASE_DATE" build *.spec \
   151 pkgtool -v --nightly --date "$RELEASE_DATE" build *.spec closed/*.spec \
   155         --logdir=$WEBROOT/$LOGDIR \
   152         --logdir=$WEBROOT/$LOGDIR \
   156         --logdir-url=http://gnome.ireland/$LOGDIR \
   153         --logdir-url=http://gnome.ireland/$LOGDIR \
   157 	[email protected] \
   154 	[email protected] \
   158         --prodname="${PRODNAME}/s${OSrel}${OSarch}" \
   155         --prodname="${PRODNAME}/s${OSrel}${OSarch}" \
   159         --live --with-l10n --with-tjds \
   156         --live --with-l10n --with-tjds \
   193 
   190 
   194 # Report absolute symlinks. These are blockers for Solaris integration.
   191 # Report absolute symlinks. These are blockers for Solaris integration.
   195 grep 'is an absolute symlink' $WEBROOT/$LOGDIR/*.log >>/tmp/build.log.$$
   192 grep 'is an absolute symlink' $WEBROOT/$LOGDIR/*.log >>/tmp/build.log.$$
   196 
   193 
   197 # Count the number of local patches.
   194 # Count the number of local patches.
   198 patch_count=`ls $SPECDIR/../patches/*.diff | wc -l`
   195 patch_count=`ls $SPECDIR/patches/*.diff | wc -l`
   199 echo "PATCH COUNT: $patch_count local patches used in this build.">>/tmp/build.log.$$
   196 echo "PATCH COUNT: $patch_count local patches used in this build.">>/tmp/build.log.$$
   200 
   197 
   201 # send warnings, errors and summary in email
   198 # send warnings, errors and summary in email
   202 grep -v '^INFO:' /tmp/build.log.$$ | \
   199 grep -v '^INFO:' /tmp/build.log.$$ | \
   203     mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} nightly build: $FAILED pkgs failed" $EMAIL_ADDR
   200     mailx -s "${PRODNAME} S${OSrel} ${OSarch_full} nightly build: $FAILED pkgs failed" $EMAIL_ADDR