summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin.mock/packages/fetch-options/package.py
diff options
context:
space:
mode:
authorMichael Kuhn <michael.kuhn@informatik.uni-hamburg.de>2020-03-13 19:41:19 +0100
committerGitHub <noreply@github.com>2020-03-13 11:41:19 -0700
commit14441e00dc1c04df40d361ca46fd63c7446ac2ae (patch)
tree93f92d66c847239c791eeb21807de45a12876b24 /var/spack/repos/builtin.mock/packages/fetch-options/package.py
parent7b00712fff44a6ef0c09ab09025f2b4efaac5e65 (diff)
downloadspack-14441e00dc1c04df40d361ca46fd63c7446ac2ae.tar.gz
spack-14441e00dc1c04df40d361ca46fd63c7446ac2ae.tar.bz2
spack-14441e00dc1c04df40d361ca46fd63c7446ac2ae.tar.xz
spack-14441e00dc1c04df40d361ca46fd63c7446ac2ae.zip
package: Add fetch_options variable (#15317)
PR #15212 added a new connect_timeout option that can be overridden using fetch_options but had to specified per-version. This adds a new per-package variable that can be used to override fetch_options for all versions in the package. This includes connect_timeout as well as 'cookie' (e.g. for the jdk package). Packages can combine package-level fetch_options with per-version fetch_options, in which case the version fetch_options completely override the package-level fetch_options. This commit includes tests for the added behavior.
Diffstat (limited to 'var/spack/repos/builtin.mock/packages/fetch-options/package.py')
-rw-r--r--var/spack/repos/builtin.mock/packages/fetch-options/package.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/fetch-options/package.py b/var/spack/repos/builtin.mock/packages/fetch-options/package.py
new file mode 100644
index 0000000000..1a31a535e1
--- /dev/null
+++ b/var/spack/repos/builtin.mock/packages/fetch-options/package.py
@@ -0,0 +1,22 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class FetchOptions(Package):
+ """Mock package with fetch_options."""
+
+ homepage = "http://www.fetch-options-example.com"
+
+ url = 'https://example.com/some/tarball-1.0.tar.gz'
+
+ fetch_options = {'timeout': 42, 'cookie': 'foobar'}
+ timeout = {'timeout': 65}
+ cookie = {'cookie': 'baz'}
+
+ version('1.2', 'abc12', fetch_options=cookie)
+ version('1.1', 'abc11', fetch_options=timeout)
+ version('1.0', 'abc10')