summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAxel Huebl <axel.huebl@plasma.ninja>2020-04-14 09:09:30 -0700
committerGitHub <noreply@github.com>2020-04-14 11:09:30 -0500
commit5acea35e82f894a45615a5b02378bdef6ef6f345 (patch)
tree726dbc55485ba58e961db9c37007cef0c140cb39 /lib
parent25e2548489ed17fdf3593a462e6565d838e1e913 (diff)
downloadspack-5acea35e82f894a45615a5b02378bdef6ef6f345.tar.gz
spack-5acea35e82f894a45615a5b02378bdef6ef6f345.tar.bz2
spack-5acea35e82f894a45615a5b02378bdef6ef6f345.tar.xz
spack-5acea35e82f894a45615a5b02378bdef6ef6f345.zip
sourceware.org: mirror urls (#15992)
sourceware.org is often quite overrun and times out or results in certificate errors. Since libffi, bzip2, elfutils, etc. are quite fundamental in build chains, lets add some official mirrors. libffi, bzip2, elfutils, lvm2, valgrind: add mirrors
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/sourceware.py37
-rw-r--r--lib/spack/spack/pkgkit.py1
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/sourceware.py b/lib/spack/spack/build_systems/sourceware.py
new file mode 100644
index 0000000000..b779b530dc
--- /dev/null
+++ b/lib/spack/spack/build_systems/sourceware.py
@@ -0,0 +1,37 @@
+# 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)
+
+import spack.util.url
+import spack.package
+
+
+class SourcewarePackage(spack.package.PackageBase):
+ """Mixin that takes care of setting url and mirrors for Sourceware.org
+ packages."""
+ #: Path of the package in a Sourceware mirror
+ sourceware_mirror_path = None
+
+ #: List of Sourceware mirrors used by Spack
+ base_mirrors = [
+ 'https://sourceware.org/pub/',
+ 'https://mirrors.kernel.org/sourceware/',
+ 'https://ftp.gwdg.de/pub/linux/sources.redhat.com/'
+ ]
+
+ @property
+ def urls(self):
+ self._ensure_sourceware_mirror_path_is_set_or_raise()
+ return [
+ spack.util.url.join(m, self.sourceware_mirror_path,
+ resolve_href=True)
+ for m in self.base_mirrors
+ ]
+
+ def _ensure_sourceware_mirror_path_is_set_or_raise(self):
+ if self.sourceware_mirror_path is None:
+ cls_name = type(self).__name__
+ msg = ('{0} must define a `sourceware_mirror_path` attribute'
+ ' [none defined]')
+ raise AttributeError(msg.format(cls_name))
diff --git a/lib/spack/spack/pkgkit.py b/lib/spack/spack/pkgkit.py
index c304fb4fca..e271f27f31 100644
--- a/lib/spack/spack/pkgkit.py
+++ b/lib/spack/spack/pkgkit.py
@@ -31,6 +31,7 @@ from spack.build_systems.intel import IntelPackage
from spack.build_systems.meson import MesonPackage
from spack.build_systems.sip import SIPPackage
from spack.build_systems.gnu import GNUMirrorPackage
+from spack.build_systems.sourceware import SourcewarePackage
from spack.mixins import filter_compiler_wrappers