summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <harmenstoppels@gmail.com>2021-08-26 03:14:11 +0200
committerGitHub <noreply@github.com>2021-08-25 18:14:11 -0700
commit73005166efdc9be8d0095cb32360cced04b923b4 (patch)
treec8ae630531faf7da218e1d0cd50702ca945136bc
parent204b49fc1fcade45837541393fe5600234d95c1b (diff)
downloadspack-73005166efdc9be8d0095cb32360cced04b923b4.tar.gz
spack-73005166efdc9be8d0095cb32360cced04b923b4.tar.bz2
spack-73005166efdc9be8d0095cb32360cced04b923b4.tar.xz
spack-73005166efdc9be8d0095cb32360cced04b923b4.zip
Bugfix: reinstalling updated develop specs (#25579)
PackageInstaller and Package.installed disagree over what it means for a package to be installed: PackageInstaller believes it should be enough for a database entry to exist, whereas Package.installed requires a database entry & a prefix directory. This leads to the following niche issue: * a develop spec in an environment is successfully installed * then somehow its install prefix is removed (e.g. through a bug fixed in #25583) * you modify the sources and reinstall the environment 1. spack checks pkg.installed and realizes the develop spec is NOT installed, therefore it doesn't need to have 'overwrite: true' 2. the installer gets the build task and checks the database and realizes the spec IS installed, hence it doesn't have to install it. 3. the develop spec is not rebuilt. The solution is to make PackageInstaller and pkg.installed agree over what it means to be installed, and this PR does that by dropping the prefix directory check from pkg.installed, so that it only checks the database. As a result, spack will create a build task with overwrite: true for the develop spec, and the installer in fact handles overwrite requests fine even if the install prefix doesn't exist (it just does a normal install).
-rw-r--r--lib/spack/spack/package.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 10f4606972..690ce075cb 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1252,18 +1252,14 @@ class PackageBase(six.with_metaclass(PackageMeta, PackageViewMixin, object)):
Returns:
True if the package has been installed, False otherwise.
"""
- has_prefix = os.path.isdir(self.prefix)
try:
# If the spec is in the DB, check the installed
# attribute of the record
- rec = spack.store.db.get_record(self.spec)
- db_says_installed = rec.installed
+ return spack.store.db.get_record(self.spec).installed
except KeyError:
# If the spec is not in the DB, the method
# above raises a Key error
- db_says_installed = False
-
- return has_prefix and db_says_installed
+ return False
@property
def prefix(self):