Skip to content

Commit

Permalink
Merge pull request #5 from boegel/feature_package_step_w_fpm
Browse files Browse the repository at this point in the history
cleanup of support for packaging + kickstart unit tests related to packaging support
  • Loading branch information
rjeschmi committed Jul 8, 2015
2 parents 76bb33a + d5abf40 commit 4466188
Show file tree
Hide file tree
Showing 7 changed files with 244 additions and 133 deletions.
20 changes: 7 additions & 13 deletions easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@
from easybuild.framework.easyconfig.templates import template_documentation
from easybuild.framework.easyconfig.tools import get_paths_for
from easybuild.framework.extension import Extension
from easybuild.tools import build_log, config, run # @UnusedImport make sure config is always initialized!
from easybuild.tools import build_log, config, run # build_log should always stay there, to ensure EasyBuildLog
from easybuild.tools.build_log import EasyBuildError, raise_easybuilderror
from easybuild.tools.config import DEFAULT_LOGFILE_FORMAT, DEFAULT_MNS, DEFAULT_MODULE_SYNTAX, DEFAULT_MODULES_TOOL
from easybuild.tools.config import DEFAULT_MODULECLASSES, DEFAULT_PATH_SUBDIRS
from easybuild.tools.config import DEFAULT_PREFIX, DEFAULT_REPOSITORY
from easybuild.tools.config import DEFAULT_MODULECLASSES, DEFAULT_PATH_SUBDIRS, DEFAULT_PREFIX, DEFAULT_REPOSITORY
from easybuild.tools.config import DEFAULT_STRICT, get_pretend_installpath, mk_full_default_path
from easybuild.tools.configobj import ConfigObj, ConfigObjError
from easybuild.tools.docs import FORMAT_RST, FORMAT_TXT, avail_easyconfig_params
Expand All @@ -63,9 +62,7 @@
from easybuild.tools.module_naming_scheme.utilities import avail_module_naming_schemes
from easybuild.tools.modules import Lmod
from easybuild.tools.ordereddict import OrderedDict
import easybuild.tools.package.utilities as packaging
from easybuild.tools.package.utilities import DEFAULT_PNS
from easybuild.tools.package.activepns import avail_package_naming_scheme
from easybuild.tools.package.utilities import DEFAULT_PNS, avail_package_naming_schemes, check_pkg_support
from easybuild.tools.toolchain.utilities import search_toolchain
from easybuild.tools.repository.repository import avail_repositories
from easybuild.tools.version import this_is_easybuild
Expand Down Expand Up @@ -267,7 +264,7 @@ def config_options(self):
'packagepath': ("The destination path for the packages built by package-tool",
None, 'store', mk_full_default_path('packagepath')),
'package-naming-scheme': ("Packaging naming scheme choice",
'choice', 'store', DEFAULT_PNS, sorted(avail_package_naming_scheme().keys())),
'choice', 'store', DEFAULT_PNS, sorted(avail_package_naming_schemes().keys())),
'prefix': (("Change prefix for buildpath, installpath, sourcepath and repositorypath "
"(used prefix for defaults %s)" % DEFAULT_PREFIX),
None, 'store', None),
Expand Down Expand Up @@ -472,15 +469,12 @@ def postprocess(self):

self._postprocess_config()

#Check experimental option dependencies (for now packaging)
#print "Got config_options: %s" % packaging.config_options
package_options = [ getattr(self.options, x) for x in packaging.config_options if getattr(self.options, x) ]
if any( package_options ):
packaging.option_postprocess()
# check whether packaging is supported when it's being used
if any([self.options.package_tool, self.options.package_type]):
check_pkg_support()
else:
self.log.debug("Didn't find any packaging options")


def _postprocess_external_modules_metadata(self):
"""Parse file(s) specifying metadata for external modules."""
# leave external_modules_metadata untouched if no files are provided
Expand Down
50 changes: 0 additions & 50 deletions easybuild/tools/package/activepns.py

This file was deleted.

34 changes: 28 additions & 6 deletions easybuild/tools/package/packaging_naming_scheme/easybuild_pns.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@



##
# Copyright 2015-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (http://www.herculesstichting.be/in_English)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# http://github.com/hpcugent/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
Default implementation of the EasyBuild packaging naming scheme
Implementation of the EasyBuild packaging naming scheme
@author: Rob Schmidt (Ottawa Hospital Research Institute)
@author: Robert Schmidt (Ottawa Hospital Research Institute)
@author: Kenneth Hoste (Ghent University)
"""

Expand All @@ -17,6 +38,7 @@ class EasyBuildPNS(PackagingNamingScheme):
REQUIRED_KEYS = ['name', 'version', 'versionsuffix', 'toolchain']

def name(self, ec):
"""Determine package name"""
self.log.debug("easyconfig dict for name looks like %s " % ec )
name_template = "eb%(eb_ver)s-%(name)s-%(version)s-%(toolchain)s"
pkg_name = name_template % {
Expand All @@ -28,10 +50,10 @@ def name(self, ec):
return pkg_name

def _toolchain(self, ec):
"""Determine toolchain"""
toolchain_template = "%(toolchain_name)s-%(toolchain_version)s"
pkg_toolchain = toolchain_template % {
'toolchain_name': ec['toolchain']['name'],
'toolchain_version': ec['toolchain']['version'],
}
return pkg_toolchain

57 changes: 42 additions & 15 deletions easybuild/tools/package/packaging_naming_scheme/pns.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,55 @@

##
# Copyright 2015-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (http://www.herculesstichting.be/in_English)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# http://github.com/hpcugent/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##

"""
General package naming scheme.
@author: Robert Schmidt (Ottawa Hospital Research Institute)
@author: Kenneth Hoste (Ghent University)
"""
from vsc.utils import fancylogger
from easybuild.tools.config import build_option
from easybuild.tools.version import VERSION as EASYBUILD_VERSION
options = [ "package-naming-name-template", "package-naming-version-template", "package-naming-toolchain-template" ]

class PackagingNamingScheme(object):
"""Abstract class for package naming scheme"""

class PackagingNamingScheme(object):
"""Abstract class for package naming schemes"""

def __init__(self, *args, **kwargs):
def __init__(self):
"""initialize logger."""
self.log = fancylogger.getLogger(self.__class__.__name__, fname=False)
self.eb_ver = EASYBUILD_VERSION

def name(self,ec):
"""Return name of the package, by default would include name, version, toolchain"""
def name(self, ec):
"""Determine package name"""
raise NotImplementedError

def version(self,ec):
"""The version in the version part of the package"""
return ec['version']

def release(self,ec=None):
"""Just the release"""
return build_option('package_release')

def version(self, ec):
"""Determine package version"""
return ec['version']

def release(self, ec=None):
"""Determine package release"""
return build_option('package_release')
Loading

0 comments on commit 4466188

Please sign in to comment.