aboutsummaryrefslogtreecommitdiff
path: root/extended/parselog.perl
blob: e975446a09359b303ca8d414dec87a2e5192262a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/perl -w

use File::Basename;

##-- parse filename?
if (@ARGV) {
  $file = $ARGV[0];
  $base = File::Basename::basename($file);
  $base =~ s/\Q_pd-extended_run-automated-builder.txt\E$//;
  $base =~ s/^[^a-zA-Z]*//;
  $arch = $base;
} else {
  $arch = 'unknown';
}
$ismoo=0;
%class2n =qw();
%packages =qw();
$nfailed = 0;
while (<>) {
  if (
      m|[Ee]ntering directory\b.*\/moocow\/extended(?!\/)|
      ||
      m|^make -C .*\/moocow\/extended\s|
     )
    {
      $ismoo = 1;
      next;
    }
  next if (!$ismoo);

  if (m/MOOCOW_BUILD_VERSION/ || m/^\(moocow/i) {
    $ismoo = 1;
    print "DEBUG: $_";
    $nfailed++ if ($_ =~ /sub-target failed/);
  }
  elsif (
	 m|[Ee]ntering directory\b.*\/moocow\/([^\/]*)\s|
	 ||
	 m|^\(cd \.\./(\S+);|
	)
    {
      $extdir = $1;
      chomp($extdir);
      $extdir =~ s/\'$//;
      #print "DIR: $extdir\n";
    }
  elsif (m|install(.*?)\s+(\S+)\s+(?:\S*)/moocow/extended/build.moo/(.*)$|) {
    ($opts,$file,$instdir) = ($1,$2,$3);
    next if ($file eq '-d' || $opts =~ /\s\-d\b/);
    $file    =~ s/[\'\"]//g;
    $instdir =~ s/[\'\"]//g;
    $instdir =~ s/$file$//;
    if ($file =~ /^(.*)(\.[^\.]*)$/) {
      ($base,$ext) = ($1,$2);
    } else {
      ($base,$ext) = ($file,'');
    }
    $class = 'UNK';
    if ($instdir =~ m|\bdoc/5\.reference\b|) {
      $class = 'DOC';
    }
    elsif ($ext eq '.pd' && $instdir =~ m/\b(?:externs|extra)\b/) {
      $class = 'PAT';
    }
    elsif ($instdir =~ m/\b(?:externs|extra)\b/) {
      $class = 'EXT';
    }
    $class2n{$class}++;
    $packages{$extdir}=1;
    print sprintf("INSTALL %-3s %10s %-20s %-12s %s\n", $class, $extdir, $base, $ext, $instdir);
  }
  elsif (
	 m|[Ll]eaving directory\b.*\/moocow\/extended(?!\/)|
	 ||
	 m|^make -C (?!.*\/moocow\/)|
	)
    {
      $ismoo=0;
    } #/
}

##-- summarize
%class2name = (EXT=>'externals', PAT=>'patches', DOC=>'docs', UNK=>'unknown');
@summary =
  (sprintf("%-32s: ", $arch),
   join(', ',
	(sprintf("%2d packages, %2d failed", scalar(keys(%packages)), $nfailed)),
	(map { sprintf("%2d", ($class2n{$_}||0))." ".($class2name{$_}||$_) } qw(EXT PAT DOC UNK)),
       ),
   "\n",
  );
print STDERR @summary;
print @summary;