Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ Current support:
|Type | Number |
|----------------|--------|
|Licenses | 210 |
|Aliases | 2933 |
|Aliases | 2934 |
|Compatibilities | 22 |
|Operators | 14 |
|Ambiguities | 171 |
|Compounds | 56 |
|Compounds | 57 |

# About

Expand Down
4 changes: 2 additions & 2 deletions STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
|Type | Number |
|----------------|--------|
|Licenses | 210 |
|Aliases | 2933 |
|Aliases | 2934 |
|Compatibilities | 22 |
|Operators | 14 |
|Ambiguities | 171 |
|Compounds | 56 |
|Compounds | 57 |
4 changes: 3 additions & 1 deletion python/flame/license_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def __init_license_db(self, check=False):
logging.debug(f'duals_file: {duals_file}')
logging.debug(f'config: {self.config}')

self.license_expression = license_expression.get_spdx_licensing()
self.license_expression = license_expression.Licensing([])
self.license_db[DUALS_TAG] = duals
self.license_db[AMBIG_TAG] = self.ambiguities
self.license_db[LICENSES_TAG] = licenses
Expand Down Expand Up @@ -501,12 +501,14 @@ def expression_license(self, license_expression, validations=None, update_dual=T
except boolean.boolean.ParseError as e:
update_problem = f'Could not parse \"{updates_object["license_expression"]}\". Exception: {e}'
updated_license = updates_object['license_expression']
print("2")
else:
try:
updated_license = str(self.license_expression.parse(ret['license_expression']))
except boolean.boolean.ParseError as e:
update_problem = f'Could not parse "ret["license_expression"]". Exception: {e}'
updated_license = ret['license_expression']
print("3")

license_parsed = updated_license

Expand Down
18 changes: 18 additions & 0 deletions tests/licenses/MIT.LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 changes: 12 additions & 0 deletions tests/licenses/MIT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"meta": {
"disclaimer": "https://raw.githubusercontent.com/hesa/foss-licenses/main/var/disclaimer.md",
"comment": ""
},
"name": "MIT License",
"scancode_key": "mit",
"spdxid": "MIT",
"aliases": [
"mit"
]
}
2 changes: 1 addition & 1 deletion tests/python/test_ambigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
'compounds_file': 'tests/var/compounds.json'
})

def _DISABLE_test_ambig_gpl():
def test_ambig_gpl():
lic = fl.expression_license("GPL", update_dual=False)
assert lic['identified_license'] == "GPL"
assert lic['ambiguities']
Expand Down
3 changes: 1 addition & 2 deletions tests/python/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ def test_204_and():

exp_lic = 'MIT AND (GPL-2.0-only OR GPL-3.0-only)'
c = fl.expression_compatibility_as(lic)
assert c['compat_license'] == exp_lic

exp_lic = 'MIT AND GPL-2.0-or-later'
c = fl.expression_compatibility_as(lic, update_dual=False)
assert c['compat_license'] == exp_lic

def test_204_and():
def test_204_and_noupdate():
lic = 'mit and GPLv2+'

exp_lic = 'MIT AND (GPL-2.0-only OR GPL-3.0-only)'
Expand Down
4 changes: 2 additions & 2 deletions tests/python/test_ldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

def test_supported():
licenses = fl.licenses()
assert len(licenses) == 6
assert len(licenses) == 7

def test_alias_list():
# list of all aliases
aliases = fl.alias_list()
assert len(aliases) == 11
assert len(aliases) == 12

def test_alias_list_gpl():
# list of all aliases with license with GPL
Expand Down
2 changes: 1 addition & 1 deletion tests/python/test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

def test_licenses():
licenses = fl_default.licenses()
assert len(licenses) == 6
assert len(licenses) == 7

def test_compat_default():
compat = fl_default.expression_compatibility_as("MIT")
Expand Down
3 changes: 1 addition & 2 deletions tests/python/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def test_supported():
licenses = fl.licenses()
assert len(licenses) == 6
assert len(licenses) == 7

def test_osadl_validation():
fl.expression_license("MIT", validations=[Validation.OSADL])
Expand Down Expand Up @@ -71,4 +71,3 @@ def test_scancode_relaxed():

fl.expression_license("LicenseRef-scancode-unknown-license-reference", validations=[Validation.SCANCODE])


34 changes: 34 additions & 0 deletions tests/shell/test-issues.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

exec_flame()
{
./devel/flame $*
}


test_flame()
{
COMMAND="$1"
LICENSE="$2"
EXPECTED="$3"

ACTUAL=$(exec_flame $COMMAND $LICENSE 2>/dev/null)

echo -n " $COMMAND $LICENSE: "
if [ "$ACTUAL" != "$EXPECTED" ]
then
echo "fail....."
echo " license : $LICENSE"
echo " expected: $EXPECTED"
echo " actual: $ACTUAL"
exit 1
fi
echo "OK"
}


echo "Testing issues"
echo "=============="
echo " https://github.com/hesa/foss-licenses/issues/214"
echo "---------------------------------------------------"
test_flame license "GPL" "GPL"
3 changes: 2 additions & 1 deletion var/compounds.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@
"GPL-3.0-only WITH GCC Runtime Library exception",
"GPL-2.0-only WITH GCC exception",
"GPL-2.0-only WITH GCC Runtime Library exception",
"GNU General Public License 3 plus GCC RUNTIME LIBRARY EXCEPTION"
"GNU General Public License 3 plus GCC RUNTIME LIBRARY EXCEPTION",
"GNU General Public Licensev3 w/Runtime exception V3.1"
],
"compatibility_as": "0BSD"
},
Expand Down