Alexandre Julliard : patches: Generate a static html index so that we don' t need to delete old patch files.

Alexandre Julliard julliard at winehq.org
Fri Jul 9 06:01:57 CDT 2010


Module: tools
Branch: master
Commit: 68967d664f38eb705ee3769804160567e831ee0f
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=68967d664f38eb705ee3769804160567e831ee0f

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Jul  9 12:42:46 2010 +0200

patches: Generate a static html index so that we don't need to delete old patch files.

---

 patches/{index.cgi => update} |   44 +++++++++++++++++++++++-----------------
 1 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/patches/index.cgi b/patches/update
similarity index 82%
rename from patches/index.cgi
rename to patches/update
index 5016363..e18d32d 100755
--- a/patches/index.cgi
+++ b/patches/update
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 #
-# Patches CGI script
+# Update the patches data and index file
 #
 # Copyright 2009 Alexandre Julliard
 #
@@ -80,7 +80,8 @@ my @legend =
                  "<li>The patch fixes a failure but doesn't remove the corresponding todo_wine.</li></ul>" ],
 );
 
-my $dir = "data";
+my $dir = "$ENV{HOME}/patches";
+my $dest = "/home/winehq/opt/source/patches";
 my %patches;
 
 sub format_author($)
@@ -90,13 +91,14 @@ sub format_author($)
     return $_;
 }
 
-print header( -charset => "utf-8" );
-print start_html(-title=>"Patches list",
-                 -encoding=>"utf-8",
-                 -style=>{src=>"patches.css"});
+open INDEX, "> $dest/index.html.new" or die "cannot create $dest/index.html.new";
 
-print "<div class=\"main\">\n";
-print "<table class=\"main\"><tr><th class=\"id\">ID</th>",
+print INDEX start_html(-title=>"Patches list",
+                       -encoding=>"utf-8",
+                       -style=>{src=>"patches.css"});
+
+print INDEX "<div class=\"main\">\n";
+print INDEX "<table class=\"main\"><tr><th class=\"id\">ID</th>",
     "<th class=\"status\">Status</th>",
     "<th class=\"author\">Author</th>",
     "<th class=\"subject\">Subject</th>",
@@ -147,33 +149,37 @@ my $row = 0;
 foreach my $file (sort { $patches{$b}->{"order"} <=> $patches{$a}->{"order"} } keys %patches)
 {
     my $patch = $patches{$file};
-    printf "<tr class=\"%s %s\"><td class=\"id\">%s</td><td class=\"status\"><a href=\"#legend\">%s</a></td><td class=\"author\">%s</td>",
+    printf INDEX "<tr class=\"%s %s\"><td class=\"id\">%s</td><td class=\"status\"><a href=\"#legend\">%s</a></td><td class=\"author\">%s</td>",
            $row & 1 ? "odd" : "even", $patch->{"status"}, $file, $status_descr{$patch->{"status"}} || $patch->{"status"},
            escapeHTML($patch->{"author"});
-    printf "<td class=\"subject\"><a href=\"data/$file\">%s</a></td>",
+    printf INDEX "<td class=\"subject\"><a href=\"data/$file\">%s</a></td>",
            escapeHTML($patch->{"subject"});
     if ($patch->{"testbot"} eq "Failed")
     {
-        print "<td class=\"testbot botfail\"><a href=\"data/$file.testfail\">Failed</a></td>";
+        print INDEX "<td class=\"testbot botfail\"><a href=\"data/$file.testfail\">Failed</a></td>";
     }
     else
     {
-        printf "<td class=\"testbot\">%s</td>", $patch->{"testbot"};
+        printf INDEX "<td class=\"testbot\">%s</td>", $patch->{"testbot"};
     }
-    print "</tr>\n";
+    print INDEX "</tr>\n";
     $row++;
 }
-print "</table></div>\n";
+print INDEX "</table></div>\n";
 
 $row = 0;
-print "<div class=\"legend\"><h2><a name=\"legend\">Legend</a></h2>\n";
-print "<table class=\"legend\"><tr><th class=\"status\">Status</th><th class=\"causes\">Possible causes</th></tr>\n";
+print INDEX "<div class=\"legend\"><h2><a name=\"legend\">Legend</a></h2>\n";
+print INDEX "<table class=\"legend\"><tr><th class=\"status\">Status</th><th class=\"causes\">Possible causes</th></tr>\n";
 foreach my $status (@legend)
 {
-    printf "<tr class=\"%s\"><td class=\"status %s\">%s</td><td class=\"causes\">%s</td></tr>\n",
+    printf INDEX "<tr class=\"%s\"><td class=\"status %s\">%s</td><td class=\"causes\">%s</td></tr>\n",
            $row & 1 ? "odd" : "even", $status->[0], $status_descr{$status->[0]}, $status->[1];
     $row++;
     
 }
-print "</table></div>\n";
-print end_html;
+print INDEX "</table></div>\n";
+print INDEX end_html;
+close INDEX;
+
+!system "rsync", "-q", "-r", "--chmod=+r", "--exclude=OLD/", "$dir/", "$dest/data" or die "rsync failed: $?";
+rename "$dest/index.html.new", "$dest/index.html" or die "failed to update index.html";




More information about the wine-cvs mailing list