mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
auto-patchelf: refactor structuredAttrs support
stdenv now provides better tooling to support structuredAttrs without depending on $__structuredAttrs itself.
This commit is contained in:
parent
2a2b88eb55
commit
bc0395ee6f
@ -53,19 +53,11 @@ autoPatchelf() {
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$__structuredAttrs" ]; then
|
||||
local ignoreMissingDepsArray=( "${autoPatchelfIgnoreMissingDeps[@]}" )
|
||||
local appendRunpathsArray=( "${appendRunpaths[@]}" )
|
||||
local runtimeDependenciesArray=( "${runtimeDependencies[@]}" )
|
||||
local patchelfFlagsArray=( "${patchelfFlags[@]}" )
|
||||
local autoPatchelfFlagsArray=( "${autoPatchelfFlags[@]}" )
|
||||
else
|
||||
readarray -td' ' ignoreMissingDepsArray < <(echo -n "$autoPatchelfIgnoreMissingDeps")
|
||||
local appendRunpathsArray=($appendRunpaths)
|
||||
local runtimeDependenciesArray=($runtimeDependencies)
|
||||
local patchelfFlagsArray=($patchelfFlags)
|
||||
local autoPatchelfFlagsArray=($autoPatchelfFlags)
|
||||
fi
|
||||
concatTo ignoreMissingDepsArray autoPatchelfIgnoreMissingDeps
|
||||
concatTo appendRunpathsArray appendRunpaths
|
||||
concatTo runtimeDependenciesArray runtimeDependencies
|
||||
concatTo patchelfFlagsArray patchelfFlags
|
||||
concatTo autoPatchelfFlagsArray autoPatchelfFlags
|
||||
|
||||
# Check if ignoreMissingDepsArray contains "1" and if so, replace it with
|
||||
# "*", printing a deprecation warning.
|
||||
|
@ -389,6 +389,8 @@ appendToVar() {
|
||||
# Arrays are simply concatenated, strings are split on whitespace.
|
||||
# Default values can be passed via name=default.
|
||||
concatTo() {
|
||||
local -
|
||||
set -o noglob
|
||||
local -n targetref="$1"; shift
|
||||
local arg default name type
|
||||
for arg in "$@"; do
|
||||
|
@ -101,7 +101,7 @@ let
|
||||
({
|
||||
inherit name;
|
||||
|
||||
string = "a b";
|
||||
string = "a *";
|
||||
list = ["c" "d"];
|
||||
|
||||
passAsFile = [ "buildCommand" ] ++ lib.optionals (extraAttrs ? extraTest) [ "extraTest" ];
|
||||
@ -116,7 +116,7 @@ let
|
||||
concatTo flagsArray string list notset=e=f empty_array=g empty_string=h
|
||||
declare -p flagsArray
|
||||
[[ "''${flagsArray[0]}" == "a" ]] || (echo "'\$flagsArray[0]' was not 'a'" && false)
|
||||
[[ "''${flagsArray[1]}" == "b" ]] || (echo "'\$flagsArray[1]' was not 'b'" && false)
|
||||
[[ "''${flagsArray[1]}" == "*" ]] || (echo "'\$flagsArray[1]' was not '*'" && false)
|
||||
[[ "''${flagsArray[2]}" == "c" ]] || (echo "'\$flagsArray[2]' was not 'c'" && false)
|
||||
[[ "''${flagsArray[3]}" == "d" ]] || (echo "'\$flagsArray[3]' was not 'd'" && false)
|
||||
[[ "''${flagsArray[4]}" == "e=f" ]] || (echo "'\$flagsArray[4]' was not 'e=f'" && false)
|
||||
@ -127,7 +127,7 @@ let
|
||||
concatTo nonExistant string list notset=e=f empty_array=g empty_string=h
|
||||
declare -p nonExistant
|
||||
[[ "''${nonExistant[0]}" == "a" ]] || (echo "'\$nonExistant[0]' was not 'a'" && false)
|
||||
[[ "''${nonExistant[1]}" == "b" ]] || (echo "'\$nonExistant[1]' was not 'b'" && false)
|
||||
[[ "''${nonExistant[1]}" == "*" ]] || (echo "'\$nonExistant[1]' was not '*'" && false)
|
||||
[[ "''${nonExistant[2]}" == "c" ]] || (echo "'\$nonExistant[2]' was not 'c'" && false)
|
||||
[[ "''${nonExistant[3]}" == "d" ]] || (echo "'\$nonExistant[3]' was not 'd'" && false)
|
||||
[[ "''${nonExistant[4]}" == "e=f" ]] || (echo "'\$nonExistant[4]' was not 'e=f'" && false)
|
||||
@ -344,7 +344,7 @@ in
|
||||
concatTo flagsWithSpaces string listWithSpaces
|
||||
declare -p flagsWithSpaces
|
||||
[[ "''${flagsWithSpaces[0]}" == "a" ]] || (echo "'\$flagsWithSpaces[0]' was not 'a'" && false)
|
||||
[[ "''${flagsWithSpaces[1]}" == "b" ]] || (echo "'\$flagsWithSpaces[1]' was not 'b'" && false)
|
||||
[[ "''${flagsWithSpaces[1]}" == "*" ]] || (echo "'\$flagsWithSpaces[1]' was not '*'" && false)
|
||||
[[ "''${flagsWithSpaces[2]}" == "c c" ]] || (echo "'\$flagsWithSpaces[2]' was not 'c c'" && false)
|
||||
[[ "''${flagsWithSpaces[3]}" == "d d" ]] || (echo "'\$flagsWithSpaces[3]' was not 'd d'" && false)
|
||||
'';
|
||||
|
Loading…
Reference in New Issue
Block a user