chiark / gitweb /
new update-master-info seems to work
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 31 Aug 2009 23:34:50 +0000 (00:34 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 31 Aug 2009 23:34:50 +0000 (00:34 +0100)
yarrg/Commods.pm
yarrg/README
yarrg/db-idempotent-populate
yarrg/ocean-midnight.txt [deleted file]
yarrg/source-info.txt
yarrg/update-master-info
yarrg/web/copyrightdate

index c10965b2dfb75c0f63cf531e7d355ccbdaafaa84..860510e33835e5e1e574ab429862f0563ecf7c2a 100644 (file)
@@ -88,10 +88,12 @@ sub parse_info1 ($$) {
            @ctx= (sub { push @nocm, lc $_; });
        } elsif (m/^ocean (\w+)$/) {
            my $ocean= $1;
+           keys %{ $oceans{$ocean} };
            @ctx= (sub {
                $ocean or die; # ref to $ocean needed to work
                               # around a perl bug
                my $arch= $_;
+               keys %{ $oceans{$ocean}{$arch} };
                $ctx[1]= sub {
                    $oceans{$ocean}{$arch}{$_} .= $src;
                };
@@ -223,7 +225,7 @@ sub parse_info_serverside () {
 sub parse_info_serverside_ocean ($) {
     my ($oceanname) = @_;
     die "unknown ocean $oceanname ?" unless exists $oceans{$oceanname};
-    parse_info1("ocean-".(lc $oceanname).".txt",'s');
+    parse_info1("_ocean-".(lc $oceanname).".txt",'s');
 }
 
 sub parse_pctb_commodmap () {
index ac0240ed39b8d4960b4ec9fc14792e531e64caa6..a468b9a7b8832302b652d3d5655a598a76f49079 100644 (file)
@@ -172,8 +172,7 @@ for assisting players of Yohoho Puzzle Pirates.
 
 ypp-sc-tools and YARRG are
 Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
-Copyright (C) 2009 Stephen Early
-Copyright (C) 2009 Clare Boothby¬
+Copyright (C) 2009 Clare Boothby
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of
index 69703a6745e1bcf7b7365ac50fd021dbe9f9580c..143e2ef9d518e2e733d221365c372971b3ad29e0 100755 (executable)
@@ -42,8 +42,6 @@ my ($oceanname) = @ARGV;
 #---------- setup ----------
 
 parse_info_serverside();
-parse_info_serverside_ocean($oceanname);
-our $ocean= $oceans{$oceanname};
 
 db_setocean($oceanname);
 db_writer();
diff --git a/yarrg/ocean-midnight.txt b/yarrg/ocean-midnight.txt
deleted file mode 100644 (file)
index f7c8059..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-routes Midnight
- # Try to include "shortcut" routes (those where you can chart a
- # league that isn't actually on any inter-island charts), but if you
- # don't it won't affect things too much.
-
- # Ruby internal
- Olivia,               Midsummer,              3
- Midsummer,            Cranberry,              2
- Olivia,               Lynx,                   5
- Olivia,               Eta,                    7
- Cranberry,            Eta,                    3
- Lynx,                 Eta,                    3
- Lynx,                 Islay of Luthien,       5
- Eta,                  Islay of Luthien,       4
- Islay of Luthien,     Jorvik,                 5
- Eta,                  Jorvik,                 5
-
- # Pearl internal and interarch
- Cleopatra,            O'Reilly,               3
- Cleopatra,            Zeta,                   4
- Cleopatra,            Nuptial,                6
- O'Reilly,             Nuptial,                4
- O'Reilly,             Zeta,                   6
- Nuptial,              Zeta,                   4
- Nuptial,              Ostreum,                6
- Zeta,                 Tadpole,                4
- Tadpole,              Ostreum,                6
- Tadpole,              Frond,                  4
- Frond,                        Ostreum,                4
- Frond,                        Zeta,                   6
- Nuptial,              Islay of Luthien,       10
- Ostreum,              Wrasse,                 6
- Ostreum,              Gaea,                   10
- Frond,                        Wrasse,                 9
- Frond,                        Gaea,                   13
-
- # Diamond internal and interarch - this has lots of shortcut routes
- Turtle,               Jorvik,                 6
- Turtle,               Papaya,                 3
- Turtle,               Cnossos,                8
- Turtle,               Alpha,                  7
- Papaya,               Byrne,                  3
- Papaya,               Alpha,                  6
- Papaya,               Oyster,                 8
- Papaya,               Winter Solstice,        11
- Cnossos,              Alpha,                  3
- Cnossos,              Winter Solstice,        4
- Cnossos,              Guava,                  6
- Winter Solstice,      Guava,                  9
- Winter Solstice,      Alpha,                  6
- Winter Solstice,      Oyster,                 5
- Winter Solstice,      Park,                   11
- Winter Solstice,      Delta,                  16
- Winter Solstice,      Byrne,                  9
- Alpha,                        Oyster,                 3
- Oyster,               Park,                   7
- Oyster,               Delta,                  12
- Alpha,                        Byrne,                  4
- Byrne,                        Remora,                 10
- Papaya,               Remora,                 8
-
- # Emerald internal and interarch to Jet and Opal
- Wrasse,               Guava,                  5
- Wrasse,               Gaea,                   5
- Wrasse,               Epsilon,                11
- Guava,                        Epsilon,                7
- Gaea,                 Epsilon,                4
- Gaea,                 Tinga,                  8
- Epsilon,              Emperor,                3
- Epsilon,              Spring,                 6
- Emperor,              Spring,                 4
- Epsilon,              Tinga,                  5
- Tinga,                        Spring,                 4
- Tinga,                        Hephaestus,             11
- Spring,               Hephaestus,             8
- Tinga,                        Orca,                   8
-
- # Opal internal
- Orca,                 Endurance,              3
- Orca,                 Norse,                  5
- Orca,                 Nu,                     4
- Nu,                   Norse,                  3
- Nu,                   Endurance,              3
- Nu,                   Oseberg,                4
- Norse,                        Oseberg,                6
- Norse,                        Waterberry,             4
- Waterberry,           Boyle,                  3
- Boyle,                        Flow,                   3
- Flow,                 Oseberg,                3
-
- # Jet internal
- Hephaestus,           Namath,                 6
- Hephaestus,           Xi,                     4
- Hephaestus,           Lagniappe,              8
- Hephaestus,           Dugong,                 10
- Namath,               Rhinoceros Ridge,       3
- Rhinoceros Ridge,     Lagniappe,              2
- Xi,                   Lagniappe,              5
- Xi,                   Chaparral,              4
- Xi,                   Eclipse,                6
- Chaparral,            Eclipse,                4
- Lagniappe,            Dugong,                 3
- Lagniappe,            Eclipse,                5
-
- # Coral internal and interarch to Jet
- Park,                 Angelfish,              5
- Angelfish,            Meke,                   4
- Park,                 Delta,                  6
- Delta,                        Angelfish,              3
- Delta,                        Macaw,                  5
- Macaw,                        Monsoon,                3
- Monsoon,              Chaparral,              6
- Monsoon,              Turongo,                4
- Monsoon,              Durian,                 6
- Turongo,              Durian,                 3
- Turongo,              Angelfish,              7
- Turongo,              Delta,                  8
- Turongo,              Park,                   11
-
- # Sapphire internal
- Remora,               The Horseshoe Crabs,    3
- Remora,               Beta,                   3
- The Horseshoe Crabs,  Verdant Atoll,          3
- The Horseshoe Crabs,  Beta,                   5
- Beta,                 Iris,                   4
- Verdant Atoll,                Uxmal,                  3
- Verdant Atoll,                Iris,                   6
- Uxmal,                        Iris,                   4
- Iris,                 Vernal Equinox,         3
index 1d68915342c078cc87c7f46a7e55b8329d9bf8dc..2e3382f2d05302df39599b914da2495743f5fdf7 100644 (file)
@@ -123,55 +123,7 @@ commods
  wood                  175kg 250l
 
 ocean Midnight
- Coral
-  Angelfish Island
-  Delta Island
-  Meke Island
-  Park Island
- Diamond
-  Alpha Island
-  Byrne Island
-  Cnossos Island
-  Oyster Island
-  Papaya Island
-  Turtle Island
-  Winter Solstice
- Emerald
-  Emperor Island
-  Epsilon Island
-  Gaea Island
-  Guava Island
-  Spring Island
-  Tinga Island
-  Wrasse Island
- Jet
-  Chaparral Island
-  Eclipse Island
-  Hephaestus' Forge
-  Lagniappe Island
-  Namath Island
-  Xi Island
- Opal
-  Endurance Island
-  Nu Island
-  Orca Island
-  Waterberry
- Pearl
-  Cleopatra's Pearls
-  Frond Island
-  Ostreum Island
-  Zeta Island
- Ruby
-  Eta Island
-  Cranberry Island
-  Islay of Luthien
-  Jorvik Island
-  Midsummer
- Sapphire
-  Beta Island
-  Iris Island
-  Remora Island
-  Vernal Equinox
+ocean Sage
 
 client ypp-sc-tools yarrg
  lastpage
index 4c1547bd23cdfef10a0c15d701a51b47c28ddf1f..1dd432ff895584365fbc7c2aebfbe05193466562 100755 (executable)
 #!/usr/bin/perl -w
 
 use strict (qw(vars));
-
 use DBI;
-
 use Commods;
 
-@ARGV==1 or die;
-my ($rsyncdir) = @ARGV;
 
-parse_info_serverside();
+sub full ($) {
+    my ($ocean) = @_;
+    quick($ocean);
+    print "## updating topology of $ocean\n";
+    system('./yppedia-chart-parser',$ocean); die $? if $?;
+}
 
-foreach my $oceanname (sort keys %oceans) {
-    print STDERR "updating ocean $oceanname...\n";
-    system('./db-idempotent-populate',$oceanname); die $? if $?;
+sub quick ($) {
+    my ($ocean) = @_;
+    print STDERR "## updating schema and commodities for $ocean\n";
+    system('./db-idempotent-populate',$ocean); die $? if $?;
 }
 
-my $sfn= 'source-info.txt';
+my $rsyncdir;
 
-foreach my $v (1..$masterinfoversion) {
-    my $dfnl= sprintf "master-info%s.txt", ($v>1 ? "-v$v" : '');
-    print STDERR "installing new $dfnl...\n";
+sub update_master_info () {
+    my $sfn= 'source-info.txt';
+
+    foreach my $v (1..$masterinfoversion) {
+       my $dfnl= sprintf "master-info%s.txt", ($v>1 ? "-v$v" : '');
+       print STDERR "installing new $dfnl...\n";
     
-    my $dfn= "$rsyncdir/$dfnl";
-    my $sf= new IO::File $sfn or die "$sfn $!";
-    my $df= new IO::File "$dfn.tmp", 'w' or die "$dfn.tmp $!";
-
-    my $h;
-    while (<$sf>) {
-       chomp; s/\s+$//;
-       next if m/^\s*\#/ || !m/\S/;
-       if (m/^\S.*/) {
-           $h= $&;
-       }
-       die "$_ ?" unless defined $h;
-       if ($h =~ m/^commods|^\%[a-z]\b/) {
-           s/\t.*//;
-       }
-       if ($v<2) {
-           next if $h =~ m/^nocommods/;
+       my $dfn= "$rsyncdir/$dfnl";
+       my $sf= new IO::File $sfn or die "$sfn $!";
+       my $df= new IO::File "$dfn.tmp", 'w' or die "$dfn.tmp $!";
+
+       my $h;
+       while (<$sf>) {
+           chomp; s/\s+$//;
+           next if m/^\s*\#/ || !m/\S/;
+           if (m/^\S.*/) {
+               $h= $&;
+           }
+           die "$_ ?" unless defined $h;
+           if ($h =~ m/^commods|^\%[a-z]\b/) {
+               s/\t.*//;
+           }
+           if ($v<2) {
+               next if $h =~ m/^nocommods/;
+           }
+           print $df $_, "\n" or die $!;
        }
-       print $df $_, "\n" or die $!;
+
+       $sf->error and die $!;
+       close $df or die $!;
+       rename "$dfn.tmp", "$dfn" or die $!;
+    }
+
+}
+
+
+my @specoceans;
+my $alloceans;
+
+sub optarg () {
+    return $_ if length;
+    die unless @ARGV;
+    return scalar shift @ARGV;
+}
+
+while (@ARGV && $ARGV[0] =~ m/^-/) {
+    $_= shift @ARGV;
+    last if m/^--?$/;
+    while (m/^-./) {
+       if (s/^-d//) { $rsyncdir= optarg(); }
+       elsif (s/^-O//) { push @specoceans, optarg(); }
+       elsif (s/^-a//) { $alloceans=1; }
+       else { die "$_ ?"; }
     }
+}
+
+die if @specoceans && $alloceans;
+
+parse_info_serverside();
+
+if (@specoceans) {
+    print "### full update of specified oceans ...\n";
+    foreach my $ocean (@specoceans) {
+       die "$ocean ?" unless defined $oceans{$ocean};
+       full($ocean);
+    }
+} elsif ($alloceans) {
+    print "### full (inc.topology) update of all oceans ...\n";
+    foreach my $ocean (sort keys %oceans) {
+       full($ocean);
+    }
+} else {
+    print "### quick (no topology) update only (of all oceans) ...\n";
+    foreach my $ocean (sort keys %oceans) {
+       quick($ocean);
+    }
+}
 
-    $sf->error and die $!;
-    close $df or die $!;
-    rename "$dfn.tmp", "$dfn" or die $!;
+if (defined $rsyncdir) {
+    print "### master-info update ...\n";
+    update_master_info();
 }
index 26b7264e853e1fee827e7d8a0cf17c53460facc7..e7d2dc83b901c4a2331c353f299c5746b1306c39 100644 (file)
@@ -1 +1 @@
-Copyright 2009 Ian Jackson, Steve Early, Clare Boothby
\ No newline at end of file
+Copyright 2009 Ian Jackson, Clare Boothby
\ No newline at end of file