From d5b89b422d9cebb83aea269f46b865ba1ba88b13 Mon Sep 17 00:00:00 2001 From: Thomas Madlener Date: Fri, 13 Nov 2020 19:43:43 +0100 Subject: Add sio and add it as possible dependency for podio (#19875) Newest podio can use SIO as backend --- var/spack/repos/builtin/packages/podio/package.py | 11 ++++- var/spack/repos/builtin/packages/sio/package.py | 55 +++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 var/spack/repos/builtin/packages/sio/package.py diff --git a/var/spack/repos/builtin/packages/podio/package.py b/var/spack/repos/builtin/packages/podio/package.py index adf601306d..37b461b1d7 100644 --- a/var/spack/repos/builtin/packages/podio/package.py +++ b/var/spack/repos/builtin/packages/podio/package.py @@ -28,6 +28,9 @@ class Podio(CMakePackage): description='The build type to build', values=('Debug', 'Release')) + variant('sio', default=False, + description='Build the SIO I/O backend') + # cpack config throws an error on some systems patch('cpack.patch', when="@:0.10.0") patch('dictloading.patch', when="@0.10.0") @@ -38,9 +41,15 @@ class Podio(CMakePackage): depends_on('python', type=('build', 'run')) depends_on('py-pyyaml', type=('build', 'run')) depends_on('py-jinja2@2.10.1:', type=('build', 'run'), when='@0.12.0:') + depends_on('sio', type=('build', 'run'), when='+sio') + + conflicts('+sio', when='@:0.12', msg='sio support requires at least podio@0.13') def cmake_args(self): - args = ['-DBUILD_TESTING=%s' % self.run_tests, ] + args = [ + self.define('BUILD_TESTING', self.run_tests), + self.define_from_variants('ENABLE_SIO', 'sio') + ] return args def url_for_version(self, version): diff --git a/var/spack/repos/builtin/packages/sio/package.py b/var/spack/repos/builtin/packages/sio/package.py new file mode 100644 index 0000000000..0bcffaad44 --- /dev/null +++ b/var/spack/repos/builtin/packages/sio/package.py @@ -0,0 +1,55 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Sio(CMakePackage): + """SIO is a persistency solution for reading and writing binary data in SIO + structures called record and block. SIO has originally been implemented as + persistency layer for LCIO. + """ + + url = "https://github.com/iLCSoft/SIO/archive/v00-00-02.tar.gz" + homepage = "https://github.com/iLCSoft/SIO" + git = "https://github.com/iLCSoft/SIO.git" + + maintainers = ['vvolkl', 'tmadlener'] + + version('master', branch='master') + version('0.0.3', sha256='4c8b9c08480fb53cd10abb0e1260071a8c3f68d06a8acfd373f6560a916155cc') + version('0.0.2', sha256='e4cd2aeaeaa23c1da2c20c5c08a9b72a31b16b7a8f5aa6d480dcd561ef667657') + + def url_for_version(self, version): + """Translate version numbers to ilcsoft conventions. + in spack, the convention is: 0.1 (or 0.1.0) 0.1.1, 0.2, 0.2.1 ... + in ilcsoft, releases are dashed and padded with a leading zero + the patch version is omitted when 0 + so for example v01-12-01, v01-12 ... + + :param self: spack package class that has a url + :type self: class: `spack.PackageBase` + :param version: version + :type param: str + """ + base_url = self.url.rsplit('/', 1)[0] + + if len(version) == 1: + major = version[0] + minor, patch = 0, 0 + elif len(version) == 2: + major, minor = version + patch = 0 + else: + major, minor, patch = version + + # By now the data is normalized enough to handle it easily depending + # on the value of the patch version + if patch == 0: + version_str = 'v%02d-%02d.tar.gz' % (major, minor) + else: + version_str = 'v%02d-%02d-%02d.tar.gz' % (major, minor, patch) + + return base_url + '/' + version_str -- cgit v1.2.3-60-g2f50