diff options
-rwxr-xr-x | bin/spack | 3 | ||||
-rw-r--r-- | lib/spack/spack/__init__.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/cmd/install.py | 6 | ||||
-rw-r--r-- | lib/spack/spack/cmd/uninstall.py | 3 | ||||
-rw-r--r-- | lib/spack/spack/directory_layout.py | 31 | ||||
-rw-r--r-- | lib/spack/spack/hooks/__init__.py | 5 | ||||
-rw-r--r-- | lib/spack/spack/package.py | 20 | ||||
-rw-r--r-- | lib/spack/spack/packages.py | 3 | ||||
-rw-r--r-- | var/spack/packages/extrae/package.py | 10 | ||||
-rw-r--r-- | var/spack/packages/gperftools/package.py | 38 |
10 files changed, 94 insertions, 27 deletions
@@ -25,7 +25,8 @@ ############################################################################## import sys if not sys.version_info[:2] >= (2,6): - sys.exit("Spack requires Python 2.6. Version was %s." % sys.version_info) + v_info = sys.version_info[:3] + sys.exit("Spack requires Python 2.6 or higher. This is Python %d.%d.%d." % v_info) import os diff --git a/lib/spack/spack/__init__.py b/lib/spack/spack/__init__.py index da7088640f..6697e00e40 100644 --- a/lib/spack/spack/__init__.py +++ b/lib/spack/spack/__init__.py @@ -26,7 +26,7 @@ import os import tempfile from llnl.util.filesystem import * -# This lives in $prefix/lib/spac/spack/__file__ +# This lives in $prefix/lib/spack/spack/__file__ prefix = ancestor(__file__, 4) # The spack script itself diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index 2374d02feb..2c2deb2803 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -44,6 +44,9 @@ def setup_parser(subparser): '-n', '--no-checksum', action='store_true', dest='no_checksum', help="Do not check packages against checksum") subparser.add_argument( + '--fake', action='store_true', dest='fake', + help="Fake install. Just remove the prefix and touch a fake file in it.") + subparser.add_argument( 'packages', nargs=argparse.REMAINDER, help="specs of packages to install") @@ -59,4 +62,5 @@ def install(parser, args): package = spack.db.get(spec) package.do_install(keep_prefix=args.keep_prefix, keep_stage=args.keep_stage, - ignore_deps=args.ignore_deps) + ignore_deps=args.ignore_deps, + fake=args.fake) diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py index 84eb4703a6..e787c460ad 100644 --- a/lib/spack/spack/cmd/uninstall.py +++ b/lib/spack/spack/cmd/uninstall.py @@ -72,13 +72,12 @@ def uninstall(parser, args): for s in matching_specs: try: # should work if package is known to spack - pkgs.append(spack.db.get(s)) + pkgs.append(s.package) except spack.packages.UnknownPackageError, e: # The package.py file has gone away -- but still want to uninstall. spack.Package(s).do_uninstall(force=True) - # Sort packages to be uninstalled by the number of installed dependents # This ensures we do things in the right order def num_installed_deps(pkg): diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index 9b31aad5fe..42cac0c9d2 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -157,19 +157,24 @@ class SpecHashDirectoryLayout(DirectoryLayout): # Specs from files are assumed normal and concrete spec = Spec(spec_file.read().replace('\n', '')) - # If we do not have a package on hand for this spec, we know - # it is concrete, and we *assume* that it is normal. This - # prevents us from trying to fetch a non-existing package, and - # allows best effort for commands like spack find. - if not spack.db.exists(spec.name): - spec._normal = True - spec._concrete = True - else: - spec.normalize() - if not spec.concrete: - tty.warn("Spec read from installed package is not concrete:", - path, spec) - + if all(spack.db.exists(s.name) for s in spec.traverse()): + copy = spec.copy() + copy.normalize() + if copy.concrete: + return copy # These are specs spack still understands. + + # If we get here, either the spec is no longer in spack, or + # something about its dependencies has changed. So we need to + # just assume the read spec is correct. We'll lose graph + # information if we do this, but this is just for best effort + # for commands like uninstall and find. Currently Spack + # doesn't do anything that needs the graph info after install. + + # TODO: store specs with full connectivity information, so + # that we don't have to normalize or reconstruct based on + # changing dependencies in the Spack tree. + spec._normal = True + spec._concrete = True return spec diff --git a/lib/spack/spack/hooks/__init__.py b/lib/spack/spack/hooks/__init__.py index 4f0d574e49..98b7f2323f 100644 --- a/lib/spack/spack/hooks/__init__.py +++ b/lib/spack/spack/hooks/__init__.py @@ -47,8 +47,11 @@ import spack def all_hook_modules(): modules = [] for name in list_modules(spack.hooks_path): + mod_name = __name__ + '.' + name path = join_path(spack.hooks_path, name) + ".py" - modules.append(imp.load_source('spack.hooks', path)) + mod = imp.load_source(mod_name, path) + modules.append(mod) + return modules diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index d296e6c189..fa91dbbbea 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -703,9 +703,10 @@ class Package(object): Package implementations should override install(). """ # whether to keep the prefix on failure. Default is to destroy it. - keep_prefix = kwargs.get('keep_prefix', False) - keep_stage = kwargs.get('keep_stage', False) - ignore_deps = kwargs.get('ignore_deps', False) + keep_prefix = kwargs.get('keep_prefix', False) + keep_stage = kwargs.get('keep_stage', False) + ignore_deps = kwargs.get('ignore_deps', False) + fake_install = kwargs.get('fake', False) if not self.spec.concrete: raise ValueError("Can only install concrete packages.") @@ -719,7 +720,8 @@ class Package(object): if not ignore_deps: self.do_install_dependencies() - self.do_patch() + if not fake_install: + self.do_patch() # Fork a child process to do the build. This allows each # package authors to have full control over their environment, @@ -744,8 +746,14 @@ class Package(object): build_env.set_build_environment_variables(self) build_env.set_module_variables_for_package(self) - # Subclasses implement install() to do the real work. - self.install(self.spec, self.prefix) + if fake_install: + mkdirp(self.prefix.bin) + touch(join_path(self.prefix.bin, 'fake')) + mkdirp(self.prefix.lib) + mkdirp(self.prefix.man1) + else: + # Subclasses implement install() to do the real work. + self.install(self.spec, self.prefix) # Ensure that something was actually installed. if not os.listdir(self.prefix): diff --git a/lib/spack/spack/packages.py b/lib/spack/spack/packages.py index 047d82a93a..25d01fe7eb 100644 --- a/lib/spack/spack/packages.py +++ b/lib/spack/spack/packages.py @@ -74,7 +74,8 @@ class PackageDB(object): if not spec in self.instances: package_class = self.get_class_for_package_name(spec.name) try: - self.instances[spec.copy()] = package_class(spec) + copy = spec.copy() + self.instances[copy] = package_class(copy) except Exception, e: raise FailedConstructorError(spec.name, e) diff --git a/var/spack/packages/extrae/package.py b/var/spack/packages/extrae/package.py index 3b842bc1ec..b1a3a3e440 100644 --- a/var/spack/packages/extrae/package.py +++ b/var/spack/packages/extrae/package.py @@ -31,7 +31,15 @@ class Extrae(Package): elif 'mvapich2' in spec: mpi = spec['mvapich2'] - configure("--prefix=%s" % prefix, "--with-mpi=%s" % mpi.prefix, "--with-unwind=%s" % spec['libunwind'].prefix, "--with-dyninst=%s" % spec['dyninst'].prefix, "--with-boost=%s" % spec['boost'].prefix, "--with-dwarf=%s" % spec['libdwarf'].prefix, "--with-papi=%s" % spec['papi'].prefix, "--with-dyninst-headers=%s" % spec['dyninst'].prefix.include, "--with-dyninst-libs=%s" % spec['dyninst'].prefix.lib) + configure("--prefix=%s" % prefix, + "--with-mpi=%s" % mpi.prefix, + "--with-unwind=%s" % spec['libunwind'].prefix, + "--with-dyninst=%s" % spec['dyninst'].prefix, + "--with-boost=%s" % spec['boost'].prefix, + "--with-dwarf=%s" % spec['libdwarf'].prefix, + "--with-papi=%s" % spec['papi'].prefix, + "--with-dyninst-headers=%s" % spec['dyninst'].prefix.include, + "--with-dyninst-libs=%s" % spec['dyninst'].prefix.lib) make() make("install", parallel=False) diff --git a/var/spack/packages/gperftools/package.py b/var/spack/packages/gperftools/package.py new file mode 100644 index 0000000000..8900462324 --- /dev/null +++ b/var/spack/packages/gperftools/package.py @@ -0,0 +1,38 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/spack +# Please also see the LICENSE file for our notice and the LGPL. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License (as published by +# the Free Software Foundation) version 2.1 dated February 1999. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and +# conditions of the GNU General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +############################################################################## +from spack import * + +class Gperftools(Package): + """Google's fast malloc/free implementation, especially for multi-threaded applications. + Contains tcmalloc, heap-checker, heap-profiler, and cpu-profiler.""" + homepage = "https://code.google.com/p/gperftools" + url = "https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.3.tar.gz" + + version('2.3', 'f54dd119f0e46ac1f13264f8d97adf90', url="https://googledrive.com/host/0B6NtGsLhIcf7MWxMMF9JdTN3UVk/gperftools-2.3.tar.gz") + + def install(self, spec, prefix): + configure("--prefix=" + prefix) + make() + make("install") |