
# regex to cope with rebuildd's annoying log-file naming scheme with 
# dash separators and dashes in version strings and distronames.
# dashes in version are always followed by a digit
# reponames always start with a letter 
$logregex = eval { qr/^  # start 
      ([\w\+\.-]+)       # package ($1)
      _                  # package_ver separator
      (                  # version number ($2)
	  (
	   [:\w\d\.\+~]  # chars in version strings
	   |             # or 
	   -(?=\d)       # a dash with a digit after it ($3, annoyingly)
	  )+             # at least one character
      )     
      -                  # dash separator
      ([-\w]+)           # repo name (including dashes) $4
      -                  # dash separator
      (\w+)              # architecture $5
      -                  # dash separator
      (\d{8})            # date (20120522) $6
      -                  # dash separator
      (\d\d)(\d\d).*     # hours and minutes $7 $8
      $                  # end 
      /x };              # (allowing multiline comments)

if (not defined $logregex) { warn $@ };

my @files =<*.log>;
foreach $logname (@files) {
    print "$logname  ";
    $package=$version=$arch=$date=$datestring="";
      if ( $logname =~ m/$logregex/ ) { 
         $package=$1;
        $version=$2;
        $arch=$5;
        $date="$6";
        $datestring="$5&nbsp;$7:$8";
    }
print "    version=$version, print \$3=$3, arch=$arch\n";
}    