X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=mig-bin%2Fmig-reporter;h=3758f0f2cb7114f0b5e6fcd33be32c1f674b39ea;hp=a0bb7d1f50ef904e36d974af39216f4e61431d9a;hb=5b9d7295b87aadec1479c1d4e8b39ac6f15675c1;hpb=f4808dda09a01455cf36b28ccaae9e40e7c31d98 diff --git a/mig-bin/mig-reporter b/mig-bin/mig-reporter index a0bb7d1..3758f0f 100755 --- a/mig-bin/mig-reporter +++ b/mig-bin/mig-reporter @@ -102,7 +102,6 @@ my $mig_path = abs_path($0); $mig_path =~ s|[^/]+$||; if (!defined $reports_xml) { $reports_xml = $mig_path . '../mig-xml/evergreen_staged_report.xml'; } else { $reports_xml = $mig_path . '/../mig-xml/' . $reports_xml; } -print "$reports_xml \n"; my $dom = $parser->parse_file($reports_xml); if (defined $added_page_file or defined $added_page_title) { @@ -114,7 +113,7 @@ my $dbh = Mig::db_connect(); my $report_file = create_report_name($report_title); $report_file = $MIGGITDIR . $report_file; -open(my $fh, '>', $report_file) or die "Could not open output file!"; +open(my $fh, '>', $report_file) or abort("Could not open output file!"); write_title_page($report_title,$fh,$analyst); @@ -122,7 +121,7 @@ if (defined $added_page_file and defined $added_page_title) { print $fh "<<<\n"; print $fh "== $added_page_title\n"; print "$added_page_file\t$added_page_title\n"; - open(my $an,'<:encoding(UTF-8)', $added_page_file) or die "Could not open $added_page_file !"; + open(my $an,'<:encoding(UTF-8)', $added_page_file) or abort("Could not open $added_page_file!"); while ( my $line = <$an> ) { print $fh $line; } @@ -147,18 +146,41 @@ my @report_tags = split(/\./,$tags); foreach my $t (@report_tags) { print "\n\n=========== Starting to process tag $t\n"; print "==========================================\n"; + + my @asset_files; + foreach my $asset ($dom->findnodes('//asset')) { + if (index($asset->findvalue('./tag'),$t) != -1) { + push @asset_files, $asset->findvalue('./file'); + } + } + + foreach my $fname (@asset_files) { + my $asset_path = $mig_path . '../mig-asc/' . $fname; + open my $a, $asset_path or abort("Could not open $fname."); + while ( my $l = <$a> ) { + print $fh $l; + } + print $fh "<<<\n"; + } + print_section_header(ucfirst($t),$fh); my $linecount = $lines_per_page; my $r; - my @report_names; + my @asset_files; + foreach my $asset ($dom->findnodes('//asset')) { + if (index($asset->findvalue('./tag'),$t) != -1) { + push @asset_files, $asset->findvalue('./file'); + } + } + my @report_names; foreach my $report ($dom->findnodes('//report')) { if (index($report->findvalue('./tag'),$t) != -1 and $report->findvalue('./iteration') eq '0') { push @report_names, $report->findvalue('./name'); } } - + #only has one level of failover now but could change to array of hashes and loops #but this keeps it simple and in practice I haven't needed more than two foreach my $rname (@report_names) { @@ -257,6 +279,8 @@ sub check_table { my $query = shift; my $MIGSCHEMA = shift; + print "$query\n"; + my $i; my $return_flag = 1; my @qe = split(/ /,$query); @@ -276,15 +300,15 @@ sub check_table { $i = 0; foreach my $table (@tables) { - $table =~ s/\)//g; - $table =~ s/\