Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report SPDX keys everywhere #2225

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions etc/scripts/synclic.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def get_licenses_by_spdx_key(licenses, include_other=False):
"""
by_spdx = {}
for lic in licenses:
if not lic.spdx_license_key:
raise ValueError('Missing SPDX license key for {}'.format(lic.key))
if not (lic.spdx_license_key or lic.other_spdx_license_keys):
continue

Expand Down
13 changes: 8 additions & 5 deletions src/formattedcode/output_spdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
from scancode import FileOptionType
from scancode import OUTPUT_GROUP


# Tracing flags
TRACE = False
TRACE_DEEP = False
Expand Down Expand Up @@ -241,13 +240,17 @@ def write_spdx(output_file, files, tool_name, tool_version, notice, input_file,
if file_licenses:
all_files_have_no_license = False
for file_license in file_licenses:
license_key = file_license.get('key')

spdx_id = file_license.get('spdx_license_key')
if spdx_id:
if not spdx_id:
spdx_id = 'LicenseRef-scancode-' + license_key
is_license_ref = spdx_id.lower.startswith('licenseref-')

if not is_license_ref:
spdx_license = License.from_identifier(spdx_id)
else:
license_key = file_license.get('key')
licenseref_id = 'LicenseRef-scancode-' + license_key
spdx_license = ExtractedLicense(licenseref_id)
spdx_license = ExtractedLicense(spdx_id)
spdx_license.name = file_license.get('short_name')
comment = ('See details at https://github.com/nexB/scancode-toolkit'
'/blob/develop/src/licensedcode/data/licenses/%s.yml\n' % license_key)
Expand Down
37 changes: 34 additions & 3 deletions src/licensedcode/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,37 @@ def get_licenses_db(licenses_data_dir=None, _test_mode=False):
return _LICENSES_BY_KEY


# global in-memory cache of Licensing object built from all active licenses
_LICENSING = {}


def get_licensing(_test_licenses=None):
"""
Return and cache a license_expression.Licensing objet built from the all the
licenses.
"""
global _LICENSING
if not _LICENSING or _test_licenses:

if _test_licenses:
licenses = _test_licenses
else:
licenses = get_licenses_db()

from license_expression import LicenseSymbolLike
from license_expression import Licensing

licensing = Licensing((LicenseSymbolLike(lic) for lic in licenses.values()))

if _test_licenses:
# Do not cache when testing
return licensing

_LICENSING = licensing

return _LICENSING


# global in-memory cache for the unknown license symbol
_UNKNOWN_SPDX_SYMBOL = None

Expand Down Expand Up @@ -131,14 +162,14 @@ def get_unknown_spdx_symbol(_test_licenses=None):

def get_spdx_symbols(_test_licenses=None):
"""
Return a mapping of (SPDX LicenseSymbol -> lowercased SPDX license key-> key}
Return a mapping of {lowercased SPDX license key: LicenseSymbolLike} where
LicenseSymbolLike wraps a License object

Note: the `_test_licenses` arg is a mapping of key: license used for testing
instead of the standard license db.
"""
global _LICENSE_SYMBOLS_BY_SPDX_KEY
if not _LICENSE_SYMBOLS_BY_SPDX_KEY or _test_licenses:
from license_expression import LicenseSymbol
from license_expression import LicenseSymbolLike
symbols_by_spdx_key = {}

Expand Down Expand Up @@ -315,7 +346,7 @@ def tree_checksum(tree_base_dir=scancode_src_dir, _ignored=_ignored_from_hash):
hashable = (pth + str(getmtime(pth)) + str(getsize(pth)) for pth in resources)
hashable = ''.join(sorted(hashable))
if py3:
hashable=hashable.encode('utf-8')
hashable = hashable.encode('utf-8')
return md5(hashable).hexdigest()


Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/3com-microcode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ name: 3Com Microcode
category: Permissive
owner: HP - Hewlett Packard
notes: this is a Linux firmware BSD-like license with some weird extra terms
spdx_license_key: LicenseRef-scancode-3com-microcode
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/3dslicer-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: 3D Slicer Contribution and Software License Agreement v1.0
category: Permissive
owner: Slicer Project
homepage_url: https://www.slicer.org/wiki/License
spdx_license_key: LicenseRef-scancode-3dslicer-1.0
text_urls:
- https://github.com/Slicer/Slicer/blob/v4.6.2/COPYRIGHT.txt
faq_url: https://www.slicer.org/wiki/CommercialUse
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/4suite-1.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ short_name: 4Suite 1.1
name: 4Suite License v1.1
category: Permissive
owner: Fourthought, Inc.
spdx_license_key: LicenseRef-scancode-4suite-1.1
ignorable_copyrights:
- Copyright (c) 2000 Fourthought, Inc.
- Copyright (c) 2000 The Apache Software Foundation
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/996-icu-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ category: Free Restricted
owner: 996icu
homepage_url: https://github.com/996icu/996.ICU
notes: this is based on the still draft text of 2019-04-17
spdx_license_key: LicenseRef-scancode-996-icu-1.0
text_urls:
- https://github.com/996icu/996.ICU/blob/dd185162b9d56b629e52c5726995cd7505326b06/LICENSE
5 changes: 3 additions & 2 deletions src/licensedcode/data/licenses/abrms.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
key: abrms
name: Anyone But Richard Stallman License
short_name: ABRMS
name: Anyone But Richard Stallman License
category: Proprietary Free
notes: From https://github.com/ErikMcClure/bad-licenses
owner: Unspecified
notes: From https://github.com/ErikMcClure/bad-licenses
spdx_license_key: LicenseRef-scancode-abrms
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/ac3filter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ notes: |
used for demonstration and educational purposes. Any other use may be
prohibited by law in some coutries." The typo "coutries" is in the original
license text.
spdx_license_key: LicenseRef-scancode-ac3filter
other_urls:
- http://ac3filter.net
- http://ac3filter.net/forum
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/acdl-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Apple Common Documentation License v1.0
category: Copyleft Limited
owner: Apple
homepage_url: http://fedoraproject.org/wiki/Licensing/Common_Documentation_License
spdx_license_key: LicenseRef-scancode-acdl-1.0
text_urls:
- http://fedoraproject.org/wiki/Licensing/Common_Documentation_License
faq_url: http://fedoraproject.org/wiki/Licensing/Common_Documentation_License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: ActiveState Community License 2012
category: Proprietary Free
owner: ActiveState Software, Inc.
homepage_url: https://web.archive.org/web/20130420143215/http://www.activestate.com/activeperl/license-agreement
spdx_license_key: LicenseRef-scancode-activestate-community-2012
standard_notice: |
ActivePerl is covered by the ActiveState Community License.
Please note:
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/activestate-community.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ short_name: ActiveState Community License
name: ActiveState Community License
category: Proprietary Free
owner: ActiveState Software, Inc.
spdx_license_key: LicenseRef-scancode-activestate-community
ignorable_copyrights:
- Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam
- Copyright (c) 1995-2001 Corporation for National Research Initiatives
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/activestate-komodo-edit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: ActiveState Komodo Edit EULA
category: Proprietary Free
owner: ActiveState Software, Inc.
homepage_url: http://www.activestate.com/komodo-edit/license-agreement
spdx_license_key: LicenseRef-scancode-activestate-komodo-edit
other_urls:
- https://www.mozilla.org/en-US/MPL/1.1/
ignorable_urls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Actuate Corporation BIRT iHub F-Type Software License Agreement
category: Proprietary Free
owner: Actuate
homepage_url: http://spp.actuate.com/DM/DownloadOpenFile.aspx?docId=4637
spdx_license_key: LicenseRef-scancode-actuate-birt-ihub-ftype-sla
ignorable_copyrights:
- copyrighted by Actuate
ignorable_holders:
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/ada-linking-exception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Ada linking exception to GPL 2.0 or later
category: Copyleft Limited
owner: Dmitriy Anisimkov
is_exception: yes
spdx_license_key: LicenseRef-scancode-ada-linking-exception
other_urls:
- http://zlib-ada.sourceforge.net/
- http://ada-ru.org/
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adaptec-downloadable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ name: Adaptec Downloadable Software License
category: Proprietary Free
owner: Adaptec
homepage_url: https://github.com/gooselinux/aic94xx-firmware/blob/master/LICENSE.aic94xx
spdx_license_key: LicenseRef-scancode-adaptec-downloadable
other_urls:
- https://lists.fedoraproject.org/pipermail/scm-commits/2010-March/408246.html
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adaptec-eula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ name: Adaptec EULA
category: Proprietary Free
owner: Adaptec
homepage_url: https://www.adaptec.com/en-us/support/_eula/license.php
spdx_license_key: LicenseRef-scancode-adaptec-eula
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/addthis-mobile-sdk-1.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: AddThis Mobile Application SDK License 1.0
category: Proprietary Free
owner: Oracle Corporation
homepage_url: https://www.addthis.com/appsdk-license-agreement#.VvMVkRIrJZ1
spdx_license_key: LicenseRef-scancode-addthis-mobile-sdk-1.0
other_urls:
- http://www.addthis.com/about
minimum_coverage: 80
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adi-bsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ notes: |
Before incorporating code licensed under the ADI BSD license into projects
which you are going to ship in a end product, you must ensure that you have
the patent rights to do.
spdx_license_key: LicenseRef-scancode-adi-bsd
text_urls:
- https://docs.blackfin.uclinux.org/doku.php?id=adi_bsd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ short_name: Adobe Acrobat Reader EULA
name: Adobe Acrobat Reader EULA
category: Proprietary Free
owner: Adobe Systems
spdx_license_key: LicenseRef-scancode-adobe-acrobat-reader-eula
other_urls:
- http://www.adobe.com/products/reader/distribution.html
ignorable_urls:
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-air-sdk-2014.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Adobe Air SDK EULA - 2014
category: Proprietary Free
owner: Adobe Systems
homepage_url: http://www.adobe.com/products/air/sdk-eula.html
spdx_license_key: LicenseRef-scancode-adobe-air-sdk-2014
other_urls:
- www.adobe.com/go/redistributeairsdk
- http://www.adobe.com/products/air/sdk-agreement.html
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-air-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Adobe AIR SDK EULA - 2008
category: Proprietary Free
owner: Adobe Systems
homepage_url: http://www.adobe.com/products/eulas/
spdx_license_key: LicenseRef-scancode-adobe-air-sdk
faq_url: http://www.adobe.com/products/eulas/
other_urls:
- http://www.adobe.com/products/eulas/
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-dng-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Adobe DNG SDK License Agreement
category: Proprietary Free
owner: Adobe Systems
homepage_url: https://www.adobe.com/support/downloads/dng/dng_sdk.html
spdx_license_key: LicenseRef-scancode-adobe-dng-sdk
text_urls:
- https://www.adobe.com/support/downloads/dng/dng_sdk_eula_mac.html
ignorable_urls:
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-eula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ homepage_url: http://www.adobe.com/products/eulas/
notes: |
This is a generic license for a large number of Adobe EULAs that are very
long and proprietary.
spdx_license_key: LicenseRef-scancode-adobe-eula
minimum_coverage: 70
ignorable_urls:
- http://www.adobe.com/products/eulas/
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Adobe Flash Player EULA 21.0
category: Proprietary Free
owner: Adobe Systems
homepage_url: http://wwwimages.adobe.com/content/dam/acom/en/legal/licenses-terms/pdf/Flash_Player_21_0.pdf
spdx_license_key: LicenseRef-scancode-adobe-flash-player-eula-21.0
ignorable_urls:
- http://www.adobe.com/
- http://www.adobe.com/go/RTMFP
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-flex-4-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Adobe Flex 4 SDK Software License Agreement
category: Proprietary Free
owner: Adobe Systems
homepage_url: https://wwwimages2.adobe.com/content/dam/acom/en/legal/licenses-terms/pdf/Adobe%20Flex%20SDK_4.0.pdf
spdx_license_key: LicenseRef-scancode-adobe-flex-4-sdk
text_urls:
- https://wwwimages2.adobe.com/content/dam/acom/en/legal/licenses-terms/pdf/Adobe%20Flex%20SDK_4.5.pdf
ignorable_urls:
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-flex-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ name: Adobe Flex SDK SLA
category: Proprietary Free
owner: Adobe Systems
homepage_url: https://raw.githubusercontent.com/nginadfoundation/flexsdk/master/license-adobesdk.htm
spdx_license_key: LicenseRef-scancode-adobe-flex-sdk
ignorable_urls:
- http://www.adobe.com/go/thirdparty
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-general-tou.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Adobe General Terms of Use
category: Commercial
owner: Adobe Systems
homepage_url: http://www.adobe.com/legal/general-terms.html
spdx_license_key: LicenseRef-scancode-adobe-general-tou
text_urls:
- http://www.adobe.com/legal/general-terms.html
ignorable_urls:
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-indesign-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Adobe SDK License for INDESIGN, INDESIGN SERVER and INCOPY Software
category: Proprietary Free
owner: Adobe Systems
homepage_url: http://www.adobe.com/devnet/indesign/sdk/eula_cs55.html
spdx_license_key: LicenseRef-scancode-adobe-indesign-sdk
ignorable_urls:
- http://support.adobe.com/devsup/devsup.nsf/docs/50093.htm
- http://www.adobe.com/go/thirdparty
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/adobe-postscript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ short_name: Adobe PostScript License
name: Adobe PostScript License
category: Proprietary Free
owner: Adobe Systems
spdx_license_key: LicenseRef-scancode-adobe-postscript
minimum_coverage: 25
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/aes-128-3.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ short_name: AES-128 3.0 License
name: AES-128 v3.0 License
category: Public Domain
owner: Unspecified
spdx_license_key: LicenseRef-scancode-aes-128-3.0
minimum_coverage: 90
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/afpl-9.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Aladdin Free Public License v9
category: Copyleft
owner: Aladdin Enterprises
homepage_url: http://www.artifex.com/downloads/doc/Public.htm
spdx_license_key: LicenseRef-scancode-afpl-9.0
text_urls:
- http://www.artifex.com/downloads/doc/Public.htm
ignorable_copyrights:
Expand Down
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/agentxpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ name: AgentX++ License Agreement
category: Commercial
owner: agentpp
homepage_url: https://agentpp.com/licenses/LICENSE_AgentX++.txt
spdx_license_key: LicenseRef-scancode-agentxpp
ignorable_urls:
- http://www.agentpp.com/
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/agere-bsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ notes: |
firmware was developed by Agere and runs on the DISC processor embedded
within the Hermes 1/2/2.5 Wireless MAC devices. Hope this helps. Sincerely,
Viren Pathare Intellectual Property Licensing Manager Agere
spdx_license_key: LicenseRef-scancode-agere-bsd
other_urls:
- https://github.com/mdamt/linux-firmware/blob/bf9f8648fdf1d1d63db471554781f897d219bd62/LICENCE.agere
minimum_coverage: 80
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/agere-sla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ name: Agere Systems WinModem EULA
category: Proprietary Free
owner: LSI Corporation
homepage_url: http://fedoraproject.org/wiki/Licensing/Agere_LT_Modem_Driver_License
spdx_license_key: LicenseRef-scancode-agere-sla
text_urls:
- http://fedoraproject.org/wiki/Licensing/Agere_LT_Modem_Driver_License
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/agpl-2.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Affero General Public License 2.0
category: Copyleft
owner: Affero
homepage_url: http://www.affero.org/agpl2.html
spdx_license_key: LicenseRef-scancode-agpl-2.0
text_urls:
- http://www.affero.org/agpl2.html
faq_url: http://www.affero.org/oagf.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
key: agpl-generic-additional-terms
short_name: AGPL Generic Additional Terms
name: AGPL Generic Additional Terms
is_exception: yes
category: Copyleft
owner: Unspecified
notes: this is a generic entry for rare one-off AGPL extra license terms.
These are typically additional terms under section 7 of the AGPL-3.0

notes: this is a generic entry for rare one-off AGPL extra license terms. These are typically
additional terms under section 7 of the AGPL-3.0
is_exception: yes
spdx_license_key: LicenseRef-scancode-agpl-generic-additional-terms
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/alasir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ name: The Alasir Licence
category: Proprietary Free
owner: Alasir
homepage_url: http://alasir.com/licence/TAL.txt
spdx_license_key: LicenseRef-scancode-alasir
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/alexisisaac-freeware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ name: Alexisisaac Freeware License
category: Permissive
owner: Alexis Isaac
homepage_url: https://sourceforge.net/projects/soleditor/?source=typ_redirect
spdx_license_key: LicenseRef-scancode-alexisisaac-freeware
ignorable_urls:
- http://www.alexisisaac.net/products
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/alfresco-exception-0.5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ category: Copyleft
owner: Alfresco Software
homepage_url: https://web.archive.org/web/20070306001556/http://www.alfresco.com/legal/licensing/floss_exception/
is_exception: yes
spdx_license_key: LicenseRef-scancode-alfresco-exception-0.5
ignorable_urls:
- http://www.gnu.org/philosophy/free-sw.html
- http://www.opensource.org/docs/definition.php
1 change: 1 addition & 0 deletions src/licensedcode/data/licenses/altova-eula.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ name: Altova EULA
category: Commercial
owner: Altova
homepage_url: http://www.altova.com/eula.html
spdx_license_key: LicenseRef-scancode-altova-eula
ignorable_copyrights:
- Copyright (c) 2007-2011 Altova GmbH (www.altova.com)
ignorable_holders:
Expand Down
Loading