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)
|
||||
|
||||
def translate_license_fedora(license):
|
||||
comments = ''
|
||||
comments = []
|
||||
final = []
|
||||
for tag in license.split():
|
||||
# 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)
|
||||
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)
|
||||
elif mapped == '':
|
||||
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"
|
||||
comments += [f"# FIXME: Upstream SPDX tag {fulltag} not listed in Fedora's good licenses list.",
|
||||
"# FIXME: This package might not be allowed in Fedora!"]
|
||||
final.append(tag)
|
||||
else:
|
||||
final.append(mapped)
|
||||
if mapped != tag:
|
||||
print(f'Upstream license tag {fulltag} translated to {mapped}',
|
||||
file=_sys.stderr)
|
||||
return (' '.join(final), comments or None)
|
||||
return (' '.join(final), '\n'.join(comments) or None)
|
||||
|
||||
def translate_license(target, license):
|
||||
license = translate_slashes(license)
|
||||
|
|
Loading…
Reference in a new issue