10 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
13 @EXPORT = qw(&parse_masters %oceans %commods %clients
14 &parse_pctb_commodmap %pctb_commodmap @pctb_commodmap
21 our %oceans; # eg $oceans{'Midnight'}{'Ruby'}{'Eta Island'}= $sources;
22 our %commods; # eg $commods{'Fine black cloth'}= $sources;
23 our %clients; # eg $clients{'ypp-sc-tools'}= [ qw(last-page) ];
25 # 's' = Special Circumstances; 'l' = local ; B = with Bleach
27 our (%pctb_commodmap,@pctb_commodmap);
29 my %colours; # eg $colours{'c'}{'black'}= $sources
30 my @rawcm; # eg $rawcm[0]='fine rum'; $rawcm[1]='fine %c cloth'
32 sub parse_master_master1 ($$) {
34 my $mm= new IO::File $mmfn, 'r' or die "$mmfn $!";
42 @ctx= (sub { $colours{$colourkind}{lc $_} .= $src; });
43 } elsif (m/^commods$/) {
44 @ctx= (sub { push @rawcm, lc $_; });
45 } elsif (m/^ocean (\w+)$/) {
48 $ocean or die; # ref to $ocean needed to work
52 $oceans{$ocean}{$arch}{$_} .= $src;
55 } elsif (m/^client (\S+.*\S)$/) {
57 $clients{$client}= [ ];
60 push @{ $clients{$client} }, $bug;
63 my $indent= length $&;
64 die "wrong indent $indent" unless defined $ctx[$indent-1];
65 &{ $ctx[$indent-1] }();
70 $mm->error and die $!;
73 #print Dumper(\%oceans);
74 #print Dumper(\@rawcm);
81 if ($s !~ m/\%(\w+)/) { $commods{ucfirst $s} .= $ss; return; }
82 die "unknown $&" unless defined $colours{$1};
83 foreach my $c (keys %{ $colours{$1} }) {
84 &$ca($`.$c.$', $ss .'%'. $colours{$1}{$c});
87 foreach (@rawcm) { &$ca($_,$src); }
90 sub parse_masters () {
91 parse_master_master1('master-master.txt','s');
94 sub parse_pctb_commodmap () {
95 undef %pctb_commodmap;
96 foreach my $commod (keys %commods) { $commods{$commod} =~ s/b//; }
98 my $c= new IO::File '_commodmap.tsv' or die $!;
99 if (!$c) { $!==&ENOENT or die $!; return 0; }
102 m/^(\S.*\S)\t(\d+)\n$/ or die "$_";
103 die if defined $pctb_commodmap{$1}; $pctb_commodmap{$1}= $2;
104 die if defined $pctb_commodmap[$2]; $pctb_commodmap[$2]= $1;
107 $c->error and die $!;
112 sub get_our_version ($) {
115 no strict (qw(refs));
116 ${ "${prefix}name" }= 'ypp-sc-tools yarrg';
117 ${ "${prefix}fixes" }= 'lastpage';
118 ${ "${prefix}version" }= `git-describe --tags HEAD`;