From patchwork Fri May 28 10:48:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12470 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 A0614C3205 for ; Fri, 28 May 2021 10:48:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 140186891F; Fri, 28 May 2021 12:48:37 +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="SGswJoJR"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 22991602AA for ; Fri, 28 May 2021 12:48:36 +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 D45EA140E; Fri, 28 May 2021 12:48:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622198915; bh=d9g+nTar80H6UA9eTxqAfG4uWrpr8ZV01CH5tzQZGzs=; h=From:To:Cc:Subject:Date:From; b=SGswJoJRhcqjAsaW7b/3vgC+qCncRpJS9H7SBmr/T8/P8Jq2E6cn5ymo5m95W65fN VPxkurAarQnWmcs4Z/WspOE2IOxetfcD0Q0Tq8fNmyG1CMEJOZkh8A7BojSaTBaX6m +HmoK+zGSQZt4/m3/kAEgunHxyL8P523wwkeN5y4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 28 May 2021 19:48:24 +0900 Message-Id: <20210528104824.2978880-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3] 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 the mojom file has no SPDX header. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- Changes in v3: - make the if nicer Changes in v2: - Error out if SPDX header is unavailable - add newline at end of default SPDX string --- utils/ipc/extract-docs.py | 9 +++++++-- 1 file 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. *