diff options
author | Jude Taylor <me@jude.bio> | 2016-08-13T22·27-0700 |
---|---|---|
committer | Jude Taylor <me@jude.bio> | 2016-08-13T22·27-0700 |
commit | 596e4a5693fc710ee47126d19910951b22d91018 (patch) | |
tree | d129a0cf4178d2566af663fca9ffd26ead891010 | |
parent | 2df9a972fc1f361020ece1a21721379d090dd0ae (diff) |
remove old traces of resolve-system-dependencies
-rw-r--r-- | scripts/local.mk | 7 | ||||
-rwxr-xr-x | scripts/resolve-system-dependencies.pl.in | 122 | ||||
-rw-r--r-- | src/libstore/globals.cc | 2 | ||||
-rw-r--r-- | src/resolve-system-dependencies/local.mk | 2 |
4 files changed, 3 insertions, 130 deletions
diff --git a/scripts/local.mk b/scripts/local.mk index fef256451d8b..9852d8298e80 100644 --- a/scripts/local.mk +++ b/scripts/local.mk @@ -11,19 +11,12 @@ nix_noinst_scripts := \ $(d)/nix-profile.sh \ $(d)/nix-reduce-build -ifeq ($(OS), Darwin) - nix_noinst_scripts += $(d)/resolve-system-dependencies.pl -endif - noinst-scripts += $(nix_noinst_scripts) profiledir = $(sysconfdir)/profile.d $(eval $(call install-file-as, $(d)/nix-profile.sh, $(profiledir)/nix.sh, 0644)) $(eval $(call install-program-in, $(d)/build-remote.pl, $(libexecdir)/nix)) -ifeq ($(OS), Darwin) - $(eval $(call install-program-in, $(d)/resolve-system-dependencies.pl, $(libexecdir)/nix)) -endif $(eval $(call install-symlink, nix-build, $(bindir)/nix-shell)) clean-files += $(nix_bin_scripts) $(nix_noinst_scripts) diff --git a/scripts/resolve-system-dependencies.pl.in b/scripts/resolve-system-dependencies.pl.in deleted file mode 100755 index a20f0dc020fe..000000000000 --- a/scripts/resolve-system-dependencies.pl.in +++ /dev/null @@ -1,122 +0,0 @@ -#! @perl@ -w @perlFlags@ - -use utf8; -use strict; -use warnings; -use Cwd qw(realpath); -use Errno; -use File::Basename qw(dirname); -use File::Path qw(make_path); -use File::Spec::Functions qw(catfile); -use List::Util qw(reduce); -use IPC::Open3; -use Nix::Config; -use Nix::Store qw(derivationFromPath); -use POSIX qw(uname); -use Storable qw(lock_retrieve lock_store); - -my ($sysname, undef, $version, undef, $machine) = uname; -$sysname =~ /Darwin/ or die "This tool is only meant to be used on Darwin systems."; - -my $cache = "$Nix::Config::stateDir/dependency-maps/$machine-$sysname-$version.map"; - -make_path dirname($cache); - -our $DEPS; -eval { - $DEPS = lock_retrieve($cache); -}; - -if($!{ENOENT}) { - lock_store {}, $cache; - $DEPS = {}; -} elsif($@) { - die "Unable to obtain a lock on dependency-map file $cache: $@"; -} - -sub mkset(@) { - my %set; - @set{@_} = (); - \%set -} - -sub union($$) { - my ($set1, $set2) = @_; - my %new = (%$set1, %$set2); - \%new -} - -sub cache_filepath($) { - my $fp = shift; - $fp =~ s/-/--/g; - $fp =~ s/\//-/g; - $fp =~ s/^-//g; - catfile $cache, $fp -} - -sub resolve_tree { - sub resolve_tree_inner { - my ($lib, $TREE) = @_; - return if (defined $TREE->{$lib}); - $TREE->{$lib} = mkset(@{cache_get($lib)}); - foreach my $dep (keys %{$TREE->{$lib}}) { - resolve_tree_inner($dep, $TREE); - } - values %$TREE - } - - reduce { union($a, $b) } {}, resolve_tree_inner(@_) -} - -sub cache_get { - my $key = shift; - if (defined $DEPS->{$key}) { - $DEPS->{$key} - } else { - cache_insert($key); - cache_get($key) - } -} - -sub cache_insert($) { - my $key = shift; - print STDERR "Finding dependencies for $key...\n"; - my @deps = find_deps($key); - $DEPS->{$key} = \@deps; -} - -sub find_deps($) { - my $lib = shift; - my($chld_in, $chld_out, $chld_err); - my $pid = open3($chld_in, $chld_out, $chld_err, "@otool@", "-L", "-arch", "x86_64", $lib); - waitpid($pid, 0); - my $line = readline $chld_out; - if($? == 0 and $line !~ /not an object file/) { - my @libs; - while(<$chld_out>) { - my $dep = (split /\s+/)[1]; - push @libs, $dep unless $dep eq $lib or $dep =~ /\@rpath/; - } - @libs - } elsif (-l $lib) { - (realpath($lib)) - } else { - () - } -} - -if (defined $ARGV[0]) { - my $deps = derivationFromPath($ARGV[0])->{"env"}->{"__impureHostDeps"}; - if (defined $deps) { - my @files = split(/\s+/, $deps); - my $depcache = {}; - my $depset = reduce { union($a, $b) } (map { resolve_tree($_, $depcache) } @files); - print "extra-chroot-dirs\n"; - print join("\n", keys %$depset); - print "\n"; - } - lock_store($DEPS, $cache); -} else { - print STDERR "Usage: $0 path/to/derivation.drv\n"; - exit 1 -} diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index 7bf48be378f8..ecf81e8eb38e 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -76,7 +76,7 @@ void Settings::processEnvironment() // should be set with the other config options, but depends on nixLibexecDir #ifdef __APPLE__ - preBuildHook = nixLibexecDir + "/nix/resolve-system-dependencies.pl"; + preBuildHook = nixLibexecDir + "/nix/resolve-system-dependencies"; #endif } diff --git a/src/resolve-system-dependencies/local.mk b/src/resolve-system-dependencies/local.mk index 4e1379ae879b..abf4edaffd0a 100644 --- a/src/resolve-system-dependencies/local.mk +++ b/src/resolve-system-dependencies/local.mk @@ -2,6 +2,8 @@ programs += resolve-system-dependencies resolve-system-dependencies_DIR := $(d) +resolve-system-dependencies_INSTALL_DIR := $(libexecdir)/nix + resolve-system-dependencies_LIBS := libstore libmain libutil libformat resolve-system-dependencies_SOURCES := $(d)/resolve-system-dependencies.cc |