Skip to content

Commit f6b7196

Browse files
committed
Improve license rules and license tests
Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 2fd0dd7 commit f6b7196

File tree

8 files changed

+407
-49
lines changed

8 files changed

+407
-49
lines changed

src/licensedcode/data/rules/gfdl-1.1_36.RULE

Lines changed: 368 additions & 0 deletions
Large diffs are not rendered by default.

src/licensedcode/data/rules/gpl-3.0-plus_417.RULE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This program is free software: you can redistribute it and/or modify
2020
You should have received a copy of the {{GNU General Public License}}
2121
along with this program. If not, see <https://www.gnu.org/licenses/>.
2222

23-
On Debian GNU/Linux systems, the complete text of the {{GNU General Public License}}
23+
On Debian GNU/Linux systems, the complete text of the GNU General Public License
2424
version 2 can be found in `/usr/share/common-licenses/GPL-2'. the
2525
complete text of the {{GNU General Public License version 3 can be found
26-
in `/usr/share/common-licenses/GPL-3}}'.
26+
in `/usr/share/common-licenses/GPL-3}}'.

src/licensedcode/data/rules/lgpl-2.1-plus_312.RULE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ notes: See in LIBTASN1
2626
On Debian GNU/Linux systems, the complete text of the {{GNU Lesser
2727
General Public License}} can be found in
2828
`/usr/share/common-licenses/LGPL'; the text of the earliest applying version
29-
of the license (2.1) can be found in `/usr/share/common-licenses/LGPL-2.1'.
29+
of the license (2.1) can be found in {{ /usr/share/common-licenses/LGPL-2.1 }}

tests/formattedcode/data/yaml/package-and-licenses-expected.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ headers:
2929
system_environment:
3030
operating_system: linux
3131
cpu_architecture: 64
32-
platform: Linux-5.15.0-119-generic-x86_64-with-glibc2.35
33-
platform_version: '#129-Ubuntu SMP Fri Aug 2 19:25:20 UTC 2024'
34-
python_version: 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0]
35-
spdx_license_list_version: '3.24'
32+
platform: Linux-6.8.0-45-generic-x86_64-with-glibc2.35
33+
platform_version: '#45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 11 15:25:05 UTC 2'
34+
python_version: 3.11.8 (main, Feb 12 2024, 14:25:06) [GCC 11.4.0]
35+
spdx_license_list_version: '3.25'
3636
files_count: 4
3737
summary:
3838
declared_license_expression: apache-2.0
@@ -856,7 +856,7 @@ license_rule_references:
856856
is_license_tag: yes
857857
is_license_intro: no
858858
is_license_clue: no
859-
is_required_phrase: no
859+
is_required_phrase: yes
860860
skip_for_required_phrase_generation: no
861861
is_continuous: no
862862
is_builtin: yes
@@ -872,7 +872,7 @@ license_rule_references:
872872
ignorable_authors: []
873873
ignorable_urls: []
874874
ignorable_emails: []
875-
text: 'license: Apache-2.0'
875+
text: license="Apache-2.0
876876
- license_expression: apache-2.0
877877
identifier: apache-2.0_73.RULE
878878
language: en
@@ -982,7 +982,7 @@ license_rule_references:
982982
is_license_tag: no
983983
is_license_intro: no
984984
is_license_clue: no
985-
is_required_phrase: no
985+
is_required_phrase: yes
986986
skip_for_required_phrase_generation: no
987987
is_continuous: no
988988
is_builtin: yes
@@ -998,7 +998,7 @@ license_rule_references:
998998
ignorable_authors: []
999999
ignorable_urls: []
10001000
ignorable_emails: []
1001-
text: apache-2.0
1001+
text: Apache-2.0
10021002
files:
10031003
- path: package-and-licenses
10041004
type: directory

tests/packagedcode/data/debian/copyright/debian-slim-2021-04-07/usr/share/doc/libsepol1/copyright-detailed.expected.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ declared_license_expression_spdx: LGPL-2.1-or-later AND GPL-2.0-only
44
other_license_expression:
55
other_license_expression_spdx:
66
license_detections:
7-
- license_expression: lgpl-2.1-plus AND gpl-2.0
8-
license_expression_spdx: LGPL-2.1-or-later AND GPL-2.0-only
7+
- license_expression: lgpl-2.1-plus
8+
license_expression_spdx: LGPL-2.1-or-later
99
matches:
1010
- license_expression: lgpl-2.1-plus
1111
spdx_license_expression: LGPL-2.1-or-later
1212
from_file:
1313
start_line: 16
14-
end_line: 41
15-
matcher: 3-seq
16-
score: '89.63'
17-
matched_length: 147
18-
match_coverage: '89.63'
14+
end_line: 31
15+
matcher: 2-aho
16+
score: '100.0'
17+
matched_length: 141
18+
match_coverage: '100.0'
1919
rule_relevance: 100
20-
rule_identifier: lgpl-2.1-plus_312.RULE
21-
rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/lgpl-2.1-plus_312.RULE
20+
rule_identifier: lgpl-2.1-plus_298.RULE
21+
rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/lgpl-2.1-plus_298.RULE
2222
matched_text: |
23-
library is free software; you can redistribute it and/or
23+
This library is free software; you can redistribute it and/or
2424
modify it under the terms of the GNU Lesser General Public
2525
License as published by the Free Software Foundation; either
2626
version 2.1 of the License, or (at your option) any later version.
@@ -36,16 +36,10 @@ license_detections:
3636
3737
On Debian GNU/Linux systems, the complete text of the Lesser GNU General
3838
Public License can be found in `/usr/share/common-licenses/LGPL'.
39-
40-
This package is maintained by Manoj Srivastava <[email protected]>.
41-
42-
The Debian specific changes are © 2005-2008, Manoj Srivastava
43-
<[email protected]>, and distributed under the terms of the GNU
44-
General Public License, version 2.
45-
46-
47-
On Debian GNU/Linux systems, the complete text of the GNU General
48-
Public License can be found in `/usr/share/common-licenses/
39+
identifier: lgpl_2_1_plus-8a5e2990-4794-788b-8d4c-f58a9743e092
40+
- license_expression: gpl-2.0
41+
license_expression_spdx: GPL-2.0-only
42+
matches:
4943
- license_expression: gpl-2.0
5044
spdx_license_expression: GPL-2.0-only
5145
from_file:
@@ -70,7 +64,7 @@ license_detections:
7064
<URL:http://www.gnu.org/copyleft/gpl.html>. You may also obtain
7165
it by writing to the Free Software Foundation, Inc., 51 Franklin
7266
St, Fifth Floor, Boston, MA 02110-1301 USA
73-
identifier: lgpl_2_1_plus_and_gpl_2_0-b692f769-146f-b44e-952a-1c81d2c7cf5e
67+
identifier: gpl_2_0-e6238f93-b011-923d-bb0a-6fe716f20b50
7468
other_license_detections: []
7569
copyright: |
7670
Copyright (c) 2003, 2004 Stephen Smalley <[email protected]>

tests/packagedcode/data/debian/copyright/debian-slim-2021-04-07/usr/share/doc/libtasn1-6/copyright-detailed.expected.yml

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ license_detections:
6969
spdx_license_expression: GPL-3.0-or-later
7070
from_file:
7171
start_line: 50
72-
end_line: 70
73-
matcher: 3-seq
74-
score: '85.91'
72+
end_line: 66
73+
matcher: 2-aho
74+
score: '100.0'
7575
matched_length: 128
76-
match_coverage: '85.91'
76+
match_coverage: '100.0'
7777
rule_relevance: 100
78-
rule_identifier: gpl-3.0-plus_417.RULE
79-
rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl-3.0-plus_417.RULE
78+
rule_identifier: gpl-3.0-plus_288.RULE
79+
rule_url: https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/gpl-3.0-plus_288.RULE
8080
matched_text: |
8181
This program is free software: you can redistribute it and/or modify
8282
* it under the terms of the GNU General Public License as published by
@@ -95,10 +95,6 @@ license_detections:
9595
9696
On Debian GNU/Linux systems, the complete text of the GNU General Public
9797
License version 3 can be found in /usr/share/common-licenses/GPL-3.
98-
99-
100-
The documentation is distributed under the terms of the GNU Free
101-
Documentation License (
10298
- license_expression: gfdl-1.3
10399
spdx_license_expression: GFDL-1.3-only
104100
from_file:
@@ -137,7 +133,7 @@ license_detections:
137133
138134
On Debian systems a copy of the complete text of the GNU FDL 1.3
139135
can be found in /usr/share/common-licenses/GFDL-1.3.
140-
identifier: gpl_3_0_plus_and_gfdl_1_3_and_gfdl_1_3_plus-20aaaa92-d02e-2c2d-0615-d69acc5b00d5
136+
identifier: gpl_3_0_plus_and_gfdl_1_3_and_gfdl_1_3_plus-ca4df800-141f-5c15-72b1-19b8df01217e
141137
other_license_detections: []
142138
copyright: |
143139
Copyright (c) 2000-2020 Free Software Foundation, Inc.

tests/packagedcode/data/pypi/setup.py/boolean2_py_setup.py-expected.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@
6060
"start_line": 1,
6161
"end_line": 1,
6262
"matcher": "1-hash",
63-
"score": 90.0,
63+
"score": 100.0,
6464
"matched_length": 3,
6565
"match_coverage": 100.0,
66-
"rule_relevance": 90,
66+
"rule_relevance": 100,
6767
"rule_identifier": "bsd-new_708.RULE",
6868
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/bsd-new_708.RULE",
6969
"matched_text": "revised BSD license"
7070
}
7171
],
72-
"identifier": "bsd_new-9d4149ba-60ed-9e49-34a8-20576feb3295"
72+
"identifier": "bsd_new-98c737b4-e505-9919-75a7-94b39533f450"
7373
},
7474
{
7575
"license_expression": "bsd-new",

tests/packagedcode/data/pypi/setup.py/simple-setup.py-expected.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@
7171
"start_line": 1,
7272
"end_line": 1,
7373
"matcher": "2-aho",
74-
"score": 95.0,
74+
"score": 100.0,
7575
"matched_length": 3,
7676
"match_coverage": 100.0,
77-
"rule_relevance": 95,
77+
"rule_relevance": 100,
7878
"rule_identifier": "spdx_license_id_cc0-1.0_for_cc0-1.0.RULE",
7979
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/spdx_license_id_cc0-1.0_for_cc0-1.0.RULE",
8080
"matched_text": "Apache-2.0 with ScanCode acknowledgment and CC0-1.0 and others"
8181
}
8282
],
83-
"identifier": "apache_2_0_and_scancode_acknowledgment__and_cc0_1_0-d8559b0f-151a-7966-fe46-c91dd29c027e"
83+
"identifier": "apache_2_0_and_scancode_acknowledgment__and_cc0_1_0-15c44782-c134-8767-6ef8-10e8ab046877"
8484
},
8585
{
8686
"license_expression": "apache-2.0",

0 commit comments

Comments
 (0)