Skip to content

Commit c40fa76

Browse files
committed
Fix name requirements and add test cases
1 parent 411de90 commit c40fa76

File tree

2 files changed

+87
-5
lines changed

2 files changed

+87
-5
lines changed

PURL-TYPES.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,14 @@ bazel
6565

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

8078

test-suite-data.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,5 +550,89 @@
550550
"qualifiers": null,
551551
"subpath": null,
552552
"is_invalid": false
553+
},
554+
{
555+
"description": "bazel module with default registry",
556+
"purl": "pkg:bazel/[email protected]?registry_url=https://bcr.bazel.build/",
557+
"canonical_purl": "pkg:bazel/[email protected]",
558+
"type": "bazel",
559+
"namespace": null,
560+
"name": "rules_java",
561+
"version": "7.8.0",
562+
"qualifiers": null,
563+
"subpath": null,
564+
"is_invalid": false
565+
},
566+
{
567+
"description": "bazel module with custom registry",
568+
"purl": "pkg:bazel/[email protected]?registry_url=https://example.org/bazel-registry/",
569+
"canonical_purl": "pkg:bazel/[email protected]?registry_url=https://example.org/bazel-registry",
570+
"type": "bazel",
571+
"namespace": null,
572+
"name": "rules_java",
573+
"version": "7.8.0",
574+
"qualifiers": null,
575+
"subpath": null,
576+
"is_invalid": false
577+
},
578+
{
579+
"description": "bazel module with relaxed semver version",
580+
"purl": "pkg:bazel/[email protected]",
581+
"canonical_purl": "pkg:bazel/[email protected]",
582+
"type": "bazel",
583+
"namespace": null,
584+
"name": "curl",
585+
"version": "8.8.0.bcr.1",
586+
"qualifiers": null,
587+
"subpath": null,
588+
"is_invalid": false
589+
},
590+
{
591+
"description": "bazel module names are lowercased",
592+
"purl": "pkg:bazel/[email protected]",
593+
"canonical_purl": "pkg:bazel/[email protected]",
594+
"type": "bazel",
595+
"namespace": null,
596+
"name": "curl",
597+
"version": "8.8.0.bcr.1",
598+
"qualifiers": null,
599+
"subpath": null,
600+
"is_invalid": true
601+
},
602+
{
603+
"description": "bazel module with target",
604+
"purl": "pkg:bazel/[email protected]#//toolchains:singlejar",
605+
"canonical_purl": "pkg:bazel/[email protected]#toolchains:singlejar",
606+
"type": "bazel",
607+
"namespace": null,
608+
"name": "rules_java",
609+
"version": "7.8.0",
610+
"qualifiers": null,
611+
"subpath": "toolchains:singlejar",
612+
"is_invalid": false
613+
},
614+
{
615+
"description": "bazel module with target in short-hand form",
616+
"purl": "pkg:bazel/[email protected]#//go:go",
617+
"canonical_purl": "pkg:bazel/[email protected]#go",
618+
"type": "bazel",
619+
"namespace": null,
620+
"name": "rules_go",
621+
"version": "0.48.0",
622+
"qualifiers": null,
623+
"subpath": "go",
624+
"is_invalid": false
625+
},
626+
{
627+
"description": "bazel module with top-level target",
628+
"purl": "pkg:bazel/[email protected]#//:stdlib",
629+
"canonical_purl": "pkg:bazel/[email protected]#:stdlib",
630+
"type": "bazel",
631+
"namespace": null,
632+
"name": "rules_go",
633+
"version": "0.48.0",
634+
"qualifiers": null,
635+
"subpath": ":stdlib",
636+
"is_invalid": false
553637
}
554638
]

0 commit comments

Comments
 (0)