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 605CCC0015E for ; Sun, 16 Jul 2023 00:50:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AB2D486645; Sun, 16 Jul 2023 02:40:55 +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="gESuYneF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D0EE862B9; Sun, 16 Jul 2023 02:38:46 +0200 (CEST) Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) (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 BCC3086633 for ; Sun, 16 Jul 2023 02:38:19 +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-x12c.google.com with SMTP id e9e14a558f8ab-3458a08310aso16623665ab.3 for ; Sat, 15 Jul 2023 17:38:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689467898; x=1692059898; 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=b7BalONs2KaGXK1hbVfvT3fUrLiyJ/GMLSeKtRkDs9A=; b=gESuYneFsrrdZXX/VYNW2vn0zeTJSugLheu2+wcQYI9FensOIr8+YGwrRHg1j6MFkJ xNl05YpvX1aiefe3HSuzV81rd/U14IP+shd99zYPe1VZgeoNT9rbZ3mXsWPETVPiLMW4 lRry77fKpB5vvn73/w6UJ8Ibi12rQONQxGSso= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689467898; x=1692059898; 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=b7BalONs2KaGXK1hbVfvT3fUrLiyJ/GMLSeKtRkDs9A=; b=T/VhMLraaDCoh9VfksMrAoRL5KwnSHUvjog5OGDox43jCQ2cgXqpfQA8Q2SipQyh4G tnhFcDpahbJSSTBhHKwexrPGVfQKRtGNdKA0DPu3xXHwQdN/NqLj5ugqRPPYIGz8jsfL J86haskMWQ4QlhAboo7uN3six7rYk8TxS84Lr5fN3P0MIhHTUMuVTPu0yDpcRLyRieRw zFwY0C5cqg/5Tr6UemAy/6vn9+5RZBw7eOZmI7JxmVOK5QODOHkXYzbiwVxyqj7a7+hH I4XnOie7Zw4hrJPdHSg/oAF+O3flj2CpmxvAnqjuEgu6qh5tr7365npnMTGWoa94sFFo UmnA== X-Gm-Message-State: ABy/qLbEUgL3qsQZhypP+AMJfurRMlF9/Vtem9ZJpchKkC4Pz+bV9Utt tcuDnhIZCRoTXrrUQF3WNsTEdG4KrgZziYMxETo= X-Google-Smtp-Source: APBJJlEYL712xaqvTKxnLYGOU7nYTU5tuLngfW2IYmPQeL4wrG4SsAs8oqcx0iqXrwJmb3/4fJRUng== X-Received: by 2002:a92:d98c:0:b0:348:1a1c:ab6f with SMTP id r12-20020a92d98c000000b003481a1cab6fmr5502288iln.11.1689467898405; Sat, 15 Jul 2023 17:38:18 -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.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 17:38:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v3 78/81] buildman: Add a way to print the architecture for a board Date: Sat, 15 Jul 2023 18:36:46 -0600 Message-ID: <20230716003718.231903-79-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 This is useful for some tools and is easily available for buildman. Add a new --print-arch option. Signed-off-by: Simon Glass --- (no changes since v2) Changes in v2: - Add new patch to print the architecture for a board tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 24 ++++++++++++++++++++++++ tools/buildman/func_test.py | 7 +++++++ 3 files changed, 33 insertions(+) diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index e218c8ffae76..047cd1a39eab 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -122,6 +122,8 @@ def add_after_m(parser): default=False, help="Use full toolchain path in CROSS_COMPILE") parser.add_argument('-P', '--per-board-out-dir', action='store_true', default=False, help="Use an O= (output) directory per board rather than per thread") + parser.add_argument('--print-arch', action='store_true', + default=False, help="Print the architecture for a board (ARCH=)") parser.add_argument('-r', '--reproducible-builds', action='store_true', help='Set SOURCE_DATE_EPOCH=0 to suuport a reproducible build') parser.add_argument('-R', '--regen-board-list', type=str, diff --git a/tools/buildman/control.py b/tools/buildman/control.py index e6c20d6d3b6e..c96018252a57 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -140,6 +140,26 @@ def show_toolchain_prefix(brds, toolchains): tchain = tc_set.pop() print(tchain.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) +def show_arch(brds): + """Show information about a the architecture used by one or more boards + + The function checks that all boards use the same architecture, then prints + the correct value for ARCH. + + Args: + boards: Boards object containing selected boards + + Return: + None on success, string error message otherwise + """ + board_selected = brds.get_selected_dict() + arch_set = set() + for brd in board_selected.values(): + arch_set.add(brd.arch) + if len(arch_set) != 1: + sys.exit('Supplied boards must share one arch') + print(arch_set.pop()) + def get_allow_missing(opt_allow, opt_no_allow, num_selected, has_branch): """Figure out whether to allow external blobs @@ -605,6 +625,10 @@ def do_buildman(args, toolchains=None, make_func=None, brds=None, show_toolchain_prefix(brds, toolchains) return 0 + if args.print_arch: + show_arch(brds) + return 0 + series = determine_series(selected, col, git_dir, args.count, args.branch, args.work_in_output) diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 75fabab5e205..e95e9c0cb903 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -1043,3 +1043,10 @@ endif self._RunControl('--boards', 'board1,board2', '--boards', 'board4') self.assertEqual(3, self._builder.count) + + def test_print_arch(self): + """Test that we can print the board architecture""" + with test_util.capture_sys_output() as (stdout, stderr): + result = self._RunControl('--print-arch', 'board0') + self.assertEqual('arm\n', stdout.getvalue()) + self.assertEqual('', stderr.getvalue()) -- 2.41.0.455.g037347b96a-goog