Skip to content

Commit 638e498

Browse files
committed
Merge branch 'develop' into 5.0.x
2 parents 083076c + 02ed943 commit 638e498

File tree

12 files changed

+228
-43
lines changed

12 files changed

+228
-43
lines changed

easybuild/toolchains/ifbf.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
##
2+
# Copyright 2012-2023 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8+
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# https://github.com/easybuilders/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
25+
"""
26+
EasyBuild support for ifbf toolchain (includes Intel compilers, FlexiBLAS, and FFTW).
27+
28+
Authors:
29+
30+
* Sebastian Achilles (Juelich Supercomputing Centre)
31+
"""
32+
33+
from easybuild.toolchains.intel_compilers import IntelCompilersToolchain
34+
from easybuild.toolchains.fft.fftw import Fftw
35+
from easybuild.toolchains.linalg.flexiblas import FlexiBLAS
36+
37+
38+
class Ifbf(IntelCompilersToolchain, FlexiBLAS, Fftw):
39+
"""
40+
Compiler toolchain with Intel compilers, FlexiBLAS, and FFTW
41+
"""
42+
NAME = 'ifbf'
43+
SUBTOOLCHAIN = IntelCompilersToolchain.NAME
44+
OPTIONAL = True

easybuild/toolchains/iofbf.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
##
2+
# Copyright 2012-2023 Ghent University
3+
#
4+
# This file is part of EasyBuild,
5+
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
6+
# with support of Ghent University (http://ugent.be/hpc),
7+
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
8+
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
9+
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
10+
#
11+
# https://github.com/easybuilders/easybuild
12+
#
13+
# EasyBuild is free software: you can redistribute it and/or modify
14+
# it under the terms of the GNU General Public License as published by
15+
# the Free Software Foundation v2.
16+
#
17+
# EasyBuild is distributed in the hope that it will be useful,
18+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
# GNU General Public License for more details.
21+
#
22+
# You should have received a copy of the GNU General Public License
23+
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
24+
##
25+
"""
26+
EasyBuild support for iofbf toolchain (includes Intel compilers, OpenMPI,
27+
FlexiBLAS, LAPACK, ScaLAPACK and FFTW).
28+
29+
Authors:
30+
31+
* Sebastian Achilles (Juelich Supercomputing Centre)
32+
"""
33+
34+
from easybuild.toolchains.iompi import Iompi
35+
from easybuild.toolchains.ifbf import Ifbf
36+
from easybuild.toolchains.fft.fftw import Fftw
37+
from easybuild.toolchains.linalg.flexiblas import FlexiBLAS
38+
from easybuild.toolchains.linalg.scalapack import ScaLAPACK
39+
40+
41+
class Iofbf(Iompi, FlexiBLAS, ScaLAPACK, Fftw):
42+
"""
43+
Compiler toolchain with Intel compilers (icc/ifort), OpenMPI,
44+
FlexiBLAS, LAPACK, ScaLAPACK and FFTW.
45+
"""
46+
NAME = 'iofbf'
47+
SUBTOOLCHAIN = [Iompi.NAME, Ifbf.NAME]

easybuild/tools/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX):
300300
'sequential',
301301
'set_default_module',
302302
'set_gid_bit',
303+
'silence_hook_trigger',
303304
'skip_extensions',
304305
'skip_test_cases',
305306
'skip_test_step',

easybuild/tools/filetools.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,6 +2591,8 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
25912591
recursive = git_config.pop('recursive', False)
25922592
clone_into = git_config.pop('clone_into', False)
25932593
keep_git_dir = git_config.pop('keep_git_dir', False)
2594+
extra_config_params = git_config.pop('extra_config_params', None)
2595+
recurse_submodules = git_config.pop('recurse_submodules', None)
25942596

25952597
# input validation of git_config dict
25962598
if git_config:
@@ -2616,7 +2618,11 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
26162618
targetpath = os.path.join(targetdir, filename)
26172619

26182620
# compose 'git clone' command, and run it
2619-
clone_cmd = ['git', 'clone']
2621+
if extra_config_params:
2622+
git_cmd = 'git ' + ' '.join(['-c %s' % param for param in extra_config_params])
2623+
else:
2624+
git_cmd = 'git'
2625+
clone_cmd = [git_cmd, 'clone']
26202626

26212627
if not keep_git_dir and not commit:
26222628
# Speed up cloning by only fetching the most recent commit, not the whole history
@@ -2627,6 +2633,8 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
26272633
clone_cmd.extend(['--branch', tag])
26282634
if recursive:
26292635
clone_cmd.append('--recursive')
2636+
if recurse_submodules:
2637+
clone_cmd.extend(["--recurse-submodules='%s'" % pat for pat in recurse_submodules])
26302638
else:
26312639
# checkout is done separately below for specific commits
26322640
clone_cmd.append('--no-checkout')
@@ -2646,17 +2654,22 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
26462654

26472655
# if a specific commit is asked for, check it out
26482656
if commit:
2649-
checkout_cmd = ['git', 'checkout', commit]
2650-
if recursive:
2651-
checkout_cmd.extend(['&&', 'git', 'submodule', 'update', '--init', '--recursive'])
2657+
checkout_cmd = [git_cmd, 'checkout', commit]
2658+
2659+
if recursive or recurse_submodules:
2660+
checkout_cmd.extend(['&&', git_cmd, 'submodule', 'update', '--init'])
2661+
if recursive:
2662+
checkout_cmd.append('--recursive')
2663+
if recurse_submodules:
2664+
checkout_cmd.extend(["--recurse-submodules='%s'" % pat for pat in recurse_submodules])
26522665

26532666
work_dir = os.path.join(tmpdir, repo_name) if repo_name else tmpdir
26542667
run_shell_cmd(' '.join(checkout_cmd), work_dir=work_dir, hidden=True, verbose_dry_run=True)
26552668

26562669
elif not build_option('extended_dry_run'):
26572670
# If we wanted to get a tag make sure we actually got a tag and not a branch with the same name
26582671
# This doesn't make sense in dry-run mode as we don't have anything to check
2659-
cmd = "git describe --exact-match --tags HEAD"
2672+
cmd = f"{git_cmd} describe --exact-match --tags HEAD"
26602673
work_dir = os.path.join(tmpdir, repo_name) if repo_name else tmpdir
26612674
res = run_shell_cmd(cmd, fail_on_error=False, work_dir=work_dir, hidden=True, verbose_dry_run=True)
26622675

@@ -2671,13 +2684,17 @@ def get_source_tarball_from_git(filename, targetdir, git_config):
26712684
# make the repo unshallow first;
26722685
# this is equivalent with 'git fetch -unshallow' in Git 1.8.3+
26732686
# (first fetch seems to do nothing, unclear why)
2674-
cmds.append("git fetch --depth=2147483647 && git fetch --depth=2147483647")
2687+
cmds.append(f"{git_cmd} fetch --depth=2147483647 && git fetch --depth=2147483647")
26752688

2676-
cmds.append(f"git checkout refs/tags/{tag}")
2689+
cmds.append(f"{git_cmd} checkout refs/tags/{tag}")
26772690
# Clean all untracked files, e.g. from left-over submodules
2678-
cmds.append("git clean --force -d -x")
2691+
cmds.append(f"{git_cmd} clean --force -d -x")
26792692
if recursive:
2680-
cmds.append("git submodule update --init --recursive")
2693+
cmds.append(f"{git_cmd} submodule update --init --recursive")
2694+
elif recurse_submodules:
2695+
cmds.append(f"{git_cmd} submodule update --init ")
2696+
cmds[-1] += ' '.join(["--recurse-submodules='%s'" % pat for pat in recurse_submodules])
2697+
26812698
for cmd in cmds:
26822699
run_shell_cmd(cmd, work_dir=work_dir, hidden=True, verbose_dry_run=True)
26832700

easybuild/tools/github.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,15 +2251,18 @@ def install_github_token(github_user, silent=False):
22512251
def validate_github_token(token, github_user):
22522252
"""
22532253
Check GitHub token:
2254-
* see if it conforms expectations (only [a-f]+[0-9] characters, length of 40)
2255-
* see if it can be used for authenticated access
2254+
* see if it conforms expectations (classic GitHub token with only [0-9a-f] characters
2255+
and length of 40 starting with 'ghp_', or fine-grained GitHub token with only
2256+
alphanumeric ([a-zA-Z0-9]) characters + '_' and length of 93 starting with 'github_pat_'),
2257+
* see if it can be used for authenticated access.
22562258
"""
22572259
# cfr. https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats/
22582260
token_regex = re.compile('^ghp_[a-zA-Z0-9]{36}$')
22592261
token_regex_old_format = re.compile('^[0-9a-f]{40}$')
2262+
# https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-authentication-to-github#githubs-token-formats
2263+
token_regex_fine_grained = re.compile('github_pat_[a-zA-Z0-9_]{82}')
22602264

2261-
# token should be 40 characters long, and only contain characters in [0-9a-f]
2262-
sanity_check = bool(token_regex.match(token))
2265+
sanity_check = bool(token_regex.match(token)) or bool(token_regex_fine_grained.match(token))
22632266
if sanity_check:
22642267
_log.info("Sanity check on token passed")
22652268
else:

easybuild/tools/hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def run_hook(label, hooks, pre_step_hook=False, post_step_hook=False, args=None,
241241

242242
if msg is None:
243243
msg = "Running %s hook..." % label
244-
if build_option('debug'):
244+
if build_option('debug') and not build_option('silence_hook_trigger'):
245245
print_msg(msg)
246246

247247
_log.info("Running '%s' hook function (args: %s, keyword args: %s)...", hook.__name__, args, kwargs)

easybuild/tools/module_generator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,8 @@ def _generate_extensions_list(self):
621621
"""
622622
Generate a list of all extensions in name/version format
623623
"""
624-
return self.app.make_extension_string(name_version_sep='/', ext_sep=',').split(',')
624+
exts_str = self.app.make_extension_string(name_version_sep='/', ext_sep=',')
625+
return exts_str.split(',') if exts_str else []
625626

626627
def _generate_help_text(self):
627628
"""

easybuild/tools/options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,8 @@ def override_options(self):
495495
'silence-deprecation-warnings': (
496496
"Silence specified deprecation warnings out of (%s)" % ', '.join(all_deprecations),
497497
'strlist', 'extend', []),
498+
'silence-hook-trigger': ("Supress printing of debug message every time a hook is triggered",
499+
None, 'store_true', False),
498500
'skip-extensions': ("Skip installation of extensions", None, 'store_true', False),
499501
'skip-test-cases': ("Skip running test cases", None, 'store_true', False, 't'),
500502
'skip-test-step': ("Skip running the test step (e.g. unit tests)", None, 'store_true', False),

test/framework/filetools.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2815,6 +2815,32 @@ def run_check():
28152815
]) % git_repo
28162816
run_check()
28172817

2818+
git_config['recurse_submodules'] = ['!vcflib', '!sdsl-lite']
2819+
expected = '\n'.join([
2820+
' running command "git clone --depth 1 --branch tag_for_tests --recursive'
2821+
+ ' --recurse-submodules=\'!vcflib\' --recurse-submodules=\'!sdsl-lite\' %(git_repo)s"',
2822+
r" \(in .*/tmp.*\)",
2823+
r' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"',
2824+
r" \(in .*/tmp.*\)",
2825+
]) % git_repo
2826+
run_check()
2827+
2828+
git_config['extra_config_params'] = [
2829+
'submodule."fastahack".active=false',
2830+
'submodule."sha1".active=false',
2831+
]
2832+
expected = '\n'.join([
2833+
' running command "git -c submodule."fastahack".active=false -c submodule."sha1".active=false'
2834+
+ ' clone --depth 1 --branch tag_for_tests --recursive'
2835+
+ ' --recurse-submodules=\'!vcflib\' --recurse-submodules=\'!sdsl-lite\' %(git_repo)s"',
2836+
r" \(in .*/tmp.*\)",
2837+
r' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"',
2838+
r" \(in .*/tmp.*\)",
2839+
]) % git_repo
2840+
run_check()
2841+
del git_config['recurse_submodules']
2842+
del git_config['extra_config_params']
2843+
28182844
git_config['keep_git_dir'] = True
28192845
expected = '\n'.join([
28202846
r' running command "git clone --branch tag_for_tests --recursive %(git_repo)s"',
@@ -2837,7 +2863,20 @@ def run_check():
28372863
]) % git_repo
28382864
run_check()
28392865

2866+
git_config['recurse_submodules'] = ['!vcflib', '!sdsl-lite']
2867+
expected = '\n'.join([
2868+
r' running command "git clone --no-checkout %(git_repo)s"',
2869+
r" \(in .*/tmp.*\)",
2870+
' running command "git checkout 8456f86 && git submodule update --init --recursive'
2871+
+ ' --recurse-submodules=\'!vcflib\' --recurse-submodules=\'!sdsl-lite\'"',
2872+
r" \(in /.*/testrepository\)",
2873+
r' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"',
2874+
r" \(in .*/tmp.*\)",
2875+
]) % git_repo
2876+
run_check()
2877+
28402878
del git_config['recursive']
2879+
del git_config['recurse_submodules']
28412880
expected = '\n'.join([
28422881
r' running command "git clone --no-checkout %(git_repo)s"',
28432882
r" \(in /.*\)",

test/framework/github.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,11 @@ def test_validate_github_token(self):
655655
if token_old_format:
656656
self.assertTrue(gh.validate_github_token(token_old_format, GITHUB_TEST_ACCOUNT))
657657

658+
# if a fine-grained token is available, test with that too
659+
finegrained_token = os.getenv('TEST_GITHUB_TOKEN_FINEGRAINED')
660+
if finegrained_token:
661+
self.assertTrue(gh.validate_github_token(finegrained_token, GITHUB_TEST_ACCOUNT))
662+
658663
def test_github_find_easybuild_easyconfig(self):
659664
"""Test for find_easybuild_easyconfig function"""
660665
if self.skip_github_tests:

0 commit comments

Comments
 (0)