Skip to content
Snippets Groups Projects
Commit bd3accd6 authored by Fabian.Jakub's avatar Fabian.Jakub
Browse files

add icon-nwp spack package to use a variant: LMU

Now, use a variant +lmu to download from LMU mirrors
Otherwise use the original dkrz git repo
parent 8ebd1796
No related branches found
No related tags found
1 merge request!4Switching to the advanced configuration method and fixing spack build.
......@@ -13,12 +13,10 @@ class IconNwp(Package):
Recipe to build ICON-NWP using the LMU gitlab repository.
"""
git = "ssh://git@gitlab.dkrz.de/icon/icon-nwp.git"
homepage = "https://code.mpimet.mpg.de/projects/iconpublic"
# maintainers("oriol.tinto")
# Main repository (pointing to LMU's gitlab)
git = "ssh://git@gitlab.physik.uni-muenchen.de/w2w/icon.git"
# Version w2w-B6 points to a different repository and branch)
version("w2w-B6", git="ssh://git@gitlab.physik.uni-muenchen.de/w2w/icon-w2w.git", branch="icon-w2w/icon-nwp-B6")
# FIXME: The ugly configuration system in older icon versions prevents us from using this package with it.
......@@ -28,6 +26,8 @@ class IconNwp(Package):
version("master", branch="master")
version("psp", branch="icon-nwp/icon-nwp-psp")
variant("lmu", default=False, description="if git.url and submodules should be patched to use the LMU mirrors")
# Dependencies
depends_on("mpi")
depends_on("netcdf-c")
......@@ -48,7 +48,19 @@ 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"
super(IconNwp, self).do_fetch(mirror_only)
def patch(self):
# Run git submodule update
git = which("git")
if "+lmu" in self.spec:
self.patch_submodules()
git("submodule", "update", "--init", "--recursive")
def patch_submodules(self):
"""
Because of the lack of access rights to the original submodule repositories,
we patch the gitmodules file to point to a different mirror.
......@@ -118,12 +130,7 @@ class IconNwp(Package):
with git_submodules_file.open("w") as out_f:
out_f.write(git_modules_patch)
# Run git submodule update
git = which("git")
git("submodule", "update", "--init", "--recursive")
def setup_build_environment(self, env):
spec = self.spec
# Some environment variables to set
......@@ -137,7 +144,7 @@ class IconNwp(Package):
def configure(self, spec, prefix):
spec = self.spec
print(spec['mpi'].mpifc)
print(spec["mpi"].mpifc)
libs = [
f"-L{spec['netcdf-c'].prefix.lib} -lnetcdf ", # netcdf-c libs
......@@ -202,7 +209,13 @@ class IconNwp(Package):
rsync("-av", "data/", f"{prefix}/data")
rsync("-av", "run/", f"{prefix}/run")
rsync("-av", "--include='*.pdf'", "--exclude='*.*'", "doc/", f"{prefix}/doc/")
curl("https://code.mpimet.mpg.de/attachments/download/19568/ICON_tutorial_2019.pdf", "--output",
f"{prefix}/doc/ICON_tutorial_2019.pdf")
curl("http://www.cosmo-model.org/content/model/documentation/core/emvorado_userguide.pdf", "--output",
f"{prefix}/doc/emvorado_userguide.pdf")
curl(
"https://code.mpimet.mpg.de/attachments/download/19568/ICON_tutorial_2019.pdf",
"--output",
f"{prefix}/doc/ICON_tutorial_2019.pdf",
)
curl(
"http://www.cosmo-model.org/content/model/documentation/core/emvorado_userguide.pdf",
"--output",
f"{prefix}/doc/emvorado_userguide.pdf",
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment