mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
improve error when srcs is used with directories with the same post-hash name
This commit is contained in:
parent
2773ad7600
commit
183939da54
@ -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 New Issue
Block a user