Skip to content

bugfix: don't fetch package metadata for unknown concrete specs#36990

Merged
tgamblin merged 3 commits intodevelopfrom
bugfix-patch-failures-for-unknown-dep-packages
May 15, 2023
Merged

bugfix: don't fetch package metadata for unknown concrete specs#36990
tgamblin merged 3 commits intodevelopfrom
bugfix-patch-failures-for-unknown-dep-packages

Conversation

@tgamblin
Copy link
Copy Markdown
Member

@tgamblin tgamblin commented Apr 17, 2023

Fixes #36847.
Fixes #34108.

This fixes two issues:

  1. The concretizer can fail with reuse:true if a buildcache or installation contains a package with a dependency that has been renamed or deleted in the main repo (e.g., netcdf was refactored to netcdf-c, netcdf-fortran, etc., but there are still binary packages with dependencies called netcdf).

    We should still be able to install things for which we are missing package.py files.

    Spec.inject_patches_variant() was failing this requirement by attempting to look up the package class for concrete specs. This isn't needed -- we can skip it.

  2. spec_clauses() attempts to look up package information for concrete specs in order to determine which virtuals they may provide. This fails for renamed/deleted dependencies of buildcaches and installed packages.

    This will eventually be fixed by Add virtual information on DAG edges #35258, but we need a workaround to make older buildcaches usable.

  • swap two conditions in Spec.inject_patches_variant()
  • make an exception for renamed packages and omit their virtual constraints
  • add a note that this will be solved by adding virtuals to edges

@spackbot-app spackbot-app bot added the core PR affects Spack core functionality label Apr 17, 2023
@tgamblin tgamblin requested review from alalazo and scheibelp April 17, 2023 22:09
@tgamblin
Copy link
Copy Markdown
Member Author

@eugeneswalker: does this fix your issue?

@eugeneswalker
Copy link
Copy Markdown
Contributor

This PR does indeed resolve #36847. Thank you!

@tgamblin
Copy link
Copy Markdown
Member Author

@eugeneswalker see if the second commit fixes #34108.

@tgamblin tgamblin changed the title bugfix: don't look up patches from packages for concrete specs bugfix: don't fetch package metadata for unknown concrete specs Apr 18, 2023
@tgamblin tgamblin force-pushed the bugfix-patch-failures-for-unknown-dep-packages branch from fe8e8e4 to 0106478 Compare April 18, 2023 00:02
alalazo
alalazo previously approved these changes Apr 18, 2023
# Ensure Spack will not coconcretize this with another provider
# for the same virtual
for virtual in dep.package.virtuals_provided:
# Skip virtual node constriants for renamed/deleted packages,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Skip virtual node constriants for renamed/deleted packages,
# Skip virtual node constraints for renamed/deleted packages,

Comment on lines +1571 to +1572
# NOTE: with current specs (which lack edge attributes) this
# can allow concretizations with two providers, but it's unlikely.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit scary 😟 Not sure what we could do more than this though. I agree it's unlikely, since one of the provider must be in a buildcache and not in the current repository.

Copy link
Copy Markdown
Member Author

@tgamblin tgamblin Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't rename things (especially MPI and other virtuals) frequently enough for this to matter. Though @eugeneswalker and the E4S team are trying hard to make it matter with their 100,000 package buildcache.

Goal should be to get virtual info on edges before it matters 😅

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the value of reuse here outweighs the corner case.

@alalazo alalazo self-assigned this Apr 18, 2023
@alalazo alalazo added this to the v0.20.0 milestone Apr 21, 2023
tgamblin added 3 commits May 14, 2023 21:04
The concretizer can fail with `reuse:true` if a buildcache or installation contains a
package with a dependency that has been renamed or deleted in the main repo (e.g.,
`netcdf` was refactored to `netcdf-c`, `netcdf-fortran`, etc., but there are still
binary packages with dependencies called `netcdf`).

We should still be able to install things for which we are missing `package.py` files.

`Spec.inject_patches_variant()` was failing this requirement by attempting to look up
the package class for concrete specs.  This isn't needed -- we can skip it.

- [x] swap two conditions in `Spec.inject_patches_variant()`
`spec_clauses()` attempts to look up package information for concrete specs in order to
determine which virtuals they may provide. This fails for renamed/deleted dependencies
of buildcaches and installed packages.

This will eventually be fixed by #35258, which adds virtual information on edges, but we
need a workaround to make older buildcaches usable.

- [x] make an exception for renamed packages and omit their virtual constraints
- [x] add a note that this will be solved by adding virtuals to edges
We currently throw a nasty error if you try to reuse packages from some other namespace
(e.g., OLCF), but we should be able to reuse patched local versions of builtin packages.

Right now the only obstacle to that is that we try to look up virtual info for unknown
namespaces, and we can't get the package from the repo to do that. We *can* assume that
a package with a known namespace is similar, and that its virtual provider information
is reasonably accurate, so we now do that. This isn't 100% accurate, but neither is
relying on the package itself, as it may have gone out of date.

The real solution here is virtual edge information, but this is a stopgap until we have
that.
@tgamblin tgamblin force-pushed the bugfix-patch-failures-for-unknown-dep-packages branch from a892475 to 7517ed5 Compare May 15, 2023 06:38
@eugeneswalker
Copy link
Copy Markdown
Contributor

Fixes #36847.
Fixes #34108.

I am happy to report that indeed, this PR fixes these issues. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buildcache concretization core PR affects Spack core functionality

Projects

None yet

3 participants