resource directive : now works with all the fetch strategies available

This commit is contained in:
alalazo
2016-01-28 10:58:56 +01:00
parent 47035671e8
commit 07bb6fef01
4 changed files with 36 additions and 5 deletions

View File

@@ -296,8 +296,8 @@ def resource(pkg, **kwargs):
raise RuntimeError(message) raise RuntimeError(message)
when_spec = parse_anonymous_spec(when, pkg.name) when_spec = parse_anonymous_spec(when, pkg.name)
resources = pkg.resources.setdefault(when_spec, []) resources = pkg.resources.setdefault(when_spec, [])
fetcher = from_kwargs(**kwargs)
name = kwargs.get('name') name = kwargs.get('name')
fetcher = from_kwargs(**kwargs)
resources.append(Resource(name, fetcher, destination, placement)) resources.append(Resource(name, fetcher, destination, placement))

View File

@@ -44,6 +44,7 @@
import sys import sys
import re import re
import shutil import shutil
import copy
from functools import wraps from functools import wraps
import llnl.util.tty as tty import llnl.util.tty as tty
from llnl.util.filesystem import * from llnl.util.filesystem import *
@@ -370,8 +371,12 @@ class GitFetchStrategy(VCSFetchStrategy):
required_attributes = ('git',) required_attributes = ('git',)
def __init__(self, **kwargs): def __init__(self, **kwargs):
# Discards the keywords in kwargs that may conflict with the next call to __init__
forwarded_args = copy.copy(kwargs)
forwarded_args.pop('name', None)
super(GitFetchStrategy, self).__init__( super(GitFetchStrategy, self).__init__(
'git', 'tag', 'branch', 'commit', **kwargs) 'git', 'tag', 'branch', 'commit', **forwarded_args)
self._git = None self._git = None
@property @property
@@ -479,8 +484,12 @@ class SvnFetchStrategy(VCSFetchStrategy):
required_attributes = ['svn'] required_attributes = ['svn']
def __init__(self, **kwargs): def __init__(self, **kwargs):
# Discards the keywords in kwargs that may conflict with the next call to __init__
forwarded_args = copy.copy(kwargs)
forwarded_args.pop('name', None)
super(SvnFetchStrategy, self).__init__( super(SvnFetchStrategy, self).__init__(
'svn', 'revision', **kwargs) 'svn', 'revision', **forwarded_args)
self._svn = None self._svn = None
if self.revision is not None: if self.revision is not None:
self.revision = str(self.revision) self.revision = str(self.revision)
@@ -556,8 +565,12 @@ class HgFetchStrategy(VCSFetchStrategy):
required_attributes = ['hg'] required_attributes = ['hg']
def __init__(self, **kwargs): def __init__(self, **kwargs):
# Discards the keywords in kwargs that may conflict with the next call to __init__
forwarded_args = copy.copy(kwargs)
forwarded_args.pop('name', None)
super(HgFetchStrategy, self).__init__( super(HgFetchStrategy, self).__init__(
'hg', 'revision', **kwargs) 'hg', 'revision', **forwarded_args)
self._hg = None self._hg = None
@property @property

View File

@@ -435,7 +435,6 @@ def url_for_version(self, version):
def _make_resource_stage(self, root_stage, fetcher, resource): def _make_resource_stage(self, root_stage, fetcher, resource):
resource_stage_folder = self._resource_stage(resource) resource_stage_folder = self._resource_stage(resource)
# FIXME : works only for URLFetchStrategy
resource_mirror = join_path(self.name, os.path.basename(fetcher.url)) resource_mirror = join_path(self.name, os.path.basename(fetcher.url))
stage = ResourceStage(resource.fetcher, root=root_stage, resource=resource, stage = ResourceStage(resource.fetcher, root=root_stage, resource=resource,
name=resource_stage_folder, mirror_path=resource_mirror) name=resource_stage_folder, mirror_path=resource_mirror)

View File

@@ -171,6 +171,25 @@ class Llvm(Package):
when='@%(version)s' % release, when='@%(version)s' % release,
placement=resources[name].get('placement', None)) placement=resources[name].get('placement', None))
# SVN - current develop
version('develop', svn='http://llvm.org/svn/llvm-project/llvm/trunk')
resource(name='clang', svn='http://llvm.org/svn/llvm-project/cfe/trunk',
destination='tools', when='@develop', placement='clang')
resource(name='compiler-rt', svn='http://llvm.org/svn/llvm-project/compiler-rt/trunk',
destination='projects', when='@develop', placement='compiler-rt')
resource(name='openmp', svn='http://llvm.org/svn/llvm-project/openmp/trunk',
destination='projects', when='@develop', placement='openmp')
resource(name='libcxx', svn='http://llvm.org/svn/llvm-project/libcxx/trunk',
destination='projects', when='@develop', placement='libcxx')
resource(name='libcxxabi', svn='http://llvm.org/svn/llvm-project/libcxxabi/trunk',
destination='projects', when='@develop', placement='libcxxabi')
resource(name='polly', svn='http://llvm.org/svn/llvm-project/polly/trunk',
destination='tools', when='@develop', placement='polly')
resource(name='lldb', svn='http://llvm.org/svn/llvm-project/lldb/trunk',
destination='tools', when='@develop', placement='lldb')
def install(self, spec, prefix): def install(self, spec, prefix):
env['CXXFLAGS'] = self.compiler.cxx11_flag env['CXXFLAGS'] = self.compiler.cxx11_flag
cmake_args = [ arg for arg in std_cmake_args if 'BUILD_TYPE' not in arg ] cmake_args = [ arg for arg in std_cmake_args if 'BUILD_TYPE' not in arg ]