diff --git a/spack_repo/packages/icon-nwp/package.py b/spack_repo/packages/icon-nwp/package.py index 40a28488e32f652712703af23b6f8dfbc9bd1209..bb8acee52570fe94b33d4e8d3ea69eda679628ca 100644 --- a/spack_repo/packages/icon-nwp/package.py +++ b/spack_repo/packages/icon-nwp/package.py @@ -27,7 +27,15 @@ class IconNwp(Package): version("plexrt", branch="icon-nwp/icon-nwp-plexrt") version("master", branch="master") - variant("lmu", default=False, description="if git.url and submodules should be patched to use the LMU mirrors") + # FIXME: Workaround to deal with different sources. The default is using dkrz's through ssh. + variant("source", values=('dkrz', 'dkrz_https', 'lmu'), default='dkrz', + description='Select the source of the ICON: dkrz (ssh), dkrz_https, lmu (ssh)') + custom_fetchers = { + "dkrz": "ssh://git@gitlab.dkrz.de/icon/icon-nwp.git", + "dkrz_https": "https://gitlab.dkrz.de/icon/icon-nwp.git", + "lmu": "ssh://git@gitlab.physik.uni-muenchen.de/w2w/icon.git", + } + variant("plexrt", default=False, description="add 3D radiation support with TenStream") variant("petsc", default=False, description="add PETSc support") @@ -57,14 +65,16 @@ class IconNwp(Package): phases = ["configure", "build", "install"] def do_fetch(self, mirror_only=False): - if "+lmu" in self.spec: - self.fetcher[0].url = self.git = "ssh://git@gitlab.physik.uni-muenchen.de/w2w/icon.git" + # FIXME: Using the custom_fetchers workaround + source = self.spec.variants['source'].value + self.fetcher[0].url = self.git = self.custom_fetchers[source] + super(IconNwp, self).do_fetch(mirror_only) def patch(self): # Run git submodule update git = which("git") - if "+lmu" in self.spec: + if self.spec.variants['source'].value == 'lmu': self.patch_submodules() git("submodule", "update", "--init", "--recursive")