From patchwork Fri May 28 10:29:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12469 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 653D0C3206 for ; Fri, 28 May 2021 10:30:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 77A2C6891F; Fri, 28 May 2021 12:30:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PduLNjg4"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 416C4602AA for ; Fri, 28 May 2021 12:30:12 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8E64511F9; Fri, 28 May 2021 12:30:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622197811; bh=P1FxuURVfSOtZzrxCYwDzUNhLPYMIYubV3yvs1up+Gw=; h=From:To:Cc:Subject:Date:From; b=PduLNjg45bdK2kvrCdde+cRxJrsRRW2rozZBV+WjeUBuugSaFdMtISvPJ94WxbRkz 2fy5UmyC5CUqsDF203zMcI2GreNH8SYBBTLuRiy1A/sBKhPyrVtN9v4jn4txwRI72Y TChqrEELF5XqbDjs8QR3hEGtRA0Gwy2Xf7GRE6lk= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 28 May 2021 19:29:56 +0900 Message-Id: <20210528102956.2750155-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] utils: ipc: extract-docs: Extract the SPDX header X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Take the SPDX header from the mojom file. Error out if it doesn't Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Umang Jain --- Changes in v2: - Error out if SPDX header is unavailable - add newline at end of default SPDX string --- utils/ipc/extract-docs.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/utils/ipc/extract-docs.py b/utils/ipc/extract-docs.py index 56566ce0..1ff9a775 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,13 @@ 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 regex_spdx.match(lines[0]): + data = lines[0] + else: + raise Exception(f'Missing SPDX license header in {args.input}') + + data += f'''\ /* * Copyright (C) 2021, Google Inc. *