fetchzip: extraPostFetch -> postFetch && tests
This commit is contained in:
parent
7283d3942f
commit
5a6a31e54d
@ -12,6 +12,7 @@
|
|||||||
, url ? ""
|
, url ? ""
|
||||||
, urls ? []
|
, urls ? []
|
||||||
, extraPostFetch ? ""
|
, extraPostFetch ? ""
|
||||||
|
, postFetch ? ""
|
||||||
, name ? "source"
|
, name ? "source"
|
||||||
, nativeBuildInputs ? [ ]
|
, nativeBuildInputs ? [ ]
|
||||||
, # Allows to set the extension for the intermediate downloaded
|
, # Allows to set the extension for the intermediate downloaded
|
||||||
@ -20,6 +21,8 @@
|
|||||||
extension ? null
|
extension ? null
|
||||||
, ... } @ args:
|
, ... } @ args:
|
||||||
|
|
||||||
|
|
||||||
|
lib.warnIf (extraPostFetch != "") "use 'postFetch' instead of 'extraPostFetch' with 'fetchzip' and 'fetchFromGitHub'."
|
||||||
(fetchurl (let
|
(fetchurl (let
|
||||||
tmpFilename =
|
tmpFilename =
|
||||||
if extension != null
|
if extension != null
|
||||||
@ -60,11 +63,14 @@ in {
|
|||||||
mv "$unpackDir" "$out"
|
mv "$unpackDir" "$out"
|
||||||
'')
|
'')
|
||||||
+ ''
|
+ ''
|
||||||
|
${postFetch}
|
||||||
|
'' + ''
|
||||||
${extraPostFetch}
|
${extraPostFetch}
|
||||||
''
|
''
|
||||||
|
|
||||||
# Remove non-owner write permissions
|
# Remove non-owner write permissions
|
||||||
# Fixes https://github.com/NixOS/nixpkgs/issues/38649
|
# Fixes https://github.com/NixOS/nixpkgs/issues/38649
|
||||||
+ ''
|
+ ''
|
||||||
chmod 755 "$out"
|
chmod 755 "$out"
|
||||||
'';
|
'';
|
||||||
} // removeAttrs args [ "stripRoot" "extraPostFetch" "extension" "nativeBuildInputs" ]))
|
} // removeAttrs args [ "stripRoot" "extraPostFetch" "postFetch" "extension" "nativeBuildInputs" ]))
|
||||||
|
25
pkgs/build-support/fetchzip/tests.nix
Normal file
25
pkgs/build-support/fetchzip/tests.nix
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{ testers, fetchzip, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
zipUrl = "https://gist.github.com/glandium/01d54cefdb70561b5f6675e08f2990f2/archive/2f430f0c136a69b0886281d0c76708997d8878af.zip";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
simple = testers.invalidateFetcherByDrvHash fetchzip {
|
||||||
|
inherit zipUrl;
|
||||||
|
sha256 = "sha256-0ecwgL8qUavSj1+WkaxpmRBmu7cvj53V5eXQV71fddU=";
|
||||||
|
};
|
||||||
|
|
||||||
|
postFetch = testers.invalidateFetcherByDrvHash fetchzip {
|
||||||
|
inherit zipUrl;
|
||||||
|
sha256 = "sha256-7sAOzKa+9vYx5XyndHxeY2ffWAjOsgCkXC9anK6cuV0=";
|
||||||
|
postFetch = ''touch $out/filee'';
|
||||||
|
};
|
||||||
|
|
||||||
|
#extraPostFetch = testers.invalidateFetcherByDrvHash fetchzip {
|
||||||
|
# inherit url;
|
||||||
|
# sha256 = "sha256-UC8oJqojqpjqa72UpT0QTME+UwQhVVk5/d9mgRPDR20=";
|
||||||
|
# extraPostFetch = ''
|
||||||
|
# touch $out/afile
|
||||||
|
# '';
|
||||||
|
#};
|
||||||
|
}
|
@ -28,6 +28,7 @@ with pkgs;
|
|||||||
cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; };
|
cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; };
|
||||||
|
|
||||||
fetchpatch = callPackages ../build-support/fetchpatch/tests.nix { };
|
fetchpatch = callPackages ../build-support/fetchpatch/tests.nix { };
|
||||||
|
fetchzip = callPackages ../build-support/fetchzip/tests.nix { };
|
||||||
fetchgit = callPackages ../build-support/fetchgit/tests.nix { };
|
fetchgit = callPackages ../build-support/fetchgit/tests.nix { };
|
||||||
fetchFirefoxAddon = callPackages ../build-support/fetchfirefoxaddon/tests.nix { };
|
fetchFirefoxAddon = callPackages ../build-support/fetchfirefoxaddon/tests.nix { };
|
||||||
|
|
||||||
|
@ -723,7 +723,10 @@ with pkgs;
|
|||||||
inherit curl stdenv;
|
inherit curl stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
fetchzip = callPackage ../build-support/fetchzip { };
|
fetchzip = callPackage ../build-support/fetchzip { }
|
||||||
|
// {
|
||||||
|
tests = pkgs.tests.fetchzip;
|
||||||
|
};
|
||||||
|
|
||||||
fetchCrate = callPackage ../build-support/rust/fetchcrate.nix { };
|
fetchCrate = callPackage ../build-support/rust/fetchcrate.nix { };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user