From 37f07a54bdb48b2fd1a564a054d20a576f4de342 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 20 Feb 2007 05:28:41 +0000 Subject: [PATCH] Several corrections & changes to what has been stated in revision 1.45 1) The maketgz script does not insert the timestamp in curlver.h, it actually updates it. For CVS versions it is the "CVS" string. 2) testcurl.pl will always print the "date" string which represents the moment the test build is run. 3) testcurl.pl may not print the "timestamp" string since the script may end before it is printed out. (i.e. unable to update from CVS) 4) The "timestamp" string printed will be the same as the "date" one unless one of the following conditions is met. *) It is a tarball-based build. Timestamp will be creation time. *) CVS update has been done. Timestamp will be end of CVS update. --- tests/testcurl.pl | 54 +++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/tests/testcurl.pl b/tests/testcurl.pl index 4209954aa..2dc17cad6 100755 --- a/tests/testcurl.pl +++ b/tests/testcurl.pl @@ -265,6 +265,10 @@ if ($fixed < 4) { close(F); } +# Set timestamp to the UTC this script is running. Its value might +# be changed later in the script to the value present in curlver.h +$timestamp = scalar(gmtime)." UTC"; + logit "STARTING HERE"; # first line logged, for scripts to trigger on logit "NAME = $name"; logit "EMAIL = $email"; @@ -276,34 +280,12 @@ logit "LDFLAGS = ".$ENV{LDFLAGS}; logit "CC = ".$ENV{CC}; logit "target = ".$targetos; logit "version = $version"; # script version -logit "date = ".(scalar gmtime)." UTC"; +logit "date = $timestamp"; # When the test build starts # Make $pwd to become the path without newline. We'll use that in order to cut # off that path from all possible logs and error messages etc. $pwd = cwd(); -# libcurl timestamp is present in curlver.h only if this isn't a CVS version. -# If no timestamp available in curlver.h then we are building from CVS and we -# will use current UTC build time as the CVS version timestamp. -if ((-f "$CURLDIR/include/curl/curlver.h") && - (grepfile("define LIBCURL_TIMESTAMP", - "$CURLDIR/include/curl/curlver.h")) && - (open(F, "<$CURLDIR/include/curl/curlver.h"))) { - while () { - chomp; - if ($_ =~ /^\#define LIBCURL_TIMESTAMP\s+\"(.+)\".*$/) { - $timestamp = $1; - $timestamp =~ s/\s+UTC//; - $timestamp .= " UTC"; - } - } - close(F); -} -if(not defined $timestamp) { - $timestamp = scalar(gmtime)." UTC"; -} -logit "timestamp = $timestamp"; - if (-d $CURLDIR) { if ($CVS && -d "$CURLDIR/CVS") { logit "$CURLDIR is verified to be a fine source dir"; @@ -381,6 +363,10 @@ if ($CVS) { if ($cvsstat != 0) { mydie "failed to update from CVS ($cvsstat), exiting"; } + elsif (!$nocvsup) { + # Set timestamp to the UTC the CVS update took place. + $timestamp = scalar(gmtime)." UTC"; + } if($nobuildconf) { logit "told to not run buildconf"; @@ -414,6 +400,28 @@ if ($CVS) { } } +# Set timestamp to the one in curlver.h if this isn't a CVS test build. +if ((-f "$CURLDIR/include/curl/curlver.h") && + (grepfile("define LIBCURL_TIMESTAMP", + "$CURLDIR/include/curl/curlver.h")) && + (open(F, "<$CURLDIR/include/curl/curlver.h"))) { + while () { + chomp; + if ($_ =~ /^\#define\s+LIBCURL_TIMESTAMP\s+\"(.+)\".*$/) { + my $stampstring = $1; + if ($stampstring !~ /CVS/) { + $stampstring =~ s/\s+UTC//; + $timestamp = $stampstring." UTC"; + } + last; + } + } + close(F); +} + +# Show timestamp we are using for this test build. +logit "timestamp = $timestamp"; + if ($configurebuild) { if (-f "configure") { logit "configure created (at least it exists)";