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

add Arch Linux compatibility for OS dependency resolution #4116

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 18 additions & 1 deletion easybuild/framework/easyconfig/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

from easybuild.base import fancylogger
from easybuild.tools.build_log import print_warning
from easybuild.tools.systemtools import KNOWN_ARCH_CONSTANTS, get_os_name, get_os_type, get_os_version
from easybuild.tools.systemtools import ARCH_DISTROS, KNOWN_ARCH_CONSTANTS, get_os_name, get_os_type, get_os_version


_log = fancylogger.getLogger('easyconfig.constants', fname=False)
Expand Down Expand Up @@ -88,3 +88,20 @@ def _get_arch_constant():
# Add EasyConfig constants to export list
globals().update({name: value for name, (value, _) in EASYCONFIG_CONSTANTS.items()})
__all__ = ['EXTERNAL_MODULE_MARKER', 'EASYCONFIG_CONSTANTS'] + list(EASYCONFIG_CONSTANTS.keys())

# Add EasyConfig constants to export list
globals().update({name: value for name, (value, _) in EASYCONFIG_CONSTANTS.items()})
__all__ = ['EXTERNAL_MODULE_MARKER', 'EASYCONFIG_CONSTANTS'] + list(EASYCONFIG_CONSTANTS.keys())

# package names for openssl-dev, pam-devel, and rdma-core-devel do not include the devel suffix on arch distros.
# simply adding the arch names to the tuples below would falsely satisfy the dependencies on some non-arch distros,
# so we need to explicitly define them separately.
# to accomodate other arch_distros, simply add to the arch_distros list
os_name = get_os_name()
if os_name in ARCH_DISTROS:
EASYCONFIG_CONSTANTS['OS_PKG_IBVERBS_DEV'] = (('rdma-core'),
"OS packages providing ibverbs/infiniband development support")
EASYCONFIG_CONSTANTS['OS_PKG_OPENSSL_LIB'] = (('openssl'),
"OS packages providing openSSL libraries")
EASYCONFIG_CONSTANTS['OS_PKG_PAM_DEV'] = (('pam'),
"OS packages providing PAM developement support")
21 changes: 21 additions & 0 deletions easybuild/tools/systemtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
RPM = 'rpm'
DPKG = 'dpkg'
ZYPPER = 'zypper'
PACMAN = 'pacman'

SYSTEM_TOOLS = {
'7z': "extracting sources (.iso)",
Expand Down Expand Up @@ -215,6 +216,9 @@
'setuptools': ('pkg_resources', "obtaining information on Python packages via pkg_resources module"),
}

# arch-based linux distros (might require tweaks to package names)
ARCH_DISTROS = ['arch', 'manjaro']


class SystemToolsException(Exception):
"""raised when systemtools fails"""
Expand Down Expand Up @@ -847,13 +851,30 @@ def check_os_dependency(dep):
'redhat': RPM,
'rhel': RPM,
'ubuntu': DPKG,
'arch': PACMAN,
'manjaro': PACMAN,
}
pkg_cmd_flag = {
DPKG: '-s',
RPM: '-q',
ZYPPER: 'search -i',
PACMAN: '-Q'
}
os_name = get_os_name().lower().split(' ')[0]

# to accomodate arch package naming conventions
# these are explicitly defined in case the corresponding easyconfig constant was not used
ssl_deps = ['libssl', 'libopenssl', 'openssl-devel', 'libssl-dev', 'libopenssl-devel']
ibvers_deps = ['libibverbs-dev', 'libibverbs-devel', 'rdma-core-devel']
pam_deps = ['pam-devel', 'libpam0g-dev']
if os_name in ARCH_DISTROS:
if dep in ssl_deps:
dep = 'openssl'
elif dep in ibvers_deps:
dep = 'rdma-core'
elif dep in pam_deps:
dep = 'pam'

if os_name in os_to_pkg_cmd_map:
pkg_cmds = [os_to_pkg_cmd_map[os_name]]
else:
Expand Down