Merge pull request #191355 from GenericNerdyUsername/fetchzip-include-hidden
fetchzip: don't error out if the directory inside the archive starts with a "."
This commit is contained in:
commit
922556a3d3
2 changed files with 12 additions and 4 deletions
|
@ -63,12 +63,12 @@ fetchurl ((
|
||||||
chmod -R +w "$unpackDir"
|
chmod -R +w "$unpackDir"
|
||||||
''
|
''
|
||||||
+ (if stripRoot then ''
|
+ (if stripRoot then ''
|
||||||
if [ $(ls "$unpackDir" | wc -l) != 1 ]; then
|
if [ $(ls -A "$unpackDir" | wc -l) != 1 ]; then
|
||||||
echo "error: zip file must contain a single file or directory."
|
echo "error: zip file must contain a single file or directory."
|
||||||
echo "hint: Pass stripRoot=false; to fetchzip to assume flat list of files."
|
echo "hint: Pass stripRoot=false; to fetchzip to assume flat list of files."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fn=$(cd "$unpackDir" && echo *)
|
fn=$(cd "$unpackDir" && ls -A)
|
||||||
if [ -f "$unpackDir/$fn" ]; then
|
if [ -f "$unpackDir/$fn" ]; then
|
||||||
mkdir $out
|
mkdir $out
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ testers, fetchzip, ... }:
|
{ testers, fetchzip, runCommand, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
url = "https://gist.github.com/glandium/01d54cefdb70561b5f6675e08f2990f2/archive/2f430f0c136a69b0886281d0c76708997d8878af.zip";
|
url = "https://gist.github.com/glandium/01d54cefdb70561b5f6675e08f2990f2/archive/2f430f0c136a69b0886281d0c76708997d8878af.zip";
|
||||||
|
@ -12,6 +12,14 @@ in
|
||||||
postFetch = testers.invalidateFetcherByDrvHash fetchzip {
|
postFetch = testers.invalidateFetcherByDrvHash fetchzip {
|
||||||
inherit url;
|
inherit url;
|
||||||
sha256 = "sha256-7sAOzKa+9vYx5XyndHxeY2ffWAjOsgCkXC9anK6cuV0=";
|
sha256 = "sha256-7sAOzKa+9vYx5XyndHxeY2ffWAjOsgCkXC9anK6cuV0=";
|
||||||
postFetch = ''touch $out/filee'';
|
postFetch = "touch $out/filee";
|
||||||
|
};
|
||||||
|
|
||||||
|
hiddenDir = testers.invalidateFetcherByDrvHash fetchzip {
|
||||||
|
url = "file://${runCommand "hiddendir.tar" {} ''
|
||||||
|
mkdir .foo
|
||||||
|
tar -cf $out .foo
|
||||||
|
''}";
|
||||||
|
sha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue