Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions purl-types-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"npm",
"nuget",
"oci",
"otp",
"pub",
"pypi",
"qpkg",
Expand Down
120 changes: 120 additions & 0 deletions tests/types/otp-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"$schema": "https://packageurl.org/schemas/purl-test.schema-0.1.json",
"tests": [
{
"description": "Parse test for <class 'type'> PURL",
"test_group": "base",
"test_type": "parse",
"input": "pkg:otp/[email protected]?arch=amd64&platform=linux&repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Ferlang%2Fotp.git#src/asn1ct.erl",
"expected_output": {
"type": "otp",
"namespace": null,
"name": "asn1",
"version": "5.4.1",
"qualifiers": {
"platform": "linux",
"arch": "amd64",
"repository_url": "https://github.com/erlang/otp",
"vcs_url": "git+https://github.com/erlang/otp.git"
},
"subpath": "src/asn1ct.erl"
},
"expected_failure": false,
"expected_failure_reason": null
},
{
"description": "Roundtrip test for <class 'type'> PURL",
"test_group": "base",
"test_type": "roundtrip",
"input": "pkg:otp/[email protected]?arch=amd64&platform=linux&repository_url=https://github.com/erlang/otp&vcs_url=git%2Bhttps://github.com/erlang/otp.git#src/asn1ct.erl",
"expected_output": "pkg:otp/[email protected]?arch=amd64&platform=linux&repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Ferlang%2Fotp.git#src/asn1ct.erl",
"expected_failure": false,
"expected_failure_reason": null
},
{
"description": "Build test for <class 'type'> PURL",
"test_group": "base",
"test_type": "build",
"input": {
"type": "otp",
"namespace": null,
"name": "asn1",
"version": "5.4.1",
"qualifiers": {
"platform": "linux",
"arch": "amd64",
"repository_url": "https://github.com/erlang/otp",
"vcs_url": "git+https://github.com/erlang/otp.git"
},
"subpath": "src/asn1ct.erl"
},
"expected_output": "pkg:otp/[email protected]?arch=amd64&platform=linux&repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Ferlang%2Fotp.git#src/asn1ct.erl",
"expected_failure": false,
"expected_failure_reason": null
},
{
"description": "Parse test for <class 'type'> PURL",
"test_group": "base",
"test_type": "parse",
"input": "pkg:otp/[email protected]",
"expected_output": {
"type": "otp",
"namespace": null,
"name": "hex",
"version": "2.1.1",
"qualifiers": null,
"subpath": null
},
"expected_failure": false,
"expected_failure_reason": null
},
{
"description": "Roundtrip test for <class 'type'> PURL",
"test_group": "base",
"test_type": "roundtrip",
"input": "pkg:otp/[email protected]",
"expected_output": "pkg:otp/[email protected]",
"expected_failure": false,
"expected_failure_reason": null
},
{
"description": "Build test for <class 'type'> PURL",
"test_group": "base",
"test_type": "build",
"input": {
"type": "otp",
"namespace": null,
"name": "hex",
"version": "2.1.1",
"qualifiers": null,
"subpath": null
},
"expected_output": "pkg:otp/[email protected]",
"expected_failure": false,
"expected_failure_reason": null
},
{
"description": "Parse test for <class 'type'> PURL",
"test_group": "base",
"test_type": "parse",
"input": "pkg:otp/namespace/[email protected]",
"expected_failure": true,
"expected_failure_reason": "Should fail to parse an OTP PURL containing a prohibited namespace component"
},
{
"description": "Build test for <class 'type'> PURL",
"test_group": "base",
"test_type": "build",
"input": {
"type": "otp",
"namespace": "namespace",
"name": "hex",
"version": "2.1.1",
"qualifiers": null,
"subpath": null
},
"expected_failure": true,
"expected_failure_reason": "Should fail to build an OTP PURL containing a prohibited namespace component"
}
]
}
68 changes: 68 additions & 0 deletions types-doc/otp-definition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- NOTE: Auto-generated from the JSON PURL type definition.
Do not manually edit this file. Edit the JSON type definition instead. -->

# PURL Type Definition: otp

- **Type Name:** BEAM/OTP Application
- **Description:** BEAM/OTP applications written in Elixir, Erlang, Gleam and other BEAM languages
- **Schema ID:** `https://packageurl.org/types/otp-definition.json`

## PURL Syntax

The structure of a PURL for this package type is:

pkg:otp/<name>@<version>?<qualifiers>#<subpath>

## Repository Information

- **Use Repository:** No

## Namespace definition

- **Requirement:** Prohibited
- **Note:** `The component is unused and MUST be empty`

## Name definition

- **Requirement:** Required
- **Native Label:** name
- **Note:** `The OTP application name from the `.app` file; it is case-insensitive and MUST be lower-cased.`

## Version definition

- **Requirement:** Optional
- **Native Label:** version
- **Note:** `The OTP application version (the `vsn` attribute).`

## Subpath definition

- **Requirement:** Optional
- **Native Label:** May be added to reference a specific file or directory inside the OTP application.

## Qualifiers Definition

| Key | Requirement | Native name | Default Value | Description |
|------|-------------|-------------|---------------|-------------|
| repository_url | Optional | Repository URL | | The canonical origin of the OTP application source. This qualifier is optional, but it should be included whenever the origin is known, and should point to a trusted source repository. |
| platform | Optional | platform | | The target operating system for native code (e.g. ``linux``, ``darwin``, ``freebsd``, ``sunos``, ``win32``; case-insensitive). |
| arch | Optional | arch | | The arch is the qualifiers key for a package architecture. |

## Examples

- `pkg:otp/[email protected]?platform=linux&arch=amd64&repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%20https:%2F%2Fgithub.com%2Ferlang%2Fotp.git`
- `pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%20https:%2F%2Fgithub.com%2Ferlang%2Fotp.git`
- `pkg:otp/[email protected]?platform=darwin&arch=x86_64&repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%20https:%2F%2Fgithub.com%2Ferlang%2Fotp.git`
- `pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Felixir-lang%2Felixir&vcs_url=git%20https:%2F%2Fgithub.com%2Felixir-lang%2Felixir.git`
- `pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Felixir-lang%2Felixir&vcs_url=git%20https:%2F%2Fgithub.com%2Felixir-lang%2Felixir.git`
- `pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Felixir-lang%2Felixir&vcs_url=git%20https:%2F%2Fgithub.com%2Felixir-lang%2Felixir.git`
- `pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Ferlang%2Frebar3&vcs_url=git%20https:%2F%2Fgithub.com%2Ferlang%2Frebar3.git`
- `pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Fhexpm%2Fhex&vcs_url=git%20https:%2F%2Fgithub.com%2Fhexpm%2Fhex.git`

## Note

- If the component was fetched from a Hex repository, prefer a ``hex`` purl
because Hex provides a global, collision-free namespace that uniquely ties
the version to the published source.
- There is no default package repository. When the application can be
fetched from a known location, add a general qualifier such as
`repository_url`, `download_url` or `vcs_url`.
61 changes: 61 additions & 0 deletions types/otp-definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "https://packageurl.org/schemas/purl-type-definition.schema-1.0.json",
"$id": "https://packageurl.org/types/otp-definition.json",
"type": "otp",
"type_name": "BEAM/OTP Application",
"description": "BEAM/OTP applications written in Elixir, Erlang, Gleam and other BEAM languages",
"note": "- If the component was fetched from a Hex repository, prefer a ``hex`` purl\n because Hex provides a global, collision-free namespace that uniquely ties\n the version to the published source.\n- There is no default package repository. When the application can be\n fetched from a known location, add a general qualifier such as\n `repository_url`, `download_url` or `vcs_url`.",
"repository": {
"use_repository": false
},
"namespace_definition": {
"requirement": "prohibited",
"note": "The component is unused and MUST be empty"
},
"name_definition": {
"case_sensitive": false,
"native_name": "name",
"note": "The OTP application name from the `.app` file; it is case-insensitive and MUST be lower-cased.",
"requirement": "required"
},
"version_definition": {
"native_name": "version",
"note": "The OTP application version (the `vsn` attribute).",
"requirement": "optional"
},
"subpath_definition": {
"case_sensitive": false,
"native_name": "May be added to reference a specific file or directory inside the OTP application.",
"requirement": "optional"
},
"qualifiers_definition": [
{
"key": "repository_url",
"requirement": "optional",
"native_name": "Repository URL",
"description": "The canonical origin of the OTP application source. This qualifier is optional, but it should be included whenever the origin is known, and should point to a trusted source repository."
},
{
"key": "platform",
"requirement": "optional",
"native_name": "platform",
"description": "The target operating system for native code (e.g. ``linux``, ``darwin``, ``freebsd``, ``sunos``, ``win32``; case-insensitive)."
},
{
"key": "arch",
"requirement": "optional",
"native_name": "arch",
"description": "The arch is the qualifiers key for a package architecture."
}
],
"examples": [
"pkg:otp/[email protected]?platform=linux&arch=amd64&repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Ferlang%2Fotp.git",
"pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Ferlang%2Fotp.git",
"pkg:otp/[email protected]?platform=darwin&arch=x86_64&repository_url=https:%2F%2Fgithub.com%2Ferlang%2Fotp&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Ferlang%2Fotp.git",
"pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Felixir-lang%2Felixir&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Felixir-lang%2Felixir.git",
"pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Felixir-lang%2Felixir&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Felixir-lang%2Felixir.git",
"pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Felixir-lang%2Felixir&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Felixir-lang%2Felixir.git",
"pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Ferlang%2Frebar3&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Ferlang%2Frebar3.git",
"pkg:otp/[email protected]?repository_url=https:%2F%2Fgithub.com%2Fhexpm%2Fhex&vcs_url=git%2Bhttps:%2F%2Fgithub.com%2Fhexpm%2Fhex.git"
]
}