Skip to content

Commit a7819ed

Browse files
Merge pull request #299 from SgtCoDFish/simplify-licenses
Simplify handling of licenses
2 parents b7b26d5 + e8545c3 commit a7819ed

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

modules/licenses/01_mod.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ generate-go-licenses: #
3030
shared_generate_targets += generate-go-licenses
3131

3232
define licenses_target
33-
$1/LICENSES: $1/go.mod $(licenses_go_work) | $(NEEDS_GO-LICENSES)
33+
$1/LICENSES: $1/go.mod $(licenses_go_work) $(dir $(lastword $(MAKEFILE_LIST)))/licenses.tmpl | $(NEEDS_GO-LICENSES)
3434
cd $$(dir $$@) && \
3535
GOWORK=$(abspath $(licenses_go_work)) \
3636
GOOS=linux GOARCH=amd64 \
37-
$(GO-LICENSES) report --ignore "$$(license_ignore)" ./... > LICENSES
37+
$(GO-LICENSES) report --ignore "$$(license_ignore)" --template $(dir $(lastword $(MAKEFILE_LIST)))/licenses.tmpl ./... > LICENSES
3838

3939
generate-go-licenses: $1/LICENSES
4040
# The /LICENSE targets make sure these files exist.

modules/licenses/licenses.tmpl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This LICENSES file is generated by the `licenses` module in makefile-modules.
2+
3+
The licenses below the "---" are determined by the go-licenses tool.
4+
5+
The aim of this file is to collect the licenses of all dependencies, and provide
6+
a single source of truth for licenses used by this project.
7+
8+
If CI reports that this file is out of date, you should be careful to check that the
9+
new licenses are acceptable for this project before running `make generate-go-licenses`
10+
to update this file.
11+
12+
Acceptable licenses are those allowlisted by the CNCF[0].
13+
14+
You MUST NOT add any new dependencies whose licenses are not allowlisted by the CNCF,
15+
or which do not have an explicit license exception[1].
16+
17+
[0]: https://github.com/cncf/foundation/blob/db4179134ebe7fa00b140a050c19147db808b6fa/policies-guidance/allowed-third-party-license-policy.md#cncf-allowlist-license-policy
18+
[1]: https://github.com/cncf/foundation/blob/db4179134ebe7fa00b140a050c19147db808b6fa/license-exceptions/README.md
19+
20+
---
21+
22+
{{ range . -}}
23+
{{ .Name }},{{ .LicenseName }}
24+
{{ end -}}

0 commit comments

Comments
 (0)