summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2022-12-16 18:08:36 +0100
committerGitHub <noreply@github.com>2022-12-16 18:08:36 +0100
commit922556a3d3096a244193757b027af9f9c5ae52b3 (patch)
treef920c7c1d43bf1be10c66da61e649dca34e6bb8f /pkgs/build-support
parent0381d09ae8bde8da4ae9e46c1cadc7ea694b5250 (diff)
parent725f4bc5becaa05f5a73a4026e1c0641676600ad (diff)
downloadnixpkgs-922556a3d3096a244193757b027af9f9c5ae52b3.tar
nixpkgs-922556a3d3096a244193757b027af9f9c5ae52b3.tar.gz
nixpkgs-922556a3d3096a244193757b027af9f9c5ae52b3.tar.bz2
nixpkgs-922556a3d3096a244193757b027af9f9c5ae52b3.tar.lz
nixpkgs-922556a3d3096a244193757b027af9f9c5ae52b3.tar.xz
nixpkgs-922556a3d3096a244193757b027af9f9c5ae52b3.tar.zst
nixpkgs-922556a3d3096a244193757b027af9f9c5ae52b3.zip
Merge pull request #191355 from GenericNerdyUsername/fetchzip-include-hidden
fetchzip: don't error out if the directory inside the archive starts with a "."
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/fetchzip/default.nix4
-rw-r--r--pkgs/build-support/fetchzip/tests.nix12
2 files changed, 12 insertions, 4 deletions
diff --git a/pkgs/build-support/fetchzip/default.nix b/pkgs/build-support/fetchzip/default.nix
index 8605564fc1e..e980f9d6521 100644
--- a/pkgs/build-support/fetchzip/default.nix
+++ b/pkgs/build-support/fetchzip/default.nix
@@ -63,12 +63,12 @@ fetchurl ((
       chmod -R +w "$unpackDir"
     ''
     + (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 "hint: Pass stripRoot=false; to fetchzip to assume flat list of files."
         exit 1
       fi
-      fn=$(cd "$unpackDir" && echo *)
+      fn=$(cd "$unpackDir" && ls -A)
       if [ -f "$unpackDir/$fn" ]; then
         mkdir $out
       fi
diff --git a/pkgs/build-support/fetchzip/tests.nix b/pkgs/build-support/fetchzip/tests.nix
index f1a1ed65817..13175d5ce92 100644
--- a/pkgs/build-support/fetchzip/tests.nix
+++ b/pkgs/build-support/fetchzip/tests.nix
@@ -1,4 +1,4 @@
-{ testers, fetchzip, ... }:
+{ testers, fetchzip, runCommand, ... }:
 
 let
   url = "https://gist.github.com/glandium/01d54cefdb70561b5f6675e08f2990f2/archive/2f430f0c136a69b0886281d0c76708997d8878af.zip";
@@ -12,6 +12,14 @@ in
   postFetch = testers.invalidateFetcherByDrvHash fetchzip {
     inherit url;
     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=";
   };
 }