Skip to content

Commit 46e7e74

Browse files
authored
Merge pull request #8 from eflows4hpc/new_developments
fix error when no spack
2 parents c44dbce + 27da89f commit 46e7e74

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

files/Dockerfile.spack

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,13 @@ COPY %APPDIR% /%APPDIR%
66
COPY software-catalog /software-catalog
77
COPY .spack /.spack
88
COPY packages /packages
9+
COPY build_spack.sh /.spack/build_spack.sh
910

1011
WORKDIR /packages
1112

1213
RUN echo "Installing apt-get packages" && %APTGET_INSTALL%
1314

14-
RUN [ ! /%APPDIR%/spack.yaml ] && echo "No spack environment to install" || echo "Installing spack packages" && spack -C /.spack find && cat /%APPDIR%/spack.yaml \
15-
&& spack -C /.spack compiler find && spack -C /.spack external find && spack -C /.spack -e /%APPDIR% install --fail-fast --no-checksum --keep-stage -j2 \
16-
&& [ -f /%APPDIR%/post_inst.sh ] && sh /%APPDIR%/post_inst.sh || echo "Nothing else to do"; spack gc -y
17-
# && spack -C /.spack mirror add binary_mirror_dev https://binaries.spack.io/develop \
18-
# && spack -C /.spack buildcache keys --install --trust \
19-
20-
21-
RUN spack -C /.spack env activate /%APPDIR% --sh >> /etc/profile.d/z10_spack_environment.sh && \
22-
echo "export PYTHONPATH=/opt/view/local/lib/python3.10/site-packages/:\$PYTHONPATH" >> /etc/profile.d/z10_spack_environment.sh && \
23-
echo "export PATH=/usr/local/bin/:\$PATH" >> /etc/profile.d/z10_spack_environment.sh
15+
RUN sh /.spack/build_spack.sh /%APPDIR% 3.10
2416

2517
SHELL ["/bin/bash", "--login", "-c"]
2618

image_builder/build.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def __init__(self, repositories_cfg, builder_cfg, registry_cfg):
6363
builder_cfg["builder_home"], "files", "run_build.sh")
6464
self.get_workflow_script = os.path.join(
6565
builder_cfg["builder_home"], "files", "get_workflow.sh")
66+
self.spack_build_script = os.path.join(
67+
builder_cfg["builder_home"], "files", "build_spack.sh")
6668
self.singularity_sudo = builder_cfg['singularity_sudo']
6769

6870
def _update_dockerfile(self, tmp_folder, step_id, machine, debs, pips):
@@ -128,11 +130,8 @@ def _update_configuration(self, workflow_folder_path, machine):
128130
environment['spack']['config'] = {
129131
'shared_linking': {'type': 'runpath'}}
130132
environment['spack']['view'] = "/opt/view"
131-
else:
132-
raise Exception(
133-
"Incorrect spack environment. Not containing the spack tag.")
134-
with open(os.path.join(workflow_folder_path, "spack.yaml"), 'w') as file:
135-
yaml.dump(environment, file, default_flow_style=False)
133+
with open(os.path.join(workflow_folder_path, "spack.yaml"), 'w') as file:
134+
yaml.dump(environment, file, default_flow_style=False)
136135
return debs, pips
137136

138137
def _generate_build_environment(self, logger, tmp_folder, workflow, machine, path):
@@ -142,6 +141,7 @@ def _generate_build_environment(self, logger, tmp_folder, workflow, machine, pat
142141
debs, pips = self._update_configuration(workflow_folder_path, machine)
143142
software_repo_path = os.path.join(
144143
tmp_folder, os.path.basename(self.software_repository))
144+
shutil.copy2(self.spack_build_script, tmp_folder)
145145
shutil.copytree(self.software_repository, software_repo_path)
146146
spack_cfg_path = os.path.join(tmp_folder, ".spack")
147147
shutil.copytree(self.spack_cfg, spack_cfg_path)

0 commit comments

Comments
 (0)