about summary refs log tree commit diff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2016-08-10T12·40-0400
committerShea Levy <shea@shealevy.com>2016-08-10T12·40-0400
commite3128014dbef2f0cd172767ff8904d25f6efccbb (patch)
tree4eb9a61526cc6f3d65d29927e18d3bc847fdbf36
parentfe94b72acc40c00f9a2a6ad78a28e62edd63d75c (diff)
Remove scripts/show-duplication.pl
Was added in 2006 to "measure the cost of the Nix approach".

Given that it uses /usr/bin/perl, I think this is safe to remove.
-rwxr-xr-xscripts/show-duplication.pl73
1 files changed, 0 insertions, 73 deletions
diff --git a/scripts/show-duplication.pl b/scripts/show-duplication.pl
deleted file mode 100755
index 0604c6696c7a..000000000000
--- a/scripts/show-duplication.pl
+++ /dev/null
@@ -1,73 +0,0 @@
-#! /usr/bin/perl -w
-
-if (scalar @ARGV != 1) {
-    print "syntax: show-duplication.pl PATH\n";
-    exit 1;
-}
-
-my $root = $ARGV[0];
-
-
-my $nameRE = "(?:(?:[A-Za-z0-9\+\_]|(?:-[^0-9]))+)";
-my $versionRE = "(?:[A-Za-z0-9\.\-]+)";
-
-
-my %pkgInstances;
-
-
-my $pid = open(PATHS, "-|") || exec "nix-store", "-qR", $root;
-while (<PATHS>) {
-    chomp;
-    /^.*\/[0-9a-z]*-(.*)$/;
-    my $nameVersion = $1;
-    $nameVersion =~ /^($nameRE)(-($versionRE))?$/;
-    $name = $1;
-    $version = $3;
-    $version = "(unnumbered)" unless defined $version;
-#    print "$nameVersion $name $version\n";
-    push @{$pkgInstances{$name}}, {version => $version, path => $_};
-}
-close PATHS or exit 1;
-
-
-sub pathSize {
-    my $path = shift;
-    my @st = lstat $path or die;
-
-    my $size = $st[7];
-
-    if (-d $path) {
-        opendir DIR, $path or die;
-        foreach my $name (readdir DIR) {
-            next if $name eq "." || $name eq "..";
-            $size += pathSize("$path/$name");
-        }
-    }
-    
-    return $size;
-}
-
-
-my $totalPaths = 0;
-my $totalSize = 0, $totalWaste = 0;
-
-foreach my $name (sort {scalar @{$pkgInstances{$b}} <=> scalar @{$pkgInstances{$a}}} (keys %pkgInstances)) {
-    print "$name ", scalar @{$pkgInstances{$name}}, "\n";
-    my $allSize = 0;
-    foreach my $x (sort {$a->{version} cmp $b->{version}} @{$pkgInstances{$name}}) {
-        $totalPaths++;
-        my $size = pathSize $x->{path};
-        $allSize += $size;
-        print "    $x->{version} $size\n";
-    }
-    my $avgSize = int($allSize / scalar @{$pkgInstances{$name}});
-    my $waste = $allSize - $avgSize;
-    $totalSize += $allSize;
-    $totalWaste += $waste;
-    print "    average $avgSize, waste $waste\n";
-}
-
-
-my $avgDupl = $totalPaths / scalar (keys %pkgInstances);
-my $wasteFactor = ($totalWaste / $totalSize) * 100;
-print "average package duplication $avgDupl, total size $totalSize, total waste $totalWaste, $wasteFactor% wasted\n";