git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #12469 from domenkozar/fetchurl/executable

fetchurl: support executables

commite210fdd272d76c7186586335877c9ab11338e7ca authorEelco Dolstra <eelco.dolstra@logicblox.com> dateTue 19 Jan 2016, 11:27 (11 years ago) parentcdd07d1c7383cb
2 files changed+10−2
pkgs/build-support/fetchurl/builder.sh+5 pkgs/build-support/fetchurl/default.nix+5−2
pkgs/build-support/fetchurl/builder.sh+5
@@ -45,6 +45,11 @@ tryDownload() {
4545
4646finish() {
4747 set +o noglob
48+
49+ if [[ $executable == "1" ]]; then
50+ chmod +x $downloadedFile
51+ fi
52+
4853 runHook postFetch
4954 stopNest
5055 exit 0
pkgs/build-support/fetchurl/default.nix+5−2
@@ -73,6 +73,9 @@ in
7373 # is communicated to postFetch via $downloadedFile.
7474 downloadToTemp ? false
7575
76+, # If true, set executable bit on downloaded file
77+ executable ? false
78+
7679, # If set, don't download the file, but write a list of all possible
7780 # URLs (resulting from resolving mirror:// URLs) to $out.
7881 showURLs ? false
@@ -116,9 +119,9 @@ if (!hasHash) then throw "Specify hash for fetchurl fixed-output derivation: ${s
116119 outputHash = if outputHash != "" then outputHash else
117120 if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
118121
119− outputHashMode = if recursiveHash then "recursive" else "flat";
122+ outputHashMode = if (recursiveHash || executable) then "recursive" else "flat";
120123
121− inherit curlOpts showURLs mirrorsFile impureEnvVars postFetch downloadToTemp;
124+ inherit curlOpts showURLs mirrorsFile impureEnvVars postFetch downloadToTemp executable;
122125
123126 # Doing the download on a remote machine just duplicates network
124127 # traffic, so don't do that.