Merge pull request #133350 from rasendubi/fetchzip-downloadname
fetchzip: add extension parameter
This commit is contained in:
commit
a57ca31b3b
1 changed files with 10 additions and 3 deletions
|
@ -13,10 +13,17 @@
|
|||
, urls ? []
|
||||
, extraPostFetch ? ""
|
||||
, name ? "source"
|
||||
, # Allows to set the extension for the intermediate downloaded
|
||||
# file. This can be used as a hint for the unpackCmdHooks to select
|
||||
# an appropriate unpacking tool.
|
||||
extension ? null
|
||||
, ... } @ args:
|
||||
|
||||
(fetchurl (let
|
||||
basename = baseNameOf (if url != "" then url else builtins.head urls);
|
||||
tmpFilename =
|
||||
if extension != null
|
||||
then "download.${extension}"
|
||||
else baseNameOf (if url != "" then url else builtins.head urls);
|
||||
in {
|
||||
inherit name;
|
||||
|
||||
|
@ -30,7 +37,7 @@ in {
|
|||
mkdir "$unpackDir"
|
||||
cd "$unpackDir"
|
||||
|
||||
renamed="$TMPDIR/${basename}"
|
||||
renamed="$TMPDIR/${tmpFilename}"
|
||||
mv "$downloadedFile" "$renamed"
|
||||
unpackFile "$renamed"
|
||||
''
|
||||
|
@ -56,7 +63,7 @@ in {
|
|||
+ ''
|
||||
chmod 755 "$out"
|
||||
'';
|
||||
} // removeAttrs args [ "stripRoot" "extraPostFetch" ])).overrideAttrs (x: {
|
||||
} // removeAttrs args [ "stripRoot" "extraPostFetch" "extension" ])).overrideAttrs (x: {
|
||||
# Hackety-hack: we actually need unzip hooks, too
|
||||
nativeBuildInputs = x.nativeBuildInputs ++ [ unzip ];
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue