From patchwork Mon Aug 5 17:48:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20805 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 706C4C323E for ; Mon, 5 Aug 2024 17:48:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5C5A96195D; Mon, 5 Aug 2024 19:48:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="SWmUI05z"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D6D76195D for ; Mon, 5 Aug 2024 19:48:30 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 98E34581 for ; Mon, 5 Aug 2024 19:47:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1722880058; bh=RNx3x1h7kZtKgwwiiiEc7RoQklSq8F9LQWDbo1/TBSk=; h=From:To:Subject:Date:From; b=SWmUI05zbGF+I1vGKZzPE9+gHsc+Za7YTaISy7T5FjmM+EN6oHmDlrx0/cOoPJQpf 413dRh2nEd8Op2BfPczK0FKowIr/yj9Mdajws+DrK7whZ34smxADkyETt/VYXuNfm6 tRDiDNx0rnkOeb46j8+77Gtyob7qfWIhCGur2fwQ= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 1/2] utils: checkstyle.py: Add author property to Commit class Date: Mon, 5 Aug 2024 20:48:06 +0300 Message-ID: <20240805174807.10125-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 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" Extend the Commit class with an author property, retrieved from the commit. It will be used to extend checkers. Signed-off-by: Laurent Pinchart Reviewed-by: Stefan Klug Reviewed-by: Kieran Bingham --- utils/checkstyle.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) base-commit: 8af95d6854889dc66746429ccf8888e3a81f6baf diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 7d480bdf4a2f..1eeb3809f7fe 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -216,7 +216,7 @@ class Commit: self._parse() def _parse_trailers(self, lines): - for index in range(1, len(lines)): + for index in range(2, len(lines)): line = lines[index] if not line: break @@ -227,12 +227,13 @@ class Commit: def _parse(self): # Get the commit title and list of files. - ret = subprocess.run(['git', 'show', '--format=%s%n%(trailers:only,unfold)', '--name-status', + ret = subprocess.run(['git', 'show', '--format=%an <%ae>%n%s%n%(trailers:only,unfold)', '--name-status', self.commit], stdout=subprocess.PIPE).stdout.decode('utf-8') lines = ret.splitlines() - self._title = lines[0] + self._author = lines[0] + self._title = lines[1] index = self._parse_trailers(lines) self._files = [CommitFile(f) for f in lines[index:] if f] @@ -240,6 +241,10 @@ class Commit: def files(self, filter='AMR'): return [f.filename for f in self._files if f.status in filter] + @property + def author(self): + return self._author + @property def title(self): return self._title @@ -282,12 +287,13 @@ class Amendment(Commit): def _parse(self): # Create a title using HEAD commit and parse the trailers. - ret = subprocess.run(['git', 'show', '--format=%H %s%n%(trailers:only,unfold)', + ret = subprocess.run(['git', 'show', '--format=%an <%ae>%n%H %s%n%(trailers:only,unfold)', '--no-patch'], stdout=subprocess.PIPE).stdout.decode('utf-8') lines = ret.splitlines() - self._title = 'Amendment of ' + lines[0].strip() + self._author = lines[0] + self._title = 'Amendment of ' + lines[1].strip() self._parse_trailers(lines) From patchwork Mon Aug 5 17:48:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20806 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 9AE3EC323E for ; Mon, 5 Aug 2024 17:48:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A581E63384; Mon, 5 Aug 2024 19:48:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="F0X1vU6N"; 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 A8EDB6195D for ; Mon, 5 Aug 2024 19:48:31 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 08D19581 for ; Mon, 5 Aug 2024 19:47:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1722880060; bh=NkWhutWDdCpRFzx15RqJNGTOtBw9RoG9PwqCrkKTHU0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=F0X1vU6N8C8yDHCrfrCbIZ+dazzws+H5Unh7LBUiSWSHqpL/AGcVaeB1Rf2NztQCK ZB1T9/ChkNJIYOWlZT/2gf/ctfBD5bsjHpXidAIOkqiUGD809ap5QoS/kTtTxqXkbf Xq8JFwtJmRTjAXSPxbRcuJLhW2w18en1bEAu/lxY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 2/2] utils: checkstyle.py: Validate SoB trailer against author Date: Mon, 5 Aug 2024 20:48:07 +0300 Message-ID: <20240805174807.10125-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240805174807.10125-1-laurent.pinchart@ideasonboard.com> References: <20240805174807.10125-1-laurent.pinchart@ideasonboard.com> 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" The TrailersChecker enforces the presence of a Signed-off-by tag in the trailer, but doesn't verify that the tag matches the commit's author. Add that verification, as required by the libcamera contribution process. Signed-off-by: Laurent Pinchart Reviewed-by: Stefan Klug Reviewed-by: Kieran Bingham --- utils/checkstyle.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 1eeb3809f7fe..722b59920062 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -524,10 +524,11 @@ class TrailersChecker(CommitChecker): continue if key == 'Signed-off-by': - sob_found = True + if value == commit.author: + sob_found = True if not sob_found: - issues.append(CommitIssue(f"No valid 'Signed-off-by' trailer found, see Documentation/contributing.rst")) + issues.append(CommitIssue(f"No 'Signed-off-by' trailer matching author '{commit.author}', see Documentation/contributing.rst")) return issues