diff options
Diffstat (limited to 'extended')
-rwxr-xr-x | extended/checklogs.sh | 38 | ||||
-rwxr-xr-x | extended/parselog.perl | 72 |
2 files changed, 110 insertions, 0 deletions
diff --git a/extended/checklogs.sh b/extended/checklogs.sh new file mode 100755 index 0000000..ebd0429 --- /dev/null +++ b/extended/checklogs.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +## Usage: getlogs.sh [DATE [FORCE]] + +proto="http" +baseurl="autobuild.pure-data.info/auto-build" + +#wget_quiet_flags="-q" +#wget_quiet_flags="-nv" +wget_quiet_flags="" + +logdate="$1" +test $# -gt 0 && shift +test -z "$logdate" -o "$logdate" = "-" && logdate=`date +%Y-%m-%d` + +if [ $# -gt 0 ]; then + force="$1" + shift; +fi + +##-- get full log url +logdir="${baseurl}/${logdate}/logs" +logurl="${proto}://${logdir}" + +##-- get logs +if [ -d "$logdir" -a "$force" != "force" ]; then + echo "$0: logdir $logdir exists and 'force' was not specified" + echo "$0: NOT retrieving logs from $logurl" +else + echo "$0: retrieving logs from $logurl to $logdir" + wget $wget_quiet_flags -r -np -A ".html,_pd-extended_run-automated-builder.txt" "$logurl/" +fi + +##-- parse logs +for logfile in ${logdir}/*_pd-extended_*.txt; do + #echo "$0: parsing logfile $logfile" + ./parselog.perl "$logfile" > "$logfile.moo" +done diff --git a/extended/parselog.perl b/extended/parselog.perl new file mode 100755 index 0000000..cf8d125 --- /dev/null +++ b/extended/parselog.perl @@ -0,0 +1,72 @@ +#!/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(); +while (<>) { + if (m|[Ee]ntering directory\b.*\/moocow\/extended(?!\/)|) { #/ + $ismoo=1; + next; + } + next if (!$ismoo); + + if (m/^\(moocow/i || m/MOOCOW_BUILD_VERSION/) { + print "DEBUG: $_"; + } + elsif (m|[Ee]ntering directory\b.*\/moocow\/([^\/]*)$|) { + $extdir = $1; + chomp($extdir); + $extdir =~ s/\'$//; + #print "DIR: $extdir\n"; + } + elsif (m|install(?:.*?)\s+(\S+)\s+(?:\S*)/moocow/extended/build.moo/(.*)$|) { + ($file,$instdir) = ($1,$2); + $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 (/[Ll]eaving directory\b.*\/moocow\/extended(?!\/)/) { $ismoo=0; } #/ +} + +##-- summarize +%class2name = (EXT=>'externals', PAT=>'patches', DOC=>'docs', UNK=>'unknown'); +@summary = + (sprintf("%-32s: ", $arch), + join(', ', + (sprintf("%2d packages", scalar(keys(%packages)))), + (map { sprintf("%2d", ($class2n{$_}||0))." ".($class2name{$_}||$_) } qw(EXT PAT DOC UNK)), + ), + "\n", + ); +print STDERR @summary; +print @summary; |