
This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. (From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1.6 KiB
Executable File
#! /usr/bin/env python3
SPDX-License-Identifier: GPL-2.0-only
import sys try: import xml.etree.cElementTree as etree except: import xml.etree.ElementTree as etree
def child (elem, name): for e in elem.getchildren(): if e.tag == name: return e return None
def children (elem, name=None): l = elem.getchildren() if name: l = [e for e in l if e.tag == name] return l
if len(sys.argv) < 2 or sys.argv[1] in ('-h', '--help'): print('oe-trim-schemas: error: the following arguments are required: schema\n' 'Usage: oe-trim-schemas schema\n\n' 'OpenEmbedded trim schemas - remove unneeded schema locale translations\n' ' from gconf schema files\n\n' 'arguments:\n' ' schema gconf schema file to trim\n') sys.exit(2)
xml = etree.parse(sys.argv[1])
for schema in child(xml.getroot(), "schemalist").getchildren(): e = child(schema, "short") if e is not None: schema.remove(e)
e = child(schema, "long")
if e is not None:
schema.remove(e)
for locale in children(schema, "locale"):
# One locale must exist so leave C locale...
a = locale.attrib.get("name")
if a == 'C':
continue
e = child(locale, "default")
if e is None:
schema.remove(locale)
else:
e = child(locale, "short")
if e is not None:
locale.remove(e)
e = child(locale, "long")
if e is not None:
locale.remove(e)
xml.write(sys.stdout, "UTF-8")