From patchwork Tue Apr 7 13:56:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 26439 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 BD3A7BEFBE for ; Tue, 7 Apr 2026 13:56:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AA5C362D9C; Tue, 7 Apr 2026 15:56:35 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="V55x+jFY"; 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 7F1AE62846 for ; Tue, 7 Apr 2026 15:56:34 +0200 (CEST) Received: from killaraus.ideasonboard.com (2001-14ba-703d-e500--2a1.rev.dnainternet.fi [IPv6:2001:14ba:703d:e500::2a1]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id C3184596 for ; Tue, 7 Apr 2026 15:55:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1775570107; bh=XUAZTud8yfqxHD76lPROt7JTpHEsGrS1PxMxU7xVqjc=; h=From:To:Subject:Date:From; b=V55x+jFYwvK6z5x0SYmwL9ePpRmQBT7FsZnQ5wV25CtDlTa3r7iH6qIiUpSwyWQT1 r0nOf3kdI1FC7NS4GFCdHwcVVWQd1osbaQK1BV8yUXT1mLCFpCq1p1OrZjwEzZzeI1 vkhBJCcOOInhQfn9Pyvaby8wXaCJYrckkGk5d2Ns= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH] utils: checkstyle: Add license commit checker Date: Tue, 7 Apr 2026 16:56:32 +0300 Message-ID: <20260407135632.1810486-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 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" Add a checker, based on the reuse tool, to detect files without a valid license. The tool is optional, the checker will be skipped when not available. Signed-off-by: Laurent Pinchart --- I figured out that if we want this in CI, we should have it in checkstyle too. In which case we could drop the license job from CI. --- utils/checkstyle.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) base-commit: 4b6c47bd6675c428c19ea76370f0301c24f23bf1 diff --git a/utils/checkstyle.py b/utils/checkstyle.py index fa1355c1738b..f1ba1ee0ed81 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -453,6 +453,31 @@ class HeaderAddChecker(CommitChecker): return issues +class LicenseChecker(CommitChecker): + commit_types = (Commit, StagedChanges, Amendment) + dependencies = ('reuse',) + + missing_license_regex = re.compile(r'^(.*): no license identifier$') + + @classmethod + def check(cls, commit, top_level): + issues = [] + + ret = subprocess.run(['reuse', 'lint-file'] + commit.files('AR'), + stdout=subprocess.PIPE) + + for line in ret.stdout.decode('utf-8').splitlines(): + match = LicenseChecker.missing_license_regex.match(line) + if not match: + continue + + filename = match.group(1) + issue = CommitIssue(f'File {filename} has no license identifier') + issues.append(issue) + + return issues + + class TitleChecker(CommitChecker): commit_types = (Commit,)