resource directive : now works with all the fetch strategies available
This commit is contained in:
		@@ -296,8 +296,8 @@ def resource(pkg, **kwargs):
 | 
			
		||||
        raise RuntimeError(message)
 | 
			
		||||
    when_spec = parse_anonymous_spec(when, pkg.name)
 | 
			
		||||
    resources = pkg.resources.setdefault(when_spec, [])
 | 
			
		||||
    fetcher = from_kwargs(**kwargs)
 | 
			
		||||
    name = kwargs.get('name')
 | 
			
		||||
    fetcher = from_kwargs(**kwargs)
 | 
			
		||||
    resources.append(Resource(name, fetcher, destination, placement))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,7 @@
 | 
			
		||||
import sys
 | 
			
		||||
import re
 | 
			
		||||
import shutil
 | 
			
		||||
import copy
 | 
			
		||||
from functools import wraps
 | 
			
		||||
import llnl.util.tty as tty
 | 
			
		||||
from llnl.util.filesystem import *
 | 
			
		||||
@@ -370,8 +371,12 @@ class GitFetchStrategy(VCSFetchStrategy):
 | 
			
		||||
    required_attributes = ('git',)
 | 
			
		||||
 | 
			
		||||
    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__(
 | 
			
		||||
                'git', 'tag', 'branch', 'commit', **kwargs)
 | 
			
		||||
                'git', 'tag', 'branch', 'commit', **forwarded_args)
 | 
			
		||||
        self._git = None
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
@@ -479,8 +484,12 @@ class SvnFetchStrategy(VCSFetchStrategy):
 | 
			
		||||
    required_attributes = ['svn']
 | 
			
		||||
 | 
			
		||||
    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__(
 | 
			
		||||
                'svn', 'revision', **kwargs)
 | 
			
		||||
                'svn', 'revision', **forwarded_args)
 | 
			
		||||
        self._svn = None
 | 
			
		||||
        if self.revision is not None:
 | 
			
		||||
            self.revision = str(self.revision)
 | 
			
		||||
@@ -556,8 +565,12 @@ class HgFetchStrategy(VCSFetchStrategy):
 | 
			
		||||
    required_attributes = ['hg']
 | 
			
		||||
 | 
			
		||||
    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__(
 | 
			
		||||
                'hg', 'revision', **kwargs)
 | 
			
		||||
                'hg', 'revision', **forwarded_args)
 | 
			
		||||
        self._hg = None
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
 
 | 
			
		||||
@@ -435,7 +435,6 @@ def url_for_version(self, version):
 | 
			
		||||
 | 
			
		||||
    def _make_resource_stage(self, root_stage, fetcher, resource):
 | 
			
		||||
        resource_stage_folder = self._resource_stage(resource)
 | 
			
		||||
        # FIXME : works only for URLFetchStrategy
 | 
			
		||||
        resource_mirror = join_path(self.name, os.path.basename(fetcher.url))
 | 
			
		||||
        stage = ResourceStage(resource.fetcher, root=root_stage, resource=resource,
 | 
			
		||||
                              name=resource_stage_folder, mirror_path=resource_mirror)
 | 
			
		||||
 
 | 
			
		||||
@@ -171,6 +171,25 @@ class Llvm(Package):
 | 
			
		||||
                     when='@%(version)s' % release,
 | 
			
		||||
                     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):
 | 
			
		||||
        env['CXXFLAGS'] = self.compiler.cxx11_flag
 | 
			
		||||
        cmake_args = [ arg for arg in std_cmake_args if 'BUILD_TYPE' not in arg ]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user