Add Mercurial fetch strategy and lwm2.
This commit is contained in:
parent
727d313c30
commit
0fa1c5b0a5
@ -421,6 +421,76 @@ def reset(self):
|
|||||||
self.svn('revert', '.', '-R')
|
self.svn('revert', '.', '-R')
|
||||||
|
|
||||||
|
|
||||||
|
class HgFetchStrategy(VCSFetchStrategy):
|
||||||
|
"""Fetch strategy that gets source code from a Mercurial repository.
|
||||||
|
Use like this in a package:
|
||||||
|
|
||||||
|
version('name', hg='https://jay.grs.rwth-aachen.de/hg/lwm2')
|
||||||
|
|
||||||
|
Optionally, you can provide a branch, or revision to check out, e.g.:
|
||||||
|
|
||||||
|
version('torus', hg='https://jay.grs.rwth-aachen.de/hg/lwm2', branch='torus')
|
||||||
|
|
||||||
|
You can use these three optional attributes in addition to ``hg``:
|
||||||
|
|
||||||
|
* ``branch``: Particular branch to build from (default is 'default')
|
||||||
|
* ``tag``: Particular tag to check out
|
||||||
|
* ``revision``: Particular revision hash in the repo
|
||||||
|
"""
|
||||||
|
enabled = True
|
||||||
|
required_attributes = ['hg']
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
super(HgFetchStrategy, self).__init__(
|
||||||
|
'hg', 'tag', 'branch', 'revision', **kwargs)
|
||||||
|
self._hg = None
|
||||||
|
|
||||||
|
# For git fetch branches and tags the same way.
|
||||||
|
if not self.revision:
|
||||||
|
self.revision = self.branch
|
||||||
|
if not self.revision:
|
||||||
|
self.revision = self.tag
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
def hg(self):
|
||||||
|
if not self._hg:
|
||||||
|
self._hg = which('hg', required=True)
|
||||||
|
return self._hg
|
||||||
|
|
||||||
|
|
||||||
|
def fetch(self):
|
||||||
|
assert(self.stage)
|
||||||
|
self.stage.chdir()
|
||||||
|
|
||||||
|
if self.stage.source_path:
|
||||||
|
tty.msg("Already fetched %s." % self.stage.source_path)
|
||||||
|
return
|
||||||
|
|
||||||
|
tty.msg("Trying to clone Mercurial repository: %s" % self.url)
|
||||||
|
|
||||||
|
args = ['clone', self.url]
|
||||||
|
if self.revision:
|
||||||
|
args += ['-r', self.revision]
|
||||||
|
|
||||||
|
self.hg(*args)
|
||||||
|
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
assert(self.stage)
|
||||||
|
self.stage.chdir()
|
||||||
|
|
||||||
|
scrubbed = "scrubbed-source-tmp"
|
||||||
|
args = ['clone']
|
||||||
|
if self.revision:
|
||||||
|
args += ['-r', self.revision]
|
||||||
|
args += [self.stage.source_path, scrubbed]
|
||||||
|
|
||||||
|
self.hg(*args)
|
||||||
|
shutil.rmtree(self.stage.source_path, ignore_errors=True)
|
||||||
|
shutil.move(scrubbed, self.stage.source_path)
|
||||||
|
|
||||||
|
|
||||||
def from_url(url):
|
def from_url(url):
|
||||||
"""Given a URL, find an appropriate fetch strategy for it.
|
"""Given a URL, find an appropriate fetch strategy for it.
|
||||||
Currently just gives you a URLFetchStrategy that uses curl.
|
Currently just gives you a URLFetchStrategy that uses curl.
|
||||||
|
18
var/spack/packages/lwm2/package.py
Normal file
18
var/spack/packages/lwm2/package.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from spack import *
|
||||||
|
|
||||||
|
class Lwm2(Package):
|
||||||
|
"""LWM2: Light Weight Measurement Module. This is a PMPI module
|
||||||
|
that can collect a number of time-sliced MPI and POSIX I/O
|
||||||
|
measurements from a program.
|
||||||
|
"""
|
||||||
|
homepage = "https://jay.grs.rwth-aachen.de/redmine/projects/lwm2"
|
||||||
|
|
||||||
|
version('torus', hg='https://jay.grs.rwth-aachen.de/hg/lwm2', branch='torus')
|
||||||
|
|
||||||
|
depends_on("papi")
|
||||||
|
depends_on("mpi")
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
configure("--prefix=%s" % prefix)
|
||||||
|
make()
|
||||||
|
make("install")
|
Loading…
Reference in New Issue
Block a user