From b500a9670e2c4c3a0dbb7fb20dbc240c4f32f84d Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Thu, 10 Aug 2006 11:17:02 +0000 Subject: [PATCH] [ Petter Reinholdtsen ] * Add more features to get_diskusage.pl, making it easier to track dependencies and rejected packages. --- debian/changelog | 4 ++++ tools/get_diskusage.pl | 44 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 01fd126e..43948404 100644 --- a/debian/changelog +++ b/debian/changelog @@ -116,6 +116,10 @@ debian-cd (2.2.25) UNRELEASED; urgency=low * Update popularity contest data for etch. * Update generate_di+k_list to include libdiscover1. + [ Petter Reinholdtsen ] + * Add more features to get_diskusage.pl, making it easier to track + dependencies and rejected packages. + -- Frans Pop Wed, 2 Aug 2006 16:47:57 +0200 debian-cd (2.2.24) unstable; urgency=low diff --git a/tools/get_diskusage.pl b/tools/get_diskusage.pl index 2cd486dc..2778ff0f 100755 --- a/tools/get_diskusage.pl +++ b/tools/get_diskusage.pl @@ -12,7 +12,7 @@ use Text::Format; # From debian package libtext-format-perl use Getopt::Std; my %opts; -getopts('t', \%opts); +getopts('cm:t', \%opts); my $logfile = ($ARGV[0] || "/skolelinux/developer/local0/ftp/tmp/woody-i386/log.list2cds"); @@ -25,6 +25,7 @@ my $text = Text::Format->new(leftMargin => 16, rightMargin => 0, firstIndent => 0); my $curcd = 1; +my $markerstep = $opts{m} || 0; my $pkg; my @order; my %cdsize; @@ -32,12 +33,35 @@ my %size; my %deps; my $curcdsize; my $cursize; +my @excluded; +my $nextmarker = $markerstep; while () { chomp; -# $pkg = $1 if (/^\+ Trying to add (.+)\.\.\./); + if (/^\+ Trying to add (.+)\.\.\./) { + } + if (/^ (.+) has been refused because of user choice/) { + push @excluded, $1; + } + if (/^Can\'t add (.+) \.\.\. one of the package needed has been refused/) { + my $txt = "REJECT $1 (" . join(" ", @excluded). ")"; + $size{$txt} = 0; + $cdsize{$txt} = $curcdsize; + push(@order, $txt); + @excluded = (); + } if (/ \$cd_size = (\d+), \$size = (\d+)/) { $curcdsize = $1; $cursize = $2; + if ($markerstep) { + while ($curcdsize > $nextmarker) { + my $txt = sprintf("<=============== CD fill level passing %d KiB", + $nextmarker / 1024); + $size{$txt} = 0; + $cdsize{$txt} = $curcdsize; + push(@order, $txt); + $nextmarker += $markerstep; + } + } } if (/^ Adding (.+) to CD \d+/) { my ($pkg, $deplist) = split(/\s+/, $1, 2); @@ -47,11 +71,12 @@ while () { $deps{$pkg} = $deplist; } if (/Limit for CD (.+) is/) { - last if $cdlimit == $1; + last if $cdlimit == $1; my $txt = "<=============== start of CD $1"; $size{$txt} = 0; $cdsize{$txt} = 0; push @order, $txt; + $nextmarker = $markerstep; } # Add delimiter if (/Standard system already takes (.\d+)/) { @@ -63,10 +88,19 @@ while () { } close(LOG); -print " +size cdsize pkgname\n"; +if ($opts{'c'}) { + print " +size cdsize pkgname\n"; +} else { + print " +size pkgname\n"; + $text->leftMargin(8); +} print "-----------------------\n"; for $pkg (@order) { - printf "%7d %7d %s\n", $size{$pkg} / 1024, $cdsize{$pkg} / 1024, $pkg; + if ($opts{'c'}) { + printf "%7d %7d %s\n", $size{$pkg} / 1024, $cdsize{$pkg} / 1024, $pkg; + } else { + printf "%7d %s\n", $size{$pkg} / 1024, $pkg; + } print $text->format($deps{$pkg}) if ($opts{'t'} && $deps{$pkg}); }