1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
#!/usr/bin/env python3
# Copyright (C) 2021 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
_data = {}
def has_android_free_license_filename(data, repository_path):
pass
_license_filenames = {
'license-filename': {
'func' : has_android_free_license_filename,
'files' : [
'MODULE_LICENSE_BSD_LIKE',
'MODULE_LICENSE_APACHE2',
'MODULE_LICENSE_BSD',
'MODULE_LICENSE_MIT',
'MODULE_LICENSE_BSD_APL2',
'MODULE_LICENSE_GPL',
'MODULE_LICENSE_PUBLIC_DOMAIN',
],
'sha1sums' : None,
},
}
_data.update(_license_filenames)
#################
# License files #
#################
license_files = [
'COPYING',
'LICENSE',
'LICENCE',
'NIST-CONDITIONS-OF-USE',
]
stock_license_files_checksums = [
##############
# Apache 2.0 #
##############
'11d8a409876496183c8fba90eb70f25301875b67',
'5a7d7df655ba40478fae80a6abafc6afc36f9b6a',
'82f88802986ad28deac953dc06bd0bb52f3d012c',
'04f15afbbe53b69d0e4870e9308efae75efa773a',
'58853eb8199b5afe72a73a25fd8cf8c94285174b',
#######
# BSD #
#######
# external/openssh/LICENCE, also contains
# various other permissive licenses
'0ea904438c8997ec028278e2d51a0af60ef7e698',
###############
# Expat / MIT #
###############
# external/libepoxy/COPYING
'00f34512740377ad1f155eaa15936e472661c5e3',
###########
# OFL-1.1 #
###########
# external/google-fonts/source-sans-pro/LICENSE
'a55d8584dd1af1bd63bf607a6195d56beb8ee564',
# external/google-fonts/lato/LICENSE
'76897b37e127e2332a1a79aab2e0d6f30ccdc47a',
# external/google-fonts/arvo/LICENSE
'2ef38678dab952ed745c71e59e9a2f595cddb0f4',
# external/google-fonts/big-shoulders-text/LICENSE
'35765f09b7708df97741f83ca94978a8a742adfa',
# external/google-fonts/fraunces/LICENSE
'587180e421d550a5e4bf6a6e76275c21d486e8ef',
##############
# Python 2.1 #
##############
'0c492b235e749a739628cdd18d8c860c6f70396b',
]
modified_license_files_checksums = [
# Apache 2.0
'11d8a409876496183c8fba90eb70f25301875b67',
]
def has_stock_free_license_file(path):
pass
stock_license_files = {
'stock-license-file': {
'func' : has_stock_free_license_file,
'files': license_files,
'sha1sums': stock_license_files_checksums,
},
}
_data.update(stock_license_files)
def has_modified_free_license_file(path):
pass
modified_license_files = {
'modified-license-file': {
'func' : has_modified_free_license_file,
'files': license_files,
'sha1sums': modified_license_files_checksums,
},
}
_data.update(modified_license_files)
if __name__ == '__main__':
verbose = True
if len(sys.argv) != 2:
usage(sys.argv[0])
manifest_xml_path = sys.argv[1]
m = manifest.Manifest(manifest_xml_path)
paths = m.list_repositories_paths()
nr_unknown_repositories = 0
nr_unknown_licenses = 0
for path in paths:
l = RepositoryLicense(path)
found, details = l.has_free_license()
if not found and verbose:
nr_unknown_repositories += 1
if len(details) > 0:
for k, v in details.items():
printed_header = False
if v['type'] in ['stock-license-file',
'modified-license-file']:
if not printed_header:
print("{}:".format(path))
printed_header = True
print("- {} {}".format(k, v['sha1sum']))
nr_unknown_licenses += 1
# We'll handle repositories with READMEs when we
# will have handled all the licenses files
# else:
# print("- TODO: look at the READMEs")
# We'll handle these repositories when we
# will have handled all the licenses files
# else:
# print("{}".format(path))
if verbose:
if nr_unknown_repositories > 0 or nr_unknown_licenses > 0:
print()
print("Total:")
print("------")
if nr_unknown_repositories > 0:
print("- {} repositories to check".format(nr_unknown_repositories))
if nr_unknown_licenses > 0:
print("- {} licenses to check".format(nr_unknown_licenses))
|