Skip to content
1 change: 1 addition & 0 deletions purl-types-index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"apk",
"bitbucket",
"bitnami",
"bsd",
"cargo",
"cocoapods",
"composer",
Expand Down
52 changes: 52 additions & 0 deletions tests/types/bsd-test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"$schema": "https://packageurl.org/schemas/purl-test.schema-1.0.json",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct URL or is server down as this just returns HTTP server is too slow for me

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. I just followed other purl type examples.
@pombredanne Do you know anything about this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server will be up in the new few days ;)

"tests": [
{
"description": "Rountrip test for <class 'type'> PURL",
"test_group": "base",
"test_type": "roundtrip",
"input": "pkg:bsd/freebsd/[email protected]_2?distro=14.3&epoch=3",
"expected_output": "pkg:bsd/freebsd/[email protected]_2?distro=14.3&epoch=3",
"expected_failure": false,
"expected_failure_reason": null
},
{
"description": "Build test for <class 'type'> PURL",
"test_group": "base",
"test_type": "build",
"input": {
"type": "bsd",
"namespace": "freebsd",
"name": "emacs",
"version": "30.1_2",
"qualifiers": {
"distro": "14.3",
"epoch": 3
},
"subpath": null
},
"expected_output": "pkg:bsd/freebsd/[email protected]_2?distro=14.3&epoch=3",
"expected_failure": false,
"expected_failure_reason": null
},
{
"description": "Parse test for <class 'type'> PURL",
"test_group": "base",
"test_type": "parse",
"input": "pkg:bsd/freebsd/[email protected]_2?distro=14.3&epoch=3",
"expected_output": {
"type": "bsd",
"namespace": "freebsd",
"name": "emacs",
"version": "30.1_2",
"qualifiers": {
"distro": "14.3",
"epoch": 3
},
"subpath": null
},
"expected_failure": false,
"expected_failure_reason": null
}
]
}
49 changes: 49 additions & 0 deletions types-doc/bsd-definition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!-- NOTE: Auto-generated from the JSON PURL type definition.
Do not manually edit this file. Edit the JSON type definition instead. -->

# PURL Type Definition: bsd

- **Type Name:** BSD
- **Description:** BSD Operating System variant packages, primarily focused on FreeBSD with extensibility for other BSD variants such as OpenBSD, DragonFly BSD. Note: since NetBSD's package manager is designed for cross-platform use, it should use its own dedicated PURL type.
- **Schema ID:** `https://packageurl.org/types/bsd-definition.json`

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why choose Bitname for types?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one needs to be probably added in some point but as I can't get anything out of that domain or URL it probably does not matter.

## PURL Syntax

The structure of a PURL for this package type is:

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

## Repository Information

- **Use Repository:** Yes
- **Note:** The default repository is http://pkg.freebsd.org for FreeBSD. Other BSD variants may use different repositories as appropriate.

## Namespace definition

- **Requirement:** Required
- **Native Label:** vendor
- **Note:** `The namespace is the BSD variant name such as "freebsd", "openbsd", or "dragonflybsd". It is not case sensitive and must be lowercased.`

## Name definition

- **Case Sensitive:** Yes
- **Native Label:** name
- **Note:** `The name is the package name and is case sensitive.`

## Version definition

- **Native Label:** version
- **Note:** `The version is the version of the package.`

## Qualifiers Definition

| Key | Requirement | Native name | Default Value | Description |
|------|-------------|-------------|---------------|-------------|
| arch | Optional | | | The target architecture for the package. |
| distro | Optional | | | The BSD release version or distribution variant. |
| epoch | Optional | | | The package epoch number used for version comparison when normal version ordering is insufficient. |

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As FreeBSD is going thru pkgbasecifcation how one could write that package is from base FreeBSD 15.1 and not ports? I would suggest add keys like these (they can go under different name):

  • branch - which would be is it unstable or stable version
  • source - source of package like core, kernel or ports

With these one could write something like:
pkg:bsd/freebsd/[email protected]?source=core&branch=stable
pkg:bsd/freebsd/[email protected]?source=core&branch=releng/15.1

Then would URL would translate to https://pkg.freebsd.org/15/base_latest or https://pkg.freebsd.org/15/base_release_1 not ports one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@illuusio I agree to add something qualifier to distinguish how package is installed. But how can we get these information for each installed package?
It appears that this information does not exist in the pkg database.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion we have to trust people how write these PURLs. In perfect world it would be nice to have such info straight from pkg out generated. I don't know is this irrelevant to this but there were discussion about bit similar to this in mailing list PKGBASE Removes FreeBSD Base System Feature few weeks ago.

Copy link
Author

@s-kenji s-kenji Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@illuusio Maybe we should leverage the existing known qualifiers such as repository_url, download_url, and vcs_url to represent how packages are installed. What do you think about using the known qualifiers?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think they are needed at the beginning and hopefully magically things will be sorted out and they are not needed anymore as they make PURLs look gluttered to me. If they don't exist then just assume installation location is default one.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I think we should keep it simple at this point:

  1. As per PURL specification, these qualifiers should be omitted when using default installation sources, which helps maintain cleaner and more readable PURLs.

  2. Rather than defining new qualifiers now, we could revisit this discussion when FreeBSD's pkg database actually supports storing and retrieving this information. This approach would allow us to design qualifiers that align with FreeBSD's actual implementation.

This way, we can avoid premature specification while ensuring future extensibility when the underlying infrastructure supports it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think path goes that as 1. suggest we follow KISS and after this one has landed to PURL then start 2. as it can be little tricky part. As said we can't assume what will be supported by pkg(8) but I think it's doable.

## Examples

- `pkg:bsd/freebsd/[email protected]_2?distro=14.3&epoch=3`
- `pkg:bsd/freebsd/[email protected]?distro=14.3`
44 changes: 44 additions & 0 deletions types/bsd-definition.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://packageurl.org/schemas/purl-type-definition.schema-1.0.json",
"$id": "https://packageurl.org/types/bsd-definition.json",
"type": "bsd",
"type_name": "BSD",
"description": "BSD Operating System variant packages, primarily focused on FreeBSD with extensibility for other BSD variants such as OpenBSD, DragonFly BSD. Note: since NetBSD's package manager is designed for cross-platform use, it should use its own dedicated PURL type.",
"repository": {
"use_repository": true,
"note": "The default repository is http://pkg.freebsd.org for FreeBSD. Other BSD variants may use different repositories as appropriate."
},
"namespace_definition": {
"native_name": "vendor",
"is_case_sensitve": false,
"note": "The namespace is the BSD variant name such as \"freebsd\", \"openbsd\", or \"dragonflybsd\". It is not case sensitive and must be lowercased.",
"requirement": "required"
},
"name_definition": {
"note": "The name is the package name and is case sensitive.",
"case_sensitive": true,
"native_name": "name"
},
"version_definition": {
"native_name": "version",
"note": "The version is the version of the package."
},
"qualifiers_definition": [
{
"key": "arch",
"description": "The target architecture for the package."
},
{
"key": "distro",
"description": "The BSD release version or distribution variant."
},
{
"key": "epoch",
"description": "The package epoch number used for version comparison when normal version ordering is insufficient."
}
],
"examples": [
"pkg:bsd/freebsd/[email protected]_2?distro=14.3&epoch=3",
"pkg:bsd/freebsd/[email protected]?distro=14.3"
]
}