From nobody Sat Nov 15 12:42:16 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1752497776; cv=none; d=zohomail.com; s=zohoarc; b=UOA6cZfOrF3/H9sjS+8tiF7B7Yy1Vd2jzTXwwGw/nHzMFCSnJAN02P+nYcUx36foE5bLwqUav89Fkg1aCdiyIurJdoSB724BwBqGt8NpJDwkAKL/yRAQ+c9EEkSH+03OkzwZy6KsDqeI6yMKxNYkTvpELY+KxcGesus838+2fos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752497776; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8sj9iVmDpEf+chfg1RrFtaVPsqCvpCBDEdTqoin79mM=; b=ecj3M6M9eb31MjpUZB7krXkGZdXq7363Rk6WZrA7n56KydNID1LJb4IQnqRu/qqP/T7BrXbRNE2Zm6AmLCv5pqKrECfecykTwLKe3CgxLkGjGLzG4gpEDAL2dCZqgyC0jrqiBzo+lyR1eSvaJjtQTBdXcEm3MfJG3O0wKf/0pjU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1752497776528712.4567652455048; Mon, 14 Jul 2025 05:56:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ubIgK-0000rO-A5; Mon, 14 Jul 2025 08:53:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ubHtP-000772-QU for qemu-devel@nongnu.org; Mon, 14 Jul 2025 08:02:48 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ubHtL-0003rf-Hw for qemu-devel@nongnu.org; Mon, 14 Jul 2025 08:02:47 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ae0dd7ac1f5so877734966b.2 for ; Mon, 14 Jul 2025 05:02:39 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae6e829629dsm815882266b.138.2025.07.14.05.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 05:02:35 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C97CA5F89A; Mon, 14 Jul 2025 13:02:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752494558; x=1753099358; darn=nongnu.org; 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=8sj9iVmDpEf+chfg1RrFtaVPsqCvpCBDEdTqoin79mM=; b=xDp2P9MpUe6bevc0CQqbAs9mFOQFHNZxkmsiIfzN9PaWqRma7Qx0YPIR7TEqIV9VAS YrwZyM/EEfb/OxXkqRhWZ7dPkghieuBB532Q7sDBRYcJBLKuqOJrtqRoz+oQfBx71Upr v1dqACQtzsrolyHADkQOvsiOaJUJSXI5yfLr38X82/D4fnrrratU62NQAIZEIsx+7T6+ Z3tDxkvaaZAUbZjJkwptcm/z4tYR6G5PF09fXD/e6PPT9mCyT1WDjwa7BvRlYf0tgav2 7BIeHFtdWMC9ja/0Urn9AGCyxV6ABqfW07yU1KESZ0w2lW6OV2M5pGcut9WNdMU42wui 4vCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752494558; x=1753099358; 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=8sj9iVmDpEf+chfg1RrFtaVPsqCvpCBDEdTqoin79mM=; b=PaY2MNtVX7tTZGMQseCFED9HtP3mqRX9UnHYHvHiK2H2SsT89I/1Y0sXjHN7nZMTNQ +L3iUoz20+3an/XRypA6K1oLYxaJR7T3cSiMhLIBY3Z7NwyBItrsuaOJiYpSv8hCYfZQ JgUJcXH8vW+SgAZDsYkGfZJl0LTzVjHP42dQMsuz/AWohTM0tQJzqZr1r9qwDakkqd+N 0HGJtoBI3Q5AW8rGJ23nM4tAqqsmMOWpPbbal+gZngZr+3N7nM/qkBrhdRFpOvoNhfPs SOlygpkz9YoYrduetl0mLuzu4Vf2ij/WQFeguQE1Xhdt2JJnxo0iVzsHGt+lpiQQNs3x MlCA== X-Gm-Message-State: AOJu0YzNP7kKDiETFa0HLvA2z52veSZsOc0oLb81ZWkUkBmx5OCAHOs+ hp6B47CaV5isTI7SmxcbtjJZfcsg8JDPbS47o4vD+w+FfcsaHItRxdZ+fKphjFiDoi0= X-Gm-Gg: ASbGnctl7V6l3GtIpYlCbWXMFdiJdWeyWOTmt1KmuaW9TdNjQ9g5CWlyL2BxH+46l0v cxvcP5naMwj/dB+Q/INxSYDQYEXPSVkBzGMHQL7yMea6E2MFEI93DtJVvrVP4F+4ZpS9F+1KHua IcmNWk68GrfUWaehsqHRFZIHY9DUdvfPMa2Qjo9nZ7tr+vCeEYyYnr+7AOwff7cQduuAtvTrHXq zptFe4q5I1rGXvc+UwgE+4C45OVRdkLMeYtwLAnaiSr+bFqVMw5KVX2rdFcJfd+h/MG9uIWI73I Ky6NfT2n5CBjLVEDiUxELEdlVI7pWGutOAapk7dlOX4gI/uZh+wjo3HQymTjkXe/BYuFemtc1qA vAFlkNQ4LEaLU9n6GpQ7hqR0= X-Google-Smtp-Source: AGHT+IEVaGKdoJJic6qKtm9BhXBkLMSjcg4IVYuFlNOwRIJn+wLGGuc8I9PxmKQa1fJFCuwBau26WA== X-Received: by 2002:a17:907:bd94:b0:ae3:b2b7:7f2f with SMTP id a640c23a62f3a-ae6fc0f31demr1421381466b.40.1752494558362; Mon, 14 Jul 2025 05:02:38 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Manos Pitsidianakis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth Subject: [PULL 1/8] gitlab: use argparse in check-units script Date: Mon, 14 Jul 2025 13:02:27 +0100 Message-ID: <20250714120234.1524401-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250714120234.1524401-1-alex.bennee@linaro.org> References: <20250714120234.1524401-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62d.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752497778059116600 Modernise the argument parsing so we can easily add to the script. Reviewed-by: Manos Pitsidianakis Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250710104531.3099313-2-alex.bennee@linaro.org> diff --git a/.gitlab-ci.d/check-units.py b/.gitlab-ci.d/check-units.py index 268a4118d5..cdc62ae5ee 100755 --- a/.gitlab-ci.d/check-units.py +++ b/.gitlab-ci.d/check-units.py @@ -8,8 +8,10 @@ # SPDX-License-Identifier: GPL-2.0-or-later =20 from os import access, R_OK, path -from sys import argv, exit +from sys import exit import json +import argparse +from pathlib import Path from collections import Counter =20 =20 @@ -51,16 +53,17 @@ def analyse_units(build_units): =20 =20 if __name__ =3D=3D "__main__": - if len(argv) !=3D 2: - script_name =3D path.basename(argv[0]) - print(f"Usage: {script_name} ") - exit(1) + parser =3D argparse.ArgumentParser( + description=3D"analyse number of build units in compile_commands.j= son") + parser.add_argument("cc_path", type=3DPath, default=3DNone, + help=3D"Path to compile_commands.json") + + args =3D parser.parse_args() =20 - cc_path =3D argv[1] - if path.isfile(cc_path) and access(cc_path, R_OK): - units =3D extract_build_units(cc_path) + if path.isfile(args.cc_path) and access(args.cc_path, R_OK): + units =3D extract_build_units(args.cc_path) analyse_units(units) exit(0) else: - print(f"{cc_path} doesn't exist or isn't readable") + print(f"{args.cc_path} doesn't exist or isn't readable") exit(1) --=20 2.47.2