[{"id":38525,"web_url":"https://patchwork.libcamera.org/comment/38525/","msgid":"<adX3nDqJtYk_-8a7@zed>","date":"2026-04-08T06:39:37","subject":"Re: [PATCH] utils: checkstyle: Add license commit checker","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Laurent\n\nOn Tue, Apr 07, 2026 at 04:56:32PM +0300, Laurent Pinchart wrote:\n> Add a checker, based on the reuse tool, to detect files without a valid\n> license. The tool is optional, the checker will be skipped when not\n> available.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n> I figured out that if we want this in CI, we should have it in\n> checkstyle too. In which case we could drop the license job from CI.\n\nI think this is a way better approach\n\n> ---\n>  utils/checkstyle.py | 25 +++++++++++++++++++++++++\n>  1 file changed, 25 insertions(+)\n>\n> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> index fa1355c1738b..f1ba1ee0ed81 100755\n> --- a/utils/checkstyle.py\n> +++ b/utils/checkstyle.py\n> @@ -453,6 +453,31 @@ class HeaderAddChecker(CommitChecker):\n>          return issues\n>\n>\n> +class LicenseChecker(CommitChecker):\n> +    commit_types = (Commit, StagedChanges, Amendment)\n> +    dependencies = ('reuse',)\n\nIs this a build dependency ? Does it need to be ?\n\n> +\n> +    missing_license_regex = re.compile(r'^(.*): no license identifier$')\n> +\n> +    @classmethod\n> +    def check(cls, commit, top_level):\n> +        issues = []\n> +\n> +        ret = subprocess.run(['reuse', 'lint-file'] + commit.files('AR'),\n> +                             stdout=subprocess.PIPE)\n> +\n> +        for line in ret.stdout.decode('utf-8').splitlines():\n> +            match = LicenseChecker.missing_license_regex.match(line)\n> +            if not match:\n> +                continue\n> +\n> +            filename = match.group(1)\n> +            issue = CommitIssue(f'File {filename} has no license identifier')\n> +            issues.append(issue)\n> +\n> +        return issues\n> +\n> +\n\nI trust your Python!\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\n>  class TitleChecker(CommitChecker):\n>      commit_types = (Commit,)\n>\n>\n> base-commit: 4b6c47bd6675c428c19ea76370f0301c24f23bf1\n> --\n> Regards,\n>\n> Laurent Pinchart\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 5D318BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Apr 2026 06:39:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3B0B362DBE;\n\tWed,  8 Apr 2026 08:39:43 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1BAE562CEB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Apr 2026 08:39:41 +0200 (CEST)","from ideasonboard.com (mob-109-113-47-41.net.vodafone.it\n\t[109.113.47.41])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D93621544;\n\tWed,  8 Apr 2026 08:38:12 +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=\"BpzQ5IKy\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1775630293;\n\tbh=T4LT0rAXSwSNNI7BrAK5r0L5jzU9NdL9Z5p9Fqx4+BY=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=BpzQ5IKy7rE+sKtWDKXhZfCoagTkWs9KJs7RsfWM2lKCfu0ffCrO8r1csU8Hr99ov\n\twilUiN7wuQSdju1JvbVEA5aRq4jiHqDrDt4yeakSLUm6Eep2v8vTDo+a7WzrEK/U6H\n\tOIdI5sYgFKLznv6UCQG1xFKXXE0tepFyeys4M/Ic=","Date":"Wed, 8 Apr 2026 08:39:37 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] utils: checkstyle: Add license commit checker","Message-ID":"<adX3nDqJtYk_-8a7@zed>","References":"<20260407135632.1810486-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20260407135632.1810486-1-laurent.pinchart@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":38533,"web_url":"https://patchwork.libcamera.org/comment/38533/","msgid":"<20260408091414.GQ1268443@killaraus.ideasonboard.com>","date":"2026-04-08T09:14:14","subject":"Re: [PATCH] utils: checkstyle: Add license commit checker","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Apr 08, 2026 at 08:39:37AM +0200, Jacopo Mondi wrote:\n> On Tue, Apr 07, 2026 at 04:56:32PM +0300, Laurent Pinchart wrote:\n> > Add a checker, based on the reuse tool, to detect files without a valid\n> > license. The tool is optional, the checker will be skipped when not\n> > available.\n> >\n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> > I figured out that if we want this in CI, we should have it in\n> > checkstyle too. In which case we could drop the license job from CI.\n> \n> I think this is a way better approach\n> \n> > ---\n> >  utils/checkstyle.py | 25 +++++++++++++++++++++++++\n> >  1 file changed, 25 insertions(+)\n> >\n> > diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n> > index fa1355c1738b..f1ba1ee0ed81 100755\n> > --- a/utils/checkstyle.py\n> > +++ b/utils/checkstyle.py\n> > @@ -453,6 +453,31 @@ class HeaderAddChecker(CommitChecker):\n> >          return issues\n> >\n> >\n> > +class LicenseChecker(CommitChecker):\n> > +    commit_types = (Commit, StagedChanges, Amendment)\n> > +    dependencies = ('reuse',)\n> \n> Is this a build dependency ? Does it need to be ?\n\nI expect most people to not have reuse installed (even if it's packaged\nby distributions), so we'll likely catch issues in CI only. I'm however\nnot too concerned, as missing license information when adding new files\nis not a common mistake.\n\nWe could implement file parsing in Python as well and avoid depending on\nthe reuse tool, but that's more code to maintain. I'd rather depend on\nthe reuse tool for the time being, and reconsider that later if it\ncauses issues.\n\n> > +\n> > +    missing_license_regex = re.compile(r'^(.*): no license identifier$')\n> > +\n> > +    @classmethod\n> > +    def check(cls, commit, top_level):\n> > +        issues = []\n> > +\n> > +        ret = subprocess.run(['reuse', 'lint-file'] + commit.files('AR'),\n> > +                             stdout=subprocess.PIPE)\n> > +\n> > +        for line in ret.stdout.decode('utf-8').splitlines():\n> > +            match = LicenseChecker.missing_license_regex.match(line)\n> > +            if not match:\n> > +                continue\n> > +\n> > +            filename = match.group(1)\n> > +            issue = CommitIssue(f'File {filename} has no license identifier')\n> > +            issues.append(issue)\n> > +\n> > +        return issues\n> > +\n> > +\n> \n> I trust your Python!\n> \n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> \n> >  class TitleChecker(CommitChecker):\n> >      commit_types = (Commit,)\n> >\n> >\n> > base-commit: 4b6c47bd6675c428c19ea76370f0301c24f23bf1","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 71845BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Apr 2026 09:14:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A193A62DDF;\n\tWed,  8 Apr 2026 11:14:17 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A12E362647\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Apr 2026 11:14:15 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-703d-e500--2a1.rev.dnainternet.fi\n\t[IPv6:2001:14ba:703d:e500::2a1])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 65B0B1180; \n\tWed,  8 Apr 2026 11:12:47 +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=\"Y9VeuuHs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1775639567;\n\tbh=Q2F64Oh3qLo5z5c/+AVm+Nm42TRzIP0kURTBC6gDzE0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Y9VeuuHs15Dn/P8WbwkiWxt/a4evcplIfNZjqLkSLXWzlehqESsTeqn93B/UYpyq0\n\tcrqlGQXg2zZpVl3QCkE4ke+HRkdn2WzZb8KZ4dOrnkDvMO5Xf01ZoNH0vSpE4H8p5o\n\toJ6AtZIf0wJdY854UNopGTHrT7WqqMALiywTiGvM=","Date":"Wed, 8 Apr 2026 12:14:14 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH] utils: checkstyle: Add license commit checker","Message-ID":"<20260408091414.GQ1268443@killaraus.ideasonboard.com>","References":"<20260407135632.1810486-1-laurent.pinchart@ideasonboard.com>\n\t<adX3nDqJtYk_-8a7@zed>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<adX3nDqJtYk_-8a7@zed>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":38576,"web_url":"https://patchwork.libcamera.org/comment/38576/","msgid":"<0c720b19-b0ec-4ed6-8703-b7ec5f520716@ideasonboard.com>","date":"2026-04-13T07:03:34","subject":"Re: [PATCH] utils: checkstyle: Add license commit checker","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2026. 04. 08. 11:14 keltezéssel, Laurent Pinchart írta:\n> On Wed, Apr 08, 2026 at 08:39:37AM +0200, Jacopo Mondi wrote:\n>> On Tue, Apr 07, 2026 at 04:56:32PM +0300, Laurent Pinchart wrote:\n>>> Add a checker, based on the reuse tool, to detect files without a valid\n>>> license. The tool is optional, the checker will be skipped when not\n>>> available.\n>>>\n>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>>> ---\n>>> I figured out that if we want this in CI, we should have it in\n>>> checkstyle too. In which case we could drop the license job from CI.\n>>\n>> I think this is a way better approach\n>>\n>>> ---\n>>>   utils/checkstyle.py | 25 +++++++++++++++++++++++++\n>>>   1 file changed, 25 insertions(+)\n>>>\n>>> diff --git a/utils/checkstyle.py b/utils/checkstyle.py\n>>> index fa1355c1738b..f1ba1ee0ed81 100755\n>>> --- a/utils/checkstyle.py\n>>> +++ b/utils/checkstyle.py\n>>> @@ -453,6 +453,31 @@ class HeaderAddChecker(CommitChecker):\n>>>           return issues\n>>>\n>>>\n>>> +class LicenseChecker(CommitChecker):\n>>> +    commit_types = (Commit, StagedChanges, Amendment)\n>>> +    dependencies = ('reuse',)\n>>\n>> Is this a build dependency ? Does it need to be ?\n> \n> I expect most people to not have reuse installed (even if it's packaged\n> by distributions), so we'll likely catch issues in CI only. I'm however\n> not too concerned, as missing license information when adding new files\n> is not a common mistake.\n> \n> We could implement file parsing in Python as well and avoid depending on\n> the reuse tool, but that's more code to maintain. I'd rather depend on\n> the reuse tool for the time being, and reconsider that later if it\n> causes issues.\n\nI think it's better to use the existing tool here.\n\n\n> \n>>> +\n>>> +    missing_license_regex = re.compile(r'^(.*): no license identifier$')\n>>> +\n>>> +    @classmethod\n>>> +    def check(cls, commit, top_level):\n>>> +        issues = []\n>>> +\n>>> +        ret = subprocess.run(['reuse', 'lint-file'] + commit.files('AR'),\n\nThis looks at added and renamed files, right? Why not the modified ones as well?\n\nReviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n\n\n>>> +                             stdout=subprocess.PIPE)\n>>> +\n>>> +        for line in ret.stdout.decode('utf-8').splitlines():\n>>> +            match = LicenseChecker.missing_license_regex.match(line)\n>>> +            if not match:\n>>> +                continue\n>>> +\n>>> +            filename = match.group(1)\n>>> +            issue = CommitIssue(f'File {filename} has no license identifier')\n>>> +            issues.append(issue)\n>>> +\n>>> +        return issues\n>>> +\n>>> +\n>>\n>> I trust your Python!\n>>\n>> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n>>\n>>>   class TitleChecker(CommitChecker):\n>>>       commit_types = (Commit,)\n>>>\n>>>\n>>> base-commit: 4b6c47bd6675c428c19ea76370f0301c24f23bf1\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 942DAC32BB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Apr 2026 07:03:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B9F4062E61;\n\tMon, 13 Apr 2026 09:03:38 +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 B673362846\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Apr 2026 09:03:37 +0200 (CEST)","from [192.168.33.49] (185.182.214.8.nat.pool.zt.hu [185.182.214.8])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D093F180F;\n\tMon, 13 Apr 2026 09:02:05 +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=\"GgDk66JA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1776063726;\n\tbh=A8Yl2VFgfDhfBgMsaSFxY8kvUTXOX0S4D2IZjnlEdII=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=GgDk66JAwo2Ffj8XT9mTryxpjz9mPoTn4XdGcJ0MH4X+z8Nsn+xvP5OhMfaE7FSEY\n\tPnB3FhatuShn1k0fkbkmZVdLQyUa4J8TY7FCTYl5L92vlz+zh85CIeY2eTsW+ZCjy4\n\tt028Ow8FhXU5AlKb+dDXBuV+BZD+Cohhtg4VdXvk=","Message-ID":"<0c720b19-b0ec-4ed6-8703-b7ec5f520716@ideasonboard.com>","Date":"Mon, 13 Apr 2026 09:03:34 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] utils: checkstyle: Add license commit checker","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","References":"<20260407135632.1810486-1-laurent.pinchart@ideasonboard.com>\n\t<adX3nDqJtYk_-8a7@zed>\n\t<20260408091414.GQ1268443@killaraus.ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260408091414.GQ1268443@killaraus.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]