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)
|
unpackCmdHooks+=(_defaultUnpack)
|
||||||
_defaultUnpack() {
|
_defaultUnpack() {
|
||||||
local fn="$1"
|
local fn="$1"
|
||||||
|
local destination
|
||||||
|
|
||||||
if [ -d "$fn" ]; then
|
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
|
# We can't preserve hardlinks because they may have been
|
||||||
# introduced by store optimization, which might break things
|
# introduced by store optimization, which might break things
|
||||||
# in the build.
|
# in the build.
|
||||||
cp -pr --reflink=auto -- "$fn" "$(stripHash "$fn")"
|
cp -pr --reflink=auto -- "$fn" "$destination"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue