at 16.09-beta 24 lines 692 B view raw
1skip () { 2 if [ -n "$NIX_DEBUG" ]; then 3 echo "skipping impure path $1" >&2 4 fi 5} 6 7 8# Checks whether a path is impure. E.g., `/lib/foo.so' is impure, but 9# `/nix/store/.../lib/foo.so' isn't. 10badPath() { 11 local p=$1 12 13 # Relative paths are okay (since they're presumably relative to 14 # the temporary build directory). 15 if [ "${p:0:1}" != / ]; then return 1; fi 16 17 # Otherwise, the path should refer to the store or some temporary 18 # directory (including the build directory). 19 test \ 20 "$p" != "/dev/null" -a \ 21 "${p:0:${#NIX_STORE}}" != "$NIX_STORE" -a \ 22 "${p:0:4}" != "/tmp" -a \ 23 "${p:0:${#NIX_BUILD_TOP}}" != "$NIX_BUILD_TOP" 24}