Skip to content

Commit 9edaf20

Browse files
authored
Merge pull request #34 from github/elr/license-updates
update license lists from official spdx data
2 parents a7497e7 + 442905e commit 9edaf20

12 files changed

+7903
-107
lines changed

cmd/deprecated_license_ids.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","bzip2-1.0.5","eCos-2.0","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-1.0+","GPL-2.0","GPL-2.0+","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-2.0-with-GCC-exception","GPL-3.0","GPL-3.0+","GPL-3.0-with-autoconf-exception","GPL-3.0-with-GCC-exception","LGPL-2.0","LGPL-2.0+","LGPL-2.1","LGPL-2.1+","LGPL-3.0","LGPL-3.0+","Nunit","StandardML-NJ","wxWindows"]

cmd/deprecated_license_ids.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"AGPL-1.0",
2+
"AGPL-3.0",
3+
"BSD-2-Clause-FreeBSD",
4+
"BSD-2-Clause-NetBSD",
5+
"bzip2-1.0.5",
6+
"eCos-2.0",
7+
"GFDL-1.1",
8+
"GFDL-1.2",
9+
"GFDL-1.3",
10+
"GPL-1.0",
11+
"GPL-1.0+",
12+
"GPL-2.0",
13+
"GPL-2.0+",
14+
"GPL-2.0-with-autoconf-exception",
15+
"GPL-2.0-with-bison-exception",
16+
"GPL-2.0-with-classpath-exception",
17+
"GPL-2.0-with-font-exception",
18+
"GPL-2.0-with-GCC-exception",
19+
"GPL-3.0",
20+
"GPL-3.0+",
21+
"GPL-3.0-with-autoconf-exception",
22+
"GPL-3.0-with-GCC-exception",
23+
"LGPL-2.0",
24+
"LGPL-2.0+",
25+
"LGPL-2.1",
26+
"LGPL-2.1+",
27+
"LGPL-3.0",
28+
"LGPL-3.0+",
29+
"Nunit",
30+
"StandardML-NJ",
31+
"wxWindows",

cmd/exception_ids.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["389-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-3.1","gnu-javamail-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","Libtool-exception","Linux-syscall-note","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SHL-2.0","SHL-2.1","Swift-exception","u-boot-exception-2.0","Universal-FOSS-exception-1.0","WxWindows-exception-3.1","x11vnc-openssl-exception"]

cmd/exception_ids.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
"389-exception",
2+
"Autoconf-exception-2.0",
3+
"Autoconf-exception-3.0",
4+
"Bison-exception-2.2",
5+
"Bootloader-exception",
6+
"Classpath-exception-2.0",
7+
"CLISP-exception-2.0",
8+
"DigiRule-FOSS-exception",
9+
"eCos-exception-2.0",
10+
"Fawkes-Runtime-exception",
11+
"FLTK-exception",
12+
"Font-exception-2.0",
13+
"freertos-exception-2.0",
14+
"GCC-exception-2.0",
15+
"GCC-exception-3.1",
16+
"gnu-javamail-exception",
17+
"GPL-3.0-linking-exception",
18+
"GPL-3.0-linking-source-exception",
19+
"GPL-CC-1.0",
20+
"GStreamer-exception-2005",
21+
"GStreamer-exception-2008",
22+
"i2p-gpl-java-exception",
23+
"KiCad-libraries-exception",
24+
"LGPL-3.0-linking-exception",
25+
"Libtool-exception",
26+
"Linux-syscall-note",
27+
"LLVM-exception",
28+
"LZMA-exception",
29+
"mif-exception",
30+
"OCaml-LGPL-linking-exception",
31+
"OCCT-exception-1.0",
32+
"OpenJDK-assembly-exception-1.0",
33+
"openvpn-openssl-exception",
34+
"PS-or-PDF-font-exception-20170817",
35+
"Qt-GPL-exception-1.0",
36+
"Qt-LGPL-exception-1.1",
37+
"Qwt-exception-1.0",
38+
"SHL-2.0",
39+
"SHL-2.1",
40+
"Swift-exception",
41+
"u-boot-exception-2.0",
42+
"Universal-FOSS-exception-1.0",
43+
"WxWindows-exception-3.1",
44+
"x11vnc-openssl-exception",

cmd/exceptions.go

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package main
2+
3+
import (
4+
"encoding/json"
5+
"fmt"
6+
"io/ioutil"
7+
"os"
8+
)
9+
10+
type ExceptionData struct {
11+
Version string `json:"licenseListVersion"`
12+
Exceptions []Exception `json:"exceptions"`
13+
}
14+
15+
type Exception struct {
16+
Reference string `json:"reference"`
17+
IsDeprecated bool `json:"isDeprecatedLicenseId"`
18+
DetailsURL string `json:"detailsUrl"`
19+
ReferenceNumber int `json:"referenceNumber"`
20+
Name string `json:"name"`
21+
LicenseID string `json:"licenseExceptionId"`
22+
SeeAlso []string `json:"seeAlso"`
23+
IsOsiApproved bool `json:"isOsiApproved"`
24+
}
25+
26+
// extractExceptionLicenseIDs read official exception licenses file copied from spdx/license-list-data
27+
// and write file exception_license_ids.json containing just the non-deprecated exception license IDs.
28+
// NOTE: For now, this function ignores the deprecated exception licenses.
29+
func extractExceptionLicenseIDs() error {
30+
// open file
31+
file, err := os.Open("exceptions.json")
32+
if err != nil {
33+
fmt.Println(err)
34+
return err
35+
}
36+
37+
// read in all licenses marshalled into a slice of exception structs
38+
var exceptionData ExceptionData
39+
err = json.NewDecoder(file).Decode(&exceptionData)
40+
if err != nil {
41+
return err
42+
}
43+
44+
// create slice of exception license IDs that are not deprecated
45+
var nonDeprecatedExceptionLicenseIDs []string
46+
for _, e := range exceptionData.Exceptions {
47+
if !e.IsDeprecated {
48+
nonDeprecatedExceptionLicenseIDs = append(nonDeprecatedExceptionLicenseIDs, e.LicenseID)
49+
}
50+
}
51+
52+
// save non-deprecated license IDs followed by a comma with one per line in file license_ids.txt
53+
nonDeprecatedExceptionLicenseIDsTxt := []byte{}
54+
for _, id := range nonDeprecatedExceptionLicenseIDs {
55+
nonDeprecatedExceptionLicenseIDsTxt = append(nonDeprecatedExceptionLicenseIDsTxt, []byte(" \"")...)
56+
nonDeprecatedExceptionLicenseIDsTxt = append(nonDeprecatedExceptionLicenseIDsTxt, []byte(id)...)
57+
nonDeprecatedExceptionLicenseIDsTxt = append(nonDeprecatedExceptionLicenseIDsTxt, []byte("\",")...)
58+
nonDeprecatedExceptionLicenseIDsTxt = append(nonDeprecatedExceptionLicenseIDsTxt, []byte("\n")...)
59+
}
60+
err = ioutil.WriteFile("exception_ids.txt", nonDeprecatedExceptionLicenseIDsTxt, 0600)
61+
if err != nil {
62+
return err
63+
}
64+
65+
// save non-deprecated license IDs to json array in file exception_ids.json
66+
nonDeprecatedExceptionLicenseIDsJSON, err := json.Marshal(nonDeprecatedExceptionLicenseIDs)
67+
if err != nil {
68+
return err
69+
}
70+
err = ioutil.WriteFile("exception_ids.json", nonDeprecatedExceptionLicenseIDsJSON, 0600)
71+
if err != nil {
72+
return err
73+
}
74+
return nil
75+
}

0 commit comments

Comments
 (0)