forked from mirrors/nixpkgs
Merge pull request #211910 from tejing1/srcs-name-collision
stdenv: Improve error from `stdenv` when `srcs` is used with colliding directories
This commit is contained in:
commit
b3a97d7eb4
|
@ -992,13 +992,22 @@ stripHash() {
|
|||
unpackCmdHooks+=(_defaultUnpack)
|
||||
_defaultUnpack() {
|
||||
local fn="$1"
|
||||
local destination
|
||||
|
||||
if [ -d "$fn" ]; then
|
||||
|
||||
destination="$(stripHash "$fn")"
|
||||
|
||||
if [ -e "$destination" ]; then
|
||||
echo "Cannot copy $fn to $destination: destination already exists!"
|
||||
echo "Did you specify two \"srcs\" with the same \"name\"?"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# We can't preserve hardlinks because they may have been
|
||||
# introduced by store optimization, which might break things
|
||||
# in the build.
|
||||
cp -pr --reflink=auto -- "$fn" "$(stripHash "$fn")"
|
||||
cp -pr --reflink=auto -- "$fn" "$destination"
|
||||
|
||||
else
|
||||
|
||||
|
|
Loading…
Reference in a new issue