r165 - trunk/vim-scripts/vim.org

Stefano Zacchiroli zack@costa.debian.org
Sat, 16 Apr 2005 10:44:52 +0000


Author: zack
Date: 2005-04-16 10:44:52 +0000 (Sat, 16 Apr 2005)
New Revision: 165

Added:
   trunk/vim-scripts/vim.org/vim-scripts.pl
Removed:
   trunk/vim-scripts/vim.org/download_doc.pl
   trunk/vim-scripts/vim.org/get_version.pl
Modified:
   trunk/vim-scripts/vim.org/copyright
Log:
wrote vim-scripts.pl, which parses changelog in the vim-scripts format and can
- download web page of the script on vim.org to be included as documentation
- check for new upstream version


Modified: trunk/vim-scripts/vim.org/copyright
===================================================================
--- trunk/vim-scripts/vim.org/copyright	2005-04-14 18:03:08 UTC (rev 164)
+++ trunk/vim-scripts/vim.org/copyright	2005-04-16 10:44:52 UTC (rev 165)
@@ -1,3 +1,6 @@
+
+--
+
 script_name: plugin/a.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=31
 author:      Mike Sharpe
@@ -4,7 +7,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=49
 email:       feline at irendi.com
 license:     license [1], see below
-version:     
+version:     2.11
 
 script_name: plugin/whatdomain.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=62
@@ -12,7 +15,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=38
 email:       piefel at informatik.hu-berlin.de
 license:     public domain
-version:     
+version:     20010919
 
 script_name: plugin/bufexplorer.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=42
@@ -20,7 +23,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=97
 email:       delux256-vim at yahoo dot com
 license:     license [2], see below
-version:     
+version:     7.0.2
 
 script_name: plugin/minibufexpl.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=159
@@ -28,7 +31,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=385
 email:       bindu at wavell.net
 license:     license [2], see below
-version:     
+version:     6.3.2
 
 script_name: plugin/gnupg.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=661
@@ -36,7 +39,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=1120
 email:       markus.braun at krawel.de
 license:     no license
-version:     
+version:     1.27
 
 script_name: plugin/vimspell.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=465
@@ -44,7 +47,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=1196
 email:       mathieu.clabaut at free.fr
 license:     GNU GPL, see /usr/share/common-licenses/GPL-2
-version:     
+version:     1.95
 
 script_name: plugin/taglist.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=273
@@ -52,7 +55,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=244
 email:       yegappan at yahoo.com
 license:     no license
-version:     
+version:     4.0b1
 
 script_name: plugin/calendar.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=52
@@ -60,7 +63,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=103
 email:       mattn_jp at mail.goo.ne.jp
 license:     no license
-version:     
+version:     1.4
 
 script_name: plugin/winmanager.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=95
@@ -76,7 +79,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=96
 email:       drchip at campbellfamily.biz
 license:     GNU GPL, see /usr/share/common-licenses/GPL-2
-version:     26/30
+version:     27/31
 
 script_name: plugin/cvsmenu.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=1245
@@ -140,7 +143,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=299
 email:       kgergely at mcl.hu
 license:     no license
-version:     
+version:     0.52fix
 
 script_name: games/VimSokoban/sokoban.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=211
@@ -148,7 +151,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=49
 email:       feline at irendi.com
 license:     license [1], see below
-version:     
+version:     1.3
 
 script_name: plugin/themes.vim
 script_url:  http://www.vim.org/scripts/script.php?script_id=625

Deleted: trunk/vim-scripts/vim.org/download_doc.pl
===================================================================
--- trunk/vim-scripts/vim.org/download_doc.pl	2005-04-14 18:03:08 UTC (rev 164)
+++ trunk/vim-scripts/vim.org/download_doc.pl	2005-04-16 10:44:52 UTC (rev 165)
@@ -1,21 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-my ($script_name, $script_url, $author, $author_url, $email, $license,
-  $version);
-
-while (my $line = <>) {
-  chomp $line;
-  if ($line =~ /^script_name:\s*(.*)/) { $script_name = $1; }
-  elsif ($line =~ /^script_url:\s*(.*)/) { $script_url = $1; }
-  elsif ($line =~ /^author:\s*(.*)/) { $author = $1; }
-  elsif ($line =~ /^author_url:\s*(.*)/) { $author_url = $1; }
-  elsif ($line =~ /^email:\s*(.*)/) { $email = $1; }
-  elsif ($line =~ /^license:\s*(.*)/) { $license = $1; }
-  elsif ($line =~ /^version:\s*(.*)/) {
-    $version = $1;
-    $script_name =~ s/\//_/g;
-    my $html = "$script_name.html";
-    system "wget -O $html '$script_url'";
-  }
-}

Deleted: trunk/vim-scripts/vim.org/get_version.pl
===================================================================
--- trunk/vim-scripts/vim.org/get_version.pl	2005-04-14 18:03:08 UTC (rev 164)
+++ trunk/vim-scripts/vim.org/get_version.pl	2005-04-16 10:44:52 UTC (rev 165)
@@ -1,15 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-my ($in_table, $script_name, $script_version);
-while (my $line = <>) {
-  next if $script_version;
-  if (not $in_table and $line =~ /<td class="rowodd" valign="top" nowrap><a href="download_script\.php\?src_id=780">([^<]+)<\/a><\/td>/) {
-    $in_table = 1;
-    $script_name = $1;
-  } elsif ($in_table and $line =~ /<td class="rowodd" valign="top" nowrap><b>([^<]+)<\/b><\/td>/) {
-    $script_version = $1;
-  }
-}
-print "$script_name\t$script_version\n";
-

Copied: trunk/vim-scripts/vim.org/vim-scripts.pl (from rev 164, trunk/vim-scripts/vim.org/download_doc.pl)
===================================================================
--- trunk/vim-scripts/vim.org/download_doc.pl	2005-04-14 18:03:08 UTC (rev 164)
+++ trunk/vim-scripts/vim.org/vim-scripts.pl	2005-04-16 10:44:52 UTC (rev 165)
@@ -0,0 +1,92 @@
+#!/usr/bin/perl -w
+use strict;
+
+# Copyright (C) 2005, Stefano Zacchiroli <zack@debian.org>
+#
+# Created:        Sat, 16 Apr 2005 12:43:04 +0200 zack
+# Last-Modified:  Sat, 16 Apr 2005 12:43:04 +0200 zack
+#
+# This is free software, you can redistribute it and/or modify it under the
+# terms of the GNU General Public License version 2 as published by the Free
+# Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA  02111-1307  USA
+
+my $usage =
+  "Usage: debian/vim-scripts.pl { doc | update | test } [ name ...  ]\n";
+my $action = shift or die $usage;
+my $status = "debian/copyright";
+my @scripts = ();
+push @scripts, @ARGV;
+
+sub parse_script_page($) {
+  my ($url) = @_;
+  my ($in_table, $script_name, $script_version, $script_date, $download_url);
+  open HTML, "wget -nv -O - '$url' |" or die "Can't exec wget for pipe-reading";
+  while (my $line = <HTML>) {
+    next if $script_version and $script_date;
+    chomp $line;
+    if (not $in_table and $line =~ /<td class="[^"]*" valign="top" nowrap><a href="(download_script\.php\?src_id=\d+)">([^<]+)<\/a><\/td>/) {
+      $in_table = 1;
+      $download_url = "http://www.vim.org/scripts/$1";
+      $script_name = $2;
+    } elsif ($in_table and $line =~ /<td class="[^"]*" valign="top" nowrap><b>\s*([^<]+)\s*<\/b><\/td>/) {
+      $script_version = $1;
+    } elsif ($in_table and $line =~ /<td class="[^"]*" valign="top" nowrap><i>\s*([^<]+)\s*<\/i><\/td>/) {
+      $script_date = $1;
+    }
+  }
+  close HTML;
+#   print "$script_name\t$script_version\t$script_date\n";
+  return [$script_version, $script_date, $download_url];
+}
+
+open STATUS, "< $status" or die "Can't open debian/copyright";
+my ($script_name, $script_url, $author, $author_url, $email, $license,
+  $version);
+my $skip = 1;
+while (my $line = <STATUS>) {
+  chomp $line;
+  $skip = not $skip if ($line =~ /^--\s*$/);
+  next if $skip;
+  if ($line =~ /^script_name:\s*(.*)/) { $script_name = $1; }
+  elsif ($line =~ /^script_url:\s*(.*)/) { $script_url = $1; }
+  elsif ($line =~ /^author:\s*(.*)/) { $author = $1; }
+  elsif ($line =~ /^author_url:\s*(.*)/) { $author_url = $1; }
+  elsif ($line =~ /^email:\s*(.*)/) { $email = $1; }
+  elsif ($line =~ /^license:\s*(.*)/) { $license = $1; }
+  elsif ($line =~ /^version:\s*(.*)/) {
+    $version = $1;
+    if (not @scripts or grep /^\Q$script_name\E$/, @scripts) {
+      if ($action eq "test") {
+        print $script_name, "\n";
+      } elsif ($action eq "doc") {
+        my $fname = $script_name;
+        $fname =~ s/\//_/g;
+        system "wget -nv -O $fname.html '$script_url'";
+      } elsif ($action eq "update") {
+        my ($upstream_version, $upstream_date, $download_url) =
+          @{parse_script_page($script_url)};
+        if (not ($upstream_version eq $version)) {
+          print <<EOMSG;
+$script_name may be out of date:
+  debian version: $version
+  upstream version: $upstream_version
+    release date: $upstream_date
+  script url: $script_url
+  download url: $download_url
+EOMSG
+        }
+      }
+    }
+  }
+}
+close STATUS;
+