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 47B44C001DC for ; Wed, 19 Jul 2023 23:52:21 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 24BE3867D4; Thu, 20 Jul 2023 01:50:34 +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="bcqPSV41"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5A18586797; Thu, 20 Jul 2023 01:50:15 +0200 (CEST) Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (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 CEA56867AB for ; Thu, 20 Jul 2023 01:50:08 +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-il1-x12a.google.com with SMTP id e9e14a558f8ab-34896a1574dso1690285ab.0 for ; Wed, 19 Jul 2023 16:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689810607; x=1690415407; 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=RkgyDl+xW/AEhKtflAa/JnxPnO6wgw7/hRqwO+yEGgg=; b=bcqPSV41IhDofyK0DOximj6MfER7pLQH6N4AQ0KDrr6+H7S8R2eF6pRLEqN67APEU0 nceb+8jlNJkjG3qlpjfdscWrtHaA5qiMjx7HlGFvBaf53QjpHYoCGNpX3vJhK4bZXcBT sWF2hrlusnQrGy+g7cTjYZ2JhzLer18xoVoOw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689810607; x=1690415407; 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=RkgyDl+xW/AEhKtflAa/JnxPnO6wgw7/hRqwO+yEGgg=; b=I7iUSMw2ExLYPmMOrFl04HKQBb91wheA0daNgAv2yj/CKB7RVfD0Jo9cDRjpHhY7Fi L0ijBXsQ9S8kN61aCnL//S/fNsH2Vyeg34zg9tMYOcoJxc7lySze1c9xf30Ya150EQAL AUKRLogOiJzs3pFIhymvHRKdcZ9EkVc/oMTFEGcWCUfgnQ/GEan9PdSe8SYlvTbVRqwS 9MK0BVVd490jOut0HztvCTQh41bR6q2fUBR0v+6dgTck46NXEKqh03pdwaN5ogC5E7V7 N8jROM2AttKkPahG/fMMjDZ9j2Um2w9elPWTCbrv4y7UnyCjveS/z7XSwckDvdbUiaRt 9Usw== X-Gm-Message-State: ABy/qLYuC/KkkA0Zt5VlCXqRFgcbUAqon4cpkEe71fuSixExj4hkgfj2 zhmgnlaNVSccH+gUNsC/X1s8Qn9T1MHfshpKXok= X-Google-Smtp-Source: APBJJlFrVysCmbUS1RKdblMLAx2QKxgw7ZFzsnNpC7na9neLrWpo701BU38c+VcgmpZIZ2LRziTq0w== X-Received: by 2002:a05:6e02:1c2e:b0:348:7d72:86f4 with SMTP id m14-20020a056e021c2e00b003487d7286f4mr473154ilh.31.1689810607402; Wed, 19 Jul 2023 16:50:07 -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 ed16-20020a056638291000b0042bb1779c18sm1551779jab.151.2023.07.19.16.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 16:50:07 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v4 11/83] buildman: Warn about dangling maintainer entries Date: Wed, 19 Jul 2023 17:48:19 -0600 Message-ID: <20230719234953.796101-12-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230719234953.796101-1-sjg@chromium.org> References: <20230719234953.796101-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 v4: - Reword the warning message 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..122fe7090bf8 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: orphaned defconfig in {leaf} 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..eb1fa9f0b860 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: orphaned defconfig in boards/board0/MAINTAINERS 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: orphaned defconfig in boards/board0/MAINTAINERS ending at line 16'], + warnings) -- 2.41.0.487.g6d72f3e995-goog