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

enhance Tarball easyblock to support using it for installing extensions #2688

Merged
Merged
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
18 changes: 14 additions & 4 deletions easybuild/easyblocks/generic/tarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@

import os

from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.extensioneasyblock import ExtensionEasyBlock
from easybuild.framework.easyconfig import CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import copy_dir, remove_dir
from easybuild.tools.filetools import copy_dir, extract_file, remove_dir
from easybuild.tools.run import run_cmd


class Tarball(EasyBlock):
class Tarball(ExtensionEasyBlock):
"""
Precompiled software supplied as a tarball:
- will unpack binary and copy it to the install dir
Expand All @@ -53,7 +53,7 @@ class Tarball(EasyBlock):
@staticmethod
def extra_options(extra_vars=None):
"""Extra easyconfig parameters specific to Tarball."""
extra_vars = EasyBlock.extra_options(extra=extra_vars)
extra_vars = ExtensionEasyBlock.extra_options(extra_vars=extra_vars)
extra_vars.update({
'install_type': [None, "Defaults to extract tarball into clean directory. Options: 'merge' merges tarball "
"to existing directory, 'subdir' extracts tarball into its own sub-directory", CUSTOM],
Expand All @@ -73,6 +73,16 @@ def build_step(self):
"""
pass

def run(self, *args, **kwargs):
boegel marked this conversation as resolved.
Show resolved Hide resolved
"""Install as extension: unpack sources and copy (via install step)."""
if self.cfg['install_type'] is None:
self.log.info("Auto-enabled install_type=merge because Tarball is being used to install an extension")
self.cfg['install_type'] = 'merge'
# unpack sources and call install_step to copy unpacked sources to install directory
srcdir = extract_file(self.src, self.builddir, change_into_dir=False)
kwargs['src'] = srcdir
self.install_step(*args, **kwargs)

def install_step(self, src=None):
"""Install by copying from specified source directory (or 'start_dir' if not specified)."""

Expand Down