Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename 'source' step to 'extract' (affects skipsteps easyconfig parameter + --stop option) #4629

Merged
merged 6 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@
from easybuild.tools.filetools import get_cwd, get_source_tarball_from_git, is_alt_pypi_url
from easybuild.tools.filetools import is_binary, is_sha256_checksum, mkdir, move_file, move_logs, read_file, remove_dir
from easybuild.tools.filetools import remove_file, remove_lock, verify_checksum, weld_paths, write_file, symlink
from easybuild.tools.hooks import BUILD_STEP, CLEANUP_STEP, CONFIGURE_STEP, EXTENSIONS_STEP, FETCH_STEP, INSTALL_STEP
from easybuild.tools.hooks import MODULE_STEP, MODULE_WRITE, PACKAGE_STEP, PATCH_STEP, PERMISSIONS_STEP, POSTITER_STEP
from easybuild.tools.hooks import POSTPROC_STEP, PREPARE_STEP, READY_STEP, SANITYCHECK_STEP, SOURCE_STEP
from easybuild.tools.hooks import SINGLE_EXTENSION, TEST_STEP, TESTCASES_STEP, load_hooks, run_hook
from easybuild.tools.hooks import (
BUILD_STEP, CLEANUP_STEP, CONFIGURE_STEP, EXTENSIONS_STEP, EXTRACT_STEP, FETCH_STEP, INSTALL_STEP, MODULE_STEP,
MODULE_WRITE, PACKAGE_STEP, PATCH_STEP, PERMISSIONS_STEP, POSTITER_STEP, POSTPROC_STEP, PREPARE_STEP, READY_STEP,
SANITYCHECK_STEP, SINGLE_EXTENSION, TEST_STEP, TESTCASES_STEP, load_hooks, run_hook,
)
from easybuild.tools.run import RunShellCmdError, raise_run_shell_cmd_error, run_shell_cmd
from easybuild.tools.jenkins import write_to_xml
from easybuild.tools.module_generator import ModuleGeneratorLua, ModuleGeneratorTcl, module_generator, dependencies_for
Expand Down Expand Up @@ -4156,7 +4157,7 @@ def install_step_spec(initial):
# format for step specifications: (step_name, description, list of functions, skippable)

# core steps that are part of the iterated loop
extract_step_spec = (SOURCE_STEP, "unpacking", [lambda x: x.extract_step], True)
extract_step_spec = (EXTRACT_STEP, "unpacking", [lambda x: x.extract_step], True)
patch_step_spec = (PATCH_STEP, 'patching', [lambda x: x.patch_step], True)
prepare_step_spec = (PREPARE_STEP, 'preparing', [lambda x: x.prepare_step], False)
configure_step_spec = (CONFIGURE_STEP, 'configuring', [lambda x: x.configure_step], True)
Expand Down
22 changes: 19 additions & 3 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
from easybuild.tools.filetools import convert_name, copy_file, create_index, decode_class_name, encode_class_name
from easybuild.tools.filetools import find_backup_name_candidate, find_easyconfigs, load_index
from easybuild.tools.filetools import read_file, write_file
from easybuild.tools.hooks import PARSE, load_hooks, run_hook
from easybuild.tools.hooks import PARSE, EXTRACT_STEP, STEP_NAMES, load_hooks, run_hook
from easybuild.tools.module_naming_scheme.mns import DEVEL_MODULE_SUFFIX
from easybuild.tools.module_naming_scheme.utilities import avail_module_naming_schemes, det_full_ec_version
from easybuild.tools.module_naming_scheme.utilities import det_hidden_modname, is_valid_module_name
Expand Down Expand Up @@ -860,9 +860,25 @@ def validate(self, check_osdeps=True):
self.log.info("Not checking OS dependencies")

self.log.info("Checking skipsteps")
if not isinstance(self._config['skipsteps'][0], (list, tuple,)):
skipsteps = self._config['skipsteps'][0]
if not isinstance(skipsteps, (list, tuple,)):
raise EasyBuildError('Invalid type for skipsteps. Allowed are list or tuple, got %s (%s)',
type(self._config['skipsteps'][0]), self._config['skipsteps'][0])
type(skipsteps), skipsteps)
unknown_step_names = [step for step in skipsteps if step not in STEP_NAMES]
if unknown_step_names:
error_lines = ["Found one or more unknown step names in 'skipsteps' easyconfig parameter:"]
for step in unknown_step_names:
error_line = "* %s" % step
# try to find close match, may be just a typo in the step name
close_matches = difflib.get_close_matches(step, STEP_NAMES, 2, 0.8)
# 'source' step was renamed to 'extract' in EasyBuild 5.0, see provide a useful suggestion in that case;
# see https://github.com/easybuilders/easybuild-framework/pull/4629
if not close_matches and step == 'source':
close_matches.append(EXTRACT_STEP)
if close_matches:
error_line += " (did you mean %s?)" % ', or '.join("'%s'" % s for s in close_matches)
error_lines.append(error_line)
raise EasyBuildError('\n'.join(error_lines))

Flamefire marked this conversation as resolved.
Show resolved Hide resolved
self.log.info("Checking build option lists")
self.validate_iterate_opts_lists()
Expand Down
4 changes: 2 additions & 2 deletions easybuild/tools/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
CLEANUP_STEP = 'cleanup'
CONFIGURE_STEP = 'configure'
EXTENSIONS_STEP = 'extensions'
EXTRACT_STEP = 'extract'
FETCH_STEP = 'fetch'
INSTALL_STEP = 'install'
MODULE_STEP = 'module'
Expand All @@ -55,7 +56,6 @@
PREPARE_STEP = 'prepare'
READY_STEP = 'ready'
SANITYCHECK_STEP = 'sanitycheck'
SOURCE_STEP = 'source'
TEST_STEP = 'test'
TESTCASES_STEP = 'testcases'

Expand All @@ -77,7 +77,7 @@
HOOK_SUFF = '_hook'

# list of names for steps in installation procedure (in order of execution)
STEP_NAMES = [FETCH_STEP, READY_STEP, SOURCE_STEP, PATCH_STEP, PREPARE_STEP, CONFIGURE_STEP, BUILD_STEP, TEST_STEP,
STEP_NAMES = [FETCH_STEP, READY_STEP, EXTRACT_STEP, PATCH_STEP, PREPARE_STEP, CONFIGURE_STEP, BUILD_STEP, TEST_STEP,
INSTALL_STEP, EXTENSIONS_STEP, POSTITER_STEP, POSTPROC_STEP, SANITYCHECK_STEP, CLEANUP_STEP, MODULE_STEP,
PERMISSIONS_STEP, PACKAGE_STEP, TESTCASES_STEP]

Expand Down
4 changes: 2 additions & 2 deletions easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from easybuild.base import fancylogger # build_log should always stay there, to ensure EasyBuildLog
from easybuild.base.fancylogger import setLogLevel
from easybuild.base.generaloption import GeneralOption
from easybuild.framework.easyblock import MODULE_ONLY_STEPS, SOURCE_STEP, FETCH_STEP, EasyBlock
from easybuild.framework.easyblock import MODULE_ONLY_STEPS, EXTRACT_STEP, FETCH_STEP, EasyBlock
from easybuild.framework.easyconfig import EASYCONFIGS_PKG_SUBDIR
from easybuild.framework.easyconfig.easyconfig import HAVE_AUTOPEP8
from easybuild.framework.easyconfig.format.one import EB_FORMAT_EXTENSION
Expand Down Expand Up @@ -299,7 +299,7 @@ def basic_options(self):
'skip': ("Skip existing software (useful for installing additional packages)",
None, 'store_true', False, 'k'),
'stop': ("Stop the installation after certain step",
'choice', 'store_or_None', SOURCE_STEP, 's', all_stops),
'choice', 'store_or_None', EXTRACT_STEP, 's', all_stops),
'strict': ("Set strictness level", 'choice', 'store', WARN, strictness_options),
})

Expand Down
25 changes: 14 additions & 11 deletions test/framework/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"""
import os
import sys
import textwrap
from test.framework.utilities import EnhancedTestCase, TestLoaderFiltered, init_config
from unittest import TextTestRunner

Expand Down Expand Up @@ -280,22 +281,24 @@ def test_verify_hooks(self):
self.assertEqual(verify_hooks(hooks), None)

test_broken_hooks_pymod = os.path.join(self.test_prefix, 'test_broken_hooks.py')
test_hooks_txt = '\n'.join([
'',
'def there_is_no_such_hook():',
' pass',
'def stat_hook(self):',
' pass',
'def post_source_hook(self):',
' pass',
'def install_hook(self):',
' pass',
])
test_hooks_txt = textwrap.dedent("""
def there_is_no_such_hook():
pass
def stat_hook(self):
pass
def post_source_hook(self):
pass
def post_extract_hook(self):
pass
def install_hook(self):
pass
""")

write_file(test_broken_hooks_pymod, test_hooks_txt)

error_msg_pattern = r"Found one or more unknown hooks:\n"
error_msg_pattern += r"\* install_hook \(did you mean 'pre_install_hook', or 'post_install_hook'\?\)\n"
error_msg_pattern += r"\* post_source_hook \(did you mean .*'\?\)\n"
error_msg_pattern += r"\* stat_hook \(did you mean 'start_hook'\?\)\n"
error_msg_pattern += r"\* there_is_no_such_hook\n\n"
error_msg_pattern += r"Run 'eb --avail-hooks' to get an overview of known hooks"
Expand Down
Loading
Loading