diff options
author | happysalada <raphael@megzari.com> | 2021-10-01 21:44:55 +0900 |
---|---|---|
committer | Raphael Megzari <raphael@megzari.com> | 2021-10-06 00:42:29 +0900 |
commit | 84e4715a14c28d6ff87257bc701f72c667464096 (patch) | |
tree | c19f382d025985c303081178d5a646050344c78c /pkgs/stdenv | |
parent | 724ba28e48b62737b7dbdf6cfe483b1bd587ac21 (diff) |
stdenv: use named ref to clarify intent
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index f90d9020f89f1..4cf300b2036ce 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -409,15 +409,14 @@ findInputs() { # The current package's host and target offset together # provide a <=-preserving homomorphism from the relative # offsets to current offset - local -i mapOffsetResult function mapOffset() { local -r inputOffset="$1" + local -n outputOffset="$2" if (( inputOffset <= 0 )); then - local -r outputOffset=$((inputOffset + hostOffset)) + outputOffset=$((inputOffset + hostOffset)) else - local -r outputOffset=$((inputOffset - 1 + targetOffset)) + outputOffset=$((inputOffset - 1 + targetOffset)) fi - mapOffsetResult="$outputOffset" } # Host offset relative to that of the package whose immediate @@ -429,16 +428,16 @@ findInputs() { # Host offset relative to the package currently being # built---as absolute an offset as will be used. - mapOffset relHostOffset - local -i hostOffsetNext="$mapOffsetResult" + local hostOffsetNext + mapOffset "$relHostOffset" hostOffsetNext # Ensure we're in bounds relative to the package currently # being built. - [[ "${allPlatOffsets[*]}" = *"$hostOffsetNext"* ]] || continue + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue # Target offset relative to the *host* offset of the package # whose immediate dependencies we are currently exploring. - local -i relTargetOffset + local relTargetOffset for relTargetOffset in "${allPlatOffsets[@]}"; do (( "$relHostOffset" <= "$relTargetOffset" )) || continue @@ -448,12 +447,12 @@ findInputs() { # Target offset relative to the package currently being # built. - mapOffset relTargetOffset - local -i targetOffsetNext="$mapOffsetResult" + local targetOffsetNext + mapOffset "$relTargetOffset" targetOffsetNext # Once again, ensure we're in bounds relative to the # package currently being built. - [[ "${allPlatOffsets[*]}" = *"$targetOffsetNext"* ]] || continue + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue [[ -f "$pkg/nix-support/$file" ]] || continue |