new: drive the license menu, parsing and sniffing from data/licenses.yml
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
## License knowledge of `pkh new`, in one place: the wizard menu labels
|
||||
## (src/new/questions.rs), the spellings accepted by License::parse and the
|
||||
## SPDX URL template (src/new/options.rs), and the license-file sniffing
|
||||
## inputs (src/new/detect.rs) all read this table, so the three lists —
|
||||
## previously kept in sync by comments only — cannot drift apart anymore.
|
||||
## Adding or changing a curated license is one entry below.
|
||||
##
|
||||
## Keys:
|
||||
## id: SPDX identifier: written to debian/copyright, returned
|
||||
## by the license sniff and substituted into
|
||||
## license_url_template (minus a trailing '+' of the
|
||||
## "or later" spellings)
|
||||
## menu: label offered by the wizard license question (the
|
||||
## free-text "Other (enter a SPDX identifier)" entry
|
||||
## stays in Rust — it is UX, not data)
|
||||
## spellings: inputs accepted by License::parse, matched
|
||||
## case-insensitively; each entry must accept its own id
|
||||
## (a consistency test in options.rs locks ids, spellings
|
||||
## and the License enum together)
|
||||
## detect_markers: marker sets driving the LICENSE/COPYING text sniff of
|
||||
## detect.rs. A set matches when every marker of `all`
|
||||
## occurs in the lowercased license text and none of
|
||||
## `unless` does; an entry matches when any of its sets
|
||||
## does. The sets are written to be mutually exclusive:
|
||||
## the `unless` markers keep multi-license texts on the
|
||||
## entry carrying the stronger reference (a MIT-named
|
||||
## file also quoting the GPL or the Apache license is a
|
||||
## GPL/Apache file) and keep GPL sets off LGPL texts,
|
||||
## whose name contains theirs. The entry order below
|
||||
## (menu order) therefore only breaks ties.
|
||||
##
|
||||
## detect_files (top level): the candidate license file names the sniff
|
||||
## reads, in preference order, shared by every license (the case-variant
|
||||
## directory scan around them stays in Rust).
|
||||
##
|
||||
## license_url_template: the SPDX license page URL, with {id} substituted
|
||||
## for the debian/copyright reference paragraph.
|
||||
##
|
||||
## The behavioral lock for the markers is the LICENSE_TEXTS test table in
|
||||
## src/new/detect.rs: a bad marker edit fails those tests, not packages.
|
||||
|
||||
license_url_template: https://spdx.org/licenses/{id}.html
|
||||
|
||||
detect_files:
|
||||
- LICENSE
|
||||
- LICENSE.md
|
||||
- LICENSE.txt
|
||||
- COPYING
|
||||
- COPYING.txt
|
||||
|
||||
# Entries in wizard-menu order.
|
||||
licenses:
|
||||
- id: MIT
|
||||
menu: MIT
|
||||
spellings: [MIT]
|
||||
detect_markers:
|
||||
- all:
|
||||
- mit license
|
||||
unless:
|
||||
- apache license
|
||||
- general public license
|
||||
- all:
|
||||
- permission is hereby granted, free of charge
|
||||
unless:
|
||||
- apache license
|
||||
- general public license
|
||||
- id: Apache-2.0
|
||||
menu: Apache-2.0
|
||||
spellings: [Apache-2.0]
|
||||
detect_markers:
|
||||
- all:
|
||||
- apache license
|
||||
- version 2
|
||||
- id: GPL-2.0+
|
||||
menu: GPL-2.0+
|
||||
spellings: [GPL-2.0+]
|
||||
detect_markers:
|
||||
- all:
|
||||
- general public license
|
||||
unless:
|
||||
- version 3
|
||||
- lesser general public license
|
||||
- id: GPL-3.0+
|
||||
menu: GPL-3.0+
|
||||
spellings: [GPL-3.0+]
|
||||
detect_markers:
|
||||
- all:
|
||||
- general public license
|
||||
- version 3
|
||||
unless:
|
||||
- lesser general public license
|
||||
- id: LGPL-2.1+
|
||||
menu: LGPL-2.1+
|
||||
spellings: [LGPL-2.1+]
|
||||
detect_markers:
|
||||
- all:
|
||||
- lesser general public license
|
||||
unless:
|
||||
- version 3
|
||||
- all:
|
||||
- lesser general public license
|
||||
- version 2.1
|
||||
- id: LGPL-3.0+
|
||||
menu: LGPL-3.0+
|
||||
spellings: [LGPL-3.0+]
|
||||
detect_markers:
|
||||
- all:
|
||||
- lesser general public license
|
||||
- version 3
|
||||
unless:
|
||||
- version 2.1
|
||||
- id: BSD-2-Clause
|
||||
menu: BSD-2-Clause
|
||||
spellings: [BSD-2-Clause]
|
||||
detect_markers:
|
||||
- all:
|
||||
- redistribution and use in source and binary forms
|
||||
unless:
|
||||
- endorse or promote
|
||||
- isc license
|
||||
- permission to use, copy, modify, and/or distribute this software
|
||||
- id: BSD-3-Clause
|
||||
menu: BSD-3-Clause
|
||||
spellings: [BSD-3-Clause]
|
||||
detect_markers:
|
||||
- all:
|
||||
- redistribution and use in source and binary forms
|
||||
- endorse or promote
|
||||
unless:
|
||||
- isc license
|
||||
- permission to use, copy, modify, and/or distribute this software
|
||||
- id: ISC
|
||||
menu: ISC
|
||||
spellings: [ISC]
|
||||
detect_markers:
|
||||
- all:
|
||||
- isc license
|
||||
- all:
|
||||
- permission to use, copy, modify, and/or distribute this software
|
||||
Reference in New Issue
Block a user