summaryrefslogtreecommitdiff
path: root/nightly
diff options
context:
space:
mode:
authornjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-06-04 01:43:49 +0000
committernjn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9>2009-06-04 01:43:49 +0000
commite21f85d5b12b0539c6a3bf8376cd365c207cfd8a (patch)
tree93ba12a9753c6fb9516e6f60873a83a8814ffa1c /nightly
parent21c307c9c5eec7740ca4bef5a4405b3c1f7fa8e1 (diff)
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. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10238 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'nightly')
-rwxr-xr-xnightly/bin/nightly32
1 files changed, 27 insertions, 5 deletions
diff --git a/nightly/bin/nightly b/nightly/bin/nightly
index 4772f8f4..96ec50f0 100755
--- a/nightly/bin/nightly
+++ b/nightly/bin/nightly
@@ -19,11 +19,13 @@ runcmd () {
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,8 +62,28 @@ ABT_MACHINE=$2
# 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