Skip to content

Commit 3336be2

Browse files
committed
pkgbuild: remove pypi field over purl; add purl version support
* We now support pypi PURLs, so no need to have our own separate pypi type anymore. * PURLs now support versions, which take precedence over the pkgver if specified.
1 parent dd0dca8 commit 3336be2

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

web/dev/pkgbuild.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ For `msys2_references` the following keys are recognized:
2828
* `cygwin-mingw64` -
2929
the cygwin package name for all packages starting with "mingw64-x86_64-",
3030
minus that prefix: https://cygwin.com/packages/src_package_list.html
31-
* `pypi` - the PyPI project name (case-insensitive): https://pypi.org/search/
3231
* `gentoo` - the full Gentoo package name e.g. `dev-python/pyasn1`
3332
* `internal` - special key, which if it exists marks the package as internal and doesn't link it to any external sources
34-
* `purl` - a [package URL](https://github.com/package-url/purl-spec) e.g. `pkg:cargo/ripgrep` (only cargo supported atm)
35-
Multiple PURLs supported.
36-
* `cpe` - a [CPE](https://en.wikipedia.org/wiki/Common_Platform_Enumeration) prefix, either in the 2.2 format (`cpe: cpe:/a:gnu:gcc`) or the 2.3 format (`cpe:2.3:a:gnu:gcc`). `target_sw` etc are currently not supported. Multiple CPEs supported.
33+
* `purl` - a [package URL](https://github.com/package-url/purl-spec). Multiple PURLs supported. Versions are optionally supported, and useful in case the upstream version is different from the package version. Some common PURL types:
34+
* [pypi](https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#pypi) - example: `pkg:pypi/jinja2` or `pkg:pypi/@3.1.5` - make sure to [normalize](https://packaging.python.org/en/latest/specifications/name-normalization) the package name
35+
* [cargo](https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#cargo) - example: `pkg:cargo/ripgrep` or `pkg:cargo/[email protected]`
36+
* [gem](https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#gem) - example: `pkg:gem/asciidoctor`
37+
* [github](https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst#github) - example: `pkg:github/curl/curl` or `pkg:github/curl/curl@curl-8_12_1`
38+
* ...
39+
* `cpe` - a [CPE](https://en.wikipedia.org/wiki/Common_Platform_Enumeration) prefix, either in the 2.2 format (`cpe: cpe:/a:gnu:gcc`) or the 2.3 format (`cpe:2.3:a:gnu:gcc`). `version`, `target_sw` etc are currently not supported. Multiple CPEs supported.
3740

3841
Defining a key without a value means there is no mapping and the package shouldn't be linked.
3942

@@ -44,3 +47,8 @@ The following datatypes are supported:
4447
* **mapping:** Mappings of strings to optional other strings, separated by `":"`, values are
4548
stripped: `msys2_myvar=("example1: value1" "example2")` 🠆 `{"myvar": {"example1": ["value1"], "example2": [null]}}`
4649
* **boolean:** either `true` or `false`: `msys2_myvar=true` 🠆 `{"myvar": true}`
50+
51+
## Changelog
52+
53+
**2025-02-17:** Added support for the `version` component in `purl` entries, for example `purl: pkg:pypi/[email protected]`.
54+
**2025-02-17:** Removed support for `pypi` in `msys2_references`, use `purl` with the `pypi` type instead, for example `purl: pkg:pypi/jinja2` instead of `pypi: jinja2`.

web/dev/vulnerabilities.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ graph LR;
1414

1515
The following metadata is used to generate the SBOM file, so that CVEs etc. can be matched to our packages:
1616

17-
In the `msys2_references` field in each `PKGBUILD` file the `cpe` key, the `purl` and the `pypi` keys are used to match to CVEs.
17+
In the `msys2_references` field in each `PKGBUILD` file the `cpe` and `purl` entries are used to match to CVEs.
1818
The more references the better. Language ecosystem specific references such as pypi and cargo are preferred. For more information about the fields see [PKGBUILD](./pkgbuild.md).
1919

2020
Example:
@@ -23,11 +23,20 @@ Example:
2323
msys2_references=(
2424
"cpe: cpe:/a:python-cryptography_project:python-cryptography"
2525
"cpe: cpe:2.3:a:cryptography_project:cryptography"
26-
"pypi: cryptography"
2726
"purl: pkg:pypi/cryptography"
2827
)
2928
```
3029

30+
In case the version format of the referenced ecosystem is different from the PKGBUILD version, you can specify the version in the `purl` field:
31+
32+
```bash
33+
pkgver=1.0dev1
34+
_pypiver=1.0.dev1
35+
msys2_references=(
36+
"purl: pkg:pypi/example@${_pypiver}"
37+
)
38+
```
39+
3140
If a discovered vulnerability doesn't affect our users in the first place (it's
3241
Unix only for example), or is already fixed (missing or wrong version
3342
information attached to the vulnerability info), or we have backported a fix for

0 commit comments

Comments
 (0)