Skip to content
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 known types and candidate types #61

Merged
merged 5 commits into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 138 additions & 2 deletions packageurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
Loading