[{"id":17343,"web_url":"https://patchwork.libcamera.org/comment/17343/","msgid":"<YLDHGuiz1q0/5QXd@pendragon.ideasonboard.com>","date":"2021-05-28T10:34:02","subject":"Re: [libcamera-devel] [PATCH v2] utils: ipc: extract-docs: Extract\n\tthe SPDX header","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Paul,\n\nThank you for the patch.\n\nOn Fri, May 28, 2021 at 07:29:56PM +0900, Paul Elder wrote:\n> Take the SPDX header from the mojom file. Error out if it doesn't\n\nIf it doesn't what ? :-)\n\n> \n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n> Changes in v2:\n> - Error out if SPDX header is unavailable\n> - add newline at end of default SPDX string\n> ---\n>  utils/ipc/extract-docs.py | 10 ++++++++--\n>  1 file changed, 8 insertions(+), 2 deletions(-)\n> \n> diff --git a/utils/ipc/extract-docs.py b/utils/ipc/extract-docs.py\n> index 56566ce0..1ff9a775 100755\n> --- a/utils/ipc/extract-docs.py\n> +++ b/utils/ipc/extract-docs.py\n> @@ -12,6 +12,7 @@ import sys\n>  \n>  regex_block_start = re.compile('^\\/\\*\\*$')\n>  regex_block_end = re.compile('^ \\*\\/$')\n> +regex_spdx = re.compile('^\\/\\* SPDX-License-Identifier: .* \\*\\/$')\n>  \n>  \n>  def main(argv):\n> @@ -28,8 +29,13 @@ def main(argv):\n>  \n>      lines = open(args.input, 'r').readlines()\n>      pipeline = args.input.split('/')[-1].replace('.mojom', '')\n> -    data = f'''\\\n> -/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +\n> +    if regex_spdx.match(lines[0]):\n> +        data = lines[0]\n> +    else:\n> +        raise Exception(f'Missing SPDX license header in {args.input}')\n\nI would write\n\n    if not regex_spdx.match(lines[0]):\n        raise Exception(f'Missing SPDX license header in {args.input}')\n\n    data = lines[0]\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +\n> +    data += f'''\\\n>  /*\n>   * Copyright (C) 2021, Google Inc.\n>   *","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2AC8EC3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 May 2021 10:34:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5B5226891F;\n\tFri, 28 May 2021 12:34:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7CD93602AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 May 2021 12:34:10 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BD29611F9;\n\tFri, 28 May 2021 12:34:09 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"FHNnWmIb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1622198049;\n\tbh=mWH6x6mvNT+WETTRC1Gk1poSBMFNJxlcBOYBvCtllaM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=FHNnWmIbu1EvpIuxXZMLYfN1iT6W8/bGRDFyOPUSRVaaeagEq8k+cyGoyUmiQxg8g\n\tff0hKsNMkHjtcnCMXqkrsBbS9s8mpwb5m0B+7Y80xnwNIaYg1elg/Pwd4wEy/3i5+Y\n\thaYLbjyWDB0FeAgsjt/Ir+ftajIkdu2acMbEH9LE=","Date":"Fri, 28 May 2021 13:34:02 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<YLDHGuiz1q0/5QXd@pendragon.ideasonboard.com>","References":"<20210528102956.2750155-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210528102956.2750155-1-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2] utils: ipc: extract-docs: Extract\n\tthe SPDX header","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17345,"web_url":"https://patchwork.libcamera.org/comment/17345/","msgid":"<da414826-3817-c8cd-7b5f-2850429f4cec@ideasonboard.com>","date":"2021-05-28T14:05:33","subject":"Re: [libcamera-devel] [PATCH v2] utils: ipc: extract-docs: Extract\n\tthe SPDX header","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Paul,\n\nThanks for the patch.\n\nOn 5/28/21 4:04 PM, Laurent Pinchart wrote:\n> Hi Paul,\n>\n> Thank you for the patch.\n>\n> On Fri, May 28, 2021 at 07:29:56PM +0900, Paul Elder wrote:\n>> Take the SPDX header from the mojom file. Error out if it doesn't\n> If it doesn't what ? :-)\n>\n>> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n>> ---\n>> Changes in v2:\n>> - Error out if SPDX header is unavailable\n>> - add newline at end of default SPDX string\n>> ---\n>>   utils/ipc/extract-docs.py | 10 ++++++++--\n>>   1 file changed, 8 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/utils/ipc/extract-docs.py b/utils/ipc/extract-docs.py\n>> index 56566ce0..1ff9a775 100755\n>> --- a/utils/ipc/extract-docs.py\n>> +++ b/utils/ipc/extract-docs.py\n>> @@ -12,6 +12,7 @@ import sys\n>>   \n>>   regex_block_start = re.compile('^\\/\\*\\*$')\n>>   regex_block_end = re.compile('^ \\*\\/$')\n>> +regex_spdx = re.compile('^\\/\\* SPDX-License-Identifier: .* \\*\\/$')\n>>   \n>>   \n>>   def main(argv):\n>> @@ -28,8 +29,13 @@ def main(argv):\n>>   \n>>       lines = open(args.input, 'r').readlines()\n>>       pipeline = args.input.split('/')[-1].replace('.mojom', '')\n>> -    data = f'''\\\n>> -/* SPDX-License-Identifier: LGPL-2.1-or-later */\n>> +\n>> +    if regex_spdx.match(lines[0]):\n>> +        data = lines[0]\n>> +    else:\n>> +        raise Exception(f'Missing SPDX license header in {args.input}')\n> I would write\n>\n>      if not regex_spdx.match(lines[0]):\n>          raise Exception(f'Missing SPDX license header in {args.input}')\n>\n>      data = lines[0]\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nWith Laurent's suggestions in place (better readability of the code) :-)\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n>\n>> +\n>> +    data += f'''\\\n>>   /*\n>>    * Copyright (C) 2021, Google Inc.\n>>    *","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3DBDAC3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 May 2021 14:05:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 95E5D6891F;\n\tFri, 28 May 2021 16:05:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E22FA602AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 May 2021 16:05:41 +0200 (CEST)","from localhost.localdomain (unknown [103.251.226.189])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D5E26145A;\n\tFri, 28 May 2021 16:05:39 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"l6QzEUTb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1622210741;\n\tbh=biSHgywIhDCrGYdLQtN8G3V7D5OaGbHVNwnC6x8CrvI=;\n\th=Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=l6QzEUTbgc1zGNuGF7allxEzdATstFgQQYT7v/j3syjSu6+tgfiDeHWx3OaqGwxau\n\tI0Znuk0hmdx3D1zQ4mgJLRNJXZQ3Klwb2SHRhCDTttjFbQN3tgbM5I1y0U9e2F0eZU\n\tzbc258Iwh0oRfCNr/FKPKvcqTgVE32PrI2hDMB9w=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","References":"<20210528102956.2750155-1-paul.elder@ideasonboard.com>\n\t<YLDHGuiz1q0/5QXd@pendragon.ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<da414826-3817-c8cd-7b5f-2850429f4cec@ideasonboard.com>","Date":"Fri, 28 May 2021 19:35:33 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.11.0","MIME-Version":"1.0","In-Reply-To":"<YLDHGuiz1q0/5QXd@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v2] utils: ipc: extract-docs: Extract\n\tthe SPDX header","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]