Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 64c4cc3706ff
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bdec3ed04947
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Nov 14, 2018

  1. Revert "darwin/stdenv: bash is a build input"

    Completely breaks darwin. Every package in the stdenv that has shebangs
    in the output will end up with references to bootstrap-tools.
    
    This reverts commit 2f2e635.
    LnL7 committed Nov 14, 2018
    Copy the full SHA
    25fafd2 View commit details
  2. Revert "patch-shebangs: use --build for auto patch shebangs"

    Completely breaks darwin. Every package in the stdenv that has shebangs
    in the output will end up with references to bootstrap-tools.
    
    This reverts commit eb7c50a.
    LnL7 committed Nov 14, 2018
    Copy the full SHA
    c9223a1 View commit details
  3. Revert "Revert "Revert "patch-shebangs: respect cross compilation"""

    Completely breaks darwin. Every package in the stdenv that has shebangs
    in the output will end up with references to bootstrap-tools.
    
    This reverts commit bde9909.
    LnL7 committed Nov 14, 2018
    5
    Copy the full SHA
    bdec3ed View commit details
Showing with 15 additions and 56 deletions.
  1. +3 −52 pkgs/build-support/setup-hooks/patch-shebangs.sh
  2. +4 −4 pkgs/stdenv/darwin/default.nix
  3. +8 −0 pkgs/stdenv/generic/setup.sh
55 changes: 3 additions & 52 deletions pkgs/build-support/setup-hooks/patch-shebangs.sh
Original file line number Diff line number Diff line change
@@ -5,32 +5,10 @@
# rewritten to /nix/store/<hash>/bin/python. Interpreters that are
# already in the store are left untouched.

fixupOutputHooks+=(patchShebangsAuto)

# Run patch shebangs on a directory.
# patchShebangs [--build | --host] directory

# Flags:
# --build : Lookup commands available at build-time
# --host : Lookup commands available at runtime

# Example use cases,
# $ patchShebangs --host /nix/store/...-hello-1.0/bin
# $ patchShebangs --build configure
fixupOutputHooks+=('if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')

patchShebangs() {
local pathName

if [ "$1" = "--host" ]; then
pathName=HOST_PATH
shift
elif [ "$1" = "--build" ]; then
pathName=PATH
shift
fi

local dir="$1"

header "patching script interpreter paths in $dir"
local f
local oldPath
@@ -49,14 +27,6 @@ patchShebangs() {
oldInterpreterLine=$(head -1 "$f" | tail -c+3)
read -r oldPath arg0 args <<< "$oldInterpreterLine"

if [ -z "$pathName" ]; then
if [ -n "$strictDeps" ] && [[ "$f" = "$NIX_STORE"* ]]; then
pathName=HOST_PATH
else
pathName=PATH
fi
fi

if $(echo "$oldPath" | grep -q "/bin/env$"); then
# Check for unsupported 'env' functionality:
# - options: something starting with a '-'
@@ -65,17 +35,14 @@ patchShebangs() {
echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
exit 1
fi

newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"
newPath="$(command -v "$arg0" || true)"
else
if [ "$oldPath" = "" ]; then
# If no interpreter is specified linux will use /bin/sh. Set
# oldpath="/bin/sh" so that we get /nix/store/.../sh.
oldPath="/bin/sh"
fi

newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"

newPath="$(command -v "$(basename "$oldPath")" || true)"
args="$arg0 $args"
fi

@@ -98,19 +65,3 @@ patchShebangs() {

stopNest
}

patchShebangsAuto () {
if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then

if [ -z "${strictDeps-}"]; then
patchShebangs --build "$prefix"
# Dev output will end up being run on the build platform. An
# example case of this is sdl2-config. Otherwise, we can just
# use the runtime path (--host).
elif [ "$output" != out ] && [ "$output" = "${!outputDev}" ]; then
patchShebangs --build "$prefix"
else
patchShebangs --host "$prefix"
fi
fi
}
8 changes: 4 additions & 4 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
@@ -278,8 +278,8 @@ in rec {
# enables patchShebangs above. Unfortunately, patchShebangs ignores our $SHELL setting
# and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and
# patches our shebangs back to point at bootstrapTools. This makes sure bash comes first.
extraNativeBuildInputs = with pkgs; [ xz ];
extraBuildInputs = [ pkgs.darwin.CF pkgs.bash ];
extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
extraBuildInputs = [ pkgs.darwin.CF ];
libcxx = pkgs.libcxx;

extraPreHook = ''
@@ -335,8 +335,8 @@ in rec {
};
in with prevStage; stageFun 4 prevStage {
shell = "${pkgs.bash}/bin/bash";
extraNativeBuildInputs = with pkgs; [ xz ];
extraBuildInputs = [ pkgs.darwin.CF pkgs.bash ];
extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
extraBuildInputs = [ pkgs.darwin.CF ];
libcxx = pkgs.libcxx;

extraPreHook = ''
8 changes: 8 additions & 0 deletions pkgs/stdenv/generic/setup.sh
Original file line number Diff line number Diff line change
@@ -257,9 +257,17 @@ shopt -s nullglob

# Set up the initial path.
PATH=
HOST_PATH=
for i in $initialPath; do
if [ "$i" = / ]; then i=; fi
addToSearchPath PATH "$i/bin"

# For backward compatibility, we add initial path to HOST_PATH so
# it can be used in auto patch-shebangs. Unfortunately this will
# not work with cross compilation.
if [ -z "${strictDeps-}" ]; then
addToSearchPath HOST_PATH "$i/bin"
fi
done

if (( "${NIX_DEBUG:-0}" >= 1 )); then