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
#!/usr/bin/perl
use strict;
use warnings;
my $html_report = '';
my $data_file = '';
my $content = '';
my $bug = parse_file($html_report);
add_to_file($bug);
sub parse_file{
my ($file) = @_;
local $/;
open(my $fh,'<',$html_report) or die $!;
my $content = <$fh>;
close $fh;
my ($bugnumber,$package) = $content =~ /<title>(#\d+)\s?([^\s]*?)\s*?-/i;
my ($submitter) = $content =~ /pkgreport\.cgi\?submitter=([^"]*?)/;
my ($maintainer) = $content =~ /pkgreport\.cgi\?maint=([^"]*?)/ ? "unknown" : $submitter;
my ($date) = $content =~ /Date:\s?(.*?)\s?UTC/;
my ($severity) = $content =~ /Severity:\s?(.*?);/;
return join(',',$bugnumber,$submitter,$maintainer,$package,$date,$severity);
}# parse_file
sub add_to_file{
my ($file,$bug) = @_;
open(my $fh,">>",$file) or die $!;
print $fh $bug,"\n";
close $fh;
}#add_to_file