From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BD0344557F; Fri, 6 Sep 2024 15:28:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B99C42FBD; Fri, 6 Sep 2024 15:27:16 +0200 (CEST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mails.dpdk.org (Postfix) with ESMTP id 292B642F7A for ; Fri, 6 Sep 2024 15:27:15 +0200 (CEST) Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5334a8a1b07so2315134e87.1 for ; Fri, 06 Sep 2024 06:27:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1725629234; x=1726234034; darn=dpdk.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=VJWc7isaNhaUd3HWbyzCmtx+WIy7Lk7af8ATg1/g0sc=; b=F1l0R3859/49SjQXdYF696Xb0LHYhN5IuIBgsKTzcGdeeozP240Nxyq53lwFQQzNXf 1Tz5un8VoyAwWnkG08QWpQbdptd/EkeF0Kdb/iSaH3/flyZ5tW2axI7ilSK+xiYX/fUj rlZiTSz95P1uWSCgSwSEFuxBA78SNlOq17Z4tNNnkDMnSOvTCl4jkz/CRQII0pPlt/sW DaRnEhHVuj9RDAJTFguLk/79OYcDu2Vs2c14xf1LFaUma9cdh8+zdtbCE/JNwPM8qlFt Yxv9k/is0YDMTpODCUaydRf0A+aMnZbMKB5SnXTJjmEH01+jZFRtBH0Ojk3uNMYwS7RH WiTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725629234; x=1726234034; 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=VJWc7isaNhaUd3HWbyzCmtx+WIy7Lk7af8ATg1/g0sc=; b=InbyM0lyuUsdzNOekH1zKiVTAo4RM1nb/MOSyBgyRSmR7Ri9INQEMCHOVyxCSttWNg QTn/ZSqN2Oompfvi5uC1KViMWEVE2/J+ymWzDlu2OdqVvBiW+PqdP5cGLUwwnMl8fetR w4geC+kRPbiCe8BYSjE1c3mi7h98G1q76ats13mdsI73CIdFTcKyQb5Wlk72jrsfHgi7 Q4MGn9+iKV1RUr34OH+hxWwb+cYisZNa7kBGM2kFpzXeybpZCCgvf3ZQREmSFXA7IN+Y FKVASh/+f3FUsU/KaT8F9b7OMjnkW1bRTkLFq1Xvj7eTZHUlraSpbIg+dPIFYCgd67mD NOAw== X-Gm-Message-State: AOJu0YwSHsEIHSiOnkU8mntILUZqOELy1gz6FuB0SJ+NJFbh+mQNBVVj Y6++hVlcF5E175oujB8vTALCYmG6sfgHLELA0fRF2pfkDbmoa6ji1OS97V30Udc= X-Google-Smtp-Source: AGHT+IH8AHR2xp285+W+W1bsgLmR7yYjmFCKL2JLu7hdSt+BVRF/t9XR00SMnzl/4qDYEpwx8FeYfA== X-Received: by 2002:a05:6512:3f12:b0:535:645b:fb33 with SMTP id 2adb3069b0e04-536587a7738mr1891505e87.2.1725629234440; Fri, 06 Sep 2024 06:27:14 -0700 (PDT) Received: from jlinkes-PT-Latitude-5530.. ([84.245.121.62]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a7c504701sm168943566b.25.2024.09.06.06.27.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 06:27:13 -0700 (PDT) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com, alex.chapman@arm.com, probb@iol.unh.edu, jspewock@iol.unh.edu, npratte@iol.unh.edu, dmarx@iol.unh.edu Cc: dev@dpdk.org, =?UTF-8?q?Tom=C3=A1=C5=A1=20=C4=8Eurovec?= Subject: [RFC PATCH v1 10/12] dts: remove git ref option Date: Fri, 6 Sep 2024 15:26:54 +0200 Message-ID: <20240906132656.21729-11-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240906132656.21729-1-juraj.linkes@pantheon.tech> References: <20240906132656.21729-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Tomáš Ďurovec Signed-off-by: Tomáš Ďurovec --- dts/framework/settings.py | 31 ---------- dts/framework/utils.py | 117 -------------------------------------- 2 files changed, 148 deletions(-) diff --git a/dts/framework/settings.py b/dts/framework/settings.py index 97acd62fd8..d514e887d3 100644 --- a/dts/framework/settings.py +++ b/dts/framework/settings.py @@ -49,12 +49,6 @@ Path to DPDK source code tarball to test. -.. option:: --revision, --rev, --git-ref -.. envvar:: DTS_DPDK_REVISION_ID - - Git revision ID to test. Could be commit, tag, tree ID etc. - To test local changes, first commit them, then use their commit ID. - .. option:: --remote-source .. envvar:: DTS_REMOTE_SOURCE @@ -101,8 +95,6 @@ from typing import Callable from .config import DPDKLocation, TestSuiteConfig -from .exception import ConfigurationError -from .utils import DPDKGitTarball, get_commit_id @dataclass(slots=True) @@ -249,14 +241,6 @@ def _get_help_string(self, action): return help -def _parse_revision_id(rev_id: str) -> str: - """Validate revision ID and retrieve corresponding commit ID.""" - try: - return get_commit_id(rev_id) - except ConfigurationError: - raise argparse.ArgumentTypeError("The Git revision ID supplied is invalid or ambiguous") - - def _required_with_one_of(parser: _DTSArgumentParser, action: Action, *required_dests: str) -> None: """Verify that `action` is listed together with `required_dests`. @@ -372,18 +356,6 @@ def _get_parser() -> _DTSArgumentParser: ) _add_env_var_to_action(action, "DPDK_TARBALL") - action = dpdk_source.add_argument( - "--revision", - "--rev", - "--git-ref", - type=_parse_revision_id, - help="Git revision ID to test. Could be commit, tag, tree ID etc. " - "To test local changes, first commit them, then use their commit ID.", - metavar="ID", - dest="dpdk_revision_id", - ) - _add_env_var_to_action(action) - action = parser.add_argument( "--remote-source", action="store_true", @@ -526,9 +498,6 @@ def get_settings() -> Settings: parser = _get_parser() args = parser.parse_args() - if args.dpdk_revision_id: - args.dpdk_tarball_path = Path(DPDKGitTarball(args.dpdk_revision_id, args.output_dir)) - args.dpdk_location = _process_dpdk_location( args.dpdk_tree_path, args.dpdk_tarball_path, args.remote_source, args.build_dir ) diff --git a/dts/framework/utils.py b/dts/framework/utils.py index 5757872fbd..37313c268b 100644 --- a/dts/framework/utils.py +++ b/dts/framework/utils.py @@ -14,21 +14,16 @@ REGEX_FOR_PCI_ADDRESS: The regex representing a PCI address, e.g. ``0000:00:08.0``. """ -import atexit import fnmatch import json import os -import subprocess import tarfile from enum import Enum from pathlib import Path -from subprocess import SubprocessError from typing import Any from scapy.packet import Packet # type: ignore[import-untyped] -from .exception import ConfigurationError - REGEX_FOR_PCI_ADDRESS: str = "/[0-9a-fA-F]{4}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}.[0-9]{1}/" @@ -74,31 +69,6 @@ def get_packet_summaries(packets: list[Packet]) -> str: return f"Packet contents: \n{packet_summaries}" -def get_commit_id(rev_id: str) -> str: - """Given a Git revision ID, return the corresponding commit ID. - - Args: - rev_id: The Git revision ID. - - Raises: - ConfigurationError: The ``git rev-parse`` command failed, suggesting - an invalid or ambiguous revision ID was supplied. - """ - result = subprocess.run( - ["git", "rev-parse", "--verify", rev_id], - text=True, - capture_output=True, - ) - if result.returncode != 0: - raise ConfigurationError( - f"{rev_id} is not a valid git reference.\n" - f"Command: {result.args}\n" - f"Stdout: {result.stdout}\n" - f"Stderr: {result.stderr}" - ) - return result.stdout.strip() - - class StrEnum(Enum): """Enum with members stored as strings.""" @@ -174,93 +144,6 @@ def extension(self): return f".{self.value}" if self == self.none else f".{self.none.value}.{self.value}" -class DPDKGitTarball: - """Compressed tarball of DPDK from the repository. - - The class supports the :class:`os.PathLike` protocol, - which is used to get the Path of the tarball:: - - from pathlib import Path - tarball = DPDKGitTarball("HEAD", "output") - tarball_path = Path(tarball) - """ - - _git_ref: str - _tar_compression_format: TarCompressionFormat - _tarball_dir: Path - _tarball_name: str - _tarball_path: Path | None - - def __init__( - self, - git_ref: str, - output_dir: str, - tar_compression_format: TarCompressionFormat = TarCompressionFormat.xz, - ): - """Create the tarball during initialization. - - The DPDK version is specified with `git_ref`. The tarball will be compressed with - `tar_compression_format`, which must be supported by the DTS execution environment. - The resulting tarball will be put into `output_dir`. - - Args: - git_ref: A git commit ID, tag ID or tree ID. - output_dir: The directory where to put the resulting tarball. - tar_compression_format: The compression format to use. - """ - self._git_ref = git_ref - self._tar_compression_format = tar_compression_format - - self._tarball_dir = Path(output_dir, "tarball") - - self._create_tarball_dir() - - self._tarball_name = f"dpdk-tarball-{self._git_ref}{self._tar_compression_format.extension}" - self._tarball_path = self._check_tarball_path() - if not self._tarball_path: - self._create_tarball() - - def _create_tarball_dir(self) -> None: - os.makedirs(self._tarball_dir, exist_ok=True) - - def _check_tarball_path(self) -> Path | None: - if self._tarball_name in os.listdir(self._tarball_dir): - return Path(self._tarball_dir, self._tarball_name) - return None - - def _create_tarball(self) -> None: - self._tarball_path = Path(self._tarball_dir, self._tarball_name) - - atexit.register(self._delete_tarball) - - result = subprocess.run( - 'git -C "$(git rev-parse --show-toplevel)" archive ' - f'{self._git_ref} --prefix="dpdk-tarball-{self._git_ref + os.sep}" | ' - f"{self._tar_compression_format} > {Path(self._tarball_path.absolute())}", - shell=True, - text=True, - capture_output=True, - ) - - if result.returncode != 0: - raise SubprocessError( - f"Git archive creation failed with exit code {result.returncode}.\n" - f"Command: {result.args}\n" - f"Stdout: {result.stdout}\n" - f"Stderr: {result.stderr}" - ) - - atexit.unregister(self._delete_tarball) - - def _delete_tarball(self) -> None: - if self._tarball_path and os.path.exists(self._tarball_path): - os.remove(self._tarball_path) - - def __fspath__(self) -> str: - """The os.PathLike protocol implementation.""" - return str(self._tarball_path) - - def ensure_list_of_strings(value: Any | list[Any]) -> list[str]: """Ensure the input is a list of strings. -- 2.43.0