21 my @opt = <<'=back' =~ /B<--(\S+)>/g;
29 With tail, the end of file is ignored the program waits for new lines.
30 Default is true on a tty, elsewhere default is false.
42 use lib
"$FindBin::Bin/../lib";
48 use File
::Basename
qw(dirname);
49 use File
::Path
qw(mkpath);
54 use Hash
::Util
qw(lock_keys);
57 lock_keys
%Opt, map { /([^=|!]+)/ } @opt;
64 $Opt{tail
} //= -t STDOUT
;
70 use Time
::HiRes
qw(sleep);
71 use Graph
::Feather
; # schade, schade, verlangt 5.22; ==> distroprefs
72 my $gf = Graph
::Feather
->new;
76 my @x0 = $ts =~ /^(\S+)-(\S+)-(\S+)[Tt ](\S+):(\S+):(\S+)\.(\d+)/
77 or warn "strange date to parse '$ts' did not parse well";
79 $nano .= "0" while length($nano)<9;
80 my $tm0 = eval { Time
::Moment
->new(
90 )} or die "error while feeding date (@x0) to Time::Moment: $@";
98 no warnings
'uninitialized';
100 if ($t->[$i][1] && $t->[$i][2]) {
101 my $tm0 = myts_to_tmom
($t->[$i][1]);
102 my $tm1 = myts_to_tmom
($t->[$i][2]);
103 $tt = $tm0->delta_nanoseconds($tm1) / 1_000_000_000
;
105 # printf " %-14s %-26s %-26s %12.2f\n", @{$t->[$i]}, $tt;
113 my @queue = map { [$_, 1] } $gf->predecessors($v);
116 my $node = shift @queue;
117 my($name, $depth) = @
$node;
118 if (0 && $gf->get_vertex_attribute($name,"iscommand") > 0) {
121 push @queue, map {[$_, $depth+1]} $gf->predecessors($name);
130 our($LINE,%LINE,%S,%T);
131 my $file = shift or die "Usage: $0 file";
132 open my $gw_fh, $file or die "Could not open $file: $!";
140 LINE
: for ($curpos = tell($gw_fh); <$gw_fh>; $curpos =tell($gw_fh)) {
141 my $syslog = $1 if s/(^.+?)\{/{/;
142 my $h = eval { decode_json
($_); };
146 my $dumper = Dumpvalue
->new;
147 $dumper->set_quote('"');
148 my $line_dump = $dumper->stringify($line);
149 my $errmsg_dump = $dumper->stringify($errmsg);
150 warn "Could not parse line=$line_dump, errmsg=$errmsg_dump";
153 if (exists $h->{CALLED_FOR
} && ($h->{CALLED_FOR
} eq "Chemistry::File::SMILES" || $h->{CALLED_FOR
} eq "Chemistry::Ring")) {
154 warn "Ignoring all loglines about $h->{CALLED_FOR} due circular deps noise";
157 #next unless $h->{method} =~ /^post_(install)/;
159 if ($h->{make_test
} && $h->{make_test
} =~ /^(YES|NO)/) {
161 $h->{success
} = $yesno;
162 if ( $h->{method
} =~ /^post_(?:install)/ ) {
166 if ( exists $h->{make
} && $h->{make
} =~ /^NO/
167 || exists $h->{writemakefile
} && $h->{writemakefile
} =~ /^NO/
168 || exists $h->{unwrapped
} && $h->{unwrapped
} =~ /^NO/
169 || exists $h->{signature_verify
} && $h->{signature_verify
} =~ /^NO/ ) {
170 $h->{success
} = "NO";
171 if ( $h->{method
} =~ /^post_(?:install)/ ) {
176 $S{queue_size
} = $h->{queue_size
};
177 my $line; # misnomer: I was thinking metaphorically of the
178 # line in the bundle file and/or the commandline the
181 if ($h->{reqtype
} eq "c") {
182 $line = $LINE{$h->{CALLED_FOR
}} ||= ++$LINE;
183 $line = sprintf "%5d", $line;
185 $line = $h->{reqtype
};
188 if ($h->{success
}) { # yes *or* no is success
189 delete $depth{$h->{pretty_id
}};
190 $h->{depth
}=1 + scalar keys %depth;
192 $depth{$h->{pretty_id
}}=undef;
193 $h->{depth
}=scalar keys %depth;
195 $h->{mandatory_label
} = $h->{reqtype
} eq "c" ?
'-' : $h->{mandatory
} ?
"m" : "o";
196 my $x_minus_depth = 77 - $h->{depth
};
197 my ($ts) = $syslog =~ /^([-0-9]+[Tt ][:0-9]+(?:\.[0-9]+)?)/;
199 my $t = $T{$h->{pretty_id
}} ||= [];
200 my ($prepost,$phase) = $h->{method
} =~ /(pre|post)_(.+)/;
201 if ( $prepost eq "pre" ) {
202 push @
$t, [ $phase, $ts, undef ];
205 for (my $i= $#$t; $i>=0; $i--) {
206 if ( $phase eq $t->[$i][0] ) {
208 push @
$t, [ $phase, undef, $ts ];
217 push @
$t, [ $phase, undef, $ts ];
220 # print " ($h->{pretty_id})";
222 my $t = tsums
($T{$h->{pretty_id
}});
223 # $gf->add_edge($h->{CALLED_FOR},$h->{pretty_id});
224 # if ($h->{reqtype} eq "c") {
225 # $gf->set_vertex_attribute($h->{CALLED_FOR},"iscommand",1);
227 # $gf->set_vertex_attribute($h->{CALLED_FOR},"class","M");
228 # $gf->set_vertex_attribute($h->{pretty_id},"class","D");
229 # for my $prereq_cat (keys %{$h->{prereq_pm}}) {
230 # my $hash = $h->{prereq_pm}{$prereq_cat};
231 # for my $mod (keys %$hash) {
232 # $gf->add_edge($h->{pretty_id},$mod);
235 if ( $h->{method
} =~ /^post_(?:install)/ ) {
236 $h->{success_label
} = $h->{success
} || "-";
237 printf "\r%5s %s %2d %*s%-*s %-49s %-3s %8.3f %6d %s\n", @
{$h}{qw(line mandatory_label depth depth)}, " ", $x_minus_depth, @
{$h}{qw(pretty_id CALLED_FOR success_label)}, $t->{install
}, $S{queue_size
}, $ts;
238 # my $iterator = pred_walk($gf,$h->{pretty_id});
240 # while (my $p = $iterator->()) {
241 # my($name, $depth) = @$p;
242 # my $class = $gf->get_vertex_attribute($name,"class");
243 # if ($class eq "D") {
244 # last if $seen{$name}++;
245 # printf "<========= pred %s(%d)[%s]\n", $name, $depth, $class;
248 } elsif ($Opt{tail
}) {
249 $statusline = sprintf "\r%8s %-56s %11.2f %11.2f %11.2f %11.2f y%d:n%d %5d %s", "==t==",
259 if defined $h->{pretty_id
}
261 $stalledtime = myts_to_tmom
($ts)->epoch;
265 my $waiting = time - $stalledtime;
267 printf "%s %5d %s", $statusline,
269 $parallelo ?
"▱": "▰"
272 seek($gw_fh, $curpos, 0); # seek to where we had been
278 # print "yes $S{YES} no $S{NO} queue_size $S{queue_size}\n"
282 # cperl-indent-level: 4