diff options
author | scheibelp <scheibel1@llnl.gov> | 2017-04-19 21:59:18 -0700 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2017-04-19 21:59:18 -0700 |
commit | a65c37f15dff4b4d60784fd4fcc55874ce9d6d11 (patch) | |
tree | 3bc578ed31acb586f555c3cea979f9f4550752ae /var/spack/repos/builtin.mock/packages/canfail/package.py | |
parent | e12f2c18557e67d927d351c36b0760e9b7826956 (diff) | |
download | spack-a65c37f15dff4b4d60784fd4fcc55874ce9d6d11.tar.gz spack-a65c37f15dff4b4d60784fd4fcc55874ce9d6d11.tar.bz2 spack-a65c37f15dff4b4d60784fd4fcc55874ce9d6d11.tar.xz spack-a65c37f15dff4b4d60784fd4fcc55874ce9d6d11.zip |
Override partial installs by default (#3530)
* Package install remove prior unfinished installs
Depending on how spack is terminated in the middle of building a
package it may leave a partially installed package in the install
prefix. Originally Spack treated the package as being installed if
the prefix was present, in which case the user would have to
manually remove the installation prefix before restarting an
install. This commit adds a more thorough check to ensure that a
package is actually installed. If the installation prefix is present
but Spack determines that the install did not complete, it removes
the installation prefix and starts a new install; if the user has
enabled --keep-prefix, then Spack reverts to its old behavior.
* Added test for partial install handling
* Added test for restoring DB
* Style fixes
* Restoring 2.6 compatibility
* Relocated repair logic to separate function
* If --keep-prefix is set, package installs will continue an install from an existing prefix if one is present
* check metadata consistency when continuing partial install
* Added --force option to make spack reinstall a package (and all dependencies) from scratch
* Updated bash completion; removed '-f' shorthand for '--force' for install command
* dont use multiple write modes for completion file
Diffstat (limited to 'var/spack/repos/builtin.mock/packages/canfail/package.py')
-rw-r--r-- | var/spack/repos/builtin.mock/packages/canfail/package.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/canfail/package.py b/var/spack/repos/builtin.mock/packages/canfail/package.py new file mode 100644 index 0000000000..bef4f6e838 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/canfail/package.py @@ -0,0 +1,41 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://github.com/llnl/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 Lesser General Public License (as +# published by the Free Software Foundation) version 2.1, 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 Lesser 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 Canfail(Package): + """Package which fails install unless a special attribute is set""" + + homepage = "http://www.example.com" + url = "http://www.example.com/a-1.0.tar.gz" + + version('1.0', '0123456789abcdef0123456789abcdef') + + def install(self, spec, prefix): + try: + getattr(self, 'succeed') + touch(join_path(prefix, 'an_installation_file')) + except AttributeError: + raise InstallError() |