Skip to content
Closed
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
5 changes: 4 additions & 1 deletion easybuild/tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@
UNSET = 'unset'
WARN = 'warn'

PKG_TOOL_DOCKER = 'docker'
PKG_TOOL_FPM = 'fpm'
PKG_TOOL_SINGULARITY = 'singularity'
PKG_TYPE_DEF = 'def'
PKG_TYPE_IMG = 'img'
PKG_TYPE_RPM = 'rpm'


DEFAULT_JOB_BACKEND = 'GC3Pie'
DEFAULT_LOGFILE_FORMAT = ("easybuild", "easybuild-%(name)s-%(version)s-%(date)s.%(time)s.log")
DEFAULT_MAX_FAIL_RATIO_PERMS = 0.5
Expand Down
48 changes: 46 additions & 2 deletions easybuild/tools/package/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
from vsc.utils.missing import get_subclasses
from vsc.utils.patterns import Singleton

from easybuild.tools.config import PKG_TOOL_FPM, PKG_TYPE_RPM, build_option, get_package_naming_scheme, log_path
from easybuild.tools.config import PKG_TOOL_DOCKER, PKG_TOOL_FPM, PKG_TOOL_SINGULARITY
from easybuild.tools.config import PKG_TYPE_DEF, PKG_TYPE_IMG, PKG_TYPE_RPM
from easybuild.tools.config import build_option, get_package_naming_scheme, log_path
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import change_dir, which
from easybuild.tools.package.package_naming_scheme.pns import PackageNamingScheme
Expand All @@ -66,14 +68,37 @@ def package(easyblock):
Package installed software, according to active packaging configuration settings."""
pkgtool = build_option('package_tool')

if pkgtool == PKG_TOOL_FPM:
if pkgtool == PKG_TOOL_DOCKER:
pkgdir = package_with_docker(easyblock)
elif pkgtool == PKG_TOOL_FPM:
pkgdir = package_with_fpm(easyblock)
elif pkgtool == PKG_TOOL_SINGULARITY:
pkgdir = package_with_singularity(easyblock)
else:
raise EasyBuildError("Unknown packaging tool specified: %s", pkgtool)

return pkgdir


def package_with_docker(easyblock):
"""
Package software with Docker,
i.e. either generate a container definition file, or build an actual Docker container image
(depending on the value for --package-type, 'def' or 'img')
"""
workdir = tempfile.mkdtemp(prefix='eb-pkgs-')
pkgtype = build_option('package_type')

if pkgtype == PKG_TYPE_DEF:
raise NotImplementedError
elif pkgtype == PKG_TYPE_IMG:
raise NotImplementedError
else:
raise EasyBuildError("Unknown package type '%s' for Docker", pkgtype)

return workdir


def package_with_fpm(easyblock):
"""
This function will build a package using fpm and return the directory where the packages are
Expand Down Expand Up @@ -153,6 +178,25 @@ def package_with_fpm(easyblock):
return workdir


def package_with_singularity(easyblock):
"""
Package software with Singularity,
i.e. either generate a container definition file, or build an actual Singularity container image
(depending on the value for --package-type, 'def' or 'img')
"""
workdir = tempfile.mkdtemp(prefix='eb-pkgs-')
pkgtype = build_option('package_type')

if pkgtype == PKG_TYPE_DEF:
raise NotImplementedError
elif pkgtype == PKG_TYPE_IMG:
raise NotImplementedError
else:
raise EasyBuildError("Unknown package type '%s' for Singularity", pkgtype)

return workdir


def check_pkg_support():
"""Check whether packaging is possible, if required dependencies are available."""
pkgtool = build_option('package_tool')
Expand Down