-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
Fixes #4957 🛠️ Refactored the `purl` package. **Basic usage.** No platform information. ```go purl.NewPackageURL(nil, purl.TypeDebian, "curl", "7.50.3-1").String() ``` Will produce the purl: `pkg:deb/curl@7.50.3-1` **Main usage. (with platform info)** We rely on the `inventory.Platform` that already has information like the architecture that can't change. Also we guess the linux distribution from here. ```go platform := &inventory.Platform{ Arch: "x86_64", Version: "22.04", Labels: map[string]string{ "distro-id": "jessie", }, } purl.NewPackageURL(platform, purl.TypeDebian, "curl", "7.50.3-1").String() ``` Will produce the purl: `pkg:deb/debian/curl@7.50.3-1?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. ```go platform := &inventory.Platform{ Name: "windows", Version: "10.0.18363", Family: []string{"windows"}, } purl.NewPackageURL(platform, purl.TypeAppx, "Microsoft.Windows.Cortana", "1.11.5.17763", purl.WithArch("x86"), purl.WithNamespace("windows"), ).String() ``` Will produce the purl: `pkg:appx/windows/Microsoft.Windows.Cortana@1.11.5.17763?arch=x86` --------- Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.