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 5E451EB64DA for ; Thu, 22 Jun 2023 11:45:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3EA568627E; Thu, 22 Jun 2023 13:44:57 +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="KRyoKSYM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AFCEF8591B; Thu, 22 Jun 2023 13:44:54 +0200 (CEST) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 197A78627E for ; Thu, 22 Jun 2023 13:44:50 +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-wr1-x432.google.com with SMTP id ffacd0b85a97d-312824aa384so2726261f8f.1 for ; Thu, 22 Jun 2023 04:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687434289; x=1690026289; 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=JE9iUHqrbfmy79TyYdbx5aam+p7xPnvPNMyeJT72Apo=; b=KRyoKSYMGWCAnlX3VoQ13w8QF6VhyaGwjvvVa4cSRXXOYglZXejdzGKrCJvQFrYC3r mbVHshkXeRh0HAxOOS31R06cVnc023S05HSPkpVkYs4XHFWKNiWFDY5nSuJ8SEs3YcuQ tIw4zLCgOpEnuTOd7mZJ9fGPVMPFkBsiNQ/40= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687434289; x=1690026289; 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=JE9iUHqrbfmy79TyYdbx5aam+p7xPnvPNMyeJT72Apo=; b=AvhHn9So/AX9mYA/x6Yf0sZ9aDHid7Sra8mXxhL4fZEb/dyQi7tb3MuL3wx4nPtqqJ K667oLoE/64VJvvFsX9KVKrVjOv9uyOBfjAfPJ93ez3ck7oYU9q7R7hDNSKj9AX/lvNN vd/cLjGa4OGEWegP6QEkdc726div96VjAKGvHv67qhgauGjwOwOJF+mMu8uTkXLu01W/ IfWmjN7wqeyMzMKiMTUFmbduJTCtSYRIFWFdhqzvt/9jTm7DlvCsrdj0y0mcvSGcGSc/ VSZeeEqHC+/PT+KIHVUDORLTGBZGuK5kV50F62d8gXKn4Mv7x+ZjMXMKlLHkQCTf4Ytt QN2Q== X-Gm-Message-State: AC+VfDxEH+yUKJDBhny57zaPGZ7HTGpIyGtmNNAkSpgWt6rBMGbdMcIW PGT8Jlqd3FcCuhrRHPVyA62DMb41dgbVhX9/fQUbzw== X-Google-Smtp-Source: ACHHUZ7YzFH6nzkKy+zpsfv1lw2Tm502bhFsHhDCW8C53xyRKpatYnWQvr3gvq5Twq6yQQmdxp5xcg== X-Received: by 2002:adf:ec45:0:b0:30f:c9f5:7370 with SMTP id w5-20020adfec45000000b0030fc9f57370mr1550735wrn.25.1687434289092; Thu, 22 Jun 2023 04:44:49 -0700 (PDT) Received: from sjg1.corp.google.com ([2a00:79e0:d:11:3613:a1c6:41ce:326d]) by smtp.gmail.com with ESMTPSA id f14-20020adfe90e000000b003111a9a8dbfsm6858286wrm.44.2023.06.22.04.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jun 2023 04:44:48 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass , Andrew Scull , Heinrich Schuchardt , Joel Stanley , Marek Vasut , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Peter Hoyes Subject: [PATCH 2/2] buildman: Provide an argument to the -R option Date: Thu, 22 Jun 2023 12:44:24 +0100 Message-ID: <20230622114426.2114584-2-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog In-Reply-To: <20230622114426.2114584-1-sjg@chromium.org> References: <20230622114426.2114584-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 Allow writing the file to a selected location, since otherwise this is controlled by the buildman configuration, so cannot be determined by the caller. Fixes: https://source.denx.de/u-boot/u-boot/-/issues/17 Signed-off-by: Simon Glass --- .azure-pipelines.yml | 2 +- .gitlab-ci.yml | 2 +- tools/buildman/buildman.rst | 7 ++++--- tools/buildman/cmdline.py | 2 +- tools/buildman/control.py | 2 ++ tools/buildman/func_test.py | 24 ++++++++++++++++++------ 6 files changed, 27 insertions(+), 12 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 3c1846a5bc3d..4d3c588ee020 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -123,7 +123,7 @@ stages: options: $(container_option) steps: - script: | - ./tools/buildman/buildman -R + ./tools/buildman/buildman -R - - job: tools_only displayName: 'Ensure host tools build' diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e6c6ab3586e1..336db7a7448f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -184,7 +184,7 @@ sloccount: Check for configs without MAINTAINERS entry: stage: testsuites script: - - ./tools/buildman/buildman -R + - ./tools/buildman/buildman -R - # Ensure host tools build Build tools-only: diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst index c8b0db3d8b9c..b28aea477dfe 100644 --- a/tools/buildman/buildman.rst +++ b/tools/buildman/buildman.rst @@ -1307,9 +1307,10 @@ 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. with exit code -2 if there was an error in the maintainer files. +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 +with exit code 2 if there was an error in the maintainer files. To use the +default filename, use a hyphen, i.e. `-R -`. 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/cmdline.py b/tools/buildman/cmdline.py index a9cda2495727..ea43685e394d 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -104,7 +104,7 @@ def ParseArgs(): default=False, help="Use an O= (output) directory per board rather than per thread") parser.add_option('-r', '--reproducible-builds', action='store_true', help='Set SOURCE_DATE_EPOCH=0 to suuport a reproducible build') - parser.add_option('-R', '--regen-board-list', action='store_true', + parser.add_option('-R', '--regen-board-list', type='string', help='Force regeneration of the list of boards, like the old boards.cfg file') parser.add_option('-s', '--summary', action='store_true', default=False, help='Show a build summary') diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 09a11f25b3f3..b8286e185411 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -207,6 +207,8 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, if not os.path.exists(options.output_dir): os.makedirs(options.output_dir) board_file = os.path.join(options.output_dir, 'boards.cfg') + if options.regen_board_list and options.regen_board_list != '-': + board_file = options.regen_board_list brds = boards.Boards() ok = brds.ensure_board_list(board_file, diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index ebd78f225e1a..08b2714b7be2 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -225,29 +225,33 @@ class TestFunctional(unittest.TestCase): return command.run_pipe([[self._buildman_pathname] + list(args)], capture=True, capture_stderr=True) - def _RunControl(self, *args, brds=None, clean_dir=False, - test_thread_exceptions=False): + def _RunControl(self, *args, brds=False, clean_dir=False, + test_thread_exceptions=False, get_builder=True): """Run buildman Args: args: List of arguments to pass - brds: Boards object + brds: Boards object, or False to pass self._boards, or None to pass + None clean_dir: Used for tests only, indicates that the existing output_dir should be removed before starting the build test_thread_exceptions: Uses for tests only, True to make the threads raise an exception instead of reporting their result. This simulates a failure in the code somewhere + get_builder (bool): Set self._builder to the resulting builder Returns: result code from buildman """ sys.argv = [sys.argv[0]] + list(args) options, args = cmdline.ParseArgs() + if brds == False: + brds = self._boards result = control.DoBuildman(options, args, toolchains=self._toolchains, - make_func=self._HandleMake, brds=brds or self._boards, - clean_dir=clean_dir, + make_func=self._HandleMake, brds=brds, clean_dir=clean_dir, test_thread_exceptions=test_thread_exceptions) - self._builder = control.builder + if get_builder: + self._builder = control.builder return result def testFullHelp(self): @@ -779,3 +783,11 @@ Some images are invalid''' CONFIG_LOCALVERSION=y ''', cfg_data) self.assertIn('Not dropping LOCALVERSION_AUTO', stdout.getvalue()) + + def testRegenBoards(self): + """Test that we can regenerate the boards.cfg file""" + outfile = os.path.join(self._output_dir, 'test-boards.cfg') + if os.path.exists(outfile): + os.remove(outfile) + result = self._RunControl('-R', outfile, brds=None, get_builder=False) + self.assertTrue(os.path.exists(outfile)) -- 2.41.0.162.gfafddb0af9-goog