Skip to content

Commit 689380e

Browse files
authored
fetchurl, fetchgit: use __structuredAttrs = true and pass curlOptsList and sparseCheckout as lists (#464475)
2 parents f69387a + 982cafd commit 689380e

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

pkgs/build-support/fetchgit/builder.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# - revision specified and remote without HEAD
55
#
66

7+
source "$NIX_ATTRS_SH_FILE"
8+
79
echo "exporting $url (rev $rev) into $out"
810

911
runHook preFetch

pkgs/build-support/fetchgit/default.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ lib.makeOverridable (
138138

139139
derivationArgs
140140
// {
141+
__structuredAttrs = true;
142+
141143
inherit name;
142144

143145
builder = ./builder.sh;
@@ -243,7 +245,11 @@ lib.makeOverridable (
243245
"FETCHGIT_HTTP_PROXIES"
244246
];
245247

246-
inherit preferLocalBuild meta allowedRequisites;
248+
outputChecks.out = {
249+
${if allowedRequisites != null then "allowedRequisites" else null} = allowedRequisites;
250+
};
251+
252+
inherit preferLocalBuild meta;
247253

248254
passthru = {
249255
gitRepoUrl = url;

pkgs/build-support/fetchurl/builder.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
source "$NIX_ATTRS_SH_FILE"
12
source $mirrorsFile
23

34
curlVersion=$(curl -V | head -1 | cut -d' ' -f2)
@@ -22,10 +23,10 @@ if ! [ -f "$SSL_CERT_FILE" ]; then
2223
curl+=(--insecure)
2324
fi
2425

25-
eval "curl+=($curlOptsList)"
26+
curl+=("${curlOptsList[@]}")
2627

2728
curl+=(
28-
$curlOpts
29+
${curlOpts[*]}
2930
$NIX_CURL_FLAGS
3031
)
3132

pkgs/build-support/fetchurl/default.nix

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ lib.extendMkDerivation {
135135

136136
# Passthru information, if any.
137137
passthru ? { },
138+
138139
# Doing the download on a remote machine just duplicates network
139140
# traffic, so don't do that by default
140141
preferLocalBuild ? true,
@@ -240,6 +241,8 @@ lib.extendMkDerivation {
240241

241242
derivationArgs
242243
// {
244+
__structuredAttrs = true;
245+
243246
name =
244247
if finalAttrs.pname or null != null && finalAttrs.version or null != null then
245248
"${finalAttrs.pname}-${finalAttrs.version}"
@@ -315,14 +318,13 @@ lib.extendMkDerivation {
315318
''
316319
) curlOpts;
317320

318-
curlOptsList = lib.escapeShellArgs curlOptsList;
319-
320321
inherit
321-
showURLs
322-
mirrorsFile
323-
postFetch
322+
curlOptsList
324323
downloadToTemp
325324
executable
325+
mirrorsFile
326+
postFetch
327+
showURLs
326328
;
327329

328330
impureEnvVars = impureEnvVars ++ netrcImpureEnvVars;

0 commit comments

Comments
 (0)