Fix: SPDX-compliance

This commit is contained in:
Pieter Vander Vennet 2023-07-27 14:34:05 +02:00
parent 0d705b9727
commit 6c4b464f14
73 changed files with 98 additions and 81 deletions

View file

@ -30,7 +30,7 @@ License: GPL-3.0-or-later
Files: public/assets/templates/*.js public/assets/fonts/*.js Files: public/assets/templates/*.js public/assets/fonts/*.js
Copyright: MapComplete contributors Copyright: MapComplete contributors
Comment: fonts for exports Comment: fonts for exports
License: UBUNTU-FONT-LICENSE License: LicenseRef-UBUNTU-FONT-LICENSE
Files: public/assets/*.svg public/assets/*.png public/apple_touch_icon.png Files: public/assets/*.svg public/assets/*.png public/apple_touch_icon.png

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Turvec Solutions SPDX-FileCopyrightText: Turvec Solutions
SPDX-License-Identifier: ALL-RIGHTS-RESERVED SPDX-License-Identifier: LicenseRef-ALL-RIGHTS-RESERVED

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: ©Altinnova SPDX-FileCopyrightText: ©Altinnova
SPDX-License-Identifier: ALL-RIGHTS-RESERVED SPDX-License-Identifier: LicenseRef-ALL-RIGHTS-RESERVED

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: European Vegetarian Union SPDX-FileCopyrightText: European Vegetarian Union
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Agentschap Natuur en Bos SPDX-FileCopyrightText: Agentschap Natuur en Bos
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Natuurpunt SPDX-FileCopyrightText: Natuurpunt
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Groen SPDX-FileCopyrightText: Groen
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Agentschap Natuur en Bos SPDX-FileCopyrightText: Agentschap Natuur en Bos
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: LiberaPay SPDX-FileCopyrightText: LiberaPay
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Pieter Vander Vennet; OSM SPDX-FileCopyrightText: Pieter Vander Vennet; OSM
SPDX-License-Identifier: LOGO AND CC-BY-SA-4.0 SPDX-License-Identifier: LicenseRef-LOGO AND CC-BY-SA-4.0

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Mapillary SPDX-FileCopyrightText: Mapillary
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Mapillary SPDX-FileCopyrightText: Mapillary
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Mastodon SPDX-FileCopyrightText: Mastodon
SPDX-License-Identifier: LOGO AND AGPL-3.0-or-later SPDX-License-Identifier: LicenseRef-LOGO AND AGPL-3.0-or-later

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: OpenStreetMap U.S. Chapter SPDX-FileCopyrightText: OpenStreetMap U.S. Chapter
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: https://plantnet.org SPDX-FileCopyrightText: https://plantnet.org
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Wikidata SPDX-FileCopyrightText: Wikidata
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Wikimedia SPDX-FileCopyrightText: Wikimedia
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Wikipedia SPDX-FileCopyrightText: Wikipedia
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Agentschap Natuur en Bos SPDX-FileCopyrightText: Agentschap Natuur en Bos
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Natuurpunt SPDX-FileCopyrightText: Natuurpunt
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Groen SPDX-FileCopyrightText: Groen
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Groen SPDX-FileCopyrightText: Groen
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Groen SPDX-FileCopyrightText: Groen
SPDX-License-Identifier: ALL-RIGHTS-RESERVED SPDX-License-Identifier: LicenseRef-ALL-RIGHTS-RESERVED

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: SPDX-FileCopyrightText:
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: De Vlaamse Provincies SPDX-FileCopyrightText: De Vlaamse Provincies
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: De Fietsambassade SPDX-FileCopyrightText: De Fietsambassade
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: De Fietsambassade SPDX-FileCopyrightText: De Fietsambassade
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: ©UNESCO-UIS 2012 http://www.uis.unesco.org SPDX-FileCopyrightText: ©UNESCO-UIS 2012 http://www.uis.unesco.org
SPDX-License-Identifier: ALL-RIGHTS-RESERVED SPDX-License-Identifier: LicenseRef-ALL-RIGHTS-RESERVED

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Departement Omgeving, Vlaamse Overheid SPDX-FileCopyrightText: Departement Omgeving, Vlaamse Overheid
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Provincie Antwerpen SPDX-FileCopyrightText: Provincie Antwerpen
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Vlaamse Overheid SPDX-FileCopyrightText: Vlaamse Overheid
SPDX-License-Identifier: ALL-RIGHTS-RESERVED SPDX-License-Identifier: LicenseRef-ALL-RIGHTS-RESERVED

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Createlli SPDX-FileCopyrightText: Createlli
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Youtube SPDX-FileCopyrightText: Youtube
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Jo De Baerdemaeker SPDX-FileCopyrightText: Jo De Baerdemaeker
SPDX-License-Identifier: ALL-RIGHTS-RESERVED SPDX-License-Identifier: LicenseRef-ALL-RIGHTS-RESERVED

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Jo De Baerdemaeker SPDX-FileCopyrightText: Jo De Baerdemaeker
SPDX-License-Identifier: ALL-RIGHTS-RESERVED SPDX-License-Identifier: LicenseRef-ALL-RIGHTS-RESERVED

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Toerisme Vlaanderen SPDX-FileCopyrightText: Toerisme Vlaanderen
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Toerisme Vlaanderen SPDX-FileCopyrightText: Toerisme Vlaanderen
SPDX-License-Identifier: LOGO SPDX-License-Identifier: LicenseRef-LOGO

View file

@ -1,2 +1,2 @@
SPDX-FileCopyrightText: Pieter Vander Vennet SPDX-FileCopyrightText: Pieter Vander Vennet
SPDX-License-Identifier: TRIVIAL SPDX-License-Identifier: LicenseRef-TRIVIAL

View file

@ -4,9 +4,15 @@ import ScriptUtils from "./ScriptUtils"
import Script from "./Script" import Script from "./Script"
import { Utils } from "../src/Utils" import { Utils } from "../src/Utils"
const prompt = require("prompt-sync")()
export class GenerateLicenseInfo extends Script { export class GenerateLicenseInfo extends Script {
private static readonly needsLicenseRef = new Set(
ScriptUtils.readDirRecSync("./LICENSES")
.map((p) => p.substring(p.lastIndexOf("/") + 1))
.filter((p) => p.startsWith("LicenseRef-"))
.map((p) => p.substring("LicenseRef-".length))
.map((p) => p.substring(0, p.lastIndexOf(".")))
)
constructor() { constructor() {
super("Validates the licenses and compiles them into one single asset file") super("Validates the licenses and compiles them into one single asset file")
} }
@ -193,11 +199,6 @@ export class GenerateLicenseInfo extends Script {
*/ */
toSPDXCompliantLicense(licenseId: string): string { toSPDXCompliantLicense(licenseId: string): string {
licenseId = licenseId.trim() licenseId = licenseId.trim()
licenseId = licenseId.replaceAll("-AND-", " AND ")
if (!(licenseId.endsWith("-only") || licenseId.endsWith("-or-later"))) {
licenseId = licenseId.toUpperCase()
}
// https://spdx.org/licenses/ // https://spdx.org/licenses/
const mappings: Record<string, string> = { const mappings: Record<string, string> = {
"CC-0": "CC0-1.0", "CC-0": "CC0-1.0",
@ -362,11 +363,10 @@ export class GenerateLicenseInfo extends Script {
let invalid = 0 let invalid = 0
for (const licenseInfo of licenseInfos) { for (const licenseInfo of licenseInfos) {
const isTrivial = const isTrivial = licenseInfo.license
licenseInfo.license .split(";")
.split(";") .map((l) => l.trim().toLowerCase())
.map((l) => l.trim().toLowerCase()) .some((s) => s.endsWith("trivial"))
.indexOf("trivial") >= 0
if (licenseInfo.sources.length + licenseInfo.authors.length == 0 && !isTrivial) { if (licenseInfo.sources.length + licenseInfo.authors.length == 0 && !isTrivial) {
invalid++ invalid++
invalidLicenses.push( invalidLicenses.push(
@ -393,7 +393,11 @@ export class GenerateLicenseInfo extends Script {
const spdxContent = [ const spdxContent = [
"SPDX-FileCopyrightText: " + licenseInfo.authors.join("; "), "SPDX-FileCopyrightText: " + licenseInfo.authors.join("; "),
"SPDX-License-Identifier: " + licenseInfo.license, "SPDX-License-Identifier: " +
licenseInfo.license
.split(" AND ")
.map((s) => this.addLicenseRef(s))
.join(" AND "),
] ]
writeFileSync(spdxPath, spdxContent.join("\n")) writeFileSync(spdxPath, spdxContent.join("\n"))
} }
@ -410,6 +414,19 @@ export class GenerateLicenseInfo extends Script {
this.cleanLicenseInfo(licensePaths, licenseInfos) this.cleanLicenseInfo(licensePaths, licenseInfos)
this.createFullLicenseOverview(licensePaths) this.createFullLicenseOverview(licensePaths)
} }
/**
* Some licenses need "LicenseRef-" to be added to make reuse lint work
* @param s
* @private
*/
private addLicenseRef(s: string): string {
if (GenerateLicenseInfo.needsLicenseRef.has(s)) {
console.log("Mapping ", s, Array.from(GenerateLicenseInfo.needsLicenseRef))
return "LicenseRef-" + s
}
return s
}
} }
new GenerateLicenseInfo().run() new GenerateLicenseInfo().run()