summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2014-11-01 16:56:19 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-11-03 14:12:16 -0800
commit1656f62a125232b30235da01e816a3ade4481b8a (patch)
tree1f1e057eeb7b9faf5b0a9b2081841dfd8fac31fb
parent8c8fc749be47aeb1aee74f74b7129f233afdbe51 (diff)
downloadspack-1656f62a125232b30235da01e816a3ade4481b8a.tar.gz
spack-1656f62a125232b30235da01e816a3ade4481b8a.tar.bz2
spack-1656f62a125232b30235da01e816a3ade4481b8a.tar.xz
spack-1656f62a125232b30235da01e816a3ade4481b8a.zip
Add bzip2 package and spack pkg add command.
-rw-r--r--lib/spack/spack/cmd/pkg.py17
-rw-r--r--var/spack/packages/bzip2/package.py19
2 files changed, 35 insertions, 1 deletions
diff --git a/lib/spack/spack/cmd/pkg.py b/lib/spack/spack/cmd/pkg.py
index 82ebd13ff9..da905603fa 100644
--- a/lib/spack/spack/cmd/pkg.py
+++ b/lib/spack/spack/cmd/pkg.py
@@ -37,6 +37,10 @@ def setup_parser(subparser):
sp = subparser.add_subparsers(
metavar='SUBCOMMAND', dest='pkg_command')
+ add_parser = sp.add_parser('add', help=pkg_add.__doc__)
+ add_parser.add_argument('packages', nargs=argparse.REMAINDER,
+ help="Names of packages to add to git repo.")
+
list_parser = sp.add_parser('list', help=pkg_list.__doc__)
list_parser.add_argument('rev', default='HEAD', nargs='?',
help="Revision to list packages for.")
@@ -79,6 +83,16 @@ def list_packages(rev):
return sorted(line[len(relpath):] for line in output.split('\n') if line)
+def pkg_add(args):
+ for pkg_name in args.packages:
+ filename = spack.db.filename_for_package_name(pkg_name)
+ if not os.path.isfile(filename):
+ tty.die("No such package: %s. Path does not exist:" % pkg_name, filename)
+
+ git = get_git()
+ git('-C', spack.packages_path, 'add', filename)
+
+
def pkg_list(args):
"""List packages associated with a particular spack git revision."""
colify(list_packages(args.rev))
@@ -117,7 +131,8 @@ def pkg_added(args):
def pkg(parser, args):
- action = { 'diff' : pkg_diff,
+ action = { 'add' : pkg_add,
+ 'diff' : pkg_diff,
'list' : pkg_list,
'removed' : pkg_removed,
'added' : pkg_added }
diff --git a/var/spack/packages/bzip2/package.py b/var/spack/packages/bzip2/package.py
new file mode 100644
index 0000000000..83ae88e564
--- /dev/null
+++ b/var/spack/packages/bzip2/package.py
@@ -0,0 +1,19 @@
+from spack import *
+
+class Bzip2(Package):
+ """bzip2 is a freely available, patent free high-quality data
+ compressor. It typically compresses files to within 10% to 15%
+ of the best available techniques (the PPM family of statistical
+ compressors), whilst being around twice as fast at compression
+ and six times faster at decompression."""
+ homepage = "http://www.bzip.org"
+ url = "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
+
+ version('1.0.6', '00b516f4704d4a7cb50a1d97e6e8e15b')
+
+ def install(self, spec, prefix):
+ # No configure system -- have to filter the makefile for this package.
+ filter_file(r'CC=gcc', 'CC=cc', 'Makefile', string=True)
+
+ make()
+ make("install", "PREFIX=%s" % prefix)