Skip to content

Annotate virtual dependencies on DAG edges #34886

@alalazo

Description

@alalazo

Summary

As a user I want virtual dependencies to be annotated on DAG edges, so I can distinguish between software that depends on a specific virtual provider (without depending on the virtual) and software that depends on the virtual.

Rationale

This is information that we currently lose after concretization, and that should be retained. It is needed to be able to cherry-pick virtual dependencies.

Description

In memory and JSON representation of a spec should be extended to incorporate information on virtual dependencies:

  1. For the in memory representation, we need to extend the DependencySpec class
  2. For the JSON representation we need to add some new piece of information under the "dependencies" section of a node

A possible encoding for the JSON specfile could be an extra, optional, attribute under the "dependencies" section of a node:

    "dependencies": [
          {
            "name": "cmake",
            "hash": "7qhwgdbqwfpo6ataty7gqbkveciw3udn",
            "type": [
              "build"
            ]
          },
          {
            "name": "pkgconf",
            "hash": "i4avrindvhcamhurzbfdaggbj2zgsrrh",
            "type": [
              "run"
            ],
            "virtuals": [
              "pkgconfig"
            ]
          },
          {
            "name": "zlib",
            "hash": "nizxi5u5bbrzhzwfy2qb7hatlhuswlrz",
            "type": [
              "build",
              "link"
            ]
          }
        ],

Additional information

  1. If we bump specfile version correctly, we can reconstruct virtual edges in memory from old specfiles when we read them.
  2. We could also update the specfile, being careful about not changing an existing hash.
  3. Selecting a virtual dependency from the DAG can also be encoded in terms of edge attributes.
  4. The specfile representation can also be used to implement "use variants" as sketched in Proposal: handling conflicting libraries in the same package seps#2.

General information

  • I have run spack --version and reported the version of Spack
  • I have searched the issues of this repo and believe this is not a duplicate

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions