Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E4CACC0015E for ; Sun, 16 Jul 2023 00:39:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 584B4863ED; Sun, 16 Jul 2023 02:38:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="gvJLoFuw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 98C5386202; Sun, 16 Jul 2023 02:37:37 +0200 (CEST) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A6AC5862C9 for ; Sun, 16 Jul 2023 02:37:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id ca18e2360f4ac-7878e573827so57756539f.1 for ; Sat, 15 Jul 2023 17:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689467851; x=1692059851; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9NsMBbgscgyXtlPYmIENcJoIPdu8YI1ZDRt60jqs/UI=; b=gvJLoFuwFtJ8WBzL0cNKPbSh9Gnc8UMsZvUL/tPHlcpKJFOd0b6TILMk1xdIEmDYGm TGsvWZNNmw2RO65XRjgT6EIUnl3E3fbxtjB6rULi+Vl7TiUApt0xOL+yKSbYyKbTtzz6 cwwbOegD0MSTzWx0I77Q0wg0AZak6ZS7ctdq4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689467851; x=1692059851; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9NsMBbgscgyXtlPYmIENcJoIPdu8YI1ZDRt60jqs/UI=; b=GA6dshhAUtKX0Kj3OjPUI/FceyMLBdDWayMrly4I+ViJzZA2J6j7V9Jegh42edhooG HEp1FSGgqPzbhl807aerUM/8aRucKXtkpErt01IU/fKg3uAjUH/1wi1BeOX7+ITDrfXr KZrIc+u40FG9kyOqnHqsOWtQtmQbmuFuZ0h1be0KXsXjYQKITd6Qd7D+1bv8+SGs1j4N PrUhB7Au3OLl8f+pZSYEmHWH9yb966xdCG5KzyJkS+iLyyTAAqI+XJw+R3EPTqW7tokO 1QHiKfotCsQHxqj448UAcBjxRgnRq/k6oANWU8xBOJYWI+hK9CgWXTRvn27/A7f5zmXh vefQ== X-Gm-Message-State: ABy/qLZ1IiaBl3WsdRRhINV6TfHK1f08aQe/wlwMh2vWQYBTVpRZgxQb 3QhlUhopg/nNnKZq0I4SDZOIjAbXaZ8HxlaT2qA= X-Google-Smtp-Source: APBJJlGEiDdH9c376imYHI4zQHTk2I/FZnIa6OacXsULCfwn85pzBinM0gXD6Cm4vE98QEvOStgUgA== X-Received: by 2002:a92:d28c:0:b0:346:420f:2bb7 with SMTP id p12-20020a92d28c000000b00346420f2bb7mr9118024ilp.16.1689467851213; Sat, 15 Jul 2023 17:37:31 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id t3-20020a05663801e300b0042b52dc77e3sm3510512jaq.158.2023.07.15.17.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 17:37:31 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v3 11/81] buildman: Warn about dangling maintainer entries Date: Sat, 15 Jul 2023 18:35:39 -0600 Message-ID: <20230716003718.231903-12-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.455.g037347b96a-goog In-Reply-To: <20230716003718.231903-1-sjg@chromium.org> References: <20230716003718.231903-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Other than the top-level MAINTAINERS file, all maintainer entries should actually reference a target. Add a warning to detect those that do not. Signed-off-by: Simon Glass --- Changes in v3: - Add new patch to warn about dangling maintainer entries tools/buildman/boards.py | 21 ++++++++++++++++----- tools/buildman/func_test.py | 9 ++++++--- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index df57f278daad..a606ce27aef7 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -345,17 +345,28 @@ class MaintainersDatabase: srcdir (str): Directory containing source code (Kconfig files) fname (str): MAINTAINERS file to be parsed """ - def add_targets(): - """Add any new targets""" + def add_targets(linenum): + """Add any new targets + + Args: + linenum (int): Current line number + """ + added = False if targets: for target in targets: self.database[target] = (status, maintainers) + added = True + if not added and (status != '-' and maintainers): + leaf = fname[len(srcdir) + 1:] + if leaf != 'MAINTAINERS': + self.warnings.append( + f'WARNING: {leaf}: missing defconfig ending at line {linenum + 1}') targets = [] maintainers = [] status = '-' with open(fname, encoding="utf-8") as inf: - for line in inf: + for linenum, line in enumerate(inf): # Check also commented maintainers if line[:3] == '#M:': line = line[1:] @@ -388,11 +399,11 @@ class MaintainersDatabase: if match and not rear: targets.append(front) elif line == '\n': - add_targets() + add_targets(linenum) targets = [] maintainers = [] status = '-' - add_targets() + add_targets(linenum) class Boards: diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 43087b4e08d2..73abe16e1ca5 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -917,7 +917,8 @@ Active aarch64 armv8 - armltd total_compute board2 params_list, warnings = self._boards.build_board_list(config_dir, src) self.assertEquals(2, len(params_list)) self.assertEquals( - ["WARNING: no status info for 'board0'", + ['WARNING: boards/board0/MAINTAINERS: missing defconfig ending at line 4', + "WARNING: no status info for 'board0'", "WARNING: no maintainers for 'board0'"], warnings) # Remove the maintainer line (M:) from a file (this should be fine) @@ -937,9 +938,11 @@ Active aarch64 armv8 - armltd total_compute board2 self.assertEquals(2, len(params_list)) self.assertFalse(warnings) - # Add another record, this should be ignored + # Add another record, this should be ignored with a warning extra = '\n\nAnother\nM: Fred\nF: configs/board9_defconfig\nS: other\n' tools.write_file(main, data + extra, binary=False) params_list, warnings = self._boards.build_board_list(config_dir, src) self.assertEquals(2, len(params_list)) - self.assertFalse(warnings) + self.assertEquals( + ['WARNING: boards/board0/MAINTAINERS: missing defconfig ending at line 16'], + warnings) -- 2.41.0.455.g037347b96a-goog