-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
stdenv: PURL fetcher introduction #454333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,22 @@ decorate ( | |
| meta | ||
| // { | ||
| homepage = meta.homepage or baseUrl; | ||
| identifiers = { | ||
| purlParts = | ||
| if githubBase == "github.com" then | ||
| { | ||
| type = "github"; | ||
| # https://github.com/package-url/purl-spec/blob/18fd3e395dda53c00bc8b11fe481666dc7b3807a/types-doc/github-definition.md | ||
| spec = "${owner}/${repo}@${(lib.revOrTag rev tag)}"; | ||
| } | ||
| else | ||
| { | ||
| type = "generic"; | ||
| # https://github.com/package-url/purl-spec/blob/18fd3e395dda53c00bc8b11fe481666dc7b3807a/types-doc/generic-definition.md | ||
| spec = "${repo}?vcs_url=https://${githubBase}/${owner}/${repo}@${(lib.revOrTag rev tag)}"; | ||
| }; | ||
|
Comment on lines
+102
to
+105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that would be a good improvement. |
||
| } | ||
| // meta.identifiers or { }; | ||
| } | ||
| // lib.optionalAttrs (position != null) { | ||
| # to indicate where derivation originates, similar to make-derivation.nix's mkDerivation | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,5 +139,9 @@ stdenv.mkDerivation (finalAttrs: { | |
| ]; | ||
| platforms = lib.platforms.unix; | ||
| mainProgram = "jq"; | ||
| identifiers.purlParts = { | ||
| type = "github"; | ||
| spec = "jqlang/jq@jq-${finalAttrs.version}"; | ||
| }; | ||
|
Comment on lines
+142
to
+145
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this accurate? Since the PURL spec seems to be missing an important detail: whether or not the identity is about the “logical” package, or the provenance of the source file, there's some interpretation that needs to be done... My current head-canon, especially since there is (See the comment for So, in this case I'm more interested in the This is, as far as I understand, not a GitHub type PURL. This is a See these steps: This is creating an archive that differs from the commit's contents.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. while https://github.com/package-url/purl-spec/blob/main/types-doc/github-definition.md is sadly low on details, it is my understanding that you should understand GitHub purls not as literally "this is exactly the source found at this Git repository", but more abstractly "this is the software published by the owners of this repository" - so using this Purl to refer to a tarball that was uploaded to this repo seems OK to me here. |
||
| }; | ||
| }) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Additional thread for The proper tracking of provenance is, imo, another reason why the PURL should be on the Sure, this is bad form to override the source without overriding the Compare this to if it had been set on
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there's some case to be made that the purl to be encoded here should be the purl without the version component (version is optional in the spec and there's some precedence for this in CVE (https://github.com/CVEProject/cve-schema/blob/main/schema/docs/CVE_Record_Format_bundled.json#L449), as long as the version can be reliably determined by the version field. Of course, that also fails if you override just the source... |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,5 +60,9 @@ stdenv.mkDerivation (finalAttrs: { | |
| maintainers = with lib.maintainers; [ qyliss ]; | ||
| license = lib.licenses.mit; | ||
| platforms = lib.platforms.unix; | ||
| identifiers.purlParts = { | ||
| type = "github"; | ||
| spec = "rpm-software-management/popt@popt-${finalAttrs.version}-release"; | ||
| }; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compare: and Why is the Since the PURL spec seems to be missing an important detail: whether or not the identity is about the “logical” package, or the provenance of the source file, there's some interpretation that needs to be done... My current head-canon, especially since there is Though in this particular instance, the And, I'm not even sure it would be a "valid" PURL. A PURL for a derivation might really should probably be a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The purl is on the popt package because we manually encoded this knowledge. The purl is not on the hub package because we didn't specify it explicitly. In a lot of cases, unless otherwise specified, likely the purl of the package can be derived from the purl of the source, and the purl of the source can be derived from the fetcher. However, we didn't want to bake that assumption into nixpkgs yet: for various reasons it seemed better / more conservative / more precise to leave that up to whatever tool will be consuming these identifiers.
I'd say it's actually more about 'logical' 'identity' than 'provenance', though indeed they get mixed up somewhat.
My thinking is we might indeed want |
||
| }; | ||
| }) | ||
Uh oh!
There was an error while loading. Please reload this page.