+
+sub full ($) {
+ my ($ocean) = @_;
+ quick($ocean);
+ print "## updating topology of $ocean\n";
+ system('./yppedia-chart-parser',$ocean); die $? if $?;
+}
+
+sub quick ($) {
+ my ($ocean) = @_;
+ print STDERR "## updating schema and commodities for $ocean\n";
+ system('./db-idempotent-populate',$ocean); die $? if $?;
+}
+
+my $rsyncdir;
+
+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/;
+ }
+ 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 @ARGV;
+
+die if @specoceans && $alloceans;