From 04f63e0f20d6b517119053c6bc00aa8be3c3a19f Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Jun 02 2019 13:51:05 +0000 Subject: Add AGPL-3.0-or-later and automatically translate "+" suffix into "-or-later" This way we don't need to add all the deprecated variants with "+" suffix. Fixes #84. --- diff --git a/rust2rpm/licensing.py b/rust2rpm/licensing.py index 233903e..6ca4e45 100644 --- a/rust2rpm/licensing.py +++ b/rust2rpm/licensing.py @@ -35,18 +35,24 @@ def translate_license_fedora(license): elif tag.upper() == 'AND': final.append('and') else: - mapped = spdx_to_fedora_map().get(tag, None) + if tag.endswith('+'): + key = tag[:-1] + '-or-later' + fulltag = f'{tag} ({key})' + else: + key = fulltag = tag + + mapped = spdx_to_fedora_map().get(key, None) if mapped is None: - comments += f'# FIXME: Upstream uses unknown SPDX tag {tag}!' + comments += f'# FIXME: Upstream uses unknown SPDX tag {fulltag}!' final.append(tag) elif mapped == '': - comments += f"# FIXME: Upstream SPDX tag {tag} not listed in Fedora's good licenses list.\n" + comments += f"# FIXME: Upstream SPDX tag {fulltag} not listed in Fedora's good licenses list.\n" comments += "# FIXME: This package might not be allowed in Fedora!\n" final.append(tag) else: final.append(mapped) if mapped != tag: - print(f'Upstream license tag {tag} translated to {mapped}', + print(f'Upstream license tag {fulltag} translated to {mapped}', file=_sys.stderr) return (' '.join(final), comments or None) diff --git a/rust2rpm/spdx_to_fedora.csv b/rust2rpm/spdx_to_fedora.csv index a3f9604..006d80c 100644 --- a/rust2rpm/spdx_to_fedora.csv +++ b/rust2rpm/spdx_to_fedora.csv @@ -138,17 +138,15 @@ Giftware License,Giftware,Giftware,,, GL2PS License,GL2PS,GL2PS,,, Glulxe License,Glulxe,Glulxe,,, GNU Affero General Public License v3.0,AGPL-3.0,AGPLv3,Affero General Public License 3.0,, +GNU Affero General Public License v3.0 or later,AGPL-3.0-or-later,AGPLv3+,Affero General Public License 3.0 or later,, GNU Free Documentation License v1.1,GFDL-1.1,,,This specific version not on Fedora list, GNU Free Documentation License v1.2,GFDL-1.2,,,This specific version not on Fedora list, GNU Free Documentation License v1.3,GFDL-1.3,GFDL,,, GNU General Public License v1.0 only,GPL-1.0,GPLv1,,, -GNU General Public License v1.0 or later,GPL-1.0+,GPLv1+,,, GNU General Public License v1.0 or later,GPL-1.0-or-later,GPLv1+,,, GNU General Public License v2.0 only,GPL-2.0,GPLv2,,, -GNU General Public License v2.0 or later,GPL-2.0+,GPLv2+,,, GNU General Public License v2.0 or later,GPL-2.0-or-later,GPLv2+,,, GNU General Public License v3.0 only,GPL-3.0,GPLv3,,, -GNU General Public License v3.0 or later,GPL-3.0+,GPLv3+,,, GNU General Public License v3.0 or later,GPL-3.0-or-later,GPLv3+,,, GNU Lesser General Public License v2.1 only,LGPL-2.1,LGPLv2,,, GNU Lesser General Public License v3.0 only,LGPL-3.0,LGPLv3,,,