mirror of
https://abf.rosa.ru/djam/urpm-tools.git
synced 2025-02-23 17:32:46 +00:00
URPM-repoclosure 1.6: improved reports
This commit is contained in:
parent
caedf23923
commit
f43e437712
1 changed files with 59 additions and 91 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
########################################################
|
########################################################
|
||||||
# URPM Repo Closure Checker 1.5.1 for Linux
|
# URPM Repo Closure Checker 1.6 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 Laboratory
|
# Copyright (C) 2011-2012 ROSA Laboratory
|
||||||
|
@ -38,7 +38,7 @@ use File::Copy qw(copy move);
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my $TOOL_VERSION = "1.5.1";
|
my $TOOL_VERSION = "1.6";
|
||||||
my $CmdName = get_filename($0);
|
my $CmdName = get_filename($0);
|
||||||
|
|
||||||
my ($Help, $ShowVersion, $RPMlist, $RPMdir, $StaticMode,
|
my ($Help, $ShowVersion, $RPMlist, $RPMdir, $StaticMode,
|
||||||
|
@ -743,7 +743,7 @@ sub readDeps($$$)
|
||||||
foreach my $D (split("\n", `rpm -qp -$Type $Path`))
|
foreach my $D (split("\n", `rpm -qp -$Type $Path`))
|
||||||
{
|
{
|
||||||
my ($N, $O, $V) = sepDep($D);
|
my ($N, $O, $V) = sepDep($D);
|
||||||
$Dep->{$Type}{$N}{$O}{$V}=$Name;
|
$Dep->{$Type}{$N}{$O}{$V}{$Name}=1;
|
||||||
$RPMdep->{$Type}{$Name}{$N}=1;
|
$RPMdep->{$Type}{$Name}{$N}=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ sub readHDlist($$$$$)
|
||||||
{
|
{
|
||||||
my ($N, $O, $V) = sepDep($D);
|
my ($N, $O, $V) = sepDep($D);
|
||||||
$N=~s/\[\*\]//g; # /sbin/ldconfig[*]
|
$N=~s/\[\*\]//g; # /sbin/ldconfig[*]
|
||||||
$Dep->{$Type}{$N}{$O}{$V} = $Name;
|
$Dep->{$Type}{$N}{$O}{$V}{$Name} = 1;
|
||||||
$RPMdep->{$Type}{$Name}{$D} = 1;
|
$RPMdep->{$Type}{$Name}{$D} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1029,7 +1029,7 @@ sub staticCheck()
|
||||||
}
|
}
|
||||||
%IgnoreDeps = map {$_=>1} split(/\s+/, readFile($FileDeps));
|
%IgnoreDeps = map {$_=>1} split(/\s+/, readFile($FileDeps));
|
||||||
}
|
}
|
||||||
my (%Unresolved, %UnresolvedSuggested, %Broken) = ();
|
my (%Unresolved, %UnresolvedSuggested) = ();
|
||||||
foreach my $N (sort {lc($a) cmp lc($b)} keys(%{$Dep{"requires"}}))
|
foreach my $N (sort {lc($a) cmp lc($b)} keys(%{$Dep{"requires"}}))
|
||||||
{
|
{
|
||||||
foreach my $O (keys(%{$Dep{"requires"}{$N}}))
|
foreach my $O (keys(%{$Dep{"requires"}{$N}}))
|
||||||
|
@ -1049,21 +1049,21 @@ sub staticCheck()
|
||||||
if($IgnoreDeps{$N}) {
|
if($IgnoreDeps{$N}) {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
my $Name = $Dep{"requires"}{$N}{$O}{$V};
|
foreach my $Name (keys(%{$Dep{"requires"}{$N}{$O}{$V}}))
|
||||||
|
{
|
||||||
if($RPMdep{"suggests"}{$Name}{$N}) {
|
if($RPMdep{"suggests"}{$Name}{$N}) {
|
||||||
$UnresolvedSuggested{$N}{$O}{$V} = $Name;
|
$UnresolvedSuggested{$Name}{$N}{$O}{$V} = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$Unresolved{$N}{$O}{$V} = $Name;
|
$Unresolved{$Name}{$N}{$O}{$V} = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$Broken{$Name}=1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $TotalPkgs = keys(%{$RPMdep{"requires"}});
|
my $TotalPkgs = keys(%{$RPMdep{"requires"}});
|
||||||
my $TotalDeps = keys(%{$Dep{"requires"}});
|
|
||||||
|
|
||||||
my ($Report, $VReport) = ();
|
my ($Report, $VReport) = ();
|
||||||
|
|
||||||
|
@ -1090,61 +1090,57 @@ sub staticCheck()
|
||||||
|
|
||||||
my $UnresolvedLink = "0 (0.0%)";
|
my $UnresolvedLink = "0 (0.0%)";
|
||||||
if(my $Num = keys(%Unresolved)) {
|
if(my $Num = keys(%Unresolved)) {
|
||||||
$UnresolvedLink = "<a href='#Unresolved'>".$Num."</a>"." (".show_number($Num*100/$TotalDeps)."%)";
|
$UnresolvedLink = "<a href='#Unresolved'>".$Num."</a>"." (".show_number($Num*100/$TotalPkgs)."%)";
|
||||||
}
|
}
|
||||||
$VReport .= "<tr><th>Unresolved<br/>Dependencies</th><td>$UnresolvedLink</td></tr>\n";
|
$VReport .= "<tr><th>Broken<br/>Packages</th><td>$UnresolvedLink</td></tr>\n";
|
||||||
my $BrokenLink = "0 (0.0%)";
|
|
||||||
if(my $Num = keys(%Broken)) {
|
|
||||||
$BrokenLink = "<a href='#Broken'>".$Num."</a>"." (".show_number($Num*100/$TotalPkgs)."%)";
|
|
||||||
}
|
|
||||||
$VReport .= "<tr><th>Broken<br/>Packages</th><td>$BrokenLink</td></tr>\n";
|
|
||||||
$VReport .= "</table>\n";
|
$VReport .= "</table>\n";
|
||||||
|
|
||||||
$VReport .= "<br/>\n";
|
$VReport .= "<br/>\n";
|
||||||
$VReport .= "<br/>\n";
|
$VReport .= "<br/>\n";
|
||||||
|
|
||||||
if(my @Ns = sort {lc($a) cmp lc($b)} keys(%Unresolved))
|
if(my @Pkgs = sort {lc($a) cmp lc($b)} keys(%Unresolved))
|
||||||
{
|
{
|
||||||
my $Title = "Unresolved Dependencies (".($#Ns+1).")";
|
my $Title = "Broken Packages (".($#Pkgs+1).")";
|
||||||
$Report .= "\n$Title:\n\n";
|
$Report .= "\n$Title:\n\n";
|
||||||
|
|
||||||
$VReport .= "<a name='Unresolved'></a>\n";
|
$VReport .= "<a name='Unresolved'></a>\n";
|
||||||
$VReport .= "<table class='report'>\n";
|
$VReport .= "<table class='report'>\n";
|
||||||
$VReport .= "<tr>";
|
$VReport .= "<tr>\n";
|
||||||
$VReport .= "<th onclick='javascript:sort(this)'>Dependency (".($#Ns+1).")</th><th onclick=\"sort(this)\">RPM</th>";
|
$VReport .= "<th onclick='javascript:sort(this)'>RPM</th>\n";
|
||||||
|
|
||||||
if($ExtInfo) {
|
if($ExtInfo) {
|
||||||
$VReport .= "<th onclick=\"sort(this)\">SRPM</th>";
|
$VReport .= "<th onclick=\"sort(this)\">SRPM</th>\n";
|
||||||
}
|
}
|
||||||
|
$VReport .= "<th onclick=\"sort(this)\">Dependency</th>\n";
|
||||||
$VReport .= "</tr>\n";
|
$VReport .= "</tr>\n";
|
||||||
|
|
||||||
my $Num = 1;
|
my $Num = 1;
|
||||||
|
foreach my $Pkg (@Pkgs)
|
||||||
foreach my $N (@Ns)
|
|
||||||
{
|
{
|
||||||
foreach my $O (sort keys(%{$Unresolved{$N}}))
|
foreach my $N (sort keys(%{$Unresolved{$Pkg}}))
|
||||||
{
|
{
|
||||||
foreach my $V (sort keys(%{$Unresolved{$N}{$O}}))
|
foreach my $O (sort keys(%{$Unresolved{$Pkg}{$N}}))
|
||||||
|
{
|
||||||
|
foreach my $V (sort keys(%{$Unresolved{$Pkg}{$N}{$O}}))
|
||||||
{
|
{
|
||||||
my $Dep = showDep($N, $O, $V);
|
my $Dep = showDep($N, $O, $V);
|
||||||
my $Pkg = $Unresolved{$N}{$O}{$V};
|
|
||||||
$Report .= $Dep." (required by $Pkg)\n";
|
$Report .= $Dep." (required by $Pkg)\n";
|
||||||
my $Class = " class='even'";
|
my $Class = " class='even'";
|
||||||
$Class = "" if($Num++ % 2 != 0);
|
$Class = "" if($Num++ % 2 != 0);
|
||||||
$VReport .= "<tr$Class>";
|
$VReport .= "<tr$Class>\n";
|
||||||
$VReport .= "<td>".htmlSpecChars($Dep)."</td><td>$Pkg</td>";
|
$VReport .= "<td>$Pkg</td>\n";
|
||||||
if($ExtInfo) {
|
if($ExtInfo) {
|
||||||
$VReport .= "<td>".$AddInfo{$Pkg}{"SRPM"}."</td>";
|
$VReport .= "<td>".$AddInfo{$Pkg}{"SRPM"}."</td>\n";
|
||||||
}
|
}
|
||||||
|
$VReport .= "<td>".htmlSpecChars($Dep)."</td>\n";
|
||||||
$VReport .= "</tr>\n";
|
$VReport .= "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$VReport .= "</table>";
|
$VReport .= "</table>";
|
||||||
}
|
}
|
||||||
if(my @Ns = sort {lc($a) cmp lc($b)} keys(%UnresolvedSuggested))
|
if(my @Pkgs = sort {lc($a) cmp lc($b)} keys(%UnresolvedSuggested))
|
||||||
{
|
{
|
||||||
if($Report)
|
if($Report)
|
||||||
{
|
{
|
||||||
|
@ -1152,69 +1148,41 @@ sub staticCheck()
|
||||||
$VReport .= "<br/>\n";
|
$VReport .= "<br/>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $Title = "Unresolved Suggests (".($#Ns+1).")";
|
my $Title = "Unresolved Suggests (".($#Pkgs+1).")";
|
||||||
$Report .= "\n$Title:\n\n";
|
$Report .= "\n$Title:\n\n";
|
||||||
|
|
||||||
$VReport .= "<table class='report'>\n";
|
$VReport .= "<table class='report'>\n";
|
||||||
$VReport .= "<tr>";
|
$VReport .= "<tr>\n";
|
||||||
$VReport .= "<th onclick='javascript:sort(this)'>Suggestion (".($#Ns+1).")</th><th onclick=\"sort(this)\">RPM</th>";
|
$VReport .= "<th onclick='javascript:sort(this)'>Suggestion (".($#Pkgs+1).")</th>\n";
|
||||||
|
|
||||||
if($ExtInfo) {
|
if($ExtInfo) {
|
||||||
$VReport .= "<th onclick=\"sort(this)\">SRPM</th>";
|
$VReport .= "<th onclick=\"sort(this)\">SRPM</th>\n";
|
||||||
}
|
}
|
||||||
|
$VReport .= "<th onclick=\"sort(this)\">RPM</th>\n";
|
||||||
$VReport .= "</tr>\n";
|
$VReport .= "</tr>\n";
|
||||||
|
|
||||||
my $Num = 1;
|
my $Num = 1;
|
||||||
|
foreach my $Pkg (@Pkgs)
|
||||||
foreach my $N (@Ns)
|
|
||||||
{
|
{
|
||||||
foreach my $O (sort keys(%{$UnresolvedSuggested{$N}}))
|
foreach my $N (sort keys(%{$UnresolvedSuggested{$Pkg}}))
|
||||||
{
|
{
|
||||||
foreach my $V (sort keys(%{$UnresolvedSuggested{$N}{$O}}))
|
foreach my $O (sort keys(%{$UnresolvedSuggested{$Pkg}{$N}}))
|
||||||
|
{
|
||||||
|
foreach my $V (sort keys(%{$UnresolvedSuggested{$Pkg}{$N}{$O}}))
|
||||||
{
|
{
|
||||||
my $Dep = showDep($N, $O, $V);
|
my $Dep = showDep($N, $O, $V);
|
||||||
my $Pkg = $UnresolvedSuggested{$N}{$O}{$V};
|
|
||||||
$Report .= $Dep." (required by $Pkg)\n";
|
$Report .= $Dep." (required by $Pkg)\n";
|
||||||
my $Class = " class='even'";
|
my $Class = " class='even'";
|
||||||
$Class = "" if($Num++ % 2 != 0);
|
$Class = "" if($Num++ % 2 != 0);
|
||||||
$VReport .= "<tr$Class>";
|
$VReport .= "<tr$Class>\n";
|
||||||
$VReport .= "<td>".htmlSpecChars($Dep)."</td><td>$Pkg</td>";
|
$VReport .= "<td>".htmlSpecChars($Dep)."</td>\n";
|
||||||
if($ExtInfo) {
|
if($ExtInfo) {
|
||||||
$VReport .= "<td>".$AddInfo{$Pkg}{"SRPM"}."</td>";
|
$VReport .= "<td>".$AddInfo{$Pkg}{"SRPM"}."</td>\n";
|
||||||
}
|
}
|
||||||
|
$VReport .= "<td>$Pkg</td>\n";
|
||||||
$VReport .= "</tr>\n";
|
$VReport .= "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$VReport .= "</table>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$VReport .= "<br/>\n";
|
|
||||||
|
|
||||||
if(my @Ns = sort {lc($a) cmp lc($b)} keys(%Broken))
|
|
||||||
{
|
|
||||||
if($Report) {
|
|
||||||
$Report .= "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $Title = "Broken Packages (".($#Ns+1).")";
|
|
||||||
$Report .= "\n$Title:\n\n";
|
|
||||||
|
|
||||||
$VReport .= "<a name='Broken'></a>\n";
|
|
||||||
$VReport .= "<table class='report'>\n";
|
|
||||||
$VReport .= "<tr><th onclick=\"sort(this)\">Broken Packages (".($#Ns+1).")</th></tr>\n";
|
|
||||||
|
|
||||||
my $Num = 1;
|
|
||||||
|
|
||||||
foreach my $N (@Ns)
|
|
||||||
{
|
|
||||||
my $Name = parse_RPMname($N);
|
|
||||||
$Report .= $Name."\n";
|
|
||||||
my $Class = " class='even'";
|
|
||||||
$Class = "" if($Num++ % 2 != 0);
|
|
||||||
$VReport .= "<tr$Class><td>$Name</td></tr>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$VReport .= "</table>";
|
$VReport .= "</table>";
|
||||||
|
|
Loading…
Add table
Reference in a new issue