about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-04-22T17·36+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-04-22T17·36+0200
commit4bbcfaf87fcc3cca622f68b460015fc4741b14bc (patch)
tree2b15f99ec5377a61b5e841bf22b541a18bc546f6 /scripts
parent4d652875bdd87c3f1aa08111c63c0719f1ee0c1a (diff)
parentab2b3d666821cbcc7a3ece71b664c2d45f87f8c9 (diff)
Merge pull request #522 from lethalman/nix-collect-garbage
nix-collect-garbage: translate to C++
Diffstat (limited to 'scripts')
-rw-r--r--scripts/local.mk1
-rwxr-xr-xscripts/nix-collect-garbage.in65
2 files changed, 0 insertions, 66 deletions
diff --git a/scripts/local.mk b/scripts/local.mk
index f4c5e8097de4..39e1df611c5c 100644
--- a/scripts/local.mk
+++ b/scripts/local.mk
@@ -1,7 +1,6 @@
 nix_bin_scripts := \
   $(d)/nix-build \
   $(d)/nix-channel \
-  $(d)/nix-collect-garbage \
   $(d)/nix-copy-closure \
   $(d)/nix-generate-patches \
   $(d)/nix-install-package \
diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in
deleted file mode 100755
index 55e0ba7a6fab..000000000000
--- a/scripts/nix-collect-garbage.in
+++ /dev/null
@@ -1,65 +0,0 @@
-#! @perl@ -w @perlFlags@
-
-use strict;
-use Nix::Config;
-
-my $profilesDir = "@localstatedir@/nix/profiles";
-
-
-# Process the command line arguments.
-my @args = ();
-my $arg;
-
-my $removeOld = 0;
-my $gen;
-my $dryRun = 0;
-
-while ($arg = shift) {
-    if ($arg eq "--delete-old" || $arg eq "-d") {
-        $removeOld = 1;
-        $gen = "old";
-    } elsif ($arg eq "--delete-older-than") {
-        $removeOld = 1;
-        $gen = shift;
-    } elsif ($arg eq "--dry-run") {
-        $dryRun = 1;
-    } elsif ($arg eq "--help") {
-        exec "man nix-collect-garbage" or die;
-    } else {
-        push @args, $arg;
-    }
-}
-
-
-# If `-d' was specified, remove all old generations of all profiles.
-# Of course, this makes rollbacks to before this point in time
-# impossible.
-
-sub removeOldGenerations;
-sub removeOldGenerations {
-    my $dir = shift;
-
-    my $dh;
-    opendir $dh, $dir or die;
-
-    foreach my $name (sort (readdir $dh)) {
-        next if $name eq "." || $name eq "..";
-        $name = $dir . "/" . $name;
-        if (-l $name && (readlink($name) =~ /link/)) {
-            print STDERR "removing old generations of profile $name\n";
-
-            system("$Nix::Config::binDir/nix-env", "-p", $name, "--delete-generations", $gen, $dryRun ? "--dry-run" : ());
-        }
-        elsif (! -l $name && -d $name) {
-            removeOldGenerations $name;
-        }
-    }
-
-    closedir $dh or die;
-}
-
-removeOldGenerations $profilesDir if $removeOld;
-
-
-# Run the actual garbage collector.
-exec "$Nix::Config::binDir/nix-store", "--gc", @args unless $dryRun;