diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2021-05-27 18:26:48 +0900 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2021-05-31 13:20:19 +0900 |
commit | 3370b6d0a0dfe1b554865d6e5bb8e20049220bf0 (patch) | |
tree | ea11a4f5da02ce5de8a848508b3436074df94fa1 /utils/ipc/extract-docs.py | |
parent | 6b22a3657c615588ff489dbe16a0484530830823 (diff) |
utils: ipc: extract-docs: Extract the SPDX header
Take the SPDX header from the mojom file. Error out if the mojom file
has no SPDX header.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Diffstat (limited to 'utils/ipc/extract-docs.py')
-rwxr-xr-x | utils/ipc/extract-docs.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/utils/ipc/extract-docs.py b/utils/ipc/extract-docs.py index 56566ce0..8f7fff9f 100755 --- a/utils/ipc/extract-docs.py +++ b/utils/ipc/extract-docs.py @@ -12,6 +12,7 @@ import sys regex_block_start = re.compile('^\/\*\*$') regex_block_end = re.compile('^ \*\/$') +regex_spdx = re.compile('^\/\* SPDX-License-Identifier: .* \*\/$') def main(argv): @@ -28,8 +29,12 @@ def main(argv): lines = open(args.input, 'r').readlines() pipeline = args.input.split('/')[-1].replace('.mojom', '') - data = f'''\ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ + + if not regex_spdx.match(lines[0]): + raise Exception(f'Missing SPDX license header in {args.input}') + + data = lines[0] + data += f'''\ /* * Copyright (C) 2021, Google Inc. * |