From: Ian Jackson Date: Tue, 1 Sep 2009 15:43:50 +0000 (+0100) Subject: Actually produce ocean arch/island info in output master-info files X-Git-Tag: 3.4~37 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=3301fd916c8a162e69ee3fe89f1a178603ba4ab5;p=ypp-sc-tools.git Actually produce ocean arch/island info in output master-info files --- diff --git a/yarrg/update-master-info b/yarrg/update-master-info index 00aee34..6d1cae7 100755 --- a/yarrg/update-master-info +++ b/yarrg/update-master-info @@ -20,39 +20,48 @@ sub quick ($) { my $rsyncdir; -sub update_master_info () { - my $sfn= 'source-info.txt'; +sub process_some_info ($$$) { + my ($v,$df,$sfn) = @_; + my $sf= new IO::File $sfn or die "$sfn $!"; + + 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/; + } + next if $sfn =~ m/source-info/ && $h =~ m/^ocean/; + + print $df $_, "\n" or die $!; + } + + $sf->error and die $!; +} +sub update_master_info () { 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 $!; + process_some_info($v,$df, 'source-info.txt'); + foreach my $ocean (sort keys %oceans) { + process_some_info($v,$df, '_ocean-'.(lc $ocean).'.txt'); } - $sf->error and die $!; close $df or die $!; rename "$dfn.tmp", "$dfn" or die $!; } - }