Fix insertion of newlines in license conversion comments
We would end up with not-enough/one-too-many in various cases.
This commit is contained in:
parent
1482f79e28
commit
1100c60d7b
1 changed files with 5 additions and 5 deletions
|
@ -26,7 +26,7 @@ def dump_sdpx_to_fedora_map(file):
|
||||||
print(f"{k} → {v}", file=file)
|
print(f"{k} → {v}", file=file)
|
||||||
|
|
||||||
def translate_license_fedora(license):
|
def translate_license_fedora(license):
|
||||||
comments = ''
|
comments = []
|
||||||
final = []
|
final = []
|
||||||
for tag in license.split():
|
for tag in license.split():
|
||||||
# We accept all variant cases, but output lowercase which is what Fedora LicensingGuidelines specify
|
# We accept all variant cases, but output lowercase which is what Fedora LicensingGuidelines specify
|
||||||
|
@ -43,18 +43,18 @@ def translate_license_fedora(license):
|
||||||
|
|
||||||
mapped = spdx_to_fedora_map().get(key, None)
|
mapped = spdx_to_fedora_map().get(key, None)
|
||||||
if mapped is None:
|
if mapped is None:
|
||||||
comments += f'# FIXME: Upstream uses unknown SPDX tag {fulltag}!'
|
comments += [f'# FIXME: Upstream uses unknown SPDX tag {fulltag}!']
|
||||||
final.append(tag)
|
final.append(tag)
|
||||||
elif mapped == '':
|
elif mapped == '':
|
||||||
comments += f"# FIXME: Upstream SPDX tag {fulltag} not listed in Fedora's good licenses list.\n"
|
comments += [f"# FIXME: Upstream SPDX tag {fulltag} not listed in Fedora's good licenses list.",
|
||||||
comments += "# FIXME: This package might not be allowed in Fedora!\n"
|
"# FIXME: This package might not be allowed in Fedora!"]
|
||||||
final.append(tag)
|
final.append(tag)
|
||||||
else:
|
else:
|
||||||
final.append(mapped)
|
final.append(mapped)
|
||||||
if mapped != tag:
|
if mapped != tag:
|
||||||
print(f'Upstream license tag {fulltag} translated to {mapped}',
|
print(f'Upstream license tag {fulltag} translated to {mapped}',
|
||||||
file=_sys.stderr)
|
file=_sys.stderr)
|
||||||
return (' '.join(final), comments or None)
|
return (' '.join(final), '\n'.join(comments) or None)
|
||||||
|
|
||||||
def translate_license(target, license):
|
def translate_license(target, license):
|
||||||
license = translate_slashes(license)
|
license = translate_slashes(license)
|
||||||
|
|
Loading…
Reference in a new issue