URPM repoclosure 1.7.4: improved reports

This commit is contained in:
Andrey Ponomarenko 2014-04-30 18:32:55 +04:00
parent 4ae2942553
commit 2d05f43b01

View file

@ -1,9 +1,9 @@
#!/usr/bin/perl #!/usr/bin/perl
######################################################## ########################################################
# URPM Repo Closure Checker 1.7.1 for Linux # URPM Repo Closure Checker 1.7.4 for Linux
# A tool for checking closure of a set of RPM packages # A tool for checking closure of a set of RPM packages
# #
# Copyright (C) 2011-2012 ROSA Lab # Copyright (C) 2011-2014 ROSA Lab
# Written by Andrey Ponomarenko # Written by Andrey Ponomarenko
# #
# PLATFORMS # PLATFORMS
@ -38,7 +38,7 @@ use File::Copy qw(copy move);
use Data::Dumper; use Data::Dumper;
use strict; use strict;
my $TOOL_VERSION = "1.7.1"; my $TOOL_VERSION = "1.7.4";
my $CmdName = get_filename($0); my $CmdName = get_filename($0);
my ($Help, $ShowVersion, $RPMlist, $RPMdir, $StaticMode, my ($Help, $ShowVersion, $RPMlist, $RPMdir, $StaticMode,
@ -48,7 +48,7 @@ $Target, $ExtInfo, $UseCache);
my $ShortUsage = "URPM Repo Closure Checker $TOOL_VERSION my $ShortUsage = "URPM Repo Closure Checker $TOOL_VERSION
A tool for checking closure of a set of RPM packages A tool for checking closure of a set of RPM packages
Copyright (C) 2012 ROSA Lab Copyright (C) 2014 ROSA Lab
License: GNU GPL License: GNU GPL
Usage: $CmdName [options] Usage: $CmdName [options]
@ -1188,6 +1188,10 @@ sub staticCheck()
$VReport .= "</table>"; $VReport .= "</table>";
} }
else
{
$Report .= "\nBroken Dependency (0)\n\n";
}
if(my @Pkgs = sort {lc($a) cmp lc($b)} keys(%UnresolvedSuggested)) if(my @Pkgs = sort {lc($a) cmp lc($b)} keys(%UnresolvedSuggested))
{ {
if($Report) if($Report)
@ -1235,6 +1239,10 @@ sub staticCheck()
$VReport .= "</table>"; $VReport .= "</table>";
} }
else
{
$Report .= "\nUnresolved Suggests (0)\n\n";
}
my $Styles = " my $Styles = "
body { body {
@ -1380,15 +1388,15 @@ sub staticCheck()
} }
# debug info # debug info
writeFile("$RESULTS_DIR/debug/target/rpm-provides.txt", Dumper($RPMdep{"provides"})); writeFile("debug/target/rpm-provides.txt", Dumper($RPMdep{"provides"}));
writeFile("$RESULTS_DIR/debug/target/rpm-requires.txt", Dumper($RPMdep{"requires"})); writeFile("debug/target/rpm-requires.txt", Dumper($RPMdep{"requires"}));
writeFile("$RESULTS_DIR/debug/target/rpm-suggests.txt", Dumper($RPMdep{"suggests"})); writeFile("debug/target/rpm-suggests.txt", Dumper($RPMdep{"suggests"}));
if(keys(%RPMdep_D)) if(keys(%RPMdep_D))
{ {
writeFile("$RESULTS_DIR/debug/deps/rpm-provides.txt", Dumper($RPMdep_D{"provides"})); writeFile("debug/deps/rpm-provides.txt", Dumper($RPMdep_D{"provides"}));
writeFile("$RESULTS_DIR/debug/deps/rpm-requires.txt", Dumper($RPMdep_D{"requires"})); writeFile("debug/deps/rpm-requires.txt", Dumper($RPMdep_D{"requires"}));
writeFile("$RESULTS_DIR/debug/deps/rpm-suggests.txt", Dumper($RPMdep_D{"suggests"})); writeFile("debug/deps/rpm-suggests.txt", Dumper($RPMdep_D{"suggests"}));
} }
print "Report has been generated to:"; print "Report has been generated to:";
@ -1487,7 +1495,7 @@ sub cut_off_number($$$)
sub parse_RPMname($) sub parse_RPMname($)
{ {
my $Name = $_[0]; my $Name = $_[0];
if($Name=~/\d(mdv|mdk|rosa(\.\w+|))\d+/) if($Name=~/\d(mdv|omv|mdk|rosa(\.\w+|))\d+/)
{ # plexus-interactivity-1.0-0.1.a5.2.2.5mdv2011.0.i586 { # plexus-interactivity-1.0-0.1.a5.2.2.5mdv2011.0.i586
$Name=~s/\-[^\-]+\Z//; $Name=~s/\-[^\-]+\Z//;
$Name=~s/\-[^\-]+\Z//; $Name=~s/\-[^\-]+\Z//;
@ -1536,7 +1544,7 @@ sub checkProfile()
my $Dir = $Info{"distr"}."/".$Info{"arch"}."/".$Info{"section"}; my $Dir = $Info{"distr"}."/".$Info{"arch"}."/".$Info{"section"};
if(defined $Target and $Target ne $Dir) { if(defined $Target and $Dir!~/\A\Q$Target\E/) {
next; next;
} }
@ -1558,7 +1566,7 @@ sub checkProfile()
if($Info{"updates"}) { if($Info{"updates"}) {
$Cmd .= " --update-hdlists=update.hdlists"; $Cmd .= " --update-hdlists=update.hdlists";
} }
if($Info{"info"}) { if($Info{"info"} and $Info{"arch"} ne "SRPMS") {
$Cmd .= " --info=info.hdlists"; $Cmd .= " --info=info.hdlists";
} }
$Cmd .= " --file-deps=file-deps.txt"; $Cmd .= " --file-deps=file-deps.txt";
@ -1580,6 +1588,15 @@ sub checkProfile()
unlink("dep.hdlists"); unlink("dep.hdlists");
unlink("update.hdlists"); unlink("update.hdlists");
my $Content = readFile($Info{"TXT"});
if($Content=~/Broken Dependency\s*\((\d+)\)/i) {
$Info{"Count"} = $1;
}
else {
$Info{"Count"} = "0";
}
$Index{$Info{"name"}}{$Info{"arch"}}{$Info{"section"}} = \%Info; $Index{$Info{"name"}}{$Info{"arch"}}{$Info{"section"}} = \%Info;
$Order{$Info{"name"}} = $Num++; $Order{$Info{"name"}} = $Num++;
$Order_S{$Info{"name"}}{$Info{"section"}} = $Num++; $Order_S{$Info{"name"}}{$Info{"section"}} = $Num++;
@ -1674,7 +1691,7 @@ sub checkProfile()
foreach my $Section (sort {$Order_S{$Name}{$a}<=>$Order_S{$Name}{$b}} keys(%{$Index{$Name}{$Arch}})) foreach my $Section (sort {$Order_S{$Name}{$a}<=>$Order_S{$Name}{$b}} keys(%{$Index{$Name}{$Arch}}))
{ {
my %Info = %{$Index{$Name}{$Arch}{$Section}}; my %Info = %{$Index{$Name}{$Arch}{$Section}};
$INDEX .= "<td><a href=\'".$Info{"HTML"}."\'>Report</a> (<a href=\'".$Info{"TXT"}."\'>txt</a>)</td>\n"; $INDEX .= "<td><a href=\'".$Info{"HTML"}."\'>".$Info{"Count"}."</a></td>\n"; # (<a href=\'".$Info{"TXT"}."\'>txt</a>)
} }
$INDEX .= "</tr>\n"; $INDEX .= "</tr>\n";
} }
@ -1705,7 +1722,7 @@ sub scenario()
} }
if($ShowVersion) if($ShowVersion)
{ {
print "URPM Repo Closure Checker $TOOL_VERSION\nCopyright (C) 2012 ROSA Lab\nLicense: GPL <http://www.gnu.org/licenses/>\nThis program is free software: you can redistribute it and/or modify it.\n\nWritten by Andrey Ponomarenko.\n"; print "URPM Repo Closure Checker $TOOL_VERSION\nCopyright (C) 2014 ROSA Lab\nLicense: GPL <http://www.gnu.org/licenses/>\nThis program is free software: you can redistribute it and/or modify it.\n\nWritten by Andrey Ponomarenko.\n";
exit(0); exit(0);
} }