Skip to content

Commit

Permalink
Implement source_deps
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrKralCZ committed Feb 18, 2025
1 parent 5fd677b commit e7a27c9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
15 changes: 13 additions & 2 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2378,6 +2378,14 @@ def fetch_step(self, skip_checksums=False):
raise EasyBuildError("EasyBuild-version %s is newer than the currently running one. Aborting!",
easybuild_version)

source_deps = self.cfg['source_deps']
pre_fetch_env = None
# load modules for source dependencies (if any)
if source_deps:
pre_fetch_env = copy.deepcopy(os.environ)
source_deps_mod_names = [d['short_mod_name'] for d in source_deps]
self.modules_tool.load(source_deps_mod_names)

start_progress_bar(PROGRESS_BAR_DOWNLOAD_ALL, self.cfg.count_files())

if self.dry_run:
Expand Down Expand Up @@ -2464,6 +2472,9 @@ def fetch_step(self, skip_checksums=False):

stop_progress_bar(PROGRESS_BAR_DOWNLOAD_ALL)

if pre_fetch_env:
restore_env(pre_fetch_env)

def checksum_step(self):
"""Verify checksum of sources and patches, if a checksum is available."""
for fil in self.src + self.patches:
Expand Down Expand Up @@ -4324,7 +4335,7 @@ def ensure_writable_log_dir(log_dir):
adjust_permissions(log_dir, stat.S_IWUSR, add=True, recursive=True)
else:
parent_dir = os.path.dirname(log_dir)
if os.path.exists(parent_dir) and not (os.stat(parent_dir).st_mode & stat.S_IWUSR):
if os.path.exists(parent_dir):
adjust_permissions(parent_dir, stat.S_IWUSR, add=True, recursive=False)
mkdir(log_dir, parents=True)
adjust_permissions(parent_dir, stat.S_IWUSR, add=False, recursive=False)
Expand Down Expand Up @@ -4405,7 +4416,7 @@ def ensure_writable_log_dir(log_dir):
copy_file(patch['path'], target)
_log.debug("Copied patch %s to %s", patch['path'], target)

if build_option('read_only_installdir') and not app.cfg['stop']:
if build_option('read_only_installdir'):
# take away user write permissions (again)
perms = stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH
adjust_permissions(new_log_dir, perms, add=False, recursive=True)
Expand Down
1 change: 1 addition & 0 deletions easybuild/framework/easyconfig/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
'multi_deps_load_default': [True, "Load module for first version listed in multi_deps by default", DEPENDENCIES],
'osdependencies': [[], "OS dependencies that should be present on the system", DEPENDENCIES],
'moddependpaths': [None, "Absolute path(s) to prepend to MODULEPATH before loading dependencies", DEPENDENCIES],
'source_deps': [[], "source dependencies that should be present befory getting the sources", DEPENDENCIES],

# LICENSE easyconfig parameters
'accept_eula': [False, "Accepted End User License Agreement (EULA) for this software", LICENSE],
Expand Down
8 changes: 8 additions & 0 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,14 @@ def remove_false_versions(deps):
builddeps = [self._parse_dependency(dep, build_only=True) for dep in builddeps]
self['builddependencies'] = remove_false_versions(builddeps)

sourcedeps = self['source_deps']
if sourcedeps and all(isinstance(x, (list, tuple)) for b in sourcedeps for x in b):
self.iterate_options.append('source_deps')
sourcedeps = [[self._parse_dependency(dep, build_only=True) for dep in x] for x in sourcedeps]
else:
sourcedeps = [self._parse_dependency(dep, build_only=True) for dep in sourcedeps]
self['source_deps'] = remove_false_versions(sourcedeps)

# keep track of parsed multi deps, they'll come in handy during sanity check & module steps...
self.multi_deps = self.get_parsed_multi_deps()

Expand Down

0 comments on commit e7a27c9

Please sign in to comment.