summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-09-27 00:04:50 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-10-03 16:57:32 -0700
commit0fa1c5b0a54c2b64dfc431449b1ba4491b9981c0 (patch)
treedfb37aab3aeca8bc838258ad5bf90fee910a62e8
parent727d313c3052d117ec3268ccc8d3f34f1c443b1c (diff)
downloadspack-0fa1c5b0a54c2b64dfc431449b1ba4491b9981c0.tar.gz
spack-0fa1c5b0a54c2b64dfc431449b1ba4491b9981c0.tar.bz2
spack-0fa1c5b0a54c2b64dfc431449b1ba4491b9981c0.tar.xz
spack-0fa1c5b0a54c2b64dfc431449b1ba4491b9981c0.zip
Add Mercurial fetch strategy and lwm2.
-rw-r--r--lib/spack/spack/fetch_strategy.py70
-rw-r--r--var/spack/packages/lwm2/package.py18
2 files changed, 88 insertions, 0 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index 411c8cc276..ad9af43c96 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -421,6 +421,76 @@ class SvnFetchStrategy(VCSFetchStrategy):
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):
"""Given a URL, find an appropriate fetch strategy for it.
Currently just gives you a URLFetchStrategy that uses curl.
diff --git a/var/spack/packages/lwm2/package.py b/var/spack/packages/lwm2/package.py
new file mode 100644
index 0000000000..bf95c3fe12
--- /dev/null
+++ b/var/spack/packages/lwm2/package.py
@@ -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")