Skip to content
Snippets Groups Projects
Commit 9095305b authored by Takumi.Matsunobu's avatar Takumi.Matsunobu
Browse files

Adapt the package.py for icon-nwp to use mirrors for submodules

parent 2d2fa7dd
No related branches found
No related tags found
No related merge requests found
Pipeline #19535 canceled
......@@ -14,8 +14,7 @@ class IconNwp(Package):
Recipe to build ICON-NWP using the LMU gitlab repository.
"""
git = "ssh://git@gitlab.physik.uni-muenchen.de:LDAP_w2w-b3/icon.git"
#git = "ssh://git@gitlab.dkrz.de/icon/icon-nwp.git"
git = "ssh://git@gitlab.dkrz.de/icon/icon-nwp.git"
homepage = "https://code.mpimet.mpg.de/projects/iconpublic"
# maintainers("oriol.tinto")
......@@ -29,13 +28,12 @@ class IconNwp(Package):
version("master", branch="master")
# FIXME: Workaround to deal with different sources. The default is using dkrz's through ssh.
variant("source", values=('dkrz', 'dkrz_https', 'lmu', 'lmub3'), default='dkrz',
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",
"lmub3": "ssh://git@gitlab.physik.uni-muenchen.de:LDAP_w2w-b3/icon.git",
}
variant("debug", default=False, description="add debug flags when compiling icon")
......@@ -54,6 +52,8 @@ class IconNwp(Package):
variant("plexrt" , default=False, description="add 3D radiation support with TenStream")
variant("petsc" , default=False, description="add PETSc support")
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")
......@@ -91,15 +91,90 @@ class IconNwp(Package):
password = token
url = "{}://{}:{}@{}/{}".format(parsed.scheme, user, password, parsed.netloc, parsed.path)
self.fetcher[0].url = self.git = url
if "+lmu" in self.spec:
self.fetcher[0].url = self.git = "https://gitlab.physik.uni-muenchen.de/LDAP_w2w-b3/icon.git"
else:
self.fetcher[0].url = self.git = url
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.
"""
git_submodules_file = Path().cwd() / ".gitmodules"
git_mirror = "git@gitlab.lrz.de:dkrz-mirror"
git_modules_patch = f"""
[submodule "externals/mtime"]
path = externals/mtime
url = {git_mirror}/libmtime.git
[submodule "externals/jsbach"]
path = externals/jsbach
url = {git_mirror}/jsbach.git
[submodule "externals/yac"]
path = externals/yac
url = {git_mirror}/YAC.git
[submodule "externals/self"]
path = externals/self
url = {git_mirror}/libself.git
[submodule "externals/tixi"]
path = externals/tixi
url = {git_mirror}/libtixi.git
[submodule "externals/yaxt"]
path = externals/yaxt
url = {git_mirror}/yaxt.git
[submodule "externals/rte-rrtmgp"]
path = externals/rte-rrtmgp
url = https://github.com/earth-system-radiation/rte-rrtmgp.git
[submodule "externals/cub"]
path = externals/cub
url = https://github.com/NVlabs/cub.git
[submodule "externals/omni-xmod-pool"]
path = externals/omni-xmod-pool
url = https://github.com/claw-project/omni-xmod-pool.git
[submodule "externals/cdi"]
path = externals/cdi
url = {git_mirror}/libcdi.git
[submodule "externals/sct"]
path = externals/sct
url = {git_mirror}/sct.git
[submodule "externals/ecrad"]
path = externals/ecrad
url = {git_mirror}/libecrad.git
[submodule "externals/dace_icon"]
path = externals/dace_icon
url = {git_mirror}/dace-icon-interface.git
[submodule "externals/emvorado"]
path = externals/emvorado
url = {git_mirror}/emvorado-for-icon.git
[submodule "utils/mkexp"]
path = utils/mkexp
url = https://git.mpimet.mpg.de/public/mkexp
[submodule "externals/art"]
path = externals/art
url = {git_mirror}/art.git
[submodule "externals/ppm"]
path = externals/ppm
url = https://gitlab.dkrz.de/jahns/ppm.git
[submodule "externals/probtest"]
path = externals/probtest
url = https://github.com/MeteoSwiss/probtest.git
"""
# Replace the content of the original file with the patch
with git_submodules_file.open("w") as out_f:
out_f.write(git_modules_patch)
def setup_build_environment(self, env):
spec = self.spec
......
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