Skip to content

Commit f2b5328

Browse files
authored
Merge pull request #2528 from nexB/2507-license-bugs
Update license detection
2 parents 4670505 + bc518e5 commit f2b5328

File tree

242 files changed

+2765
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+2765
-125
lines changed

etc/scripts/licenses/synclic.py

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,13 @@ def build_license(self, mapping, scancode_licenses):
546546
# instead each part of the combo
547547
dejacode_special_composites = set([
548548
'intel-bsd-special',
549+
#'newlib-subdirectory',
549550
])
550-
is_combo = key in dejacode_special_composites
551+
is_component_license = mapping.get('is_component_license') or False
552+
553+
is_combo = is_component_license or key in dejacode_special_composites
551554
if is_combo:
552-
if TRACE: print('Skipping DejaCode combo license', key)
555+
if TRACE: print('Skipping DejaCode combo/component license', key)
553556
return
554557

555558
deprecated = not mapping.get('is_active')
@@ -560,6 +563,13 @@ def build_license(self, mapping, scancode_licenses):
560563
standard_notice = mapping.get('standard_notice') or ''
561564
standard_notice = clean_text(standard_notice)
562565

566+
spdx_license_key = mapping.get('spdx_license_key') or None
567+
if deprecated:
568+
spdx_license_key = None
569+
else:
570+
if not spdx_license_key:
571+
spdx_license_key = f'LicenseRef-scancode-{key}'
572+
563573
lic = License(
564574
key=key,
565575
src_dir=self.original_dir,
@@ -572,7 +582,7 @@ def build_license(self, mapping, scancode_licenses):
572582

573583
# FIXME: we may not want to carry notes over???
574584
# lic.notes = mapping.notes
575-
spdx_license_key=mapping['spdx_license_key'],
585+
spdx_license_key=spdx_license_key,
576586
text_urls=mapping['text_urls'].splitlines(False),
577587
osi_url=mapping['osi_url'],
578588
faq_url=mapping['faq_url'],
@@ -805,8 +815,12 @@ def license_to_dict(lico):
805815
}
806816

807817

808-
def merge_licenses(scancode_license, external_license, updatable_attributes,
809-
from_spdx=False):
818+
def merge_licenses(
819+
scancode_license,
820+
external_license,
821+
updatable_attributes,
822+
from_spdx=False,
823+
):
810824
"""
811825
Compare and update two License objects in-place given a sequence of
812826
`updatable_attributes`.
@@ -839,20 +853,21 @@ def update_external(_attrib, _sc_val, _ext_val):
839853
external_key = external_license.spdx_license_key
840854
if scancode_key != external_key:
841855
raise Exception(
842-
f'Non mergeable licenses with different SPDX keys: scancode_license.spdx_license_key {scancode_key} <> external_license.spdx_license_key {external_key}'
856+
f'Non mergeable licenses with different SPDX keys: '
857+
'scancode_license.spdx_license_key {scancode_key} <> '
858+
'external_license.spdx_license_key {external_key}'
843859
)
844860
else:
845861
scancode_key = scancode_license.key
846862
external_key = external_license.key
847863
if scancode_key != external_key:
848-
raise Exception('Non mergeable licenses with different keys: %(scancode_key)s <> %(external_key)s' % locals())
864+
raise Exception('Non mergeable licenses with different keys: '
865+
'%(scancode_key)s <> %(external_key)s' % locals())
849866

850-
# if scancode_license.spdx_license_key != external_license.spdx_license_key:
851-
# pass
852-
# else:
853-
# if TRACE:
854-
# print('Merging licenses with different keys, but same SPDX key: %(scancode_key)s <> %(external_key)s' % locals())
855-
# update_external('key', scancode_key, external_key)
867+
if scancode_license.spdx_license_key != external_license.spdx_license_key:
868+
if TRACE:
869+
print(f'Updating external SPDX key: from {external_license.spdx_license_key} to {scancode_license.spdx_license_key}')
870+
external_license.spdx_license_key = scancode_license.spdx_license_key
856871

857872
for attrib in updatable_attributes:
858873
scancode_value = getattr(scancode_license, attrib)
@@ -932,7 +947,11 @@ def update_external(_attrib, _sc_val, _ext_val):
932947

933948
# on difference, the other license wins
934949
if scancode_value != external_value:
935-
update_scancode(attrib, scancode_value, external_value)
950+
# unless we have SPDX ids
951+
if attrib== 'spdx_license_key' and external_value.startswith('LicenseRef-scancode'):
952+
update_external(attrib, scancode_value, external_value)
953+
else:
954+
update_scancode(attrib, scancode_value, external_value)
936955
continue
937956

938957
return updated_scancode_attributes, updated_external_attributes
@@ -1065,16 +1084,20 @@ def synchronize_licenses(scancode_licenses, external_source, use_spdx_key=False,
10651084
print('External license with different key:', matching_key, 'and text matched to ScanCode key:', matched_key)
10661085

10671086
if matched_key:
1068-
print('\nExternal license with different key and matched text to ScanCode:', matching_key, ' matched to:', matched_key)
1087+
print('External license with different key:', matching_key, 'and text matched to ScanCode key:', matched_key)
10691088
if matched_key in unmatched_scancode_by_key:
10701089
del unmatched_scancode_by_key[matched_key]
10711090

10721091
scancode_license = scancodes_by_key.get(matched_key)
1092+
if TRACE:
1093+
print('scancode_license:', matching_key, scancode_license)
10731094

10741095
scancode_updated, external_updated = merge_licenses(
1075-
scancode_license, external_license,
1076-
external_source.updatable_attributes,
1077-
from_spdx=use_spdx_key)
1096+
scancode_license=scancode_license,
1097+
external_license=external_license,
1098+
updatable_attributes=external_source.updatable_attributes,
1099+
from_spdx=use_spdx_key,
1100+
)
10781101

10791102
if not scancode_updated and not external_updated:
10801103
if TRACE_DEEP: print('License attributes are identical:', matching_key)

src/licensedcode/data/licenses/acdl-1.0.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@ name: Apple Common Documentation License v1.0
44
category: Copyleft Limited
55
owner: Apple
66
homepage_url: http://fedoraproject.org/wiki/Licensing/Common_Documentation_License
7-
spdx_license_key: LicenseRef-scancode-acdl-1.0
7+
spdx_license_key: CDL-1.0
8+
other_spdx_license_keys:
9+
- LicenseRef-scancode-acdl-1.0
810
text_urls:
9-
- http://fedoraproject.org/wiki/Licensing/Common_Documentation_License
11+
- http://www.opensource.apple.com/cdl/
1012
faq_url: http://fedoraproject.org/wiki/Licensing/Common_Documentation_License
13+
other_urls:
14+
- http://fedoraproject.org/wiki/Licensing/Common_Documentation_License
15+
- https://fedoraproject.org/wiki/Licensing/Common_Documentation_License
16+
- https://www.gnu.org/licenses/license-list.html#ACDL
1117
ignorable_copyrights:
1218
- Copyright (c) 2001 Apple Computer, Inc.
1319
ignorable_holders:

src/licensedcode/data/licenses/apl-1.1.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ short_name: APL-1.1
33
name: Academic Public License version 1.1
44
category: Permissive
55
owner: OMNeT++
6-
spdx_license_key: LicenseRef-scancode-apl-1.1
76
homepage_url: https://github.com/omnetpp/omnetpp/blob/master/doc/License
8-
other_urls:
9-
- https://opencarp.org/download/license
7+
spdx_license_key: LicenseRef-scancode-apl-1.1
8+
other_urls:
9+
- https://opencarp.org/download/license
1010
ignorable_copyrights:
11-
- Copyright (c) 2003, 2010, 2015 Andras Varga
11+
- Copyright (c) 2003, 2010, 2015 Andras Varga
1212
ignorable_holders:
1313
- Andras Varga
1414
ignorable_urls:
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Disclaimer: IMPORTANT: This Apple software is supplied to you, by Apple Inc. ("Apple"), in your
2+
capacity as a current, and in good standing, Licensee in the MFi Licensing Program. Use of this
3+
Apple software is governed by and subject to the terms and conditions of your MFi License,
4+
including, but not limited to, the restrictions specified in the provision entitled ”Public
5+
Software”, and is further subject to your agreement to the following additional terms, and your
6+
agreement that the use, installation, modification or redistribution of this Apple software
7+
constitutes acceptance of these additional terms. If you do not agree with these additional terms,
8+
please do not use, install, modify or redistribute this Apple software.
9+
10+
Subject to all of these terms and in consideration of your agreement to abide by them, Apple grants
11+
you, for as long as you are a current and in good-standing MFi Licensee, a personal, non-exclusive
12+
license, under Apple's copyrights in this original Apple software (the "Apple Software"), to use,
13+
reproduce, and modify the Apple Software in source form, and to use, reproduce, modify, and
14+
redistribute the Apple Software, with or without modifications, in binary form. While you may not
15+
redistribute the Apple Software in source form, should you redistribute the Apple Software in binary
16+
form, you must retain this notice and the following text and disclaimers in all such redistributions
17+
of the Apple Software. Neither the name, trademarks, service marks, or logos of Apple Inc. may be
18+
used to endorse or promote products derived from the Apple Software without specific prior written
19+
permission from Apple. Except as expressly stated in this notice, no other rights or licenses,
20+
express or implied, are granted by Apple herein, including but not limited to any patent rights that
21+
may be infringed by your derivative works or by other works in which the Apple Software may be
22+
incorporated.
23+
24+
Unless you explicitly state otherwise, if you provide any ideas, suggestions, recommendations, bug
25+
fixes or enhancements to Apple in connection with this software (“Feedback”), you hereby grant to
26+
Apple a non-exclusive, fully paid-up, perpetual, irrevocable, worldwide license to make, use,
27+
reproduce, incorporate, modify, display, perform, sell, make or have made derivative works of,
28+
distribute (directly or indirectly) and sublicense, such Feedback in connection with Apple products
29+
and services. Providing this Feedback is voluntary, but if you do provide Feedback to Apple, you
30+
acknowledge and agree that Apple may exercise the license granted above without the payment of
31+
royalties or further consideration to Participant.
32+
33+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
34+
IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
35+
AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR
36+
IN COMBINATION WITH YOUR PRODUCTS.
37+
38+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
39+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
40+
PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION
41+
AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT, TORT
42+
(INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
43+
POSSIBILITY OF SUCH DAMAGE.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
key: apple-mfi-license
2+
short_name: Apple MFi License
3+
name: Apple MFi License
4+
category: Proprietary Free
5+
owner: Apple
6+
spdx_license_key: LicenseRef-scancode-apple-mfi-license

src/licensedcode/data/licenses/artistic-dist-1.0.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ notes: |
88
This is a variant Artistic license still used in today's Perl and that
99
comes with the "dist" tool included in the standard Perl distrbution.
1010
See also https://github.com/pexip/os-perl/blob/d7a993d1118c65177c97ae41577b188653845a8a/regen-configure/U/README#L158
11-
1211
spdx_license_key: LicenseRef-scancode-artistic-1988-1.0
1312
text_urls:
1413
- https://raw.githubusercontent.com/rmanfredi/dist/2cec35331a912b165e2dd135d22de81f34bbc83f/Artistic
15-
14+
other_urls:
15+
- https://github.com/pexip/os-perl/blob/d7a993d1118c65177c97ae41577b188653845a8a/regen-configure/U/README#L158
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
key: broadcom-dual
2+
is_deprecated: yes
23
short_name: Broadcom Dual GPL-Commercial
34
name: Broadcom Dual GPL-Commercial
45
category: Copyleft
56
owner: Broadcom
67
notes: composite
7-
is_deprecated: yes

src/licensedcode/data/licenses/bsd-3-clause-no-military.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ short_name: BSD-3-Clause-No-Military
33
name: BSD-3-Clause-No-Military
44
category: Free Restricted
55
owner: Unspecified
6+
spdx_license_key: BSD-3-Clause-No-Military-License
7+
other_spdx_license_keys:
8+
- LicenseRef-scancode-bsd-3-clause-no-military
69
other_urls:
7-
- https://github.com/greymass/swift-eosio/blob/master/LICENSE
810
- https://gitlab.syncad.com/hive/dhive/-/blob/master/LICENSE
11+
- https://github.com/greymass/swift-eosio/blob/master/LICENSE
912
minimum_coverage: 90
10-
spdx_license_key: LicenseRef-scancode-bsd-3-clause-no-military

src/licensedcode/data/rules/bsd-original_57.RULE renamed to src/licensedcode/data/licenses/bsd-original-voices.LICENSE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* documentation and/or other materials provided with the distribution.
99
* 3. All advertising materials mentioning features or use of this software
1010
* must display the following acknowledgement:
11-
* This product includes software developed by Bill Paul.
11+
* This product includes software developed by Bill Paul.
1212
* 4. Neither the name of the author nor the names of any co-contributors
1313
* may be used to endorse or promote products derived from this software
1414
* without specific prior written permission.
@@ -23,5 +23,4 @@
2323
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2424
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2525
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26-
* THE POSSIBILITY OF SUCH DAMAGE.
27-
*/
26+
* THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
key: bsd-original-voices
2+
short_name: BSD-4-Clause with Voices
3+
name: BSD-4-Clause with Voices in Head
4+
category: Permissive
5+
owner: Bill Paul
6+
homepage_url: https://github.com/freebsd/freebsd-src/blob/098dbd7ff7f3da9dda03802cdb2d8755f816eada/sys/dev/an/if_an_isa.c
7+
spdx_license_key: LicenseRef-scancode-bsd-original-voices
8+
ignorable_authors:
9+
- Bill Paul
10+

0 commit comments

Comments
 (0)