-
Notifications
You must be signed in to change notification settings - Fork 24
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
⭐️ Add Purl to macOS and Windows systems #4996
Conversation
Fixes #4957 Signed-off-by: Salim Afiune Maya <[email protected]>
} | ||
} | ||
|
||
func ValidType(t string) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this being used. Did I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we use this somewhere else, could we add some tests to it?
Some types we use and some we do no longer want to use like windows_app
, windows-app
.
Signed-off-by: Salim Afiune Maya <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @afiune
@@ -18,6 +18,23 @@ const ( | |||
QualifierEpoch = "epoch" | |||
) | |||
|
|||
// PackageURL is a helper struct that renters a package url based of an inventory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renders
instead of renters
// | ||
// For more information, see: | ||
// https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst | ||
func NewPackageURL(pf *inventory.Platform, t Type, name, version string, modifiers ...Modifier) *PackageURL { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That made me stumble.
First thought was, that we could derive the type from the platform. But no:
- Windows: windows, appx, nuget, ...
- Ubuntu: deb, snap, brew, ...
- ...
🫤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, we really can't 😭
Fixes #4957
Refactored the
purl
package.Basic usage.
No platform information.
Will produce the purl:
pkg:deb/[email protected]
Main usage. (with platform info)
We rely on the
inventory.Platform
that already has information like the architecturethat can't change. Also we guess the linux distribution from here.
Will produce the purl:
pkg:deb/debian/[email protected]?arch=x86_64&distro=jessie
Extended usage. (with modifiers)
We can override optional attributes, like the architecture, epoch and namespace.
This is useful for non-linux systems.
Will produce the purl:
pkg:appx/windows/[email protected]?arch=x86