Skip to content

Concretizer: reuse broken for external packages #31484

@adamjstewart

Description

@adamjstewart

Steps to reproduce

First, blow away ~/.spack, clone a fresh copy of Spack, and check for external packages:

$ git clone https://github.com/spack/spack.git
$ . spack/share/spack/setup-env.sh
$ spack external find --not-buildable

This will register all external packages it finds on the system in packages.yaml. We'll focus on git since it's guaranteed to be found, but this affects all external packages.

Next, install git:

$ spack install git
[+] /usr (external git-2.32.1-lweosdwarje645t4pqta7becf7n5dwbc)
$ spack find -l git
==> 1 installed package
-- darwin-monterey-m1 / [email protected] ----------------------
lweosdw [email protected]
[12:52:36] ajstewart@ajstewart-mbp:~
$ spack spec -Il --reuse git
Input spec
--------------------------------
 -   git

Concretized
--------------------------------
[+]  lweosdw  [email protected]%[email protected]+man+nls+perl+subtree~svn~tcltk arch=darwin-monterey-m1

Next, modify the git package. For example, add a new variable:

diff --git a/var/spack/repos/builtin/packages/git/package.py b/var/spack/repos/builtin/packages/git/package.py
index 2d9a7a06f1..71d8d3e6c3 100644
--- a/var/spack/repos/builtin/packages/git/package.py
+++ b/var/spack/repos/builtin/packages/git/package.py
@@ -18,6 +18,7 @@ class Git(AutotoolsPackage):
     homepage = "http://git-scm.com"
     url      = "https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.12.0.tar.gz"
     maintainers = ['jennfshr']
+    foo = 'bar'
 
     tags = ['build-tools']

Now, Spack will no longer be able to reuse the existing git installation:

$ spack spec -Il --reuse git
Input spec
--------------------------------
 -   git

Concretized
--------------------------------
 -   634kih5  [email protected]%[email protected]+man+nls+perl+subtree~svn~tcltk arch=darwin-monterey-m1

$ spack install --reuse git
[+] /usr (external git-2.32.1-634kih5iv3oxsqem6mrsz75t3zkdwxml)

This introduces a lot of inconsistencies in the database. spack find claims to only find a single installation, but spack uninstall begs to differ:

$ spack find -l git
==> 1 installed package
-- darwin-monterey-m1 / [email protected] ----------------------
lweosdw [email protected]
$ spack uninstall git
==> Error: git matches multiple packages:

    -- darwin-monterey-m1 / [email protected] ----------------------
    lweosdw [email protected]  634kih5 [email protected]

==> Error: You can either:
    a) use a more specific spec, or
    b) specify the spec by its hash (e.g. `spack uninstall /hash`), or
    c) use `spack uninstall --all` to uninstall ALL matching specs.

This also has a recursive effect. If a single package in the DAG is modifed and another package in the DAG is external, Spack will reinstall the modified package and anything that depends on it. Effectively, this means that --reuse no longer works if you use external packages and update Spack on occasion.

This is particularly problematic on macOS because many packages depend on unwind and uuid and Spack ships with a packages.yaml that registers these as external. Since Python depends on uuid, Spack reinstalls all of my Python libraries any time any file is modified, just like in the days before --reuse was added, but worse because we now use a full hash.

Error message

No response

Information on your system

  • Spack: 0.19.0.dev0 (a12ce9f)
  • Python: 3.9.12
  • Platform: darwin-monterey-m1
  • Concretizer: clingo

@tgamblin @alalazo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions