From bcb685de80132006ec9151463305810c4f7ec8f6 Mon Sep 17 00:00:00 2001 From: Jussi Maki Date: Tue, 29 Jan 2019 19:39:07 +0100 Subject: [PATCH] Follow symlinks of tools in nixpkgs_cc_configure This should result in build actions that use the nix-store path to execute, rather than the workspace specific output path, which kills distributed caching. --- nixpkgs/nixpkgs.bzl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nixpkgs/nixpkgs.bzl b/nixpkgs/nixpkgs.bzl index 4396fb9c9..eb1d6fad9 100644 --- a/nixpkgs/nixpkgs.bzl +++ b/nixpkgs/nixpkgs.bzl @@ -199,6 +199,11 @@ def nixpkgs_package(*args, **kwargs): else: _nixpkgs_package(*args, **kwargs) +def _readlink(repository_ctx, path): + return _execute_or_fail( + repository_ctx, ["readlink", path], + ).stdout.rstrip() + def nixpkgs_cc_autoconf_impl(repository_ctx): cpu_value = get_cpu_value(repository_ctx) if not _is_supported_platform(repository_ctx): @@ -222,7 +227,7 @@ def nixpkgs_cc_autoconf_impl(repository_ctx): # the Bazel autoconfiguration with the tools we found. bin_contents = _find_children(repository_ctx, workspace_root + "/bin") overriden_tools = { - tool: entry + tool: _readlink(repository_ctx, entry) for entry in bin_contents for tool in [entry.rpartition("/")[-1]] # Compute basename }