|
From: <sv...@va...> - 2009-06-04 02:22:17
|
Author: njn
Date: 2009-06-04 02:43:49 +0100 (Thu, 04 Jun 2009)
New Revision: 10238
Log:
Fixes for Darwin: it uses a different method for getting the time-and-date
for 24 hours ago. Also, the default 'sh' doesn't support "echo -n" so use
"printf" instead.
Modified:
trunk/nightly/bin/nightly
Modified: trunk/nightly/bin/nightly
===================================================================
--- trunk/nightly/bin/nightly 2009-06-04 01:30:14 UTC (rev 10237)
+++ trunk/nightly/bin/nightly 2009-06-04 01:43:49 UTC (rev 10238)
@@ -19,11 +19,13 @@
str=$2
shift 2
- # Header in short logfile
- echo -n " $str ... " >> $logfile.short
+ # Header in short logfile.
+ # We use "printf" to avoid printing a newline; "echo -n" isn't POSIX and
+ # so isn't supported on all systems.
+ printf " $str ... " >> $logfile.short
# Header and command in verbose logfile
- echo -n " $str ... " >> $logfile.verbose
+ printf " $str ... " >> $logfile.verbose
echo "$*" >> $logfile.verbose
# Run the command
@@ -60,9 +62,29 @@
# Get times and date
ABT_START=`date "+%F %H:%M:%S %Z"`
-svn_old_date=`date --date=yesterday +%Y-%m-%dT%H:%M:%S`
-svn_new_date=`date --date=today +%Y-%m-%dT%H:%M:%S`
+# This is one of the formats SVN accepts. Yes, the 'T' appears in the final
+# string, it's supposed to be like that.
+svn_date_format="+%Y-%m-%dT%H:%M:%S"
+# The time-and-date from 24 hours ago is tricky; Linux and Darwin have
+# different ways of getting it, so we try things until something works.
+svn_old_date=
+if [ "z" = "z${svn_old_date}" ] ; then
+ # Linux method.
+ svn_old_date=`date --date=yesterday $svn_date_format 2> /dev/null`
+fi
+if [ "z" = "z${svn_old_date}" ] ; then
+ # Darwin method.
+ svn_old_date=`date -v-24H $svn_date_format 2> /dev/null`
+fi
+if [ "z" = "z${svn_old_date}" ] ; then
+ echo "Sorry, can't work out the time and date for 24 hours ago, aborting"
+ exit 1;
+fi
+
+# The time-and-date for now is easy.
+svn_new_date=`date $svn_date_format`
+
cd $ABT_TOP
# Clean up output files produced by a previous run.
|