forked from EESSI/software-layer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Another step of syncing with EESSI added all tests+licenses
- Loading branch information
Richard Top
committed
Jan 18, 2024
1 parent
c3302d9
commit 1a40831
Showing
20 changed files
with
124 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
see https://spdx.org/licenses | ||
|
||
Python function to download SPDX list of licenses is available in `spdx.py` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"EasyBuild": { | ||
"spdx": "GPL-2.0-only", | ||
"license_url": "https://easybuild.io" | ||
}, | ||
"GCCcore": { | ||
"spdx": "GPL-2.0-with-GCC-exception", | ||
"license_url": "https://github.com/gcc-mirror/gcc/blob/master/COPYING" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import json | ||
import logging | ||
import sys | ||
import urllib.request | ||
|
||
SPDX_LICENSE_LIST_URL = 'https://raw.githubusercontent.com/spdx/license-list-data/main/json/licenses.json' | ||
|
||
LICENSE_URL = 'license_url' | ||
SPDX = 'spdx' | ||
|
||
spdx_license_list = None | ||
|
||
# Configure the logging module | ||
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") | ||
|
||
|
||
def get_spdx_license_list(): | ||
""" | ||
Download JSON file with current list of SPDX licenses, parse it, and return it as a Python dictionary. | ||
""" | ||
global spdx_license_list | ||
|
||
if spdx_license_list is None: | ||
with urllib.request.urlopen(SPDX_LICENSE_LIST_URL) as fp: | ||
spdx_license_list = json.load(fp) | ||
version, release_date = spdx_license_list['licenseListVersion'], spdx_license_list['releaseDate'] | ||
logging.info(f"Downloaded version {version} of SPDX license list (release date: {release_date})") | ||
licenses = spdx_license_list['licenses'] | ||
logging.info(f"Found info on {len(licenses)} licenses!") | ||
|
||
return spdx_license_list | ||
|
||
|
||
def license_info(spdx_id): | ||
"""Find license with specified SPDX identifier.""" | ||
|
||
spdx_license_list = get_spdx_license_list() | ||
|
||
licenses = spdx_license_list['licenses'] | ||
for lic in licenses: | ||
if lic['licenseId'] == spdx_id: | ||
return lic | ||
|
||
# if no match is found, return None as result | ||
return None | ||
|
||
|
||
def read_licenses(path): | ||
""" | ||
Read software project to license mapping from specified path | ||
""" | ||
with open(path) as fp: | ||
licenses = json.loads(fp.read()) | ||
|
||
return licenses | ||
|
||
|
||
def check_licenses(licenses): | ||
""" | ||
Check mapping of software licenses: make sure SPDX identifiers are valid. | ||
""" | ||
faulty_licenses = {} | ||
|
||
for software_name in licenses: | ||
spdx_lic_id = licenses[software_name][SPDX] | ||
lic_info = license_info(spdx_lic_id) | ||
if lic_info: | ||
lic_url = licenses[software_name][LICENSE_URL] | ||
logging.info(f"License for software '{software_name}': {lic_info['name']} (see {lic_url})") | ||
else: | ||
logging.warning(f"Found faulty SPDX license ID for {software_name}: {spdx_lic_id}") | ||
faulty_licenses[software_name] = spdx_lic_id | ||
|
||
if faulty_licenses: | ||
logging.warning(f"Found {len(faulty_licenses)} faulty SPDIX license IDs (out of {len(licenses)})!") | ||
result = False | ||
else: | ||
logging.info(f"License check passed for {len(licenses)} licenses!") | ||
result = True | ||
|
||
return result | ||
|
||
|
||
def main(args): | ||
if len(args) == 1: | ||
licenses_path = args[0] | ||
else: | ||
logging.error("Usage: python spdx.py <path to licenses.json>") | ||
sys.exit(1) | ||
|
||
licenses = read_licenses(licenses_path) | ||
if check_licenses(licenses): | ||
logging.info("All license checks PASSED!") | ||
else: | ||
logging.error("One or more licence checks failed!") | ||
sys.exit(2) | ||
|
||
|
||
if __name__ == '__main__': | ||
main(sys.argv[1:]) |
1 change: 0 additions & 1 deletion
1
tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.output
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
tests/archdetect/aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.output
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
tests/archdetect/aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.output
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
tests/archdetect/aarch64/neoverse_n1/AWS-awslinux-graviton2.all.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aarch64/neoverse_n1:aarch64/generic |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
tests/archdetect/aarch64/neoverse_n1/AWS-awslinux-graviton2.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aarch64/neoverse_n1 |
1 change: 1 addition & 0 deletions
1
tests/archdetect/aarch64/neoverse_n1/Azure-Ubuntu20-Altra.all.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aarch64/neoverse_n1:aarch64/generic |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
tests/archdetect/aarch64/neoverse_n1/Azure-Ubuntu20-Altra.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aarch64/neoverse_n1 |
1 change: 1 addition & 0 deletions
1
tests/archdetect/aarch64/neoverse_v1/AWS-awslinux-graviton3.all.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aarch64/neoverse_v1:aarch64/neoverse_n1:aarch64/generic |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
tests/archdetect/aarch64/neoverse_v1/AWS-awslinux-graviton3.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aarch64/neoverse_v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ppc64le/power9le:ppc64le/generic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x86_64/amd/zen2:x86_64/generic |
1 change: 1 addition & 0 deletions
1
tests/archdetect/x86_64/amd/zen3/Azure-CentOS7-7V73X.all.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x86_64/amd/zen3:x86_64/amd/zen2:x86_64/generic |
1 change: 1 addition & 0 deletions
1
tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.all.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x86_64/intel/haswell:x86_64/generic |
1 change: 1 addition & 0 deletions
1
tests/archdetect/x86_64/intel/skylake_avx512/archspec-linux-6132.all.output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x86_64/intel/skylake_avx512:x86_64/intel/haswell:x86_64/generic |