Skip to content

Commit 770139a

Browse files
committed
Merge branch 'develop' into container_test
2 parents 9290f4a + a89b48e commit 770139a

File tree

7 files changed

+90
-65
lines changed

7 files changed

+90
-65
lines changed

easybuild/tools/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
JOB_DEPS_TYPE_ABORT_ON_ERROR = 'abort_on_error'
135135
JOB_DEPS_TYPE_ALWAYS_RUN = 'always_run'
136136

137-
DOCKER_BASE_IMAGE_UBUNTU = 'ubuntu:16.04'
137+
DOCKER_BASE_IMAGE_UBUNTU = 'ubuntu:20.04'
138138
DOCKER_BASE_IMAGE_CENTOS = 'centos:7'
139139

140140
LOCAL_VAR_NAMING_CHECK_ERROR = 'error'

easybuild/tools/containers/docker.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from easybuild.tools.containers.base import ContainerGenerator
3636
from easybuild.tools.containers.utils import det_os_deps
3737
from easybuild.tools.filetools import remove_dir
38+
from easybuild.tools.module_naming_scheme.easybuild_mns import EasyBuildMNS
3839
from easybuild.tools.run import run_cmd
3940

4041

@@ -44,9 +45,9 @@
4445
"""
4546

4647
DOCKER_INSTALL_EASYBUILD = """\
47-
RUN pip install -U pip setuptools && \\
48-
hash -r pip && \\
49-
pip install -U easybuild
48+
RUN pip3 install -U pip setuptools && \\
49+
hash -r pip3&& \\
50+
pip3 install -U easybuild
5051
5152
RUN mkdir /app && \\
5253
mkdir /scratch && \\
@@ -61,37 +62,43 @@
6162
6263
RUN set -x && \\
6364
. /usr/share/lmod/lmod/init/sh && \\
64-
eb %(eb_opts)s --installpath=/app/ --prefix=/scratch --tmpdir=/scratch/tmp
65+
eb --robot %(eb_opts)s --installpath=/app/ --prefix=/scratch --tmpdir=/scratch/tmp
6566
66-
RUN touch ${HOME}/.profile && \\
67-
echo '\\n# Added by easybuild docker packaging' >> ${HOME}/.profile && \\
68-
echo 'source /usr/share/lmod/lmod/init/bash' >> ${HOME}/.profile && \\
69-
echo 'module use %(init_modulepath)s' >> ${HOME}/.profile && \\
70-
echo 'module load %(mod_names)s' >> ${HOME}/.profile
67+
RUN touch ${HOME}/.bashrc && \\
68+
echo '' >> ${HOME}/.bashrc && \\
69+
echo '# Added by easybuild docker packaging' >> ${HOME}/.bashrc && \\
70+
echo 'source /usr/share/lmod/lmod/init/bash' >> ${HOME}/.bashrc && \\
71+
echo 'module use %(init_modulepath)s' >> ${HOME}/.bashrc && \\
72+
echo 'module load %(mod_names)s' >> ${HOME}/.bashrc
7173
7274
CMD ["/bin/bash", "-l"]
7375
"""
7476

75-
DOCKER_UBUNTU1604_INSTALL_DEPS = """\
77+
DOCKER_UBUNTU2004_INSTALL_DEPS = """\
7678
RUN apt-get update && \\
77-
apt-get install -y python python-pip lmod curl wget
79+
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip lmod \\
80+
curl wget git bzip2 gzip tar zip unzip xz-utils \\
81+
patch automake git debianutils \\
82+
g++ libdata-dump-perl libthread-queue-any-perl libssl-dev
7883
7984
RUN OS_DEPS='%(os_deps)s' && \\
80-
test -n "${OS_DEPS}" && \\
8185
for dep in ${OS_DEPS}; do apt-get -qq install ${dep} || true; done
8286
"""
8387

8488
DOCKER_CENTOS7_INSTALL_DEPS = """\
8589
RUN yum install -y epel-release && \\
86-
yum install -y python python-pip Lmod curl wget git
90+
yum install -y python3 python3-pip Lmod curl wget git \\
91+
bzip2 gzip tar zip unzip xz \\
92+
patch make git which \\
93+
gcc-c++ perl-Data-Dumper perl-Thread-Queue openssl-dev
8794
8895
RUN OS_DEPS='%(os_deps)s' && \\
8996
test -n "${OS_DEPS}" && \\
9097
yum --skip-broken install -y "${OS_DEPS}" || true
9198
"""
9299

93100
DOCKER_OS_INSTALL_DEPS_TMPLS = {
94-
DOCKER_BASE_IMAGE_UBUNTU: DOCKER_UBUNTU1604_INSTALL_DEPS,
101+
DOCKER_BASE_IMAGE_UBUNTU: DOCKER_UBUNTU2004_INSTALL_DEPS,
95102
DOCKER_BASE_IMAGE_CENTOS: DOCKER_CENTOS7_INSTALL_DEPS,
96103
}
97104

@@ -125,9 +132,12 @@ def resolve_template_data(self):
125132

126133
ec = self.easyconfigs[-1]['ec']
127134

128-
init_modulepath = os.path.join("/app/modules/all", *self.mns.det_init_modulepaths(ec))
135+
# We are using the default MNS inside the container
136+
docker_mns = EasyBuildMNS()
137+
138+
init_modulepath = os.path.join("/app/modules/all", *docker_mns.det_init_modulepaths(ec))
129139

130-
mod_names = [e['ec'].full_mod_name for e in self.easyconfigs]
140+
mod_names = [docker_mns.det_full_module_name(e['ec']) for e in self.easyconfigs]
131141

132142
eb_opts = [os.path.basename(e['spec']) for e in self.easyconfigs]
133143

easybuild/tools/containers/singularity.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,9 @@ def resolve_template_data(self):
272272
# EPEL is required for installing Lmod & python-pip
273273
'epel-release',
274274
# EasyBuild requirements
275-
'python setuptools Lmod',
276-
# pip is used to install EasyBuild packages
277-
'python-pip',
275+
'python3 setuptools Lmod',
276+
# pip3 is used to install EasyBuild packages
277+
'python3-pip',
278278
# useful utilities
279279
'bzip2 gzip tar zip unzip xz', # extracting sources
280280
'curl wget', # downloading
@@ -308,13 +308,13 @@ def resolve_template_data(self):
308308
template_data['install_os_deps'] = '\n'.join(install_os_deps)
309309

310310
# install (latest) EasyBuild in container image
311-
# use 'pip install', unless custom commands are specified via 'install_eb' keyword
311+
# use 'pip3 install', unless custom commands are specified via 'install_eb' keyword
312312
if 'install_eb' not in template_data:
313313
template_data['install_eb'] = '\n'.join([
314-
"# install EasyBuild using pip",
314+
"# install EasyBuild using pip3",
315315
# upgrade pip
316-
"pip install -U pip",
317-
"pip install easybuild",
316+
"pip3 install -U pip",
317+
"pip3 install easybuild",
318318
])
319319

320320
# if no custom value is specified for 'post_commands' keyword,

easybuild/tools/systemtools.py

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
'7z': "extracting sources (.iso)",
169169
'bunzip2': "decompressing sources (.bz2, .tbz, .tbz2, ...)",
170170
DPKG: "checking OS dependencies (Debian, Ubuntu, ...)",
171+
'git': "downloading sources using 'git clone'",
171172
'gunzip': "decompressing source files (.gz, .tgz, ...)",
172173
'make': "build tool",
173174
'patch': "applying patch files",
@@ -741,40 +742,31 @@ def get_os_version():
741742
os_version = res.group('version')
742743

743744
if os_version:
744-
if get_os_name() in ["suse", "SLES"]:
745-
746-
# SLES subversions can only be told apart based on kernel version,
747-
# see http://wiki.novell.com/index.php/Kernel_versions
748-
version_suffixes = {
749-
'11': [
750-
('2.6.27', ''),
751-
('2.6.32', '_SP1'),
752-
('3.0.101-63', '_SP4'),
753-
# not 100% correct, since early SP3 had 3.0.76 - 3.0.93, but close enough?
754-
('3.0.101', '_SP3'),
755-
# SP2 kernel versions range from 3.0.13 - 3.0.101
756-
('3.0', '_SP2'),
757-
],
758-
759-
'12': [
760-
('3.12.28', ''),
761-
('3.12.49', '_SP1'),
762-
],
763-
}
764-
745+
# older SLES subversions can only be told apart based on kernel version,
746+
# see http://wiki.novell.com/index.php/Kernel_versions
747+
sles_version_suffixes = {
748+
'11': [
749+
('2.6.27', ''),
750+
('2.6.32', '_SP1'),
751+
('3.0.101-63', '_SP4'),
752+
# not 100% correct, since early SP3 had 3.0.76 - 3.0.93, but close enough?
753+
('3.0.101', '_SP3'),
754+
# SP2 kernel versions range from 3.0.13 - 3.0.101
755+
('3.0', '_SP2'),
756+
],
757+
758+
'12': [
759+
('3.12.28', ''),
760+
('3.12.49', '_SP1'),
761+
],
762+
}
763+
if get_os_name() in ['suse', 'SLES'] and os_version in sles_version_suffixes:
765764
# append suitable suffix to system version
766-
if os_version in version_suffixes.keys():
767-
kernel_version = platform.uname()[2]
768-
known_sp = False
769-
for (kver, suff) in version_suffixes[os_version]:
770-
if kernel_version.startswith(kver):
771-
os_version += suff
772-
known_sp = True
773-
break
774-
if not known_sp:
775-
suff = '_UNKNOWN_SP'
776-
else:
777-
raise EasyBuildError("Don't know how to determine subversions for SLES %s", os_version)
765+
kernel_version = platform.uname()[2]
766+
for (kver, suff) in sles_version_suffixes[os_version]:
767+
if kernel_version.startswith(kver):
768+
os_version += suff
769+
break
778770

779771
return os_version
780772
else:

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def find_rel_test():
8484
implement support for installing particular (groups of) software packages.""",
8585
license="GPLv2",
8686
keywords="software build building installation installing compilation HPC scientific",
87-
url="https://easybuilders.github.io/easybuild",
87+
url="https://easybuild.io",
8888
packages=easybuild_packages,
8989
package_dir={'test.framework': 'test/framework'},
9090
package_data={'test.framework': find_rel_test()},
@@ -116,6 +116,7 @@ def find_rel_test():
116116
"Programming Language :: Python :: 3.7",
117117
"Programming Language :: Python :: 3.8",
118118
"Programming Language :: Python :: 3.9",
119+
"Programming Language :: Python :: 3.10",
119120
"Topic :: Software Development :: Build Tools",
120121
],
121122
platforms="Linux",

test/framework/containers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ def test_end2end_singularity_recipe_config(self):
141141
self.assertTrue(regex.search(txt), "Pattern '%s' found in: %s" % (regex.pattern, txt))
142142

143143
pip_patterns = [
144-
# EasyBuild is installed with pip by default
145-
"pip install easybuild",
144+
# EasyBuild is installed with pip3 by default
145+
"pip3 install easybuild",
146146
]
147147
post_commands_patterns = [
148148
# easybuild user is added if it doesn't exist yet
@@ -386,7 +386,7 @@ def test_end2end_dockerfile(self):
386386
base_args + ['--container-config=not-supported'],
387387
raise_error=True)
388388

389-
for cont_base in ['ubuntu:16.04', 'centos:7']:
389+
for cont_base in ['ubuntu:20.04', 'centos:7']:
390390
stdout, stderr = self.run_main(base_args + ['--container-config=%s' % cont_base])
391391
self.assertFalse(stderr)
392392
regexs = ["^== Dockerfile definition file created at %s/containers/Dockerfile.toy-0.0" % self.test_prefix]
@@ -406,11 +406,11 @@ def test_end2end_dockerfile(self):
406406
remove_file(os.path.join(self.test_prefix, 'containers', 'Dockerfile.toy-0.0'))
407407

408408
base_args.insert(1, os.path.join(test_ecs, 'g', 'GCC', 'GCC-4.9.2.eb'))
409-
self.run_main(base_args + ['--container-config=ubuntu:16.04'])
409+
self.run_main(base_args + ['--container-config=ubuntu:20.04'])
410410
def_file = read_file(os.path.join(self.test_prefix, 'containers', 'Dockerfile.toy-0.0'))
411411
regexs = [
412-
"FROM ubuntu:16.04",
413-
"eb toy-0.0.eb GCC-4.9.2.eb",
412+
"FROM ubuntu:20.04",
413+
"eb --robot toy-0.0.eb GCC-4.9.2.eb",
414414
"module load toy/0.0 GCC/4.9.2",
415415
]
416416
self.check_regexs(regexs, def_file)
@@ -435,7 +435,7 @@ def test_end2end_docker_image(self):
435435
'-C', # equivalent with --containerize
436436
'--experimental',
437437
'--container-type=docker',
438-
'--container-config=ubuntu:16.04',
438+
'--container-config=ubuntu:20.04',
439439
'--container-build-image',
440440
]
441441

test/framework/systemtools.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,10 +366,13 @@ def setUp(self):
366366
self.orig_is_readable = st.is_readable
367367
self.orig_read_file = st.read_file
368368
self.orig_run_cmd = st.run_cmd
369+
self.orig_platform_dist = st.platform.dist if hasattr(st.platform, 'dist') else None
369370
self.orig_platform_uname = st.platform.uname
370371
self.orig_get_tool_version = st.get_tool_version
371372
self.orig_sys_version_info = st.sys.version_info
372373
self.orig_HAVE_ARCHSPEC = st.HAVE_ARCHSPEC
374+
self.orig_HAVE_DISTRO = st.HAVE_DISTRO
375+
self.orig_ETC_OS_RELEASE = st.ETC_OS_RELEASE
373376
if hasattr(st, 'archspec_cpu_host'):
374377
self.orig_archspec_cpu_host = st.archspec_cpu_host
375378
else:
@@ -383,10 +386,14 @@ def tearDown(self):
383386
st.get_os_name = self.orig_get_os_name
384387
st.get_os_type = self.orig_get_os_type
385388
st.run_cmd = self.orig_run_cmd
389+
if self.orig_platform_dist is not None:
390+
st.platform.dist = self.orig_platform_dist
386391
st.platform.uname = self.orig_platform_uname
387392
st.get_tool_version = self.orig_get_tool_version
388393
st.sys.version_info = self.orig_sys_version_info
389394
st.HAVE_ARCHSPEC = self.orig_HAVE_ARCHSPEC
395+
st.HAVE_DISTRO = self.orig_HAVE_DISTRO
396+
st.ETC_OS_RELEASE = self.orig_ETC_OS_RELEASE
390397
if self.orig_archspec_cpu_host is not None:
391398
st.archspec_cpu_host = self.orig_archspec_cpu_host
392399
super(SystemToolsTest, self).tearDown()
@@ -738,6 +745,21 @@ def test_os_version(self):
738745
os_version = get_os_version()
739746
self.assertTrue(isinstance(os_version, string_type) or os_version == UNKNOWN)
740747

748+
# make sure that bug fixed in https://github.com/easybuilders/easybuild-framework/issues/3952
749+
# does not surface again, by mocking what's needed to make get_os_version fall into SLES-specific path
750+
751+
if hasattr(st.platform, 'dist'):
752+
st.platform.dist = lambda: (None, None)
753+
st.HAVE_DISTRO = False
754+
755+
st.get_os_name = lambda: 'SLES'
756+
fake_etc_os_release = os.path.join(self.test_prefix, 'os-release')
757+
write_file(fake_etc_os_release, 'VERSION="15-SP1"')
758+
st.ETC_OS_RELEASE = fake_etc_os_release
759+
760+
os_version = get_os_version()
761+
self.assertEqual(os_version, '15-SP1')
762+
741763
def test_gcc_version_native(self):
742764
"""Test getting gcc version."""
743765
gcc_version = get_gcc_version()

0 commit comments

Comments
 (0)