[Tools] winetest/gather: Show the short date in the index titles and headers.

Francois Gouget fgouget at codeweavers.com
Tue Mar 28 17:38:40 CDT 2017


Since there is only one build per day, using the short date is just as
unique while being more readable and shorter. It has the additional
advantage of being ordered unlike the build id (*) which makes the
browser tab names more meaningful.
The build id is still shown in the page header in addition to the short
date since there is more space there and it is used for linking to
other pages.

(*) 'Mar 15' is clearly older than 'Mar 17' whereas no such
    determination can be made from '6a05069a' and 'c3b108e5' alone.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 winetest/gather | 44 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 39 insertions(+), 5 deletions(-)

diff --git a/winetest/gather b/winetest/gather
index cf4423a..59cff6e 100755
--- a/winetest/gather
+++ b/winetest/gather
@@ -45,7 +45,7 @@ sub BEGIN
     }
     unshift @INC, $1 if ($0 =~ m=^(/.*)/[^/]+$=);
 }
-use vars qw/$datadir $gitweb/;
+use vars qw/$datadir $gitdir $gitweb/;
 require "winetest.conf";
 
 my $name0=$0;
@@ -55,6 +55,38 @@ $name0 =~ s+^.*/++;
 my $summary_version=4;
 
 
+$ENV{GIT_DIR} = $gitdir;
+
+sub get_build_info($)
+{
+    my ($build) = @_;
+    my ($date, $subject);
+
+    my $commit = `git log --max-count=1 --pretty="format:%ct %s" "$build^0" 2>/dev/null` if ($build =~ /^[0-9a-f]{40}$/);
+    if ($commit && $commit =~ /^(\d+) (.*)$/)
+    {
+        ($date, $subject) = ($1, $2);
+        # Make sure the directory's mtime matches the commit time
+        utime $date, $date, "$datadir/$build";
+    }
+    else
+    {
+        $date = (stat "$datadir/$build")[9];
+        $subject = "";
+    }
+    return ($date, $subject);
+}
+
+use POSIX qw(locale_h strftime);
+setlocale(LC_ALL, "C");
+
+sub short_date($)
+{
+    my ($date) = @_;
+    return strftime("%b %d", gmtime($date));
+}
+
+
 # A test name is of the form 'dll:unit' where:
 #  dll           Is the dll being tested.
 #  unit          Is a unit test composed of multiple individual checks testing
@@ -133,6 +165,7 @@ my ($outdated,undef) = glob "$datadir/*/outdated";
 exit 2 unless defined $outdated;
 (my $build = $outdated) =~ s|^\Q$datadir\E/(.*)/outdated$|$1|;
 (my $release = $build) =~ s/^(\d+).*$/$1/;
+my ($date, $_subject) = get_build_info($build);
 
 # Read in the data
 
@@ -429,6 +462,7 @@ EOF
 
 my $header_footer=build_header_footer(\@groups);
 my $short_build = substr($build,0,12);
+my $short_date = short_date($date);
 
 my $legend =
 "<div class=\"legend\">
@@ -630,14 +664,14 @@ sub output_table($)
     {
         $group_name = $group->{name};
         $header_footer = build_header_footer($group->{reports});
-        $title = "$group_name results for build $short_build";
+        $title = "$short_date: $group_name results";
         $filename = "index_$group_name.html";
     }
     else
     {
         $group_name = "global";
         $header_footer = build_header_footer(\@groups);
-        $title = "Summary for build $short_build";
+        $title = "$short_date: Summary";
         $filename = "index.html";
     }
 
@@ -671,7 +705,7 @@ EOF
         print OUT " | <a href=\"..\">index</a>\n";
         print OUT "</div>\n";
         print OUT "<div class=\"group\">\n";
-        print OUT "<h1>$group_name results for build <a href=\".\" title=\"$build\">$short_build</a></h1>\n";
+        print OUT "<h1>$short_date: $group_name results for build <a href=\".\" title=\"$build\">$short_build</a></h1>\n";
         print OUT "<table class=\"report\">\n$header_footer\n  <tbody>\n";
     }
     else
@@ -682,7 +716,7 @@ EOF
         print OUT " | <a href=\"..\">index</a>";
         print OUT "</div>\n";
         print OUT "<div class=\"main\">\n";
-        print OUT "<h1>Main summary for build $short_build</h1>\n";
+        print OUT "<h1>$short_date: Summary for build $short_build</h1>\n";
         print OUT "<table class=\"report\">\n$header_footer\n  <tbody>\n";
     }
 
-- 
2.11.0




More information about the wine-patches mailing list