unpackFile: Always copy directories
If $src refers to a directory, then always copy it. Previously, we checked the extension first, so if the directory had an extension like .tar, unpackPhase would fail.
This commit is contained in:
parent
5e82aab5d4
commit
1a44dbbbb9
@ -13,9 +13,7 @@
|
||||
, ... } @ args:
|
||||
|
||||
fetchurl ({
|
||||
# Remove the extension, because otherwise unpackPhase will get
|
||||
# confused. FIXME: fix unpackPhase.
|
||||
name = args.name or lib.removeSuffix ".zip" (lib.removeSuffix ".tar.gz" (baseNameOf url));
|
||||
name = args.name or (baseNameOf url);
|
||||
|
||||
recursiveHash = true;
|
||||
|
||||
|
@ -475,32 +475,36 @@ unpackFile() {
|
||||
|
||||
header "unpacking source archive $curSrc" 3
|
||||
|
||||
case "$curSrc" in
|
||||
*.tar.xz | *.tar.lzma)
|
||||
# Don't rely on tar knowing about .xz.
|
||||
xz -d < $curSrc | tar xf -
|
||||
;;
|
||||
*.tar | *.tar.* | *.tgz | *.tbz2)
|
||||
# GNU tar can automatically select the decompression method
|
||||
# (info "(tar) gzip").
|
||||
tar xf $curSrc
|
||||
;;
|
||||
*.zip)
|
||||
unzip -qq $curSrc
|
||||
;;
|
||||
*)
|
||||
if [ -d "$curSrc" ]; then
|
||||
stripHash $curSrc
|
||||
cp -prd --no-preserve=timestamps $curSrc $strippedName
|
||||
else
|
||||
if [ -d "$curSrc" ]; then
|
||||
|
||||
stripHash $curSrc
|
||||
cp -prd --no-preserve=timestamps $curSrc $strippedName
|
||||
|
||||
else
|
||||
|
||||
case "$curSrc" in
|
||||
*.tar.xz | *.tar.lzma)
|
||||
# Don't rely on tar knowing about .xz.
|
||||
xz -d < $curSrc | tar xf -
|
||||
;;
|
||||
*.tar | *.tar.* | *.tgz | *.tbz2)
|
||||
# GNU tar can automatically select the decompression method
|
||||
# (info "(tar) gzip").
|
||||
tar xf $curSrc
|
||||
;;
|
||||
*.zip)
|
||||
unzip -qq $curSrc
|
||||
;;
|
||||
*)
|
||||
if [ -z "$unpackCmd" ]; then
|
||||
echo "source archive $curSrc has unknown type"
|
||||
exit 1
|
||||
fi
|
||||
runSingleHook unpackCmd
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
stopNest
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user