Skip to content

Commit

Permalink
Fix name requirements and add test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
fmeum committed Nov 22, 2024
1 parent 6fdc28e commit f838dce
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 5 deletions.
8 changes: 3 additions & 5 deletions PURL-TYPES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,14 @@ bazel

- The default repository ("registry") is ``https://bcr.bazel.build``, the
Bazel Central Registry (BCR).
- The ``name`` is the module name. It is case sensitive, but a single registry
will never contain two different module names that compare equal
case-insensitively.
- The ``name`` is the module name. It must be lowercased.
- The ``version`` is the module version in `Bazel's relaxed semver format
<https://bazel.build/external/module#version_format>`_.
- The optional ``repository_url`` can be used to specify the URL of an
alternative registry.
alternative registry, with any trailing forward slashes removed.
- The optional ``subpath`` can name a particular Bazel target in the module via
a label with the leading double slash (``//``) removed and canonicalized by
omitting the target name if it is equal to the name of the containing package.
omitting the target name if it is equal to the name of the containing package.
- Examples::

pkg:bazel/[email protected]
Expand Down
84 changes: 84 additions & 0 deletions test-suite-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -622,5 +622,89 @@
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bazel module with default registry",
"purl": "pkg:bazel/[email protected]?registry_url=https://bcr.bazel.build/",
"canonical_purl": "pkg:bazel/[email protected]",
"type": "bazel",
"namespace": null,
"name": "rules_java",
"version": "7.8.0",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bazel module with custom registry",
"purl": "pkg:bazel/[email protected]?registry_url=https://example.org/bazel-registry/",
"canonical_purl": "pkg:bazel/[email protected]?registry_url=https://example.org/bazel-registry",
"type": "bazel",
"namespace": null,
"name": "rules_java",
"version": "7.8.0",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bazel module with relaxed semver version",
"purl": "pkg:bazel/[email protected]",
"canonical_purl": "pkg:bazel/[email protected]",
"type": "bazel",
"namespace": null,
"name": "curl",
"version": "8.8.0.bcr.1",
"qualifiers": null,
"subpath": null,
"is_invalid": false
},
{
"description": "bazel module names are lowercased",
"purl": "pkg:bazel/[email protected]",
"canonical_purl": "pkg:bazel/[email protected]",
"type": "bazel",
"namespace": null,
"name": "curl",
"version": "8.8.0.bcr.1",
"qualifiers": null,
"subpath": null,
"is_invalid": true
},
{
"description": "bazel module with target",
"purl": "pkg:bazel/[email protected]#//toolchains:singlejar",
"canonical_purl": "pkg:bazel/[email protected]#toolchains:singlejar",
"type": "bazel",
"namespace": null,
"name": "rules_java",
"version": "7.8.0",
"qualifiers": null,
"subpath": "toolchains:singlejar",
"is_invalid": false
},
{
"description": "bazel module with target in short-hand form",
"purl": "pkg:bazel/[email protected]#//go:go",
"canonical_purl": "pkg:bazel/[email protected]#go",
"type": "bazel",
"namespace": null,
"name": "rules_go",
"version": "0.48.0",
"qualifiers": null,
"subpath": "go",
"is_invalid": false
},
{
"description": "bazel module with top-level target",
"purl": "pkg:bazel/[email protected]#//:stdlib",
"canonical_purl": "pkg:bazel/[email protected]#:stdlib",
"type": "bazel",
"namespace": null,
"name": "rules_go",
"version": "0.48.0",
"qualifiers": null,
"subpath": ":stdlib",
"is_invalid": false
}
]

0 comments on commit f838dce

Please sign in to comment.