Skip to content

Register new PURL type: spack - #898

Open
hainest wants to merge 10 commits into
package-url:mainfrom
hainest:thaines/add_spack_purltype
Open

Register new PURL type: spack#898
hainest wants to merge 10 commits into
package-url:mainfrom
hainest:thaines/add_spack_purltype

Conversation

@hainest

@hainest hainest commented Jul 7, 2026

Copy link
Copy Markdown

closes #895

Implementation for #895

TODO

Signed-off-by: Tim Haines <thaines.astro@gmail.com>
@hainest
hainest force-pushed the thaines/add_spack_purltype branch from c155144 to c9453d4 Compare July 7, 2026 17:24
@mjherzog mjherzog added the PURL type new Register a new PURL type label Jul 7, 2026
@hainest
hainest marked this pull request as ready for review July 7, 2026 20:00
@hainest
hainest marked this pull request as draft July 7, 2026 20:00
hainest added a commit to hainest/anchore-packageurl-go that referenced this pull request Jul 22, 2026
spack is currently being considered for inclusion:

package-url/purl-spec#898

Signed-off-by: Tim Haines <thaines.astro@gmail.com>

## Version definition

- **Requirement:** Optional

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think the namespace and version should be required -- we obviously have the information if we have a Spack spec, and it's hard to claim we know what spec it is without it.

Then the purl can be given by spack find --format "pkg:spack/{namespace}/{name}@{version}?sha={hash}"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think the namespace and version should be required -- we obviously have the information if we have a Spack spec, and it's hard to claim we know what spec it is without it.

The SHA is required. Modulo perfectly reproducible builds, my perception is that this uniquely identifies a build. I don't have any objections to requiring a namespace and version. My only hesitation would be that some folks might not know that there is a default namespace, so using a PURL to identify a package would then have a possible sharp edge (maybe not too sharp). Certainly for generating the PURLs inside spack, this is a non-issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think it's possible for the version or hash to be required in PURL. That would prohibit talking about the package in general without referring to a specific version. See #157

@hainest hainest Jul 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@matt-phylum Michael noted that a qualifier key can be required, but should be rare (#895 (comment)). From 5.6.3 of the standard,

The namespace is optional, unless required by the package's type definition.

so we can enforce a namespace. The standard does not make the same exception for a version- it is always stated as optional, so we should follow that.

I will revisit the standard and see if I can get any more clarity.

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.

The only exception for 'required' qualifiers keys to date is for the Julia UUID and there was a long and deep discussion in the Julia community for this. It would be better to require a namespace instead if that is reasonable for spack.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The current structure is

  1. namespace is required
  2. version is optional
  3. sha is optional

This makes it consistent with my reading of the standard and with other purls that I've seen in test cases for osv-scanner.

@mjherzog @matt-phylum

I didn't find a mechanism for running the tests in the Makefile or the CI workflows. Am I missing something?

If this is accepted, is the next step to make a PR in the website repo to add the logo?

@hainest
hainest marked this pull request as ready for review August 17, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PURL type new Register a new PURL type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register new PURL type: spack

4 participants