~tsimonq2/debian-cd/lubuntu-cosmic-changes

601 by Arch Librarian
Add tools/get_diskusage.pl (originally by Petter).
1
#!/usr/bin/perl -w
2
#
3
# Author: Petter Reinholdtsen <pere@hungry.com>
4
# Date:   2001-11-20
5
#
6
# Parse logfile from Debian debian-cd build, and report how much each package
7
# added to the CD size.
8
9
$logfile = ($ARGV[0] ||
1049 by Colin Watson
Add subarchitecture support
10
            "$ENV{TDIR}/$ENV{CODENAME}-$ENV{FULLARCH}/log.list2cds");
601 by Arch Librarian
Add tools/get_diskusage.pl (originally by Petter).
11
12
open(LOG, $logfile) || die "Unable to open $logfile";
13
14
my $pkg;
15
while (<LOG>) {
16
    chomp;
17
    $pkg = $1 if (/^\+ Trying to add (.+)\.\.\./);
18
    if (/  \$cd_size = (\d+), \$size = (\d+)/) {
19
	$cdsize{$pkg} = $1;
20
	$size{$pkg} = $2;
21
    }
22
    last if (/Limit for CD 2 is/);
23
    # Add delimiter
24
    if (/Standard system already takes (.\d+)/) {
25
	my $pkg = "<=============== end of standard pkgs";
26
        $size{$pkg} = 0;
27
        $cdsize{$pkg} = $1;
28
    }
29
}
30
close(LOG);
31
32
print "  +size  cdsize pkgname\n";
33
print "-----------------------\n";
34
35
for $pkg (sort { $cdsize{$a} <=> $cdsize{$b} } keys %size) {
36
    printf "%7d %7d %s\n", $size{$pkg} / 1024, $cdsize{$pkg} / 1024, $pkg;
37
}