mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
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
2 changed files with 26 additions and 24 deletions
|
@ -13,9 +13,7 @@
|
||||||
, ... } @ args:
|
, ... } @ args:
|
||||||
|
|
||||||
fetchurl ({
|
fetchurl ({
|
||||||
# Remove the extension, because otherwise unpackPhase will get
|
name = args.name or (baseNameOf url);
|
||||||
# confused. FIXME: fix unpackPhase.
|
|
||||||
name = args.name or lib.removeSuffix ".zip" (lib.removeSuffix ".tar.gz" (baseNameOf url));
|
|
||||||
|
|
||||||
recursiveHash = true;
|
recursiveHash = true;
|
||||||
|
|
||||||
|
|
|
@ -475,32 +475,36 @@ unpackFile() {
|
||||||
|
|
||||||
header "unpacking source archive $curSrc" 3
|
header "unpacking source archive $curSrc" 3
|
||||||
|
|
||||||
case "$curSrc" in
|
if [ -d "$curSrc" ]; then
|
||||||
*.tar.xz | *.tar.lzma)
|
|
||||||
# Don't rely on tar knowing about .xz.
|
stripHash $curSrc
|
||||||
xz -d < $curSrc | tar xf -
|
cp -prd --no-preserve=timestamps $curSrc $strippedName
|
||||||
;;
|
|
||||||
*.tar | *.tar.* | *.tgz | *.tbz2)
|
else
|
||||||
# GNU tar can automatically select the decompression method
|
|
||||||
# (info "(tar) gzip").
|
case "$curSrc" in
|
||||||
tar xf $curSrc
|
*.tar.xz | *.tar.lzma)
|
||||||
;;
|
# Don't rely on tar knowing about .xz.
|
||||||
*.zip)
|
xz -d < $curSrc | tar xf -
|
||||||
unzip -qq $curSrc
|
;;
|
||||||
;;
|
*.tar | *.tar.* | *.tgz | *.tbz2)
|
||||||
*)
|
# GNU tar can automatically select the decompression method
|
||||||
if [ -d "$curSrc" ]; then
|
# (info "(tar) gzip").
|
||||||
stripHash $curSrc
|
tar xf $curSrc
|
||||||
cp -prd --no-preserve=timestamps $curSrc $strippedName
|
;;
|
||||||
else
|
*.zip)
|
||||||
|
unzip -qq $curSrc
|
||||||
|
;;
|
||||||
|
*)
|
||||||
if [ -z "$unpackCmd" ]; then
|
if [ -z "$unpackCmd" ]; then
|
||||||
echo "source archive $curSrc has unknown type"
|
echo "source archive $curSrc has unknown type"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
runSingleHook unpackCmd
|
runSingleHook unpackCmd
|
||||||
fi
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
|
||||||
|
fi
|
||||||
|
|
||||||
stopNest
|
stopNest
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue