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 587A5C43334 for ; Tue, 12 Jul 2022 01:07:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E980684114; Tue, 12 Jul 2022 03:05:52 +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="alBXHx52"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9505A840A7; Tue, 12 Jul 2022 03:05:04 +0200 (CEST) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (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 96BD5840A5 for ; Tue, 12 Jul 2022 03:04:48 +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-wm1-x32d.google.com with SMTP id l42so3818204wms.5 for ; Mon, 11 Jul 2022 18:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S9n36+qREX7j5WVqukKsmMMbgrhFL7zusr656rEuQiI=; b=alBXHx52OkQ/n7Awl+r7mZ2+5YJOQKK3MF0xl1T6TjfXabxBn3yv8JF23jiaHkN41s DfY1VAX4Xt3SKBEwFpXqmq4UZpZvx7faMbJpF2nAverqGphnVgAgWFjdob/n3w0bcDXp EMZfW/jO6AayAVSvsiH8EGG6RG6KgxK8FRd+4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S9n36+qREX7j5WVqukKsmMMbgrhFL7zusr656rEuQiI=; b=HTesYGBxxk5oNHMbKi52CwWyDqhzAsTcUo+UmpVi1U/Oom6A4YAmY07148j9vRA0Ni 8REVs8v/i02c/23myblYVfvu94HbxuhI/0x4yj3w1OfINfX9e9f+2G9Jpi8jfEUO2FwO id15ymcW3ZJMOTYaB/n7dUOWnL0kZfGMCKwHlabTxpwCrA3t8V4+sGApqB5hmMV5pj7T ojZnHR03nXA+3XX2mFO4PIyiLieErRLToSB6OfoCPa+8zbGmXi4FySmj5uIra2iBWzIY 19n6aZfxWCvnt9TAEfERRBuLY72e2ut5Q3muiHk+ZVTJwbvuYV0JMShkoIvkNO8o6sgB lDnA== X-Gm-Message-State: AJIora9fjrN+FzC/yIgRvr4xNetguR+yKY5lSdoNgePJVM5J/vFoTyIO aXm/fi0XgThtIc3jmRp08q1HBAWQTe8+QYkJ X-Google-Smtp-Source: AGRyM1s2ntAVx52D9vlzCn+GlItmGaYFrl1ogxn/mQT8lwrJbem6R10WwBcRWY2psElMkoU8TG6cJA== X-Received: by 2002:a05:600c:3d8b:b0:3a0:466c:b08d with SMTP id bi11-20020a05600c3d8b00b003a0466cb08dmr1012679wmb.125.1657587887423; Mon, 11 Jul 2022 18:04:47 -0700 (PDT) Received: from sjg1.roam.corp.google.com (host-92-0-109-232.as13285.net. [92.0.109.232]) by smtp.gmail.com with ESMTPSA id p12-20020a5d48cc000000b0021d9d13bf6csm5541152wrs.97.2022.07.11.18.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 18:04:47 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 14/19] buildman: Return an error if there are maintainer warnings Date: Mon, 11 Jul 2022 19:04:08 -0600 Message-Id: <20220712010413.331984-15-sjg@chromium.org> X-Mailer: git-send-email 2.37.0.144.g8ac04bfd2-goog In-Reply-To: <20220712010413.331984-1-sjg@chromium.org> References: <20220712010413.331984-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.6 at phobos.denx.de X-Virus-Status: Clean Detect warnings about missing maintain info and return result code 2 in that case. Signed-off-by: Simon Glass --- tools/buildman/README | 3 ++- tools/buildman/boards.py | 22 +++++++++++++++++----- tools/buildman/control.py | 10 +++++----- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/tools/buildman/README b/tools/buildman/README index 0666bc7d564..3ba08d0dace 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -1314,7 +1314,8 @@ Using boards.cfg This file is no-longer needed by buildman but it is still generated in the working directory. This helps avoid a delay on every build, since scanning all the Kconfig files takes a few seconds. Use the -R flag to force regeneration -of the file - in that case buildman exits after writing the file. +of the file - in that case buildman exits after writing the file. with exit code +2 if there was an error in the maintainer files. You should use 'buildman -nv ' instead of greoing the boards.cfg file, since it may be dropped altogether in future. diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index 8832e40cd5d..b30b344bc8e 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -276,11 +276,13 @@ class MaintainersDatabase: value: tuple: str: Board status (e.g. 'Active') str: List of maintainers, separated by : + warnings (list of str): List of warnings due to missing status, etc. """ def __init__(self): """Create an empty database.""" self.database = {} + self.warnings = [] def get_status(self, target): """Return the status of the given board. @@ -296,7 +298,7 @@ class MaintainersDatabase: str: 'Active', 'Orphan' or '-'. """ if not target in self.database: - print(f"WARNING: no status info for '{target}'", file=sys.stderr) + self.warnings.append(f"WARNING: no status info for '{target}'") return '-' tmp = self.database[target][0] @@ -306,7 +308,7 @@ class MaintainersDatabase: return 'Active' if tmp.startswith('Orphan'): return 'Orphan' - print(f"WARNING: {tmp}: unknown status for '{target}'", file=sys.stderr) + self.warnings.append(f"WARNING: {tmp}: unknown status for '{target}'") return '-' def get_maintainers(self, target): @@ -320,7 +322,7 @@ class MaintainersDatabase: maintainers, they are separated with colons. """ if not target in self.database: - print(f"WARNING: no maintainers for '{target}'", file=sys.stderr) + self.warnings.append(f"WARNING: no maintainers for '{target}'") return '' return ':'.join(self.database[target][1]) @@ -677,6 +679,9 @@ class Boards: Args: params_list (list of dict): A list of the board parameters + + Returns: + list of str: List of warnings collected due to missing status, etc. """ database = MaintainersDatabase() for (dirpath, _, filenames) in os.walk('.'): @@ -688,6 +693,7 @@ class Boards: params['status'] = database.get_status(target) params['maintainers'] = database.get_maintainers(target) params_list[i] = params + return database.warnings @classmethod def format_and_output(cls, params_list, output): @@ -731,11 +737,17 @@ class Boards: jobs (int): The number of jobs to run simultaneously force (bool): Force to generate the output even if it is new quiet (bool): True to avoid printing a message if nothing needs doing + + Returns: + bool: True if all is well, False if there were warnings """ if not force and output_is_new(output): if not quiet: print(f'{output} is up to date. Nothing to do.') - return + return True params_list = self.scan_defconfigs(jobs) - self.insert_maintainers_info(params_list) + warnings = self.insert_maintainers_info(params_list) + for warn in warnings: + print(warn, file=sys.stderr) self.format_and_output(params_list, output) + return not warnings diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 79ce2f6978a..0c75466fbd3 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -188,12 +188,12 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, board_file = os.path.join(options.output_dir, 'boards.cfg') brds = boards.Boards() - brds.ensure_board_list(board_file, - options.threads or multiprocessing.cpu_count(), - force=options.regen_board_list, - quiet=not options.verbose) + ok = brds.ensure_board_list(board_file, + options.threads or multiprocessing.cpu_count(), + force=options.regen_board_list, + quiet=not options.verbose) if options.regen_board_list: - return 0 + return 0 if ok else 2 brds.read_boards(board_file) exclude = [] -- 2.37.0.144.g8ac04bfd2-goog