summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2021-07-15 09:21:00 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2021-07-16 21:24:44 +0200
commitf56f4b9f43f5b102a36dbde80a69709371ab4deb (patch)
treeb2af0471ee988ab9fd080cab58ff8ffd917c77de
parent6c2bca3f56716d462af1e7615bdf079d2c441362 (diff)
downloadptxdist-f56f4b9f43f5b102a36dbde80a69709371ab4deb.tar.gz
ptxdist-f56f4b9f43f5b102a36dbde80a69709371ab4deb.tar.xz
update_spdx: sort output
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-xscripts/update_spdx.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/update_spdx.py b/scripts/update_spdx.py
index fd615c51a..e8ca0cc4a 100755
--- a/scripts/update_spdx.py
+++ b/scripts/update_spdx.py
@@ -37,18 +37,28 @@ ptxd_make_spdx() {
case "${license}" in
""" % (basename(sys.argv[0]), basename(sys.argv[1]), basename(sys.argv[2])))
+lines = []
for l in data['licenses']:
arg = ''
if l['isDeprecatedLicenseId']:
arg = 'deprecated="true" '
elif l['isOsiApproved']:
arg = 'osi="true" '
- outfile.write(" {}) {};;\n".format(l['licenseId'], arg))
+ lines.append(" {}) {};;\n".format(l['licenseId'], arg))
+lines.sort(key=str.casefold)
+for line in lines:
+ outfile.write(line)
+
+lines=[]
for l in ex_data['exceptions']:
if l['isDeprecatedLicenseId']:
continue
- outfile.write(" {}) exception=\"true\" ;;\n".format(l['licenseExceptionId']))
+ lines.append(" {}) exception=\"true\" ;;\n".format(l['licenseExceptionId']))
+
+lines.sort(key=str.casefold)
+for line in lines:
+ outfile.write(line)
outfile.write(""" *) return 1 ;;
esac