From 65f6e9f6667d266e6c591e2bed0b653883bcff53 Mon Sep 17 00:00:00 2001 From: Antonio Gamez Diaz Date: Mon, 31 Jul 2023 12:27:45 +0200 Subject: [PATCH 1/4] Sort types alphabetically Signed-off-by: Antonio Gamez Diaz --- packageurl.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packageurl.go b/packageurl.go index dc86d25..e26aeec 100644 --- a/packageurl.go +++ b/packageurl.go @@ -52,10 +52,10 @@ var ( TypeApk = "apk" // TypeBitbucket is a pkg:bitbucket purl. TypeBitbucket = "bitbucket" - // TypeCocoapods is a pkg:cocoapods purl. - TypeCocoapods = "cocoapods" // TypeCargo is a pkg:cargo purl. TypeCargo = "cargo" + // TypeCocoapods is a pkg:cocoapods purl. + TypeCocoapods = "cocoapods" // TypeComposer is a pkg:composer purl. TypeComposer = "composer" // TypeConan is a pkg:conan purl. @@ -80,30 +80,30 @@ var ( TypeHackage = "hackage" // TypeHex is a pkg:hex purl. TypeHex = "hex" + // TypeHuggingface is pkg:huggingface purl. + TypeHuggingface = "huggingface" + // TypeJulia is a pkg:julia purl + TypeJulia = "julia" + // TypeMLflow is pkg:mlflow purl. + TypeMLFlow = "mlflow" // TypeMaven is a pkg:maven purl. TypeMaven = "maven" // TypeNPM is a pkg:npm purl. TypeNPM = "npm" // TypeNuget is a pkg:nuget purl. TypeNuget = "nuget" - // TypeQPKG is a pkg:qpkg purl. - TypeQpkg = "qpkg" // TypeOCI is a pkg:oci purl TypeOCI = "oci" // TypePyPi is a pkg:pypi purl. TypePyPi = "pypi" + // TypeQPKG is a pkg:qpkg purl. + TypeQpkg = "qpkg" // TypeRPM is a pkg:rpm purl. TypeRPM = "rpm" // TypeSWID is pkg:swid purl TypeSWID = "swid" // TypeSwift is pkg:swift purl TypeSwift = "swift" - // TypeHuggingface is pkg:huggingface purl. - TypeHuggingface = "huggingface" - // TypeMLflow is pkg:mlflow purl. - TypeMLFlow = "mlflow" - // TypeJulia is a pkg:julia purl - TypeJulia = "julia" ) // Qualifier represents a single key=value qualifier in the package url From 82333258e5b633e9349dbb5e35a987f55ddf0092 Mon Sep 17 00:00:00 2001 From: Antonio Gamez Diaz Date: Mon, 31 Jul 2023 12:35:45 +0200 Subject: [PATCH 2/4] Add new purl types `pub` and `bitnami` Signed-off-by: Antonio Gamez Diaz --- packageurl.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packageurl.go b/packageurl.go index e26aeec..0b1b115 100644 --- a/packageurl.go +++ b/packageurl.go @@ -52,6 +52,8 @@ var ( TypeApk = "apk" // TypeBitbucket is a pkg:bitbucket purl. TypeBitbucket = "bitbucket" + // TypeBitnami is a pkg:bitnami purl. + TypeBitnami = "bitnami" // TypeCargo is a pkg:cargo purl. TypeCargo = "cargo" // TypeCocoapods is a pkg:cocoapods purl. @@ -94,6 +96,8 @@ var ( TypeNuget = "nuget" // TypeOCI is a pkg:oci purl TypeOCI = "oci" + // TypePub is a pkg:pub purl. + TypePub = "pub" // TypePyPi is a pkg:pypi purl. TypePyPi = "pypi" // TypeQPKG is a pkg:qpkg purl. @@ -363,6 +367,7 @@ func typeAdjustName(purlType, name string, qualifiers Qualifiers) string { case TypeAlpm, TypeApk, TypeBitbucket, + TypeBitnami, TypeComposer, TypeDebian, TypeGithub, From 4cada81fe7f4c9bdf12ea887c2a40b91788c6379 Mon Sep 17 00:00:00 2001 From: Antonio Gamez Diaz Date: Mon, 31 Jul 2023 12:37:15 +0200 Subject: [PATCH 3/4] Add KnownTypes and CandidateTypes maps Signed-off-by: Antonio Gamez Diaz --- packageurl.go | 140 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 138 insertions(+), 2 deletions(-) diff --git a/packageurl.go b/packageurl.go index 0b1b115..ebe2a58 100644 --- a/packageurl.go +++ b/packageurl.go @@ -84,8 +84,6 @@ var ( TypeHex = "hex" // TypeHuggingface is pkg:huggingface purl. TypeHuggingface = "huggingface" - // TypeJulia is a pkg:julia purl - TypeJulia = "julia" // TypeMLflow is pkg:mlflow purl. TypeMLFlow = "mlflow" // TypeMaven is a pkg:maven purl. @@ -108,6 +106,144 @@ var ( TypeSWID = "swid" // TypeSwift is pkg:swift purl TypeSwift = "swift" + + // KnownTypes is a map of types that are officially supported by the spec. + // See https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#known-purl-types + KnownTypes = map[string]struct{}{ + TypeAlpm: {}, + TypeApk: {}, + TypeBitbucket: {}, + TypeBitnami: {}, + TypeCargo: {}, + TypeCocoapods: {}, + TypeComposer: {}, + TypeConan: {}, + TypeConda: {}, + TypeCran: {}, + TypeDebian: {}, + TypeDocker: {}, + TypeGem: {}, + TypeGeneric: {}, + TypeGithub: {}, + TypeGolang: {}, + TypeHackage: {}, + TypeHex: {}, + TypeHuggingface: {}, + TypeMaven: {}, + TypeMLFlow: {}, + TypeNPM: {}, + TypeNuget: {}, + TypeOCI: {}, + TypePub: {}, + TypePyPi: {}, + TypeQpkg: {}, + TypeRPM: {}, + TypeSWID: {}, + TypeSwift: {}, + } + + TypeApache = "apache" + TypeAndroid = "android" + TypeAtom = "atom" + TypeBower = "bower" + TypeBrew = "brew" + TypeBuildroot = "buildroot" + TypeCarthage = "carthage" + TypeChef = "chef" + TypeChocolatey = "chocolatey" + TypeClojars = "clojars" + TypeCoreos = "coreos" + TypeCpan = "cpan" + TypeCtan = "ctan" + TypeCrystal = "crystal" + TypeDrupal = "drupal" + TypeDtype = "dtype" + TypeDub = "dub" + TypeElm = "elm" + TypeEclipse = "eclipse" + TypeGitea = "gitea" + TypeGitlab = "gitlab" + TypeGradle = "gradle" + TypeGuix = "guix" + TypeHaxe = "haxe" + TypeHelm = "helm" + TypeJulia = "julia" + TypeLua = "lua" + TypeMelpa = "melpa" + TypeMeteor = "meteor" + TypeNim = "nim" + TypeNix = "nix" + TypeOpam = "opam" + TypeOpenwrt = "openwrt" + TypeOsgi = "osgi" + TypeP2 = "p2" + TypePear = "pear" + TypePecl = "pecl" + TypePERL6 = "perl6" + TypePlatformio = "platformio" + TypeEbuild = "ebuild" + TypePuppet = "puppet" + TypeSourceforge = "sourceforge" + TypeSublime = "sublime" + TypeTerraform = "terraform" + TypeVagrant = "vagrant" + TypeVim = "vim" + TypeWORDPRESS = "wordpress" + TypeYocto = "yocto" + + // CandidateTypes is a map of types that are not yet officially supported by the spec, + // but are being considered for inclusion. + // See https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#other-candidate-types-to-define + CandidateTypes = map[string]struct{}{ + TypeApache: {}, + TypeAndroid: {}, + TypeAtom: {}, + TypeBower: {}, + TypeBrew: {}, + TypeBuildroot: {}, + TypeCarthage: {}, + TypeChef: {}, + TypeChocolatey: {}, + TypeClojars: {}, + TypeCoreos: {}, + TypeCpan: {}, + TypeCtan: {}, + TypeCrystal: {}, + TypeDrupal: {}, + TypeDtype: {}, + TypeDub: {}, + TypeElm: {}, + TypeEclipse: {}, + TypeGitea: {}, + TypeGitlab: {}, + TypeGradle: {}, + TypeGuix: {}, + TypeHaxe: {}, + TypeHelm: {}, + TypeJulia: {}, + TypeLua: {}, + TypeMelpa: {}, + TypeMeteor: {}, + TypeNim: {}, + TypeNix: {}, + TypeOpam: {}, + TypeOpenwrt: {}, + TypeOsgi: {}, + TypeP2: {}, + TypePear: {}, + TypePecl: {}, + TypePERL6: {}, + TypePlatformio: {}, + TypeEbuild: {}, + TypePuppet: {}, + TypeSourceforge: {}, + TypeSublime: {}, + TypeTerraform: {}, + TypeVagrant: {}, + TypeVim: {}, + TypeWORDPRESS: {}, + TypeYocto: {}, + } ) // Qualifier represents a single key=value qualifier in the package url From 2e47078ee6e450f60e7221ded548783b930b33de Mon Sep 17 00:00:00 2001 From: Antonio Gamez Diaz Date: Mon, 14 Aug 2023 14:27:36 +0200 Subject: [PATCH 4/4] Fix duplicated line after merge Signed-off-by: Antonio Gamez Diaz --- packageurl.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/packageurl.go b/packageurl.go index c4b5bf8..d31aac7 100644 --- a/packageurl.go +++ b/packageurl.go @@ -84,8 +84,6 @@ var ( TypeHex = "hex" // TypeHuggingface is pkg:huggingface purl. TypeHuggingface = "huggingface" - // TypeJulia is a pkg:julia purl - TypeJulia = "julia" // TypeMLflow is pkg:mlflow purl. TypeMLFlow = "mlflow" // TypeMaven is a pkg:maven purl.