Skip to content

Commit 4bcfc45

Browse files
authored
Merge pull request package-url#611 from package-url/592-convert-remaining-rst-to-md
Convert remaining rST files to markdown format We may need to make further updates from the next review, but these changes are need to complete an update to purl-standard.md to complete Section 5.6 PURL Types
2 parents 4d63e15 + de080b2 commit 4bcfc45

8 files changed

Lines changed: 228 additions & 149 deletions

File tree

PURL-TYPES.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ repository with:
6262

6363
- a new JSON definition file under `types/`.
6464
- a new JSON test file file under `tests/types/`.
65-
66-
65+
66+
6767
Ensure that your proposal follows the **PURL Type Definition Schema** and includes all required
6868
fields. For this see the README-dev.rst for details to run local checks.
6969

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
1-
Development setup and instructions
2-
=====================================
1+
# Development setup and instructions
32

43
We use some code:
54

65
- to validate the JSON schemas for correctness and format them, and
76
- to validate that the test suite data files are schema-valid.
87

98
To setup an environment to contribute to the Package-URL spec and standard, follow these
10-
instructions::
9+
instructions:
1110

12-
Setup
13-
-------
11+
## Setup
1412

1513
1. Ensure that you have a recent Python version 3 and Make installed.
16-
2. Configure your environment::
14+
2. Configure your environment:
1715

16+
```bash
1817
make conf
18+
```
1919

20-
Usage
21-
-------
20+
## Usage
2221

23-
To validate that the schemas and data files are correct, run::
24-
25-
make check
22+
To validate that the schemas and data files are correct, run:
2623

24+
```bash
25+
make check
26+
```
2727

2828
To regenerate the Python utility model code from the JSON schemas, then regenerate the
29-
PURL type documentation from the JSON PURL type definition files, run::
30-
31-
make generate
32-
make docs
29+
PURL type documentation from the JSON PURL type definition files, run:
3330

31+
```bash
32+
make generate
33+
make docs
34+
```

README.rst renamed to README.md

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
Context
2-
=======
1+
# Context
32

43
We build and release software by massively consuming and producing software
54
packages such as NPMs, RPMs, Rubygems, etc.
65

76
Each package manager, platform, type or ecosystem has its own conventions and
87
protocols to identify, locate and provision software packages.
98

10-
11-
Problem
12-
=======
9+
# Problem
1310

1411
When tools, APIs and databases process or store multiple package types, it is
1512
difficult to reference the same software package across tools in a uniform way.
@@ -48,9 +45,7 @@ differences in syntax, naming and conventions:
4845
- Sonatype Lifecycle uses a format id followed by format specific coordinates.
4946
https://links.sonatype.com/products/nxiq/doc/component-identifier
5047

51-
52-
Solution
53-
========
48+
# Solution
5449

5550
A `purl` or package URL is an attempt to standardize existing approaches to
5651
reliably identify and locate software packages.
@@ -62,17 +57,14 @@ packaging conventions, tools, APIs and databases.
6257
Such a package URL is useful to reliably reference the same software package
6358
using a simple and expressive syntax and conventions based on familiar URLs.
6459

65-
6660
Check also this short `purl` presentation (with video) at FOSDEM 2018
6761
https://fosdem.org/2018/schedule/event/purl/ for an overview.
6862

69-
70-
purl
71-
~~~~~
63+
## purl
7264

7365
`purl` stands for **package URL**.
7466

75-
A `purl` is a URL composed of seven components::
67+
A `purl` is a URL composed of seven components:
7668

7769
scheme:type/namespace/name@version?qualifiers#subpath
7870

@@ -94,20 +86,14 @@ The definition for each components is:
9486
- **subpath**: extra subpath within a package, relative to the package root.
9587
Optional.
9688

97-
9889
Components are designed such that they form a hierarchy from the most significant component
9990
on the left to the least significant component on the right.
10091

101-
10292
A `purl` must NOT contain a URL Authority i.e. there is no support for
10393
`username`, `password`, `host` and `port` components. A `namespace` segment may
10494
sometimes look like a `host` but its interpretation is specific to a `type`.
10595

106-
107-
Some `purl` examples
108-
~~~~~~~~~~~~~~~~~~~~
109-
110-
::
96+
## Some `purl` examples
11197

11298
pkg:bitbucket/birkenfeld/pygments-main@244fd47e07d1014f0aed9c
11399

@@ -138,23 +124,19 @@ Some `purl` examples
138124

139125
(NB: some checksums are truncated for brevity)
140126

141-
142-
Specification details
143-
~~~~~~~~~~~~~~~~~~~~~
127+
## Specification details
144128

145129
The `purl` specification consists of a core syntax definition and independent
146130
type definitions:
147131

148132
- `Package URL core <PURL-SPECIFICATION.rst>`_: Defines a versioned and
149133
formalized format, syntax, and rules used to represent and validate `purl`.
150134

151-
- `Type definitions <PURL-TYPES.rst>`_: Defines `purl` types (e.g. maven, npm,
135+
- `Type definitions <PURL-TYPES.md>`_: Defines `purl` types (e.g. maven, npm,
152136
cargo, rpm, etc) independent of the core specification. Definitions also
153137
include types reserved for future use.
154138

155-
156-
Known implementations
157-
~~~~~~~~~~~~~~~~~~~~~
139+
## Known implementations
158140

159141
- .NET: https://github.com/package-url/packageurl-dotnet
160142
- Erlang / Elixir: https://github.com/erlef/purl
@@ -170,14 +152,6 @@ Known implementations
170152
- Rust: https://github.com/package-url/packageurl.rs
171153
- Swift: https://github.com/package-url/packageurl-swift
172154

173-
174-
Users, adopters and links
175-
~~~~~~~~~~~~~~~~~~~~~~~~~
155+
## Users, adopters and links
176156

177157
See the `dedicated adopters list <ADOPTERS.md>`_.
178-
179-
180-
License
181-
~~~~~~~
182-
183-
This document is licensed under the MIT license

docs/candidate-purl-types.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## Other candidate types to define
2+
3+
- ``android`` for Android apk packages
4+
- ``apache`` for Apache projects packages
5+
- ``atom`` for Atom packages
6+
- ``bower`` for Bower JavaScript packages
7+
- ``brew`` for Homebrew packages
8+
- ``buildroot`` for Buildroot packages
9+
- ``carthage`` for Cocoapods Cocoa packages
10+
- ``chef`` for Chef packages
11+
- ``chocolatey`` for Chocolatey packages
12+
- ``clojars`` for Clojure packages
13+
- ``coreos`` for CoreOS packages
14+
- ``crystal`` for Crystal Shards packages
15+
- ``ctan`` for CTAN TeX packages
16+
- ``drupal`` for Drupal packages
17+
- ``dtype`` for DefinitelyTyped TypeScript type definitions
18+
- ``dub`` for D packages
19+
- ``ebuild`` for Gentoo Linux portage packages
20+
- ``eclipse`` for Eclipse projects packages
21+
- ``elm`` for Elm packages
22+
- ``gitea`` for Gitea-based packages
23+
- ``gitlab`` for GitLab-based packages
24+
- ``gradle`` for Gradle plugins
25+
- ``guix`` for Guix packages
26+
- ``haxe`` for Haxe packages
27+
- ``helm`` for Kubernetes packages
28+
- ``julia`` for Julia packages
29+
- ``melpa`` for Emacs packages
30+
- ``meteor`` for Meteor JavaScript packages
31+
- ``nim`` for Nim packages
32+
- ``nix`` for Nixos packages
33+
- ``opam`` for OCaml packages
34+
- ``openwrt`` for OpenWRT packages
35+
- ``osgi`` for OSGi bundle packages
36+
- ``p2`` for Eclipse p2 packages
37+
- ``pear`` for Pear PHP packages
38+
- ``pecl`` for PECL PHP packages
39+
- ``perl6`` for Perl 6 module packages
40+
- ``platformio`` for PlatformIO packages
41+
- ``puppet`` for Puppet Forge packages
42+
- ``sourceforge`` for Sourceforge-based packages
43+
- ``sublime`` for Sublime packages
44+
- ``terraform`` for Terraform modules
45+
- ``vagrant`` for Vagrant boxes
46+
- ``vim`` for Vim scripts packages
47+
- ``wordpress`` for Wordpress packages
48+
- ``yocto`` for Yocto recipe packages

docs/maintain-purl-types.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
## How PURL Types are maintained
2+
3+
PURL type definitions are maintained as JSON definition files and JSON
4+
test files in the PURL specification repository. These JSON files serve as
5+
the source of truth and define the structure of each PURL type, including:
6+
7+
- Namespace and name formatting rules
8+
- Supported qualifiers
9+
- Repository requirements
10+
- Mapping of PURL concepts to the native ecosystem concepts
11+
12+
On commit, a job automatically:
13+
14+
- Checks that all JSON files are schema-valid
15+
- Formats all the JSON files
16+
- Generates the ``purl-types-index.json`` file containing a list of defined
17+
registered PURL types
18+
- Generates human-readable documentation for each type
19+
20+
## How to Propose a New PURL Type
21+
22+
To propose a new PURL type, create an **issue** and a corresponding
23+
**pull request** in the repository with:
24+
25+
- a new JSON definition file under `types/`.
26+
- a new JSON test file file under `tests/types/`.
27+
28+
Ensure that your proposal follows the **PURL Type Definition Schema** and
29+
includes all required fields. For this see the README-dev.md for details to
30+
run local checks.

docs/standard/types.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1-
##Registered `purl` types
1+
## Package-URL Type definitions
22

3-
There are several registered `purl` package type definitions tracked in the
4-
separate [PURL-TYPES.rst](PURL-TYPES.rst) document.
3+
Each package manager, platform, type, or ecosystem has its own conventions
4+
and protocols to identify, locate, and provision software packages.
5+
6+
The package **type** is the component of a Package-URL that is used to
7+
capture this information with a short string such as ``maven``, ``npm``,
8+
``nuget``, ``gem``, ``pypi``, etc.
9+
10+
These are registered ``PURL`` package type definitions.
11+
12+
Definitions can also include types reserved for future use.
13+
14+
See also https://github.com/package-url/purl-spec and
15+
[PURL-SPECIFICATION.rst](https://github.com/package-url/purl-spec/blob/main/PURL-SPECIFICATION.rst) for the Package URL specification.
16+
17+
This document no longer contains a manually maintained list of PURL types.
18+
19+
Instead, all PURL type definitions are now maintained in a simple JSON
20+
document with automatically generated documentation.
21+
22+
## Where to find PURL Type information
23+
24+
- In the JSON Index listing of all defined PURL types at:
25+
`/purl-types-index.json <https://github.com/package-url/purl-spec/tree/main/purl-types-index.json>`_
26+
27+
- In individual JSON files, one for each PURL type definition at:
28+
`/types <https://github.com/package-url/purl-spec/tree/main/types>`_
29+
30+
- As Markdown documentation, generated from for each PURL type JSON
31+
definition at:
32+
`/types-doc <https://github.com/package-url/purl-spec/tree/main/types-doc>`_

faq.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Frequently Asked Questions
2+
3+
## Scheme
4+
5+
**QUESTION**: Can the ``scheme`` component be followed by a colon and two
6+
slashes, like a URI?
7+
8+
**ANSWER**: No. Since a ``purl`` never contains a URL Authority, its
9+
``scheme`` should not be suffixed with double slash as in 'pkg://' and should
10+
use 'pkg:' instead. Otherwise this would be an invalid URI per RFC 3986 at
11+
https://tools.ietf.org/html/rfc3986#section-3.3:
12+
13+
If a URI does not contain an authority component, then the path
14+
cannot begin with two slash characters ("//").
15+
16+
This rule applies to all slash '/' characters between the ``scheme``'s colon
17+
separator and the ``type`` component, e.g., ':/', '://', ':///' et al.
18+
19+
In its canonical form, a ``purl`` must not use any such ':/' ``scheme``
20+
suffix and may only use ':' as a ``scheme`` suffix. This means that:
21+
22+
- ``purl`` parsers must accept URLs such as 'pkg://' and must ignore and
23+
remove all such '/' characters.
24+
25+
- ``purl`` builders should not create invalid URLs with one or more slash '/'
26+
characters between 'pkg:' and the ``type`` component.
27+
28+
For example, although these two purls are strictly equivalent, the first is
29+
in canonical form, while the second -- with a '//' between 'pkg:' and the
30+
``type`` 'gem' -- is an acceptable purl but is an invalid URI/URL per RFC
31+
3986:
32+
33+
pkg:gem/ruby-advisory-db-check@0.12.4
34+
35+
pkg://gem/ruby-advisory-db-check@0.12.4
36+
37+
**QUESTION**: Is the colon between ``scheme`` and ``type`` encoded? Can it be
38+
encoded? If yes, how?
39+
40+
**ANSWER**: The "Rules for each ``purl`` component" section provides that the
41+
``scheme`` MUST be followed by an unencoded colon ':'.
42+
43+
In this case, the colon ':' between ``scheme`` and ``type`` is being used as
44+
a separator, and consequently should be used as-is, never encoded and never
45+
requiring any decoding. Moreover, it should be a parsing error if the colon
46+
':' does not come directly after 'pkg'. Tools are welcome to recover from
47+
this error to help with malformed purls, but that's not a requirement.
48+
49+
## Type
50+
51+
**QUESTION**: What behavior is expected from a purl spec implementation if a
52+
``type`` contains a character like a slash '/' or a colon ':'?
53+
54+
**ANSWER**: The "Rules for each purl component" section provides that the
55+
package ``type`` that list allowed characters:
56+
57+
MUST be composed only of ASCII letters and numbers, period '.', and
58+
dash '-'.
59+
60+
As a result, a purl spec implementation must return an error when
61+
encountering a ``type`` that contains a prohibited character.
62+
63+
## Version
64+
65+
**QUESTION**: How do package ``types`` handle the comparison and sorting of
66+
versions?
67+
68+
**ANSWER**: Some package ``types`` use versioning conventions such as SemVer
69+
for NPMs or NEVRA conventions for RPMS. A ``type`` may define a procedure to
70+
compare and sort versions, but there is no reliable and uniform way to do
71+
such comparison consistently.
72+
73+
Plus
74+
75+
**QUESTION**: Can a PURL contain a plus character '+'?
76+
77+
**ANSWER**: Decoded individual components can contain a plus. The encoded,
78+
canonical form can never contain an unencoded plus.
79+
80+
## Qualifiers
81+
82+
**QUESTION**: What is the qualifier for a checksum like a SHA1?
83+
84+
**ANSWER**: The spec was originally ambiguous and used ``checksum``
85+
(singular) in one place and ``checksums`` (plural) in other places. This has
86+
been discussed extensively in issues and PRs such as
87+
https://github.com/package-url/purl-spec/issues/73 and
88+
https://github.com/package-url/purl-spec/pull/209 and the official form
89+
is ``checksum`` (singular). When writing a lenient parser, consider accepting
90+
both ``checksum`` (singular) and ``checksums`` (plural) when reading a PURL,
91+
and always emit ``checksum`` (singular) when writing a PURL.

0 commit comments

Comments
 (0)