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 24AB7C001B0 for ; Wed, 19 Jul 2023 23:52:01 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C1BD2867D9; Thu, 20 Jul 2023 01:50:29 +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="B49rj6Ay"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F5F78677C; Thu, 20 Jul 2023 01:50:14 +0200 (CEST) Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (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 17CD98679B 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-io1-xd31.google.com with SMTP id ca18e2360f4ac-7866189cff1so9575639f.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=1689810606; x=1690415406; 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=gp7eInPvsav6E46W6rVKqOWAfWBM/FfnhosBmNmu6YE=; b=B49rj6Ayt4mX/1FLQT5b8/Q8o9JAALup7fM/NERSfGxQmv3rhPdR8JOMx+LTaPrHlu ZFkHG0p9yz9DTike50xH9/Q03jfiI7QQ8plwqBjGjlA5mXwploCEZZjyr5bZs1y4IjtT Q3++QuqhxdE4Nzmg/4HUp5cgT7oxvSO0uapfY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689810606; x=1690415406; 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=gp7eInPvsav6E46W6rVKqOWAfWBM/FfnhosBmNmu6YE=; b=X5eV7ROfQD1UQb95yBGjtimu0NKZUDnORI9RPBMQkqvpbu6i95zeljGoIAcRYIVztN J+OoOhAxV0tKie2QMsLHXByS4/81BqyAwE4F9fEqSDHrkiCKi74H842VkpMxs0sZZdc2 u87FoQff7AFLS2TkxEU2CSPk5rKbSwJEvm8qAQH3kiFOEjSqxXLfRFkzRGhVauAYybQi URkjetDjJjbb801rvM1xnSe3ECh2IlVhHGVTaqWWeNE6/WAM3x+cbkgHqi9YIbistT80 DYzFEGcOlON9sTyKeyjql/Gt4NFT3w9DVlvjHBC+nW3elZwT7nq/AKoM6AfZrO5CTioP mx0w== X-Gm-Message-State: ABy/qLZA4wf8VoKTpEhxKbT73m+UZZorGQooPNjqczMWkjM/+sgIUANF RnthNGdoFSk4t7kEaEu8NeXkCMCeMAGLv0Il5Ls= X-Google-Smtp-Source: APBJJlHq85ZU5xEagfCH2kMt94AAP27XjIrit2KiLfkL5Mzml9LGMql5AAP7Qn1qHa+FcSdr0OVY6w== X-Received: by 2002:a6b:4919:0:b0:786:f47b:c063 with SMTP id u25-20020a6b4919000000b00786f47bc063mr3345915iob.21.1689810606653; Wed, 19 Jul 2023 16:50:06 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jul 2023 16:50:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v4 10/83] buildman: Tidy up common code in parse_file() Date: Wed, 19 Jul 2023 17:48:18 -0600 Message-ID: <20230719234953.796101-11-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 Use a function to add to the maintainers database, to avoid duplicating the same code twice. Signed-off-by: Simon Glass --- (no changes since v3) Changes in v3: - Add new patch to tidy up common code in parse_file() tools/buildman/boards.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index 541c82ff9960..df57f278daad 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -345,6 +345,12 @@ class MaintainersDatabase: srcdir (str): Directory containing source code (Kconfig files) fname (str): MAINTAINERS file to be parsed """ + def add_targets(): + """Add any new targets""" + if targets: + for target in targets: + self.database[target] = (status, maintainers) + targets = [] maintainers = [] status = '-' @@ -382,14 +388,11 @@ class MaintainersDatabase: if match and not rear: targets.append(front) elif line == '\n': - for target in targets: - self.database[target] = (status, maintainers) + add_targets() targets = [] maintainers = [] status = '-' - if targets: - for target in targets: - self.database[target] = (status, maintainers) + add_targets() class Boards: -- 2.41.0.487.g6d72f3e995-goog