From patchwork Thu Aug 27 14:29:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 96567 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54A2BC61DC4 for ; Thu, 27 Aug 2026 14:31:16 +0000 (UTC) Received: from SN4PR2101CU001.outbound.protection.outlook.com (SN4PR2101CU001.outbound.protection.outlook.com [40.93.195.5]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.37450.1787841070502422392 for ; Thu, 27 Aug 2026 07:31:10 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=Ebf84X3E; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.93.195.5, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YCiNLfMplF1kHZogOZ8ZLCEj2XJa0uxP9qFb/VgaOrcMoA11Qyup9aMFTRhCFlRmBzEOA2PENykuKiat4Okbn0elHzO04+p/rTpMi2mUOszEDQpbpCVIUmodA17IryJrgZh7EPckQBzmkK94adevzh8sICcxqyuNNwXoKgv9SJthY67p9kl34/XmerpR9efqVGXw6cNAVVgzHl0+ObwlXyiFnmF4S3WEfXIFMncy0T/TJDbDBSOMpzKSr7bhWA+OBEVTrob5ZetAdfTnVBPIX4IU9VTqSmh23SRgH3j+VeJqzyAPP4ZPJl6Gs7Fpz/QSPsHVKuuLYshJh4K3ZKxz0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f0Ea0qrmXRvhCcsfM/aZMwhxyof7zYAetbN8i+jfE1w=; b=HTGzsrOMYQHcC/npUhOkaGlTuxtwVQ6Cjwito/r/qDhuluDdoQi9eYQN7WBw0CCVqh7cgAE9S6U9mQ7isuqTjZib219xQyLxv/5upldxeu78ysLb0ha1Znu0h1v9X7Ymft04eKcTw4XYbrHc66NB7i1MwEffOpQ8St43715RxnYP/1Oq9UGGrTgokUahE1HBu8XJadK1BE5lF2K57EPEQobjoATRmSbB7mn5CuIRiMYcz/1yQdjud9K4QTC7PUkOQekHzKQTlV7rMbii+f7FIHEdp+7e4ogvNYZKZVaxy9zJxMI87eehL+mCoq3QU/6Xu3PwqbKvNJQEaCP7s0vlZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.36) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f0Ea0qrmXRvhCcsfM/aZMwhxyof7zYAetbN8i+jfE1w=; b=Ebf84X3EpHk9BTqKUPk9E6rC72e+UZmHziezP90C0SlAt+Guow2uASLN1piK10h0xYaxRh1c7z7GQ0CrJOVgihFugx24JmKLjPjCteVt44H1qETEk6UaJcId939tgJQ5X1KVVwJ5G9PxI1+H7yBEBUb9a9CzkKQPda1f75BUo6kymcUR6rG7sBRkjQGfIIHEtsqroniFrtw5l+sEU2T71fyxjFG4VBIumBhCII8pln6YW7/qTAWL8NARXMD5Gt52LCSzjBE0pifUankolgrRdW8AVQh42uo6CrvrqGv/0o8UcYokPzcYkDXVOhZdkslFoDpKE8FqCjqDSgKa1PUdAA== Received: from BLAPR03CA0158.namprd03.prod.outlook.com (2603:10b6:208:32f::24) by DM4PR12MB5914.namprd12.prod.outlook.com (2603:10b6:8:67::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.10; Thu, 27 Aug 2026 14:30:50 +0000 Received: from BN3PEPF0000B373.namprd21.prod.outlook.com (2603:10b6:208:32f:cafe::f) by BLAPR03CA0158.outlook.office365.com (2603:10b6:208:32f::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.10 via Frontend Transport; Thu, 27 Aug 2026 14:30:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.36) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.36 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.36; helo=wpcosapexchedg5.windmz.agilent.com; pr=C Received: from wpcosapexchedg5.windmz.agilent.com (192.25.218.36) by BN3PEPF0000B373.mail.protection.outlook.com (10.167.243.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.0 via Frontend Transport; Thu, 27 Aug 2026 14:30:48 +0000 Received: from laplante-B650.lfs.agilent.com (192.25.126.4) by edgeappmail.agilent.com (192.25.218.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Thu, 27 Aug 2026 08:30:13 -0600 From: To: CC: , Chris Laplante Subject: [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch Date: Thu, 27 Aug 2026 10:29:55 -0400 Message-ID: <20260827142958.547182-1-chris.laplante@agilent.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B373:EE_|DM4PR12MB5914:EE_ X-MS-Office365-Filtering-Correlation-Id: 85af5391-92bd-43dd-71e0-08df0447ca2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|23010399003|82310400026|376014|36860700016|13003099007|6133799003|10067099003|11063799006|56012099006|18002099003|3023799007; X-Microsoft-Antispam-Message-Info: bWT8J+z7iXQ910+3f+eM6EliaVL7iWjygFHBpnP/55ed+he82w4akCyD7oCeldlzL3H3UF+OlnZlk6KXnS25B0AJN+UNeycyGdmiCQ3NYdjxE19KD6itPfyhiEs9acxfTuIOlJyG4GhGl2izCDkkZO1aDCNc8UjdhwHwGsjlKHfiG3bX91Vm9qXYlbT2/5AHCkR4A30bFI8DM07j1OJYQBN9D3DcaWbTXsFAeTROUjXwtVD1bWLbzJpi4PI0idU8UnHCY/4YW5fS5yxKaC7Bv4jam8CojgHvn/cqfcILLkX/+OZOuaCv/Alsf4H7Onc6VejIY4U4W26mHyxZElPuSyz0TECwjpSDVOfWunEiyxDyf/R6f7KuzYAwrSulC3vhb0TCVgMS80jK4rymoRNz7mN8hnpx0CXfvBvJFHhujGy+6AlDZrEwE6D7lUBsfwnde3XcDYPT5ovNXXSrkJz5vd9XAdqhi6boyrn3NBJI0FWiwVpnY35cAWo03h08azoP/030lQYb1mYSWcCYGNZLtIuO2ln0Y/+zsOmLQtSIPba+P/UgfSuLMFuIwdyvNdY+WpkZkU9FrExm8cat1Vftk11Zi0JOwfRJ/V321DsCdrXRNfPMj8v2KIWD3pPH1bVi3Neec4D+CE3jByTU5oo3Cw== X-Forefront-Antispam-Report: CIP:192.25.218.36;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:wpcosapexchedg5.windmz.agilent.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(23010399003)(82310400026)(376014)(36860700016)(13003099007)(6133799003)(10067099003)(11063799006)(56012099006)(18002099003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kgNW+2DNuErC2HyTcFwCiLIMjcCsrGxp037B/0fuD3J+AkeaMztQyRHw7eEKorzVU1oE3TvvAyJRBxmld0YQKk3T6LyPljaiI4TdcMaTEQmcDYrVFrdLURC/XfiLsU3DG4VaY7fuQRkRx21MwHkodke8pFZPCTXlXbwNKTRdGdKMOPhvG0zvWw0e30V6oGqh03sojXcDeR8W9qS4Aajs+VdtDJAvB1sSFG46yAlNwZBQuRJMxVjLlR1cmwSWtVp7LyfybdB7rhZThJ1bXzPFq7rHrwWImKfPPHuIYbflxeupix39N9DBVywc9Qo9hnx95Jtl+muOHRG8SiRaCZEdtc1TgGY3BXHZN3CqmdEGhqoOkKKO6Q4lmSRaj8SF7/IzcZZp/vpsJZ8Y++bSRwiRgJ+f16TfNKJ8Y9LOdJBByJi+0sUG/CgDQD3taOgZQ7Ei X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2026 14:30:48.9813 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85af5391-92bd-43dd-71e0-08df0447ca2f X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.36];Helo=[wpcosapexchedg5.windmz.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-BN3PEPF0000B373.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5914 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 27 Aug 2026 14:31:16 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/20072 From: Chris Laplante bb.fetch2 replaced bb.fetch back in 2012, and the compatibility shim of bb.fetch = bb.fetch2 has been in place ever since. There's no longer a good reason to keep the '2' suffix, so lets drop it. We also invert the bb.fetch = bb.fetch2 compatibility shim to now make bb.fetch2 = bb.fetch. We do this by creating a new lib/bb/fetch2.py, which lets us get rid of the ugly-ish shim in lib/bb/__init__.py. Finally, we add a deprecation warning for good measure. Signed-off-by: Chris Laplante --- lib/bb/__init__.py | 3 - lib/bb/{fetch2 => fetch}/README | 0 lib/bb/{fetch2 => fetch}/__init__.py | 20 +++---- lib/bb/{fetch2 => fetch}/az.py | 8 +-- lib/bb/{fetch2 => fetch}/clearcase.py | 18 +++--- lib/bb/{fetch2 => fetch}/crate.py | 6 +- lib/bb/{fetch2 => fetch}/gcp.py | 12 ++-- lib/bb/{fetch2 => fetch}/git.py | 80 +++++++++++++-------------- lib/bb/{fetch2 => fetch}/gitannex.py | 4 +- lib/bb/{fetch2 => fetch}/gitsm.py | 10 ++-- lib/bb/{fetch2 => fetch}/gomod.py | 14 ++--- lib/bb/{fetch2 => fetch}/hg.py | 18 +++--- lib/bb/{fetch2 => fetch}/local.py | 6 +- lib/bb/{fetch2 => fetch}/npm.py | 18 +++--- lib/bb/{fetch2 => fetch}/npmsw.py | 18 +++--- lib/bb/{fetch2 => fetch}/perforce.py | 16 +++--- lib/bb/{fetch2 => fetch}/repo.py | 10 ++-- lib/bb/{fetch2 => fetch}/s3.py | 12 ++-- lib/bb/{fetch2 => fetch}/sftp.py | 12 ++-- lib/bb/{fetch2 => fetch}/ssh.py | 2 +- lib/bb/{fetch2 => fetch}/svn.py | 18 +++--- lib/bb/{fetch2 => fetch}/wget.py | 18 +++--- lib/bb/fetch2.py | 19 +++++++ 23 files changed, 179 insertions(+), 163 deletions(-) rename lib/bb/{fetch2 => fetch}/README (100%) rename lib/bb/{fetch2 => fetch}/__init__.py (99%) rename lib/bb/{fetch2 => fetch}/az.py (96%) rename lib/bb/{fetch2 => fetch}/clearcase.py (95%) rename lib/bb/{fetch2 => fetch}/crate.py (97%) rename lib/bb/{fetch2 => fetch}/gcp.py (92%) rename lib/bb/{fetch2 => fetch}/git.py (92%) rename lib/bb/{fetch2 => fetch}/gitannex.py (97%) rename lib/bb/{fetch2 => fetch}/gitsm.py (97%) rename lib/bb/{fetch2 => fetch}/gomod.py (97%) rename lib/bb/{fetch2 => fetch}/hg.py (95%) rename lib/bb/{fetch2 => fetch}/local.py (91%) rename lib/bb/{fetch2 => fetch}/npm.py (97%) rename lib/bb/{fetch2 => fetch}/npmsw.py (96%) rename lib/bb/{fetch2 => fetch}/perforce.py (96%) rename lib/bb/{fetch2 => fetch}/repo.py (89%) rename lib/bb/{fetch2 => fetch}/s3.py (93%) rename lib/bb/{fetch2 => fetch}/sftp.py (93%) rename lib/bb/{fetch2 => fetch}/ssh.py (98%) rename lib/bb/{fetch2 => fetch}/svn.py (94%) rename lib/bb/{fetch2 => fetch}/wget.py (98%) create mode 100644 lib/bb/fetch2.py diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py index a9c31815a..049c87ef0 100644 --- a/lib/bb/__init__.py +++ b/lib/bb/__init__.py @@ -153,9 +153,6 @@ class PrefixLoggerAdapter(logging.LoggerAdapter): # can result in construction of the various loggers. import bb.msg -from bb import fetch2 as fetch -sys.modules['bb.fetch'] = sys.modules['bb.fetch2'] - # Messaging convenience functions def plain(*args): """ diff --git a/lib/bb/fetch2/README b/lib/bb/fetch/README similarity index 100% rename from lib/bb/fetch2/README rename to lib/bb/fetch/README diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch/__init__.py similarity index 99% rename from lib/bb/fetch2/__init__.py rename to lib/bb/fetch/__init__.py index 9cb268be5..153700dfb 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch/__init__.py @@ -543,8 +543,8 @@ def fetcher_init(d, servercontext=True): try: # fetcher_init is called multiple times, so make sure we only save the # revs the first time it is called. - if not bb.fetch2.saved_headrevs: - bb.fetch2.saved_headrevs = _revisions_cache.get_revs() + if not bb.fetch.saved_headrevs: + bb.fetch.saved_headrevs = _revisions_cache.get_revs() except: pass @@ -578,7 +578,7 @@ def fetcher_compare_revisions(d): """ headrevs = _revisions_cache.get_revs() - return headrevs != bb.fetch2.saved_headrevs + return headrevs != bb.fetch.saved_headrevs def mirror_from_string(data): mirrors = (data or "").replace('\\n',' ').split() @@ -885,7 +885,7 @@ def get_srcrev(d, method_name='sortable_revision'): return pkgv def localpath(url, d): - fetcher = bb.fetch2.Fetch([url], d) + fetcher = bb.fetch.Fetch([url], d) return fetcher.localpath(url) # Need to export PATH as binary could be in metadata paths @@ -926,7 +926,7 @@ FETCH_EXPORT_VARS = ['HOME', 'PATH', def get_fetcher_environment(d): newenv = {} origenv = d.getVar("BB_ORIGENV") - for name in bb.fetch2.FETCH_EXPORT_VARS: + for name in bb.fetch.FETCH_EXPORT_VARS: value = d.getVar(name) if not value and origenv: value = origenv.getVar(name) @@ -1059,7 +1059,7 @@ def build_mirroruris(origud, mirrors, ld): newud.setup_localpath(ld) if hasattr(ud, 'unpack_tracer'): newud.unpack_tracer = ud.unpack_tracer - except bb.fetch2.BBFetchException as e: + except bb.fetch.BBFetchException as e: logger.debug("Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url)) logger.debug(str(e)) try: @@ -1154,10 +1154,10 @@ def try_mirror_url(fetch, origud, ud, ld, check = False): update_stamp(origud, ld) return ud.localpath - except bb.fetch2.NetworkAccess: + except bb.fetch.NetworkAccess: raise - except bb.fetch2.BBFetchException as e: + except bb.fetch.BBFetchException as e: if isinstance(e, ChecksumError): logger.warning("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (ud.url, origud.url)) logger.warning(str(e)) @@ -1814,7 +1814,7 @@ class DummyUnpackTracer(object): class Fetch(object): def __init__(self, urls, d, cache = True, localonly = False, connection_cache = None): if localonly and cache: - raise Exception("bb.fetch2.Fetch.__init__: cannot set cache and localonly at same time") + raise Exception("bb.fetch.Fetch.__init__: cannot set cache and localonly at same time") if not urls: urls = d.getVar("SRC_URI").split() @@ -1934,7 +1934,7 @@ class Fetch(object): # fetcher still have chance to fetch from mirror m.update_donestamp(ud, d) - except bb.fetch2.NetworkAccess: + except bb.fetch.NetworkAccess: raise except BBFetchException as e: diff --git a/lib/bb/fetch2/az.py b/lib/bb/fetch/az.py similarity index 96% rename from lib/bb/fetch2/az.py rename to lib/bb/fetch/az.py index 81fd14468..76c411adf 100644 --- a/lib/bb/fetch2/az.py +++ b/lib/bb/fetch/az.py @@ -5,7 +5,7 @@ BitBake 'Fetch' Azure Storage implementation # Copyright (C) 2021 Alejandro Hernandez Samaniego # -# Based on bb.fetch2.wget: +# Based on bb.fetch.wget: # Copyright (C) 2003, 2004 Chris Larson # # SPDX-License-Identifier: GPL-2.0-only @@ -15,9 +15,9 @@ BitBake 'Fetch' Azure Storage implementation import shlex import os import bb -from bb.fetch2 import FetchError -from bb.fetch2 import logger -from bb.fetch2.wget import Wget +from bb.fetch import FetchError +from bb.fetch import logger +from bb.fetch.wget import Wget class Az(Wget): diff --git a/lib/bb/fetch2/clearcase.py b/lib/bb/fetch/clearcase.py similarity index 95% rename from lib/bb/fetch2/clearcase.py rename to lib/bb/fetch/clearcase.py index cb3f8b650..54f347952 100644 --- a/lib/bb/fetch2/clearcase.py +++ b/lib/bb/fetch/clearcase.py @@ -52,12 +52,12 @@ import os import shlex import shutil import bb -from bb.fetch2 import FetchMethod -from bb.fetch2 import FetchError -from bb.fetch2 import MissingParameterError -from bb.fetch2 import ParameterError -from bb.fetch2 import runfetchcmd -from bb.fetch2 import logger +from bb.fetch import FetchMethod +from bb.fetch import FetchError +from bb.fetch import MissingParameterError +from bb.fetch import ParameterError +from bb.fetch import runfetchcmd +from bb.fetch import logger class ClearCase(FetchMethod): """Class to fetch urls via 'clearcase'""" @@ -189,7 +189,7 @@ class ClearCase(FetchMethod): if os.path.exists(ud.viewdir): cmd = self._build_ccase_command(ud, 'rmview'); logger.info("cleaning up [VOB=%s label=%s view=%s]", ud.vob, ud.label, ud.viewname) - bb.fetch2.check_network_access(d, cmd, ud.url) + bb.fetch.check_network_access(d, cmd, ud.url) output = runfetchcmd(cmd, d, workdir=ud.ccasedir) logger.info("rmview output: %s", output) @@ -215,7 +215,7 @@ class ClearCase(FetchMethod): self._write_configspec(ud, d) cmd = self._build_ccase_command(ud, 'mkview') logger.info("creating view [VOB=%s label=%s view=%s]", ud.vob, ud.label, ud.viewname) - bb.fetch2.check_network_access(d, cmd, ud.url) + bb.fetch.check_network_access(d, cmd, ud.url) try: runfetchcmd(cmd, d) except FetchError as e: @@ -227,7 +227,7 @@ class ClearCase(FetchMethod): # Set configspec: Setting the configspec effectively fetches the files as defined in the configspec cmd = self._build_ccase_command(ud, 'setcs'); logger.info("fetching data [VOB=%s label=%s view=%s]", ud.vob, ud.label, ud.viewname) - bb.fetch2.check_network_access(d, cmd, ud.url) + bb.fetch.check_network_access(d, cmd, ud.url) output = runfetchcmd(cmd, d, workdir=ud.viewdir) logger.info("%s", output) diff --git a/lib/bb/fetch2/crate.py b/lib/bb/fetch/crate.py similarity index 97% rename from lib/bb/fetch2/crate.py rename to lib/bb/fetch/crate.py index 830612c98..16ea02d8a 100644 --- a/lib/bb/fetch2/crate.py +++ b/lib/bb/fetch/crate.py @@ -26,8 +26,8 @@ import subprocess import re from functools import cmp_to_key import bb -from bb.fetch2 import logger, subprocess_setup, UnpackError, runfetchcmd -from bb.fetch2.wget import Wget +from bb.fetch import logger, subprocess_setup, UnpackError, runfetchcmd +from bb.fetch.wget import Wget class Crate(Wget): @@ -76,7 +76,7 @@ class Crate(Wget): # break the URL apart by / parts = ud.url.split('/') if len(parts) < 5: - raise bb.fetch2.ParameterError("Invalid URL: Must be crate://HOST/NAME/VERSION", ud.url) + raise bb.fetch.ParameterError("Invalid URL: Must be crate://HOST/NAME/VERSION", ud.url) # version is expected to be the last token # but ignore possible url parameters which will be used diff --git a/lib/bb/fetch2/gcp.py b/lib/bb/fetch/gcp.py similarity index 92% rename from lib/bb/fetch2/gcp.py rename to lib/bb/fetch/gcp.py index 462b8e97a..dd85b9fd2 100644 --- a/lib/bb/fetch2/gcp.py +++ b/lib/bb/fetch/gcp.py @@ -10,7 +10,7 @@ Additionally, gsutil must also be installed. # Copyright (C) 2023, Snap Inc. # -# Based in part on bb.fetch2.s3: +# Based in part on bb.fetch.s3: # Copyright (C) 2017 Andre McCurdy # # SPDX-License-Identifier: GPL-2.0-only @@ -20,9 +20,9 @@ Additionally, gsutil must also be installed. import os import bb import urllib.parse, urllib.error -from bb.fetch2 import FetchMethod -from bb.fetch2 import FetchError -from bb.fetch2 import logger +from bb.fetch import FetchMethod +from bb.fetch import FetchError +from bb.fetch import logger class GCP(FetchMethod): """ @@ -62,7 +62,7 @@ class GCP(FetchMethod): if self.gcp_client is None: self.get_gcp_client() - bb.fetch2.check_network_access(d, "blob.download_to_filename", f"gs://{ud.host}{ud.path}") + bb.fetch.check_network_access(d, "blob.download_to_filename", f"gs://{ud.host}{ud.path}") # Path sometimes has leading slash, so strip it path = ud.path.lstrip("/") @@ -101,7 +101,7 @@ class GCP(FetchMethod): if self.gcp_client is None: self.get_gcp_client() - bb.fetch2.check_network_access(d, "gcp_client.bucket(ud.host).blob(path).exists()", f"gs://{ud.host}{ud.path}") + bb.fetch.check_network_access(d, "gcp_client.bucket(ud.host).blob(path).exists()", f"gs://{ud.host}{ud.path}") # Path sometimes has leading slash, so strip it path = ud.path.lstrip("/") diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch/git.py similarity index 92% rename from lib/bb/fetch2/git.py rename to lib/bb/fetch/git.py index 0bb2ea39a..30618f073 100644 --- a/lib/bb/fetch2/git.py +++ b/lib/bb/fetch/git.py @@ -76,10 +76,10 @@ import urllib import bb import bb.progress from contextlib import contextmanager -from bb.fetch2 import FetchMethod -from bb.fetch2 import runfetchcmd -from bb.fetch2 import logger -from bb.fetch2 import trusted_network +from bb.fetch import FetchMethod +from bb.fetch import runfetchcmd +from bb.fetch import logger +from bb.fetch import trusted_network git_hash_re = re.compile(r'^[0-9a-f]{40,64}$') @@ -162,7 +162,7 @@ class Git(FetchMethod): bb.warn("URL: %s uses git protocol which is no longer supported by github. Please change to ;protocol=https in the url." % ud.url) if not ud.proto in ('git', 'file', 'ssh', 'http', 'https', 'rsync'): - raise bb.fetch2.ParameterError(f"Invalid protocol type: '{ud.proto}'", ud.url) + raise bb.fetch.ParameterError(f"Invalid protocol type: '{ud.proto}'", ud.url) ud.nocheckout = ud.parm.get("nocheckout","0") == "1" @@ -174,7 +174,7 @@ class Git(FetchMethod): ud.usehead = ud.parm.get("usehead","0") == "1" if ud.usehead: if ud.proto != "file": - raise bb.fetch2.ParameterError("The usehead option is only for use with local ('protocol=file') git repositories", ud.url) + raise bb.fetch.ParameterError("The usehead option is only for use with local ('protocol=file') git repositories", ud.url) ud.nobranch = 1 # bareclone implies nocheckout @@ -185,7 +185,7 @@ class Git(FetchMethod): ud.unresolvedrev = "" ud.branch = ud.parm.get("branch", "") if not ud.branch and not ud.nobranch: - raise bb.fetch2.ParameterError("The url does not set any branch parameter or set nobranch=1.", ud.url) + raise bb.fetch.ParameterError("The url does not set any branch parameter or set nobranch=1.", ud.url) ud.noshared = d.getVar("BB_GIT_NOSHARED") == "1" @@ -206,10 +206,10 @@ class Git(FetchMethod): try: depth_default = int(depth_default or 0) except ValueError: - raise bb.fetch2.FetchError("Invalid depth for BB_GIT_SHALLOW_DEPTH: %s" % depth_default) + raise bb.fetch.FetchError("Invalid depth for BB_GIT_SHALLOW_DEPTH: %s" % depth_default) else: if depth_default < 0: - raise bb.fetch2.FetchError("Invalid depth for BB_GIT_SHALLOW_DEPTH: %s" % depth_default) + raise bb.fetch.FetchError("Invalid depth for BB_GIT_SHALLOW_DEPTH: %s" % depth_default) else: depth_default = 1 ud.shallow_depths = collections.defaultdict(lambda: depth_default) @@ -224,10 +224,10 @@ class Git(FetchMethod): try: shallow_depth = int(shallow_depth or 0) except ValueError: - raise bb.fetch2.FetchError("Invalid depth for BB_GIT_SHALLOW_DEPTH_%s: %s" % (ud.name, shallow_depth)) + raise bb.fetch.FetchError("Invalid depth for BB_GIT_SHALLOW_DEPTH_%s: %s" % (ud.name, shallow_depth)) else: if shallow_depth < 0: - raise bb.fetch2.FetchError("Invalid depth for BB_GIT_SHALLOW_DEPTH_%s: %s" % (ud.name, shallow_depth)) + raise bb.fetch.FetchError("Invalid depth for BB_GIT_SHALLOW_DEPTH_%s: %s" % (ud.name, shallow_depth)) ud.shallow_depths[ud.name] = shallow_depth revs = d.getVar("BB_GIT_SHALLOW_REVS_%s" % ud.name) @@ -343,7 +343,7 @@ class Git(FetchMethod): for rev in ud.shallow_revs: try: runfetchcmd(ud.basecmd + ['rev-parse', '-q', '--verify', rev], d, quiet=True, workdir=ud.clonedir) - except bb.fetch2.FetchError: + except bb.fetch.FetchError: return rev return None @@ -415,7 +415,7 @@ class Git(FetchMethod): if not bb.utils.path_is_descendant(toplevel, ud.clonedir): logger.warning("Top level directory '%s' is not a descendant of '%s'. Re-cloning", toplevel, ud.clonedir) needs_clone = True - except bb.fetch2.FetchError as e: + except bb.fetch.FetchError as e: logger.warning("Unable to get top level for %s (not a git directory?): %s", ud.clonedir, e) needs_clone = True except FileNotFoundError as e: @@ -438,7 +438,7 @@ class Git(FetchMethod): repourl = repourl_path clone_cmd = ud.basecmd + ['clone', '--bare', '--mirror', repourl, ud.clonedir, '--progress'] if ud.proto.lower() != 'file': - bb.fetch2.check_network_access(d, clone_cmd, ud.url) + bb.fetch.check_network_access(d, clone_cmd, ud.url) progresshandler = GitProgressHandler(d) # Try creating a fast initial shallow clone @@ -473,7 +473,7 @@ class Git(FetchMethod): else: fetch_cmd = ud.basecmd + ['fetch', '-f', '--progress', repourl, 'refs/heads/*:refs/heads/*', 'refs/tags/*:refs/tags/*'] if ud.proto.lower() != 'file': - bb.fetch2.check_network_access(d, fetch_cmd, ud.url) + bb.fetch.check_network_access(d, fetch_cmd, ud.url) progresshandler = GitProgressHandler(d) runfetchcmd(fetch_cmd, d, log=progresshandler, workdir=ud.clonedir, extraenv={'LANG':'C'}) runfetchcmd(ud.basecmd + ['repack','-adk'], d, workdir=ud.clonedir) @@ -486,12 +486,12 @@ class Git(FetchMethod): raise if not self._contains_ref(ud, d, ud.name, ud.clonedir): - raise bb.fetch2.FetchError("Unable to find revision %s in branch %s even from upstream" % (ud.revision, ud.branch)) + raise bb.fetch.FetchError("Unable to find revision %s in branch %s even from upstream" % (ud.revision, ud.branch)) if ud.shallow and ud.write_shallow_tarballs: missing_rev = self.clonedir_need_shallow_revs(ud, d) if missing_rev: - raise bb.fetch2.FetchError("Unable to find revision %s even from upstream" % missing_rev) + raise bb.fetch.FetchError("Unable to find revision %s even from upstream" % missing_rev) if self.lfs_need_update(ud, d): self.lfs_fetch(ud, d, ud.clonedir, ud.revision) @@ -595,7 +595,7 @@ class Git(FetchMethod): # The --depth and --shallow-exclude can't be used together if depth and shallow_exclude: - raise bb.fetch2.FetchError("BB_GIT_SHALLOW_REVS is set, but BB_GIT_SHALLOW_DEPTH is not 0.") + raise bb.fetch.FetchError("BB_GIT_SHALLOW_REVS is set, but BB_GIT_SHALLOW_DEPTH is not 0.") # For nobranch, we need a ref, otherwise the commits will be # removed, and for non-nobranch, we truncate the branch to our @@ -673,7 +673,7 @@ class Git(FetchMethod): # If 'subdir' param exists, create a dir and use it as destination for unpack cmd if os.path.isabs(subdir): if not os.path.realpath(subdir).startswith(os.path.realpath(destdir)): - raise bb.fetch2.UnpackError("subdir argument isn't a subdirectory of unpack root %s" % destdir, ud.url) + raise bb.fetch.UnpackError("subdir argument isn't a subdirectory of unpack root %s" % destdir, ud.url) destdir = subdir else: destdir = os.path.join(destdir, subdir) @@ -721,35 +721,35 @@ class Git(FetchMethod): source_error.append("shallow clone not enabled") if not source_found: - raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url) + raise bb.fetch.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url) if update_mode: if ud.shallow: - raise bb.fetch2.UnpackError("Can't update shallow clones checkouts without network access, not supported.", ud.url) + raise bb.fetch.UnpackError("Can't update shallow clones checkouts without network access, not supported.", ud.url) output = runfetchcmd(ud.basecmd + ['status', '--untracked-files=no', '--porcelain'], d, workdir=destdir, extraenv=extraenv) if output: - raise bb.fetch2.LocalModificationsError(destdir, ud.url, output) + raise bb.fetch.LocalModificationsError(destdir, ud.url, output) # Set up remote for the download location if it doesn't exist try: runfetchcmd(ud.basecmd + ['remote', 'get-url', 'dldir'], d, workdir=destdir) - except bb.fetch2.FetchError: + except bb.fetch.FetchError: if ud.clonedir: runfetchcmd(ud.basecmd + ['remote', 'add', 'dldir', 'file://' + ud.clonedir], d, workdir=destdir) try: runfetchcmd(ud.basecmd + ['fetch', 'dldir'], d, workdir=destdir, extraenv=extraenv) - except bb.fetch2.FetchError as e: - raise bb.fetch2.UnpackError("Failed to fetch from dldir remote: %s" % str(e), ud.url) + except bb.fetch.FetchError as e: + raise bb.fetch.UnpackError("Failed to fetch from dldir remote: %s" % str(e), ud.url) try: runfetchcmd(ud.basecmd + ['rebase', '--no-autosquash', '--no-autostash', ud.revision], d, workdir=destdir, extraenv=extraenv) - except bb.fetch2.FetchError as e: + except bb.fetch.FetchError as e: # If rebase failed, abort it try: runfetchcmd(ud.basecmd + ['rebase', '--abort'], d, workdir=destdir) except Exception: pass - raise bb.fetch2.RebaseError(destdir, ud.url, str(e)) + raise bb.fetch.RebaseError(destdir, ud.url, str(e)) return True # If there is a tag parameter in the url and we also have a fixed srcrev, check the tag @@ -763,14 +763,14 @@ class Git(FetchMethod): output2 = runfetchcmd(ud.basecmd + ['rev-list', '-n', '1', ud.revision], d, workdir=destdir) output2 = output2.strip() if output != output2: - raise bb.fetch2.FetchError("The revision the git tag '%s' resolved to didn't match the SRCREV in use (%s vs %s)" % (ud.parm['tag'], output, ud.revision), ud.url) + raise bb.fetch.FetchError("The revision the git tag '%s' resolved to didn't match the SRCREV in use (%s vs %s)" % (ud.parm['tag'], output, ud.revision), ud.url) repourl = self._get_repo_url(ud) runfetchcmd(ud.basecmd + ['remote', 'set-url', 'origin', repourl], d, workdir=destdir) if ud.clonedir: try: runfetchcmd(ud.basecmd + ['remote', 'get-url', 'dldir'], d, workdir=destdir) - except bb.fetch2.FetchError: + except bb.fetch.FetchError: runfetchcmd(ud.basecmd + ['remote', 'add', 'dldir', "file://" + ud.clonedir], d, workdir=destdir) if self._contains_lfs(ud, d, destdir): @@ -830,7 +830,7 @@ class Git(FetchMethod): cmd = ud.basecmd + ['branch', '--contains', git_ref_name, '--list', ud.branch] try: output = runfetchcmd(cmd, d, workdir=wd) - except (bb.fetch2.FetchError): + except (bb.fetch.FetchError): return False return len(output.splitlines()) > 0 @@ -876,7 +876,7 @@ class Git(FetchMethod): output = runfetchcmd(cmd, d, quiet=True, workdir=wd) if len(output.splitlines()) > 0: return True - except (bb.fetch2.FetchError,ValueError): + except (bb.fetch.FetchError,ValueError): pass return False @@ -885,7 +885,7 @@ class Git(FetchMethod): Ensures that git-lfs is available, raising a FetchError if it isn't. """ if shutil.which("git-lfs", path=d.getVar('PATH')) is None: - raise bb.fetch2.FetchError( + raise bb.fetch.FetchError( "Repository %s has LFS content, install git-lfs on host to download (or set lfs=0 " "to ignore it)" % self._get_repo_url(ud)) @@ -930,10 +930,10 @@ class Git(FetchMethod): if search: cmd.append(search) if ud.proto.lower() != 'file': - bb.fetch2.check_network_access(d, cmd, repourl) + bb.fetch.check_network_access(d, cmd, repourl) output = runfetchcmd(cmd, d, True) if not output: - raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url) + raise bb.fetch.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url) finally: d.delVar('_BB_GIT_IN_LSREMOTE') return output @@ -943,10 +943,10 @@ class Git(FetchMethod): Compute the HEAD revision for the url """ if not d.getVar("__BBSRCREV_SEEN"): - raise bb.fetch2.FetchError("Recipe uses a floating tag/branch '%s' for repo '%s' without a fixed SRCREV yet doesn't call bb.fetch2.get_srcrev() (use SRCPV in PV for OE)." % (ud.unresolvedrev, ud.host+ud.path)) + raise bb.fetch.FetchError("Recipe uses a floating tag/branch '%s' for repo '%s' without a fixed SRCREV yet doesn't call bb.fetch.get_srcrev() (use SRCPV in PV for OE)." % (ud.unresolvedrev, ud.host+ud.path)) # Ensure we mark as not cached - bb.fetch2.mark_recipe_nocache(d) + bb.fetch.mark_recipe_nocache(d) output = self._lsremote(ud, d, "") # Tags of the form ^{} may not work, need to fallback to other form @@ -961,7 +961,7 @@ class Git(FetchMethod): sha1, ref = l.split() if s == ref: return sha1 - raise bb.fetch2.FetchError("Unable to resolve '%s' in upstream git repository in git ls-remote output for %s" % \ + raise bb.fetch.FetchError("Unable to resolve '%s' in upstream git repository in git ls-remote output for %s" % \ (ud.unresolvedrev, ud.host+ud.path)) def latest_versionstring(self, ud, d, filter_regex=None): @@ -974,7 +974,7 @@ class Git(FetchMethod): try: output = self._lsremote(ud, d, "refs/tags/*") - except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess) as e: + except (bb.fetch.FetchError, bb.fetch.NetworkAccess) as e: bb.note("Could not list remote: %s" % str(e)) return pupver @@ -1031,7 +1031,7 @@ class Git(FetchMethod): commits = None else: if not os.path.exists(rev_file) or not os.path.getsize(rev_file): - commits = len(bb.fetch2.runfetchcmd(['git', 'rev-list', rev, '--'], d).splitlines()) + commits = len(bb.fetch.runfetchcmd(['git', 'rev-list', rev, '--'], d).splitlines()) if commits: open(rev_file, "w").write("%d\n" % commits) else: @@ -1045,5 +1045,5 @@ class Git(FetchMethod): try: self._lsremote(ud, d, "") return True - except bb.fetch2.FetchError: + except bb.fetch.FetchError: return False diff --git a/lib/bb/fetch2/gitannex.py b/lib/bb/fetch/gitannex.py similarity index 97% rename from lib/bb/fetch2/gitannex.py rename to lib/bb/fetch/gitannex.py index c378cc36d..d5917e54f 100644 --- a/lib/bb/fetch2/gitannex.py +++ b/lib/bb/fetch/gitannex.py @@ -9,8 +9,8 @@ BitBake 'Fetch' git annex implementation # import bb -from bb.fetch2.git import Git -from bb.fetch2 import runfetchcmd +from bb.fetch.git import Git +from bb.fetch import runfetchcmd class GitANNEX(Git): def supports(self, ud, d): diff --git a/lib/bb/fetch2/gitsm.py b/lib/bb/fetch/gitsm.py similarity index 97% rename from lib/bb/fetch2/gitsm.py rename to lib/bb/fetch/gitsm.py index d4340e116..734b35364 100644 --- a/lib/bb/fetch2/gitsm.py +++ b/lib/bb/fetch/gitsm.py @@ -22,10 +22,10 @@ import bb import copy import shutil import tempfile -from bb.fetch2.git import Git -from bb.fetch2 import runfetchcmd -from bb.fetch2 import logger -from bb.fetch2 import Fetch +from bb.fetch.git import Git +from bb.fetch import runfetchcmd +from bb.fetch import logger +from bb.fetch import Fetch class GitSM(Git): def supports(self, ud, d): @@ -115,7 +115,7 @@ class GitSM(Git): proto = "file" url = "gitsm://" + uris[module] if url.endswith("{}{}".format(ud.host, ud.path)): - raise bb.fetch2.FetchError("Submodule refers to the parent repository. This will cause deadlock situation in current version of Bitbake." \ + raise bb.fetch.FetchError("Submodule refers to the parent repository. This will cause deadlock situation in current version of Bitbake." \ "Consider using git fetcher instead.") url += ';protocol=%s' % proto diff --git a/lib/bb/fetch2/gomod.py b/lib/bb/fetch/gomod.py similarity index 97% rename from lib/bb/fetch2/gomod.py rename to lib/bb/fetch/gomod.py index 5cdf8f998..a62d643fb 100644 --- a/lib/bb/fetch2/gomod.py +++ b/lib/bb/fetch/gomod.py @@ -67,12 +67,12 @@ import subprocess import zipfile import bb -from bb.fetch2 import FetchError -from bb.fetch2 import MissingParameterError -from bb.fetch2 import runfetchcmd -from bb.fetch2 import subprocess_setup -from bb.fetch2.git import Git -from bb.fetch2.wget import Wget +from bb.fetch import FetchError +from bb.fetch import MissingParameterError +from bb.fetch import runfetchcmd +from bb.fetch import subprocess_setup +from bb.fetch.git import Git +from bb.fetch.wget import Wget def escape(path): @@ -115,7 +115,7 @@ class GoMod(Wget): else: ext = '.zip' path = escape(f"{module}/@v/{version}{ext}") - ud.url = bb.fetch2.encodeurl( + ud.url = bb.fetch.encodeurl( ('https', proxy, '/' + path, None, None, None)) ud.parm['downloadfilename'] = f"{module.replace('/', '.')}@{version}{ext}" diff --git a/lib/bb/fetch2/hg.py b/lib/bb/fetch/hg.py similarity index 95% rename from lib/bb/fetch2/hg.py rename to lib/bb/fetch/hg.py index 5c65a1985..9813b0edd 100644 --- a/lib/bb/fetch2/hg.py +++ b/lib/bb/fetch/hg.py @@ -16,11 +16,11 @@ import os import bb import errno import shlex -from bb.fetch2 import FetchMethod -from bb.fetch2 import FetchError -from bb.fetch2 import MissingParameterError -from bb.fetch2 import runfetchcmd -from bb.fetch2 import logger +from bb.fetch import FetchMethod +from bb.fetch import FetchError +from bb.fetch import MissingParameterError +from bb.fetch import runfetchcmd +from bb.fetch import logger class Hg(FetchMethod): """Class to fetch from mercurial repositories""" @@ -159,13 +159,13 @@ class Hg(FetchMethod): logger.debug("Running %s", updatecmd) try: runfetchcmd(updatecmd, d, workdir=ud.moddir) - except bb.fetch2.FetchError: + except bb.fetch.FetchError: # Runnning pull in the repo pullcmd = self._buildhgcommand(ud, d, "pull") logger.info("Pulling " + ud.url) # update sources there logger.debug("Running %s", pullcmd) - bb.fetch2.check_network_access(d, pullcmd, ud.url) + bb.fetch.check_network_access(d, pullcmd, ud.url) runfetchcmd(pullcmd, d, workdir=ud.moddir) try: os.unlink(ud.fullmirror) @@ -180,7 +180,7 @@ class Hg(FetchMethod): # check out sources there bb.utils.mkdirhier(ud.pkgdir) logger.debug("Running %s", fetchcmd) - bb.fetch2.check_network_access(d, fetchcmd, ud.url) + bb.fetch.check_network_access(d, fetchcmd, ud.url) runfetchcmd(fetchcmd, d, workdir=ud.pkgdir) # Even when we clone (fetch), we still need to update as hg's clone @@ -203,7 +203,7 @@ class Hg(FetchMethod): """ Compute tip revision for the url """ - bb.fetch2.check_network_access(d, self._buildhgcommand(ud, d, "info"), ud.url) + bb.fetch.check_network_access(d, self._buildhgcommand(ud, d, "info"), ud.url) output = runfetchcmd(self._buildhgcommand(ud, d, "info"), d) return output.strip() diff --git a/lib/bb/fetch2/local.py b/lib/bb/fetch/local.py similarity index 91% rename from lib/bb/fetch2/local.py rename to lib/bb/fetch/local.py index fda56a564..dfc5b564c 100644 --- a/lib/bb/fetch2/local.py +++ b/lib/bb/fetch/local.py @@ -17,8 +17,8 @@ import os import urllib.request, urllib.parse, urllib.error import bb import bb.utils -from bb.fetch2 import FetchMethod, FetchError, ParameterError -from bb.fetch2 import logger +from bb.fetch import FetchMethod, FetchError, ParameterError +from bb.fetch import logger class Local(FetchMethod): def supports(self, urldata, d): @@ -33,7 +33,7 @@ class Local(FetchMethod): ud.basepath = ud.path ud.needdonestamp = False if "*" in ud.path: - raise bb.fetch2.ParameterError("file:// urls using globbing are no longer supported. Please place the files in a directory and reference that instead.", ud.url) + raise bb.fetch.ParameterError("file:// urls using globbing are no longer supported. Please place the files in a directory and reference that instead.", ud.url) return def localpath(self, urldata, d): diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch/npm.py similarity index 97% rename from lib/bb/fetch2/npm.py rename to lib/bb/fetch/npm.py index a429a8292..c8995ba6b 100644 --- a/lib/bb/fetch2/npm.py +++ b/lib/bb/fetch/npm.py @@ -35,15 +35,15 @@ import re import shlex import tempfile import bb -from bb.fetch2 import Fetch -from bb.fetch2 import FetchError -from bb.fetch2 import FetchMethod -from bb.fetch2 import MalformedUrl -from bb.fetch2 import MissingParameterError -from bb.fetch2 import ParameterError -from bb.fetch2 import URI -from bb.fetch2 import check_network_access -from bb.fetch2 import runfetchcmd +from bb.fetch import Fetch +from bb.fetch import FetchError +from bb.fetch import FetchMethod +from bb.fetch import MalformedUrl +from bb.fetch import MissingParameterError +from bb.fetch import ParameterError +from bb.fetch import URI +from bb.fetch import check_network_access +from bb.fetch import runfetchcmd from bb.utils import is_semver # Preference order matches strength; the first one present in SRC_URI wins. diff --git a/lib/bb/fetch2/npmsw.py b/lib/bb/fetch/npmsw.py similarity index 96% rename from lib/bb/fetch2/npmsw.py rename to lib/bb/fetch/npmsw.py index f09ea5794..fde4fe65b 100644 --- a/lib/bb/fetch2/npmsw.py +++ b/lib/bb/fetch/npmsw.py @@ -21,15 +21,15 @@ import json import os import re import bb -from bb.fetch2 import FetchError -from bb.fetch2 import Fetch -from bb.fetch2 import FetchMethod -from bb.fetch2 import ParameterError -from bb.fetch2 import runfetchcmd -from bb.fetch2 import URI -from bb.fetch2.npm import npm_integrity -from bb.fetch2.npm import npm_localfile -from bb.fetch2.npm import npm_unpack +from bb.fetch import FetchError +from bb.fetch import Fetch +from bb.fetch import FetchMethod +from bb.fetch import ParameterError +from bb.fetch import runfetchcmd +from bb.fetch import URI +from bb.fetch.npm import npm_integrity +from bb.fetch.npm import npm_localfile +from bb.fetch.npm import npm_unpack from bb.utils import is_semver from bb.utils import lockfile from bb.utils import unlockfile diff --git a/lib/bb/fetch2/perforce.py b/lib/bb/fetch/perforce.py similarity index 96% rename from lib/bb/fetch2/perforce.py rename to lib/bb/fetch/perforce.py index 52ea061c0..aa46e0ebc 100644 --- a/lib/bb/fetch2/perforce.py +++ b/lib/bb/fetch/perforce.py @@ -27,10 +27,10 @@ Supported SRC_URI options are: import os import bb import shlex -from bb.fetch2 import FetchMethod -from bb.fetch2 import FetchError -from bb.fetch2 import logger -from bb.fetch2 import runfetchcmd +from bb.fetch import FetchMethod +from bb.fetch import FetchError +from bb.fetch import logger +from bb.fetch import runfetchcmd class PerforceProgressHandler (bb.progress.BasicProgressHandler): """ @@ -97,7 +97,7 @@ class Perforce(FetchMethod): logger.debug('Trying to use P4CONFIG to automatically set P4PORT...') ud.usingp4config = True p4cmd = ud.basecmd + ['info'] - bb.fetch2.check_network_access(d, p4cmd, ud.url) + bb.fetch.check_network_access(d, p4cmd, ud.url) output = runfetchcmd(p4cmd, d, True) ud.host = None for line in output.splitlines(): @@ -201,7 +201,7 @@ class Perforce(FetchMethod): 'p4 files' command, including trailing '#rev' file revision indicator """ p4cmd = self._buildp4command(ud, d, 'files') - bb.fetch2.check_network_access(d, p4cmd, ud.url) + bb.fetch.check_network_access(d, p4cmd, ud.url) p4fileslist = runfetchcmd(p4cmd, d, True) p4fileslist = [f.rstrip() for f in p4fileslist.splitlines()] @@ -234,7 +234,7 @@ class Perforce(FetchMethod): for afile in filelist: p4fetchcmd = self._buildp4command(ud, d, 'print', afile) - bb.fetch2.check_network_access(d, p4fetchcmd, ud.url) + bb.fetch.check_network_access(d, p4fetchcmd, ud.url) runfetchcmd(p4fetchcmd, d, workdir=ud.pkgdir, log=progresshandler) runfetchcmd(['tar', '-czf', ud.localpath, 'p4'], d, cleanup=[ud.localpath], workdir=ud.pkgdir) @@ -254,7 +254,7 @@ class Perforce(FetchMethod): def _latest_revision(self, ud, d, name): """ Return the latest upstream scm revision number """ p4cmd = self._buildp4command(ud, d, "changes") - bb.fetch2.check_network_access(d, p4cmd, ud.url) + bb.fetch.check_network_access(d, p4cmd, ud.url) tip = runfetchcmd(p4cmd, d, True) if not tip: diff --git a/lib/bb/fetch2/repo.py b/lib/bb/fetch/repo.py similarity index 89% rename from lib/bb/fetch2/repo.py rename to lib/bb/fetch/repo.py index 9b96cd824..c7eaf8b3c 100644 --- a/lib/bb/fetch2/repo.py +++ b/lib/bb/fetch/repo.py @@ -14,9 +14,9 @@ BitBake "Fetch" repo (git) implementation import os import bb import shlex -from bb.fetch2 import FetchMethod -from bb.fetch2 import runfetchcmd -from bb.fetch2 import logger +from bb.fetch import FetchMethod +from bb.fetch import runfetchcmd +from bb.fetch import logger class Repo(FetchMethod): """Class to fetch a module or modules from repo (git) repositories""" @@ -63,10 +63,10 @@ class Repo(FetchMethod): repodir = os.path.join(codir, "repo") bb.utils.mkdirhier(repodir) if not os.path.exists(os.path.join(repodir, ".repo")): - bb.fetch2.check_network_access(d, "%s init -m %s -b %s -u %s://%s%s%s" % (ud.basecmd, ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), ud.url) + bb.fetch.check_network_access(d, "%s init -m %s -b %s -u %s://%s%s%s" % (ud.basecmd, ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), ud.url) runfetchcmd(ud.basecmd + ['init', '-m', ud.manifest, '-b', ud.branch, '-u', '%s://%s%s%s' % (ud.proto, username, ud.host, ud.path)], d, workdir=repodir) - bb.fetch2.check_network_access(d, ud.basecmd + ['sync'], ud.url) + bb.fetch.check_network_access(d, ud.basecmd + ['sync'], ud.url) runfetchcmd(ud.basecmd + ['sync'], d, workdir=repodir) scmdata = ud.parm.get("scmdata", "") diff --git a/lib/bb/fetch2/s3.py b/lib/bb/fetch/s3.py similarity index 93% rename from lib/bb/fetch2/s3.py rename to lib/bb/fetch/s3.py index fdd450429..ea3dc28fc 100644 --- a/lib/bb/fetch2/s3.py +++ b/lib/bb/fetch/s3.py @@ -8,7 +8,7 @@ The aws tool must be correctly installed and configured prior to use. # Copyright (C) 2017, Andre McCurdy # -# Based in part on bb.fetch2.wget: +# Based in part on bb.fetch.wget: # Copyright (C) 2003, 2004 Chris Larson # # SPDX-License-Identifier: GPL-2.0-only @@ -20,9 +20,9 @@ import bb import urllib.request, urllib.parse, urllib.error import re import shlex -from bb.fetch2 import FetchMethod -from bb.fetch2 import FetchError -from bb.fetch2 import runfetchcmd +from bb.fetch import FetchMethod +from bb.fetch import FetchError +from bb.fetch import runfetchcmd def convertToBytes(value, unit): value = float(value) @@ -89,7 +89,7 @@ class S3(FetchMethod): """ cmd = ud.basecmd + ['cp', 's3://%s%s' % (ud.host, ud.path), ud.localpath] - bb.fetch2.check_network_access(d, cmd, ud.url) + bb.fetch.check_network_access(d, cmd, ud.url) progresshandler = S3ProgressHandler(d) runfetchcmd(cmd, d, False, log=progresshandler) @@ -113,7 +113,7 @@ class S3(FetchMethod): """ cmd = ud.basecmd + ['ls', 's3://%s%s' % (ud.host, ud.path)] - bb.fetch2.check_network_access(d, cmd, ud.url) + bb.fetch.check_network_access(d, cmd, ud.url) output = runfetchcmd(cmd, d) # "aws s3 ls s3://mybucket/foo" will exit with success even if the file diff --git a/lib/bb/fetch2/sftp.py b/lib/bb/fetch/sftp.py similarity index 93% rename from lib/bb/fetch2/sftp.py rename to lib/bb/fetch/sftp.py index 82c76bb66..4054382d7 100644 --- a/lib/bb/fetch2/sftp.py +++ b/lib/bb/fetch/sftp.py @@ -39,7 +39,7 @@ SRC_URI = "sftp://user@host.example.com/dir/path.file.txt" # Copyright (C) 2013, Olof Johansson # -# Based in part on bb.fetch2.wget: +# Based in part on bb.fetch.wget: # Copyright (C) 2003, 2004 Chris Larson # # SPDX-License-Identifier: GPL-2.0-only @@ -49,9 +49,9 @@ SRC_URI = "sftp://user@host.example.com/dir/path.file.txt" import os import bb import urllib.request, urllib.parse, urllib.error -from bb.fetch2 import URI -from bb.fetch2 import FetchMethod -from bb.fetch2 import runfetchcmd +from bb.fetch import URI +from bb.fetch import FetchMethod +from bb.fetch import runfetchcmd class SFTP(FetchMethod): """Class to fetch urls via 'sftp'""" @@ -67,7 +67,7 @@ class SFTP(FetchMethod): def urldata_init(self, ud, d): if 'protocol' in ud.parm and ud.parm['protocol'] == 'git': - raise bb.fetch2.ParameterError( + raise bb.fetch.ParameterError( "Invalid protocol - if you wish to fetch from a " + "git repository using ssh, you need to use the " + "git:// prefix with protocol=ssh", ud.url) @@ -106,6 +106,6 @@ class SFTP(FetchMethod): cmd = basecmd + [remote, lpath] - bb.fetch2.check_network_access(d, cmd, ud.url) + bb.fetch.check_network_access(d, cmd, ud.url) runfetchcmd(cmd, d) return True diff --git a/lib/bb/fetch2/ssh.py b/lib/bb/fetch/ssh.py similarity index 98% rename from lib/bb/fetch2/ssh.py rename to lib/bb/fetch/ssh.py index 56e455fb4..304872ad0 100644 --- a/lib/bb/fetch2/ssh.py +++ b/lib/bb/fetch/ssh.py @@ -31,7 +31,7 @@ IETF secsh internet draft: # import re, os -from bb.fetch2 import check_network_access, FetchMethod, ParameterError, runfetchcmd +from bb.fetch import check_network_access, FetchMethod, ParameterError, runfetchcmd import urllib diff --git a/lib/bb/fetch2/svn.py b/lib/bb/fetch/svn.py similarity index 94% rename from lib/bb/fetch2/svn.py rename to lib/bb/fetch/svn.py index 973f76f00..73ce83f4e 100644 --- a/lib/bb/fetch2/svn.py +++ b/lib/bb/fetch/svn.py @@ -14,11 +14,11 @@ import os import bb import re import shlex -from bb.fetch2 import FetchMethod -from bb.fetch2 import FetchError -from bb.fetch2 import MissingParameterError -from bb.fetch2 import runfetchcmd -from bb.fetch2 import logger +from bb.fetch import FetchMethod +from bb.fetch import FetchError +from bb.fetch import MissingParameterError +from bb.fetch import runfetchcmd +from bb.fetch import logger class Svn(FetchMethod): """Class to fetch a module or modules from svn repositories""" @@ -141,7 +141,7 @@ class Svn(FetchMethod): except FetchError: pass logger.debug("Running %s", svncmd) - bb.fetch2.check_network_access(d, svncmd, ud.url) + bb.fetch.check_network_access(d, svncmd, ud.url) runfetchcmd(svncmd, d, workdir=ud.moddir, extraenv=extraenv) else: svncmd, extraenv = self._buildsvncommand(ud, d, "fetch") @@ -149,7 +149,7 @@ class Svn(FetchMethod): # check out sources there bb.utils.mkdirhier(ud.pkgdir) logger.debug("Running %s", svncmd) - bb.fetch2.check_network_access(d, svncmd, ud.url) + bb.fetch.check_network_access(d, svncmd, ud.url) runfetchcmd(svncmd, d, workdir=ud.pkgdir, extraenv=extraenv) if not ("externals" in ud.parm and ud.parm["externals"] == "nowarn"): @@ -164,7 +164,7 @@ class Svn(FetchMethod): bb.warn("To disable this warning add ';externals=nowarn' to the url.") else: bb.debug(1, "svn repository has externals:\n%s" % output) - except bb.fetch2.FetchError: + except bb.fetch.FetchError: passs scmdata = ud.parm.get("scmdata", "") if scmdata == "keep": @@ -199,7 +199,7 @@ class Svn(FetchMethod): Return the latest upstream revision number """ cmd, extraenv = self._buildsvncommand(ud, d, "log1") - bb.fetch2.check_network_access(d, cmd, ud.url) + bb.fetch.check_network_access(d, cmd, ud.url) extraenv['LANG'] = 'C' extraenv['LC_ALL'] = 'C' output = runfetchcmd(cmd, d, True, extraenv=extraenv) diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch/wget.py similarity index 98% rename from lib/bb/fetch2/wget.py rename to lib/bb/fetch/wget.py index 0d2b7f5c8..7b05a9ef2 100644 --- a/lib/bb/fetch2/wget.py +++ b/lib/bb/fetch/wget.py @@ -23,10 +23,10 @@ import socket import http.client import urllib.request, urllib.parse, urllib.error import subprocess -from bb.fetch2 import FetchMethod -from bb.fetch2 import FetchError -from bb.fetch2 import logger -from bb.fetch2 import runfetchcmd +from bb.fetch import FetchMethod +from bb.fetch import FetchError +from bb.fetch import logger +from bb.fetch import runfetchcmd from bb._vendor.bs4 import BeautifulSoup from bb._vendor.bs4 import SoupStrainer @@ -94,7 +94,7 @@ class Wget(FetchMethod): def urldata_init(self, ud, d): if 'protocol' in ud.parm: if ud.parm['protocol'] == 'git': - raise bb.fetch2.ParameterError("Invalid protocol - if you wish to fetch from a git repository using http, you need to instead use the git:// prefix with protocol=http", ud.url) + raise bb.fetch.ParameterError("Invalid protocol - if you wish to fetch from a git repository using http, you need to instead use the git:// prefix with protocol=http", ud.url) if 'downloadfilename' in ud.parm: ud.basename = ud.parm['downloadfilename'] @@ -118,7 +118,7 @@ class Wget(FetchMethod): progresshandler = WgetProgressHandler(d) logger.debug2("Fetching %s using command '%s'" % (ud.url, command)) - bb.fetch2.check_network_access(d, command, ud.url) + bb.fetch.check_network_access(d, command, ud.url) runfetchcmd(command + ['--progress=dot', '--verbose'], d, quiet, log=progresshandler, workdir=workdir) @@ -167,7 +167,7 @@ class Wget(FetchMethod): # Try and verify any checksum now, meaning if it isn't correct, we don't remove the # original file, which might be a race (imagine two recipes referencing the same # source, one with an incorrect checksum) - bb.fetch2.verify_checksum(ud, d, localpath=localpath, fatal_nochecksum=False) + bb.fetch.verify_checksum(ud, d, localpath=localpath, fatal_nochecksum=False) # Remove the ".tmp" and move the file into position atomically # Our lock prevents multiple writers but mirroring code may grab incomplete files @@ -177,7 +177,7 @@ class Wget(FetchMethod): def checkstatus(self, fetch, ud, d, try_again=True): check_certs = self.check_certs(d) - newenv = bb.fetch2.get_fetcher_environment(d) + newenv = bb.fetch.get_fetcher_environment(d) class HTTPConnectionCache(http.client.HTTPConnection): def cache_id(self): @@ -568,7 +568,7 @@ class Wget(FetchMethod): try: self._runwget(ud, d, fetchcmd, True, workdir=workdir) fetchresult = f.read() - except bb.fetch2.BBFetchException: + except bb.fetch.BBFetchException: fetchresult = "" return fetchresult diff --git a/lib/bb/fetch2.py b/lib/bb/fetch2.py new file mode 100644 index 000000000..e64017016 --- /dev/null +++ b/lib/bb/fetch2.py @@ -0,0 +1,19 @@ +# +# Copyright (C) 2026 Agilent Technologies, Inc. +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import sys +import warnings + +import bb.fetch + +warnings.warn( + "bb.fetch2 is deprecated; use bb.fetch instead", + DeprecationWarning, + stacklevel=2, +) + +# Compatibility shim for code using bb.fetch2 +sys.modules[__name__] = bb.fetch From patchwork Thu Aug 27 14:29:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 96565 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CF99C61DCD for ; Thu, 27 Aug 2026 14:30:56 +0000 (UTC) Received: from SN4PR0501CU005.outbound.protection.outlook.com (SN4PR0501CU005.outbound.protection.outlook.com [40.93.194.14]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.37440.1787841053950374392 for ; Thu, 27 Aug 2026 07:30:54 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=cAhC/xbh; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.93.194.14, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ed4HMG5Y9IVvQ8FTH4DeckMB6d/dc4muzdHa8mYJQmBguxKxIjVKeXDi5vBM0AFUJDE+je7/zO6CjCXsGmMMd85Rx8CjD1JE1qCfSVBKLHhUEQR9dA5H0MUCl//aP9e+cbCCFHpjmshtuPS+V4we4C9i5XRub0/JsFE+25x5eCNAatvrEJ2S0GKBKp4uQVxau/QqJuTmbHI46ry5Bn1r3tyTw96McTNuOg+yMhBO91rRS93sk88Y8DUfDAMoZvGvSlioBKUXI2grzultA2oZGK75nWh0rXpX2m9RIp1k2HUegRfKVACNiDkcoKvtTikGzMEyiOyayYOuNkPt1vezeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZdXmxsBXyQJXP1dLQYs2T6czGQ/cOkZXR43n3b8+Rqw=; b=q9cZHRl28HnbcP+DvexAIkNSIzKO2HUkrvo7lMJqyXLN7gIcmnE8UwLOHuW25JRapTSN66BQ3nNhZ/Ga4MNziOzX+troPQMtDmIVtly0QUfFil6xlaLE/Gj5UwTKsGPOXym5F4kB3kvzFC0Lx5jX9kaEf1cM8ucYu6itpaTvEYVvbjQqLPtGjWNtZGGBdYQdkr0YY9UzPDGshelgU1lsNDZharYugzwEXHn1jzKGlAs2FQRBHdZ6quZtjokubzLE28jtjAjn40VxUdv6fMhEKY6X0vzmtMA4D6Fqt0luP3UALFThso0n9tYNpCbgrmYVHiKvySJh4D1LWEiIV3jO6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.36) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZdXmxsBXyQJXP1dLQYs2T6czGQ/cOkZXR43n3b8+Rqw=; b=cAhC/xbhjEuVG2GkieyJAR3KzSad01kJVf9EMDKxA97F3Tvbs+SowtwNDQ8ic5xhJG5JkyTpQQ/U4hMtbsW7m/DymfCCiNf6l/NqaYFBwY8Qj8ACYq+Xx0dD/Tzr4WBMcow9oO+N/DVt2OiOIIaTXjWKYQPEi3JZId7I0oSDBE2Qk6tvO3rU7RlzJ6+3BJ5QsenSK1+2f8I1p4ScJN/B/eKO6hkqI5aWSrln+qm2I9FdoXoVGqja9Ijw2MIEYPGESWixxxV2E+iOD2ouXBb22Wn9Z9QdLxh0uvlWaL25ET9fxRkzPTSjxsH4asLKuuusn7ZJWaAXAoH/s4/LDba4UA== Received: from BLAPR03CA0154.namprd03.prod.outlook.com (2603:10b6:208:32f::28) by DM6PR12MB4201.namprd12.prod.outlook.com (2603:10b6:5:216::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.10; Thu, 27 Aug 2026 14:30:49 +0000 Received: from BN3PEPF0000B373.namprd21.prod.outlook.com (2603:10b6:208:32f:cafe::52) by BLAPR03CA0154.outlook.office365.com (2603:10b6:208:32f::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.10 via Frontend Transport; Thu, 27 Aug 2026 14:30:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.36) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.36 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.36; helo=wpcosapexchedg5.windmz.agilent.com; pr=C Received: from wpcosapexchedg5.windmz.agilent.com (192.25.218.36) by BN3PEPF0000B373.mail.protection.outlook.com (10.167.243.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.0 via Frontend Transport; Thu, 27 Aug 2026 14:30:49 +0000 Received: from laplante-B650.lfs.agilent.com (192.25.126.4) by edgeappmail.agilent.com (192.25.218.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Thu, 27 Aug 2026 08:30:14 -0600 From: To: CC: , Chris Laplante Subject: [PATCH 2/4] bin, lib, conf: use bb.fetch instead of bb.fetch2 Date: Thu, 27 Aug 2026 10:29:56 -0400 Message-ID: <20260827142958.547182-2-chris.laplante@agilent.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260827142958.547182-1-chris.laplante@agilent.com> References: <20260827142958.547182-1-chris.laplante@agilent.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B373:EE_|DM6PR12MB4201:EE_ X-MS-Office365-Filtering-Correlation-Id: ad7267f3-8dd8-4958-5c24-08df0447ca51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|23010399003|36860700016|13003099007|6133799003|10067099003|56012099006|11063799006|18002099003|22082099003|3023799007; X-Microsoft-Antispam-Message-Info: 9QcLWREzFxjZii8+tjfnrztgSPhrU+pJx5RzRqbpsh5kLiOXKZF4vpCH+T6z1CQR3GZ7D37Q03IlVD2kwt2Z+6owAlJwclpOlIBF0c5FUzccm5CAlWn5bmFk0efPIkmweIsRz/NgpA9nqktZUnUeYkNV4Chb3c11lltGChESE7kDpa+OY/+bC1GajxdZMhmwrCNIE/tBDggoprtp3+TE99frrllNMZA3aAShO1NEIPCikHvMEbxnngB1M5MVAu8l5232SMzJrnBIAeo5NcYRzybZPNitceY5l+o17ffwJbMx/fHS3JeJRG6RwiyZWWWZLJ+3qQGdAIuIE5MhzdcqFniHi/C4/ug75kxRD/NL3YxyMfvGQWZmkcGt3wNTR1NvkgY1w2iKICS1bjqAVsE3ocN1/GEhc12v/ZALVkCygIxrhmZ8DrEmgRS14WfwztpXPvEwDleX/lguJGSDwCBWIElKFSk/NZ/RpQu97wqzohJEeUaRxtDphyidroQbNJ4V0eeJqUQrUZLM4OSTHtx8FRrRt/5pJPriX5XlxwqCgzUEf+OUYPnbxyGVp8+O3aDRjkz28rtrw0jlNfkynzc/FbljleNmXVoi+rKr9HgVqM3m7dpJJ7LPDqkjvxTXf4s2Xnwg/cf0Jdn5cP5v2H0N3w== X-Forefront-Antispam-Report: CIP:192.25.218.36;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:wpcosapexchedg5.windmz.agilent.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(376014)(23010399003)(36860700016)(13003099007)(6133799003)(10067099003)(56012099006)(11063799006)(18002099003)(22082099003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eVW0kz172RdytbqGdonu1zFJ52UfHSNj1tJGetwLCb/ouxbwpqmxfx92XBVdxoMNBW+UT95p0fflllIi8CQYZBHO7Cli7JXmHSnp+MX3YeU1JqTtUFiRvMhymOYW+25zV74J3M5RpEbQCOpFd5VoHKbb+/w5spTJUV8WXlr3RDbfz+JrBCmF3XiEf1Zsfm6BUdmUWYAhX7mTaasS+1+ZKUmo/uEe8L+ZWT8261dYhy3Un0MaIJzGVDqy5p3VjJiY+H9TsgAZRPQUx9JH5VCGvQRS8qpRXb6XpyGUPMtpkjo4a3Flpg0XfZR/ZDgvHsRfz5OGKMBLBsoV674cgTuFu9u9aw9syRSpbfwlJDahle3/ZYHqysH4yrF/r+NTbj5VW7Gqcqe2cuMqcpApJVdRrt172RGNPzLcgcNExLaRX56HtgSO9aWVSjjZITfAq2DV X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2026 14:30:49.2026 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad7267f3-8dd8-4958-5c24-08df0447ca51 X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.36];Helo=[wpcosapexchedg5.windmz.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-BN3PEPF0000B373.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4201 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 27 Aug 2026 14:30:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/20070 From: Chris Laplante Signed-off-by: Chris Laplante --- bin/bitbake-setup | 13 +-- bin/bitbake-worker | 2 +- conf/bitbake.conf | 2 +- lib/bb/command.py | 1 + lib/bb/cooker.py | 7 +- lib/bb/cookerdata.py | 2 +- lib/bb/siggen.py | 7 +- lib/bb/tests/fetch.py | 230 +++++++++++++++++++++--------------------- lib/bb/tinfoil.py | 2 +- lib/bb/utils.py | 2 +- 10 files changed, 136 insertions(+), 132 deletions(-) diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 92ed563c2..35d9730ae 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -27,6 +27,7 @@ bindir = os.path.abspath(os.path.dirname(__file__)) sys.path[0:0] = [os.path.join(os.path.dirname(bindir), 'lib')] import bb.msg # noqa: E402 +import bb.fetch # noqa: E402 import bb.process # noqa: E402 from bb import __version__ as libbb_version # noqa: E402 @@ -108,8 +109,8 @@ def init_bb_cache(top_dir, settings, args): return d def save_bb_cache(): - bb.fetch2.fetcher_parse_save() - bb.fetch2.fetcher_parse_done() + bb.fetch.fetcher_parse_save() + bb.fetch.fetcher_parse_done() def get_config_name(config): suffix = '.conf.json' @@ -192,7 +193,7 @@ def checkout_layers(layers, confdir, layerdir, d, rebase_conflicts_strategy='abo repodir_path = os.path.join(layerdir, repodir) try: do_fetch(fetcher, layerdir) - except (bb.fetch2.LocalModificationsError, bb.fetch2.RebaseError) as e: + except (bb.fetch.LocalModificationsError, bb.fetch.RebaseError) as e: if rebase_conflicts_strategy != 'backup': e.msg += ("\nUse 'bitbake-setup update --rebase-conflicts-strategy=backup'" " to automatically back up the directory and re-clone from upstream," @@ -893,7 +894,7 @@ def get_diff(file1, file2): def are_layers_changed(layers, layerdir, d): def _is_git_remote_changed(r_remote, repodir): - from bb.fetch2.git import git_hash_re + from bb.fetch.git import git_hash_re rev = r_remote['rev'] branch = r_remote.get('branch', None) @@ -1108,11 +1109,11 @@ def install_buildtools(top_dir, settings, args, d): fetcher = bb.fetch.Fetch([src_uri], d) try: fetcher.download() - except bb.fetch2.ChecksumError as e: + except bb.fetch.ChecksumError as e: logger.error("Checksum mismatch for buildtools installer. " "Verify the URL and downloaded file.\n%s" % str(e)) sys.exit(1) - except bb.fetch2.FetchError as e: + except bb.fetch.FetchError as e: logger.error("Failed to download buildtools installer: %s" % str(e)) sys.exit(1) diff --git a/bin/bitbake-worker b/bin/bitbake-worker index a9946f067..d011b2af4 100755 --- a/bin/bitbake-worker +++ b/bin/bitbake-worker @@ -11,7 +11,7 @@ import warnings warnings.simplefilter("default") warnings.filterwarnings("ignore", category=DeprecationWarning, message=".*use.of.fork.*may.lead.to.deadlocks.in.the.child.*") sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib')) -from bb import fetch2 +from bb import fetch import logging import bb import select diff --git a/conf/bitbake.conf b/conf/bitbake.conf index f5a5a333a..a8cd5c079 100644 --- a/conf/bitbake.conf +++ b/conf/bitbake.conf @@ -43,4 +43,4 @@ T = "${WORKDIR}/temp" TARGET_ARCH = "${BUILD_ARCH}" TMPDIR = "${TOPDIR}/tmp" WORKDIR = "${TMPDIR}/work/${PF}" -GITPKGV = "${@bb.fetch2.get_srcrev(d, 'gitpkgv_revision')}" +GITPKGV = "${@bb.fetch.get_srcrev(d, 'gitpkgv_revision')}" diff --git a/lib/bb/command.py b/lib/bb/command.py index 9c421aa9a..068d95c16 100644 --- a/lib/bb/command.py +++ b/lib/bb/command.py @@ -22,6 +22,7 @@ from collections import OrderedDict, defaultdict import io import bb.event +import bb.fetch import bb.cooker import bb.remotedata import bb.parse diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 00a6bac55..8a422e506 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -18,6 +18,7 @@ from io import StringIO, UnsupportedOperation from contextlib import closing from collections import defaultdict, namedtuple import bb, bb.command +import bb.fetch from bb import utils, data, parse, event, cache, providers, taskdata, runqueue, build import queue import signal @@ -1600,8 +1601,8 @@ You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result in si dump = {} # Horrible but for now we need to avoid any sideeffects of autorev being called - saved = bb.fetch2.get_autorev - bb.fetch2.get_autorev = dummy_autorev + saved = bb.fetch.get_autorev + bb.fetch.get_autorev = dummy_autorev for k in self.data.keys(): try: expand = True @@ -1621,7 +1622,7 @@ You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result in si dump[k][d] = None except Exception as e: print(e) - bb.fetch2.get_autorev = saved + bb.fetch.get_autorev = saved return dump diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py index d307bff0a..d65e3c974 100644 --- a/lib/bb/cookerdata.py +++ b/lib/bb/cookerdata.py @@ -22,7 +22,7 @@ import bb.codeparser import bb.data import bb.data_smart import bb.event -import bb.fetch2 +import bb.fetch import bb.parse import bb.utils diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py index a2ef38e17..76c82c684 100644 --- a/lib/bb/siggen.py +++ b/lib/bb/siggen.py @@ -11,6 +11,7 @@ import re import tempfile import pickle import bb.data +import bb.fetch import difflib from bb._vendor import simplediff import json @@ -362,7 +363,7 @@ class SignatureGeneratorBasic(SignatureGenerator): if self.checksum_cache: checksums = self.checksum_cache.get_checksums(dataCaches[mc].file_checksums[mcfn][task], recipename, self.localdirsexclude) else: - checksums = bb.fetch2.get_file_checksums(dataCaches[mc].file_checksums[mcfn][task], recipename, self.localdirsexclude) + checksums = bb.fetch.get_file_checksums(dataCaches[mc].file_checksums[mcfn][task], recipename, self.localdirsexclude) for (f,cs) in checksums: self.file_checksum_values[tid].append((f,cs)) @@ -413,8 +414,8 @@ class SignatureGeneratorBasic(SignatureGenerator): self.checksum_cache.save_extras() self.checksum_cache.save_merge() else: - bb.fetch2.fetcher_parse_save() - bb.fetch2.fetcher_parse_done() + bb.fetch.fetcher_parse_save() + bb.fetch.fetcher_parse_done() def save_unitaskhashes(self): self.unihash_cache.save(self.unitaskhashes) diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py index a1e4b45f8..58aff7f67 100644 --- a/lib/bb/tests/fetch.py +++ b/lib/bb/tests/fetch.py @@ -1,5 +1,5 @@ # -# BitBake Tests for the Fetcher (fetch2/) +# BitBake Tests for the Fetcher (fetch/) # # Copyright (C) 2012 Richard Purdie # @@ -21,7 +21,7 @@ import subprocess import json import tarfile import threading -from bb.fetch2 import URI +from bb.fetch import URI import bb import bb.utils from bb.tests.support.httpserver import HTTPService @@ -520,28 +520,28 @@ class MirrorUriTest(FetcherTest): for k, v in self.replaceuris.items(): ud = bb.fetch.FetchData(k[0], self.d) ud.setup_localpath(self.d) - mirrors = bb.fetch2.mirror_from_string("%s %s" % (k[1], k[2])) - newuris, uds = bb.fetch2.build_mirroruris(ud, mirrors, self.d) + mirrors = bb.fetch.mirror_from_string("%s %s" % (k[1], k[2])) + newuris, uds = bb.fetch.build_mirroruris(ud, mirrors, self.d) self.assertEqual([v] if v else [], newuris) def test_urilist1(self): fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) - mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) - uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) + mirrors = bb.fetch.mirror_from_string(self.mirrorvar) + uris, uds = bb.fetch.build_mirroruris(fetcher, mirrors, self.d) self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', 'file:///someotherpath/downloads/bitbake-1.0.tar.gz']) def test_urilist2(self): # Catch https:// -> files:// bug fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) - mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) - uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) + mirrors = bb.fetch.mirror_from_string(self.mirrorvar) + uris, uds = bb.fetch.build_mirroruris(fetcher, mirrors, self.d) self.assertEqual(uris, ['file:///someotherpath/downloads/bitbake-1.0.tar.gz']) def test_urilistsvn(self): # Catch svn:// -> svn:// bug fetcher = bb.fetch.FetchData("svn://svn.server1.com/isource/svnroot/reponame/tags/tagname;module=path_in_tagnamefolder;protocol=https;rev=2", self.d) - mirrors = bb.fetch2.mirror_from_string(self.mirrorvar) - uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) + mirrors = bb.fetch.mirror_from_string(self.mirrorvar) + uris, uds = bb.fetch.build_mirroruris(fetcher, mirrors, self.d) self.assertEqual(uris, ['svn://svn.server2.com/isource/svnroot/reponame/tags/tagname;module=path_in_tagnamefolder;protocol=https;rev=2']) def test_mirror_of_mirror(self): @@ -549,8 +549,8 @@ class MirrorUriTest(FetcherTest): mirrorvar = self.mirrorvar + " http://.*/.* http://otherdownloads.yoctoproject.org/downloads/" mirrorvar = mirrorvar + " http://otherdownloads.yoctoproject.org/.* http://downloads2.yoctoproject.org/downloads/" fetcher = bb.fetch.FetchData("http://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) - mirrors = bb.fetch2.mirror_from_string(mirrorvar) - uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) + mirrors = bb.fetch.mirror_from_string(mirrorvar) + uris, uds = bb.fetch.build_mirroruris(fetcher, mirrors, self.d) self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz', 'file:///someotherpath/downloads/bitbake-1.0.tar.gz', 'http://otherdownloads.yoctoproject.org/downloads/bitbake-1.0.tar.gz', @@ -561,8 +561,8 @@ class MirrorUriTest(FetcherTest): def test_recursive(self): fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d) - mirrors = bb.fetch2.mirror_from_string(self.recmirrorvar) - uris, uds = bb.fetch2.build_mirroruris(fetcher, mirrors, self.d) + mirrors = bb.fetch.mirror_from_string(self.recmirrorvar) + uris, uds = bb.fetch.build_mirroruris(fetcher, mirrors, self.d) self.assertEqual(uris, ['http://aaaa/A/A/A/bitbake/bitbake-1.0.tar.gz', 'https://bbbb/B/B/B/bitbake/bitbake-1.0.tar.gz', 'http://aaaa/A/A/A/B/B/bitbake/bitbake-1.0.tar.gz']) @@ -798,7 +798,7 @@ class FetcherLocalTest(FetcherTest): self.assertEqual(tree, [r'backslash\x2dsystemd-unit.device']) def test_local_wildcard(self): - with self.assertRaises(bb.fetch2.ParameterError): + with self.assertRaises(bb.fetch.ParameterError): tree = self.fetchUnpack(['file://a', 'file://dir/*']) def test_local_dir(self): @@ -827,7 +827,7 @@ class FetcherLocalTest(FetcherTest): tree = self.fetchUnpack(['file://a;subdir=%s' % os.path.join(self.unpackdir, 'bar')]) # Unpacking to an absolute path outside of the root should fail - with self.assertRaises(bb.fetch2.UnpackError): + with self.assertRaises(bb.fetch.UnpackError): self.fetchUnpack(['file://a;subdir=/bin/sh']) def test_local_striplevel(self): @@ -854,20 +854,20 @@ class FetcherLocalTest(FetcherTest): def test_local_deb_rejects_unknown_data_member_suffix(self): package = self.make_ar_package("archive.deb", data_member="data.tar.foo") - with self.assertRaises(bb.fetch2.UnpackError) as context: + with self.assertRaises(bb.fetch.UnpackError) as context: self.fetchUnpack(['file://%s' % package]) self.assertIn("does not contain supported data.tar* file", str(context.exception)) def test_local_deb_rejects_unsafe_data_member(self): package = self.make_ar_package("archive.deb", data_member="data.tar.xz;id") - with self.assertRaises(bb.fetch2.UnpackError) as context: + with self.assertRaises(bb.fetch.UnpackError) as context: self.fetchUnpack(['file://%s' % package]) self.assertIn("does not contain supported data.tar* file", str(context.exception)) def assertInvalidStriplevel(self, value): - with self.assertRaises(bb.fetch2.UnpackError) as context: + with self.assertRaises(bb.fetch.UnpackError) as context: self.fetchUnpack(['file://archive.tar;subdir=bar;striplevel=%s' % value]) self.assertIn("Invalid striplevel parameter", str(context.exception)) @@ -931,7 +931,7 @@ class FetcherNoNetworkTest(FetcherTest): self.assertFalse(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz"))) self.assertFalse(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz.done"))) fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/test-file.tar.gz"], self.d) - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() def test_valid_missing_donestamp(self): @@ -961,7 +961,7 @@ class FetcherNoNetworkTest(FetcherTest): self.assertTrue(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz"))) self.assertFalse(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz.done"))) fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/test-file.tar.gz"], self.d) - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() # the existing file should not exist or should have be moved to "bad-checksum" self.assertFalse(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz"))) @@ -972,7 +972,7 @@ class FetcherNoNetworkTest(FetcherTest): # ssh fetch does not support checksums fetcher = bb.fetch.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d) # attempts to download with missing donestamp - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() def test_nochecksums_missing_donestamp(self): @@ -985,7 +985,7 @@ class FetcherNoNetworkTest(FetcherTest): # ssh fetch does not support checksums fetcher = bb.fetch.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d) # attempts to download with missing donestamp - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() def test_nochecksums_has_donestamp(self): @@ -1014,7 +1014,7 @@ class FetcherNoNetworkTest(FetcherTest): self.assertTrue(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz.done"))) # ssh fetch does not support checksums fetcher = bb.fetch.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d) - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() # both files should still exist self.assertFalse(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz"))) @@ -1315,7 +1315,7 @@ class FetcherNetworkTest(FetcherTest): self.d.setVar("SRCREV", "14e1138441bbbb584160cb1c0a0426ec1bac35f1") with Timeout(60): fetcher = bb.fetch.Fetch([self.recipe_url], self.d) - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher.download() class SVNTest(FetcherTest): @@ -1601,7 +1601,7 @@ class FetchLatestVersionTest(FetcherTest): self.d.setVar("PN", k[0]) self.d.setVar("SRCREV", k[2]) self.d.setVar("UPSTREAM_CHECK_GITTAGREGEX", k[3]) - ud = bb.fetch2.FetchData(k[1], self.d) + ud = bb.fetch.FetchData(k[1], self.d) pupver= ud.method.latest_versionstring(ud, self.d) verstring = pupver[0] self.assertTrue(verstring, msg="Could not find upstream version for %s" % k[0]) @@ -1628,7 +1628,7 @@ class FetchLatestVersionTest(FetcherTest): self.d.setVar("UPSTREAM_CHECK_REGEX", data.check_regex) url = "http://127.0.0.1:%s/%s" % (port, data.path) - ud = bb.fetch2.FetchData(url, self.d) + ud = bb.fetch.FetchData(url, self.d) pupver = ud.method.latest_versionstring(ud, self.d) verstring = pupver[0] self.assertTrue(verstring, msg="Could not find upstream version for %s" % data.pn) @@ -1642,7 +1642,7 @@ class FetchLatestVersionTest(FetcherTest): for k, v in self.test_crate_uris.items(): with self.subTest(pn=k[0]): self.d.setVar("PN", k[0]) - ud = bb.fetch2.FetchData(k[1], self.d) + ud = bb.fetch.FetchData(k[1], self.d) pupver = ud.method.latest_versionstring(ud, self.d) verstring = pupver[0] self.assertTrue(verstring, msg="Could not find upstream version for %s" % k[0]) @@ -1657,7 +1657,7 @@ class FetchLatestVersionTest(FetcherTest): self.d.setVar("SRCREV", k[2]) self.d.setVar("UPSTREAM_CHECK_GITTAGREGEX", k[3]) filter_regex = k[4] - ud = bb.fetch2.FetchData(k[1], self.d) + ud = bb.fetch.FetchData(k[1], self.d) pupver= ud.method.latest_versionstring(ud, self.d, filter_regex=filter_regex) verstring = pupver[0] self.assertTrue(verstring, msg="Could not find upstream version for %s" % k[0]) @@ -1680,7 +1680,7 @@ class FetchLatestVersionTest(FetcherTest): if k[4]: self.d.setVar("UPSTREAM_CHECK_REGEX", k[4]) filter_regex = k[5] - ud = bb.fetch2.FetchData(url, self.d) + ud = bb.fetch.FetchData(url, self.d) pupver= ud.method.latest_versionstring(ud, self.d, filter_regex=filter_regex) verstring = pupver[0] self.assertTrue(verstring, msg="Could not find upstream version for %s" % k[0]) @@ -1696,7 +1696,7 @@ class FetchLatestVersionTest(FetcherTest): for k, v in self.test_crate_stable_uris.items(): with self.subTest(pn=k[0]): self.d.setVar("PN", k[0]) - ud = bb.fetch2.FetchData(k[1], self.d) + ud = bb.fetch.FetchData(k[1], self.d) filter_regex = k[2] pupver = ud.method.latest_versionstring(ud, self.d, filter_regex=filter_regex) verstring = pupver[0] @@ -1750,13 +1750,13 @@ class FetchCheckStatusTest(FetcherTest): return server def _checkstatus(self, url): - fetch = bb.fetch2.Fetch([url], self.d) + fetch = bb.fetch.Fetch([url], self.d) ud = fetch.ud[url] return ud.method.checkstatus(fetch, ud, self.d) @skipIfNoNetwork() def test_wget_checkstatus(self): - fetch = bb.fetch2.Fetch(self.test_wget_uris, self.d) + fetch = bb.fetch.Fetch(self.test_wget_uris, self.d) for u in self.test_wget_uris: with self.subTest(url=u): ud = fetch.ud[u] @@ -1766,10 +1766,10 @@ class FetchCheckStatusTest(FetcherTest): @skipIfNoNetwork() def test_wget_checkstatus_connection_cache(self): - from bb.fetch2 import FetchConnectionCache + from bb.fetch import FetchConnectionCache connection_cache = FetchConnectionCache() - fetch = bb.fetch2.Fetch(self.test_wget_uris, self.d, + fetch = bb.fetch.Fetch(self.test_wget_uris, self.d, connection_cache = connection_cache) for u in self.test_wget_uris: @@ -1785,7 +1785,7 @@ class FetchCheckStatusTest(FetcherTest): def test_wget_checkstatus_https_connection_cache(self): import ssl from socketserver import ThreadingMixIn - from bb.fetch2 import FetchConnectionCache + from bb.fetch import FetchConnectionCache class HTTPSRequestHandler(http.server.BaseHTTPRequestHandler): protocol_version = "HTTP/1.1" @@ -1832,7 +1832,7 @@ class FetchCheckStatusTest(FetcherTest): try: url = "https://127.0.0.1:%s/test" % server.server_port self.d.setVar("BB_CHECK_SSL_CERTS", "0") - fetch = bb.fetch2.Fetch([url], self.d, + fetch = bb.fetch.Fetch([url], self.d, connection_cache=connection_cache) ud = fetch.ud[url] self.assertTrue(ud.method.checkstatus(fetch, ud, self.d)) @@ -1918,7 +1918,7 @@ class GitShallowTest(FetcherTest): uri = 'git://%s;protocol=file;subdir=${S};branch=master' % self.srcdir self.d.setVar('SRC_URI', uri) self.d.setVar('SRCREV', '${AUTOREV}') - self.d.setVar('AUTOREV', '${@bb.fetch2.get_autorev(d)}') + self.d.setVar('AUTOREV', '${@bb.fetch.get_autorev(d)}') self.d.setVar('BB_GIT_SHALLOW', '1') self.d.setVar('BB_GENERATE_MIRROR_TARBALLS', '0') @@ -1963,7 +1963,7 @@ class GitShallowTest(FetcherTest): uri = d.expand(uri) uris = [uri] - fetcher = bb.fetch2.Fetch(uris, d) + fetcher = bb.fetch.Fetch(uris, d) fetcher.download() ud = fetcher.ud[uri] return fetcher, ud @@ -2294,7 +2294,7 @@ class GitShallowTest(FetcherTest): self.add_empty_file('b') self.d.setVar('BB_GIT_SHALLOW_DEPTH', '-12') - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): self.fetch() def test_shallow_invalid_depth_default(self): @@ -2302,7 +2302,7 @@ class GitShallowTest(FetcherTest): self.add_empty_file('b') self.d.setVar('BB_GIT_SHALLOW_DEPTH_default', '-12') - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): self.fetch() def test_shallow_extra_refs(self): @@ -2367,7 +2367,7 @@ class GitShallowTest(FetcherTest): self.add_empty_file('b') self.d.setVar('BB_GIT_SHALLOW_EXTRA_REFS', 'refs/heads/foo') - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): self.fetch() def test_shallow_missing_extra_refs_wildcard(self): @@ -2406,7 +2406,7 @@ class GitShallowTest(FetcherTest): self.d.setVar('BB_GIT_SHALLOW_DEPTH', '0') self.d.setVar('BB_GIT_SHALLOW_REVS', 'v0.0') - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): self.fetch() def test_shallow_fetch_missing_revs(self): @@ -2417,7 +2417,7 @@ class GitShallowTest(FetcherTest): self.d.setVar('BB_GIT_SHALLOW_DEPTH', '0') self.d.setVar('BB_GIT_SHALLOW_REVS', 'v0.0') - with self.assertRaises(bb.fetch2.FetchError), self.assertLogs("BitBake.Fetcher", level="ERROR") as cm: + with self.assertRaises(bb.fetch.FetchError), self.assertLogs("BitBake.Fetcher", level="ERROR") as cm: self.fetch_shallow() self.assertIn("fatal: no commits selected for shallow requests", cm.output[0]) @@ -2428,7 +2428,7 @@ class GitShallowTest(FetcherTest): self.d.setVar('BB_GIT_SHALLOW_DEPTH', '0') self.d.setVar('BB_GIT_SHALLOW_REVS', 'v0.0') - with self.assertRaises(bb.fetch2.FetchError), self.assertLogs("BitBake.Fetcher", level="ERROR") as cm: + with self.assertRaises(bb.fetch.FetchError), self.assertLogs("BitBake.Fetcher", level="ERROR") as cm: self.fetch_shallow() self.assertIn("Unable to find revision v0.0 even from upstream", cm.output[0]) @@ -2485,7 +2485,7 @@ class GitShallowTest(FetcherTest): bb.utils.remove(self.gitdir, recurse=True) bb.utils.remove(self.dldir, recurse=True) - with self.assertRaises(bb.fetch2.UnpackError) as context: + with self.assertRaises(bb.fetch.UnpackError) as context: fetcher.unpack(self.d.getVar('WORKDIR')) self.assertIn("No up to date source found", context.exception.msg) @@ -2534,7 +2534,7 @@ class GitLfsTest(FetcherTest): self.d.delVar('MIRRORS') self.d.setVar('SRCREV', '${AUTOREV}') - self.d.setVar('AUTOREV', '${@bb.fetch2.get_autorev(d)}') + self.d.setVar('AUTOREV', '${@bb.fetch.get_autorev(d)}') self.d.setVar("__BBSRCREV_SEEN", "1") bb.utils.mkdirhier(self.srcdir) @@ -2559,7 +2559,7 @@ class GitLfsTest(FetcherTest): uri = uris[0] d = self.d - fetcher = bb.fetch2.Fetch(uris, d) + fetcher = bb.fetch.Fetch(uris, d) if download: fetcher.download() ud = fetcher.ud[uri] @@ -2758,7 +2758,7 @@ class GitLfsTest(FetcherTest): fetcher.download() # If git-lfs cannot be found, the unpack should throw an error - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): with unittest.mock.patch("shutil.which", return_value=None): shutil.rmtree(self.gitdir, ignore_errors=True) fetcher.unpack(self.d.getVar('WORKDIR')) @@ -2772,7 +2772,7 @@ class GitLfsTest(FetcherTest): # If git-lfs cannot be found, the download should throw an error with unittest.mock.patch("shutil.which", return_value=None): - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher.download() def test_lfs_disabled_not_installed(self): @@ -2862,7 +2862,7 @@ class FetchLocallyMissingTagFromRemote(FetcherTest): self.git(['commit', '-m', 'dummymsg', 'dummyfile'], self.srcdir) def _fetch_and_unpack(self, uri_to_fetch): - fetcher = bb.fetch2.Fetch([uri_to_fetch], self.d) + fetcher = bb.fetch.Fetch([uri_to_fetch], self.d) fetcher.download() fetcher.unpack(self.d.getVar('WORKDIR')) @@ -2896,7 +2896,7 @@ class CrateTest(FetcherTest): uris = self.d.getVar('SRC_URI').split() d = self.d - fetcher = bb.fetch2.Fetch(uris, self.d) + fetcher = bb.fetch.Fetch(uris, self.d) ud = fetcher.ud[fetcher.urls[0]] self.assertIn("name", ud.parm) @@ -2922,7 +2922,7 @@ class CrateTest(FetcherTest): uris = self.d.getVar('SRC_URI').split() d = self.d - fetcher = bb.fetch2.Fetch(uris, self.d) + fetcher = bb.fetch.Fetch(uris, self.d) ud = fetcher.ud[fetcher.urls[0]] self.assertIn("name", ud.parm) @@ -2945,7 +2945,7 @@ class CrateTest(FetcherTest): uris = self.d.getVar('SRC_URI').split() d = self.d - fetcher = bb.fetch2.Fetch(uris, self.d) + fetcher = bb.fetch.Fetch(uris, self.d) ud = fetcher.ud[fetcher.urls[0]] self.assertIn("name", ud.parm) @@ -2969,7 +2969,7 @@ class CrateTest(FetcherTest): uris = self.d.getVar('SRC_URI').split() d = self.d - fetcher = bb.fetch2.Fetch(uris, self.d) + fetcher = bb.fetch.Fetch(uris, self.d) ud = fetcher.ud[fetcher.urls[0]] self.assertIn("name", ud.parm) @@ -3000,8 +3000,8 @@ class CrateTest(FetcherTest): uris = self.d.getVar('SRC_URI').split() - fetcher = bb.fetch2.Fetch(uris, self.d) - with self.assertRaisesRegex(bb.fetch2.FetchError, "Fetcher failure for URL"): + fetcher = bb.fetch.Fetch(uris, self.d) + with self.assertRaisesRegex(bb.fetch.FetchError, "Fetcher failure for URL"): fetcher.download() class NPMTest(FetcherTest): @@ -3151,7 +3151,7 @@ class NPMTest(FetcherTest): '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223'] self.d.setVar('BB_NO_NETWORK', '1') fetcher = bb.fetch.Fetch(urls, self.d) - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() @skipIfNoNpm() @@ -3186,7 +3186,7 @@ class NPMTest(FetcherTest): @skipIfNoNpm() def test_npm_version_latest_rejected(self): url = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=latest'] - with self.assertRaises(bb.fetch2.ParameterError): + with self.assertRaises(bb.fetch.ParameterError): bb.fetch.Fetch(url, self.d) @skipIfNoNpm() @@ -3196,7 +3196,7 @@ class NPMTest(FetcherTest): ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7' '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223'] fetcher = bb.fetch.Fetch(urls, self.d) - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher.download() @skipIfNoNpm() @@ -3206,14 +3206,14 @@ class NPMTest(FetcherTest): ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7' '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223'] fetcher = bb.fetch.Fetch(urls, self.d) - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher.download() @skipIfNoNpm() @skipIfNoNetwork() def test_npm_version_invalid(self): urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=invalid'] - with self.assertRaises(bb.fetch2.ParameterError): + with self.assertRaises(bb.fetch.ParameterError): fetcher = bb.fetch.Fetch(urls, self.d) @skipIfNoNpm() @@ -3221,7 +3221,7 @@ class NPMTest(FetcherTest): def test_npm_recipe_checksum(self): """A sha512sum param in SRC_URI is forwarded to the proxy and verified.""" import subprocess - from bb.fetch2.npm import npm_integrity + from bb.fetch.npm import npm_integrity result = subprocess.run( ['npm', 'view', '--json', '@savoirfairelinux/node-server-example@1.0.0'], capture_output=True, text=True) @@ -3249,7 +3249,7 @@ class NPMTest(FetcherTest): urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example' ';version=1.0.0;sha512sum=deadbeef00'] fetcher = bb.fetch.Fetch(urls, self.d) - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher.download() @skipIfNoNpm() @@ -3267,28 +3267,28 @@ class NPMTest(FetcherTest): self.d.delVar('BB_STRICT_CHECKSUM') else: self.d.setVar('BB_STRICT_CHECKSUM', strict) - with self.assertRaises(bb.fetch2.MissingParameterError): + with self.assertRaises(bb.fetch.MissingParameterError): bb.fetch.Fetch(urls, self.d) @skipIfNoNpm() @skipIfNoNetwork() def test_npm_registry_none(self): urls = ['npm://;package=@savoirfairelinux/node-server-example;version=1.0.0'] - with self.assertRaises(bb.fetch2.MalformedUrl): + with self.assertRaises(bb.fetch.MalformedUrl): fetcher = bb.fetch.Fetch(urls, self.d) @skipIfNoNpm() @skipIfNoNetwork() def test_npm_package_none(self): urls = ['npm://registry.npmjs.org;version=1.0.0'] - with self.assertRaises(bb.fetch2.MissingParameterError): + with self.assertRaises(bb.fetch.MissingParameterError): fetcher = bb.fetch.Fetch(urls, self.d) @skipIfNoNpm() @skipIfNoNetwork() def test_npm_version_none(self): urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example'] - with self.assertRaises(bb.fetch2.MissingParameterError): + with self.assertRaises(bb.fetch.MissingParameterError): fetcher = bb.fetch.Fetch(urls, self.d) def create_shrinkwrap_file(self, data): @@ -3405,7 +3405,7 @@ class NPMTest(FetcherTest): }) self.d.setVar('BB_NO_NETWORK', '1') fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d) - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() @skipIfNoNpm() @@ -3466,7 +3466,7 @@ class NPMTest(FetcherTest): } }) fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d) - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher.download() # Fetch correctly to get a tarball swfile = self.create_shrinkwrap_file({ @@ -3634,7 +3634,7 @@ class GitTagVerificationTests(FetcherTest): def test_tag_rev_match4(self): # Test a url with SRCREV and rev= mismatching errors self.d.setVar('SRCREV', 'bade540fc31a1c26839efd2c7785a751ce24ebfb') - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d) @skipIfNoNetwork() @@ -3652,7 +3652,7 @@ class GitTagVerificationTests(FetcherTest): self.d.setVar('BB_GIT_SHALLOW', '1') fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.8.0"], self.d) fetcher.download() - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher.unpack(self.unpackdir) @skipIfNoNetwork() @@ -3661,7 +3661,7 @@ class GitTagVerificationTests(FetcherTest): self.d.setVar('SRCREV', '5b4e20377eea8d428edf1aeb2187c18f82ca6757') fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.8.0"], self.d) fetcher.download() - with self.assertRaises(bb.fetch2.FetchError): + with self.assertRaises(bb.fetch.FetchError): fetcher.unpack(self.unpackdir) @@ -3730,7 +3730,7 @@ class FetchPremirroronlyLocalTest(FetcherTest): self.make_git_repo() self.d.setVar("SRCREV", "0"*40) fetcher = bb.fetch.Fetch([self.recipe_url], self.d) - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() def test_mirror_commit_exists(self): @@ -3743,7 +3743,7 @@ class FetchPremirroronlyLocalTest(FetcherTest): def test_mirror_tarball_nonexistent(self): self.d.setVar("SRCREV", "0"*40) fetcher = bb.fetch.Fetch([self.recipe_url], self.d) - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() @@ -3784,7 +3784,7 @@ class FetchPremirroronlyNetworkTest(FetcherTest): ## Upstream commit not in the mirror self.d.setVar("SRCREV", "49d65d53c2bf558ae6e9185af0f3af7b79d255ec") fetcher = bb.fetch.Fetch([self.recipe_url], self.d) - with self.assertRaises(bb.fetch2.NetworkAccess): + with self.assertRaises(bb.fetch.NetworkAccess): fetcher.download() class FetchPremirroronlyMercurialTest(FetcherTest): @@ -3849,7 +3849,7 @@ class FetchPremirroronlyBrokenTarball(FetcherTest): def test_mirror_broken_download(self): self.d.setVar("SRCREV", "0"*40) fetcher = bb.fetch.Fetch([self.recipe_url], self.d) - with self.assertRaises(bb.fetch2.FetchError), self.assertLogs() as logs: + with self.assertRaises(bb.fetch.FetchError), self.assertLogs() as logs: fetcher.download() output = "".join(logs.output) self.assertFalse(" not a git repository (or any parent up to mount point /)" in output) @@ -3861,7 +3861,7 @@ class GoModTest(FetcherTest): urls = ['gomod://github.com/Azure/azure-sdk-for-go/sdk/storage/azblob;version=v1.0.0;' 'sha256sum=9bb69aea32f1d59711701f9562d66432c9c0374205e5009d1d1a62f03fb4fdad'] - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.zip') self.assertEqual(ud.parm['downloadfilename'], 'github.com.Azure.azure-sdk-for-go.sdk.storage.azblob@v1.0.0.zip') @@ -3880,7 +3880,7 @@ class GoModTest(FetcherTest): urls = ['gomod://github.com/Azure/azure-sdk-for-go/sdk/storage/azblob;version=v1.0.0;mod=1;' 'sha256sum=7873b8544842329b4f385a3aa6cf82cc2bc8defb41a04fa5291c35fd5900e873'] - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.mod') self.assertEqual(ud.parm['downloadfilename'], 'github.com.Azure.azure-sdk-for-go.sdk.storage.azblob@v1.0.0.mod') @@ -3896,7 +3896,7 @@ class GoModTest(FetcherTest): urls = ['gomod://gopkg.in/ini.v1;version=v1.67.0'] self.d.setVarFlag('SRC_URI', 'gopkg.in/ini.v1@v1.67.0.sha256sum', 'bd845dfc762a87a56e5a32a07770dc83e86976db7705d7f89c5dbafdc60b06c6') - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.url, 'https://proxy.golang.org/gopkg.in/ini.v1/%40v/v1.67.0.zip') self.assertEqual(ud.parm['downloadfilename'], 'gopkg.in.ini.v1@v1.67.0.zip') @@ -3915,7 +3915,7 @@ class GoModTest(FetcherTest): urls = ['gomod://gopkg.in/ini.v1;version=v1.67.0;' 'sha256sum=bd845dfc762a87a56e5a32a07770dc83e86976db7705d7f89c5dbafdc60b06c6'] - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.url, 'https://proxy.golang.org/gopkg.in/ini.v1/%40v/v1.67.0.zip') self.assertEqual(ud.parm['downloadfilename'], 'gopkg.in.ini.v1@v1.67.0.zip') @@ -3934,7 +3934,7 @@ class GoModTest(FetcherTest): urls = ['gomod://go.opencensus.io;version=v0.24.0;' 'sha256sum=203a767d7f8e7c1ebe5588220ad168d1e15b14ae70a636de7ca9a4a88a7e0d0c'] - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.url, 'https://proxy.golang.org/go.opencensus.io/%40v/v0.24.0.zip') self.assertEqual(ud.parm['downloadfilename'], 'go.opencensus.io@v0.24.0.zip') @@ -3956,7 +3956,7 @@ class GoModGitTest(FetcherTest): 'repo=go.googlesource.com/net;' 'srcrev=694cff8668bac64e0864b552bffc280cd27f21b1'] - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.host, 'go.googlesource.com') self.assertEqual(ud.path, '/net') @@ -3981,7 +3981,7 @@ class GoModGitTest(FetcherTest): 'repo=github.com/Azure/azure-sdk-for-go;subdir=sdk/storage/azblob;' 'srcrev=ec928e0ed34db682b3f783d3739d1c538142e0c3'] - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.host, 'github.com') self.assertEqual(ud.path, '/Azure/azure-sdk-for-go') @@ -4006,7 +4006,7 @@ class GoModGitTest(FetcherTest): urls = ['gomodgit://gopkg.in/ini.v1;version=v1.67.0'] self.d.setVar('SRCREV_gopkg.in/ini.v1@v1.67.0', 'b2f570e5b5b844226bbefe6fb521d891f529a951') - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.host, 'gopkg.in') self.assertEqual(ud.path, '/ini.v1') @@ -4028,7 +4028,7 @@ class GoModGitTest(FetcherTest): urls = ['gomodgit://gopkg.in/ini.v1;version=v1.67.0;' 'srcrev=b2f570e5b5b844226bbefe6fb521d891f529a951'] - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.host, 'gopkg.in') self.assertEqual(ud.path, '/ini.v1') @@ -4051,7 +4051,7 @@ class GoModGitTest(FetcherTest): 'repo=github.com/census-instrumentation/opencensus-go;' 'srcrev=b1a01ee95db0e690d91d7193d037447816fae4c5'] - fetcher = bb.fetch2.Fetch(urls, self.d) + fetcher = bb.fetch.Fetch(urls, self.d) ud = fetcher.ud[urls[0]] self.assertEqual(ud.host, 'github.com') self.assertEqual(ud.path, '/census-instrumentation/opencensus-go') @@ -4153,7 +4153,7 @@ class GitUnpackUpdateTest(FetcherTest): 4. Verify testfile.txt now contains 'updated content'. """ # First fetch at initial revision - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4165,7 +4165,7 @@ class GitUnpackUpdateTest(FetcherTest): # Update to new revision self.d.setVar('SRCREV', self.updated_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() # Use unpack_update @@ -4187,7 +4187,7 @@ class GitUnpackUpdateTest(FetcherTest): and its URL must be 'file://'. """ # First fetch - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() uri = self.d.getVar('SRC_URI') @@ -4225,7 +4225,7 @@ class GitUnpackUpdateTest(FetcherTest): so this test covers those scenarios implicitly. """ # Step 1 - fetch + unpack at initial_rev - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4248,7 +4248,7 @@ class GitUnpackUpdateTest(FetcherTest): # Step 3 - advance SRCREV and download; clonedir must now contain # updated_rev so that unpack_update can fetch it without network access. self.d.setVar('SRCREV', self.updated_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() ud = fetcher.ud[uri] @@ -4281,7 +4281,7 @@ class GitUnpackUpdateTest(FetcherTest): the working tree unchanged. No rebase should be attempted because the checkout already points at ud.revision. """ - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4308,7 +4308,7 @@ class GitUnpackUpdateTest(FetcherTest): untracked files untouched, so both the upstream update and the untracked file must be present after the call. """ - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4321,7 +4321,7 @@ class GitUnpackUpdateTest(FetcherTest): # Update to new upstream revision self.d.setVar('SRCREV', self.updated_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() uri = self.d.getVar('SRC_URI') @@ -4346,7 +4346,7 @@ class GitUnpackUpdateTest(FetcherTest): dirty index. The caller (bitbake-setup) is expected to catch the resulting LocalModificationsError and fall back to backup + re-fetch. """ - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4360,7 +4360,7 @@ class GitUnpackUpdateTest(FetcherTest): # Update to new upstream revision self.d.setVar('SRCREV', self.updated_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() uri = self.d.getVar('SRC_URI') @@ -4368,7 +4368,7 @@ class GitUnpackUpdateTest(FetcherTest): git_fetcher = ud.method # Should fail - git rebase refuses to run with a dirty index - with self.assertRaises(bb.fetch2.LocalModificationsError): + with self.assertRaises(bb.fetch.LocalModificationsError): git_fetcher.unpack_update(ud, self.unpackdir, self.d) def test_unpack_update_with_modified_tracked_file(self): @@ -4379,7 +4379,7 @@ class GitUnpackUpdateTest(FetcherTest): the caller can fall back to backup + re-fetch rather than silently discarding work in progress. """ - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4391,7 +4391,7 @@ class GitUnpackUpdateTest(FetcherTest): # Update to new upstream revision self.d.setVar('SRCREV', self.updated_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() uri = self.d.getVar('SRC_URI') @@ -4400,7 +4400,7 @@ class GitUnpackUpdateTest(FetcherTest): # Should fail - unstaged modification to tracked file is detected by # 'git status --untracked-files=no --porcelain' - with self.assertRaises(bb.fetch2.LocalModificationsError): + with self.assertRaises(bb.fetch.LocalModificationsError): git_fetcher.unpack_update(ud, self.unpackdir, self.d) def test_unpack_update_conflict_raises_rebase_error(self): @@ -4412,7 +4412,7 @@ class GitUnpackUpdateTest(FetcherTest): to a backup + re-fetch. """ # Fetch and unpack at the initial revision - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4433,7 +4433,7 @@ class GitUnpackUpdateTest(FetcherTest): # Update SRCREV to the new upstream commit self.d.setVar('SRCREV', conflict_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() uri = self.d.getVar('SRC_URI') @@ -4442,7 +4442,7 @@ class GitUnpackUpdateTest(FetcherTest): # unpack_update must fail and clean up (rebase --abort) rather than # leaving the repo in a mid-rebase state - with self.assertRaises(bb.fetch2.RebaseError): + with self.assertRaises(bb.fetch.RebaseError): git_fetcher.unpack_update(ud, self.unpackdir, self.d) # Verify the repo is not left in a conflicted / mid-rebase state @@ -4475,7 +4475,7 @@ class GitUnpackUpdateTest(FetcherTest): local file is untouched. """ # Fresh fetch + unpack at the current SRCREV - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4497,7 +4497,7 @@ class GitUnpackUpdateTest(FetcherTest): f.write('local untracked content\n') self.d.setVar('SRCREV', new_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() uri = self.d.getVar('SRC_URI') @@ -4505,7 +4505,7 @@ class GitUnpackUpdateTest(FetcherTest): git_fetcher = ud.method # git rebase refuses because the untracked file would be overwritten - with self.assertRaises(bb.fetch2.RebaseError): + with self.assertRaises(bb.fetch.RebaseError): git_fetcher.unpack_update(ud, self.unpackdir, self.d) # Repo must not be left in a mid-rebase state @@ -4543,7 +4543,7 @@ class GitUnpackUpdateTest(FetcherTest): self.d.setVar('BB_GENERATE_SHALLOW_TARBALLS', '1') # First fetch at initial revision - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() # Remove clonedir to force use of shallow tarball @@ -4555,7 +4555,7 @@ class GitUnpackUpdateTest(FetcherTest): # Update to new revision self.d.setVar('SRCREV', self.updated_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() # unpack_update should fail for shallow clones @@ -4563,7 +4563,7 @@ class GitUnpackUpdateTest(FetcherTest): ud = fetcher.ud[uri] git_fetcher = ud.method - with self.assertRaises(bb.fetch2.UnpackError) as context: + with self.assertRaises(bb.fetch.UnpackError) as context: git_fetcher.unpack_update(ud, self.unpackdir, self.d) self.assertIn("shallow clone", str(context.exception).lower()) @@ -4576,7 +4576,7 @@ class GitUnpackUpdateTest(FetcherTest): update_mode will fail with a FetchError which must be re-raised as UnpackError so the caller can fall back to a full re-fetch. """ - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4584,7 +4584,7 @@ class GitUnpackUpdateTest(FetcherTest): # Advance SRCREV to trigger update_mode self.d.setVar('SRCREV', self.updated_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() uri = self.d.getVar('SRC_URI') @@ -4597,7 +4597,7 @@ class GitUnpackUpdateTest(FetcherTest): cwd=unpack_path) git_fetcher = ud.method - with self.assertRaises(bb.fetch2.UnpackError): + with self.assertRaises(bb.fetch.UnpackError): git_fetcher.unpack_update(ud, self.unpackdir, self.d) def test_fetch_unpack_update_toplevel_api(self): @@ -4609,7 +4609,7 @@ class GitUnpackUpdateTest(FetcherTest): fetch again, then call fetcher.unpack_update(root) and confirm the content is updated. """ - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() fetcher.unpack(self.unpackdir) @@ -4618,7 +4618,7 @@ class GitUnpackUpdateTest(FetcherTest): self.assertEqual(f.read(), 'initial content\n') self.d.setVar('SRCREV', self.updated_rev) - fetcher = bb.fetch2.Fetch([self.d.getVar('SRC_URI')], self.d) + fetcher = bb.fetch.Fetch([self.d.getVar('SRC_URI')], self.d) fetcher.download() # Use the public Fetch.unpack_update() rather than the method directly diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py index 42385c879..9b9925e51 100644 --- a/lib/bb/tinfoil.py +++ b/lib/bb/tinfoil.py @@ -25,7 +25,7 @@ import bb.utils import bb.command import bb.remotedata from bb.main import setup_bitbake, BitBakeConfigParameters -import bb.fetch2 +import bb.fetch def wait_for(f): """ diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 37edd4353..22e3f13f9 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -2107,7 +2107,7 @@ def landlock_restrict_network(): def export_proxies(d): - from bb.fetch2 import get_fetcher_environment + from bb.fetch import get_fetcher_environment """ export common proxies variables from datastore to environment """ newenv = get_fetcher_environment(d) for v in newenv: From patchwork Thu Aug 27 14:29:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 96564 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4678C61DC4 for ; Thu, 27 Aug 2026 14:30:55 +0000 (UTC) Received: from SN4PR0501CU005.outbound.protection.outlook.com (SN4PR0501CU005.outbound.protection.outlook.com [40.93.194.18]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.37729.1787841052975873691 for ; Thu, 27 Aug 2026 07:30:53 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=ASRf965e; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.93.194.18, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=on2lLjd7SDkk67qhWgdgh3V0pdzOaaGGgYpZCBwk0HK2wbqbv3ZTf88qyWGPXGWlm0og8NNi7imCky7mheThwa0X9cUbXykBn6DQNxzne98XskNhWJhy2WLRL/0CCQpHyokeEXpJu9EMbI1Z5TZ/lsGZp5fTxIrYcNI9rImtxc3Q0KjB6jLJ8UUEuluqcCmndZTnYMAoZL8sFxkC2wTc06fv+TCLI4PlxK1MOrR4RID/WWjutwA4pbiZ6gZb3Ynm3BdxMByOaYCw7ynom0acKXBYoQmrfCZE7JdJ9gOpcN/sdlG/vrj9+0XSelwrxf2eZiYRB8rKRrpRH1XHYBtnqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=bdT16wZ1axm0KM4CPhizs+rYPQs/VCKEoDtCUYe9p2g=; b=VmNQxyS0ubWwIgJzjnmpQkM151M5p4kvhmCm6C0O8eHvnoNk1KELCree+F2+z61M41QNq1ForxbP3VKFZhyro/+h8Nwzn7g0qs1XvhdGRtzIF0S0+9CalYRfjcF8yULv+CLaOkIyhRGmB2d4+64DJ+a661CcwLpy2BkiN6XgEqc0fp92xzPM6w6dPMhYDCoVLmRqyhoK4L830cBDyS0FkKI/EKWoV8lvgyGqv4fEnjutrFsPCARMMiaD0wF2medjDHhze4UgxflS5Q3Si1Wky2NoYlfcK2u+QjGvnhLcM/HZXVil/JjOQmd8Uv9iZqbPZEDhVF4eIDI8VRqPJUa22Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.36) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bdT16wZ1axm0KM4CPhizs+rYPQs/VCKEoDtCUYe9p2g=; b=ASRf965eApgr+XT1xPxoQKIGBum0IB84i1W/1SLziEuG+0UxJM0lsXN9KBLgCZ2NTpq0IqJHp0vYXdgwEr/Q/v1KW5UXo32D3FGW0QFhi16yNHact7USgONcWAY36WejHCk171YqjtS50PVqUJhW1Tbi3pTtVGVuAxxEseBMPJIfqFccAK8v3ZMOuHVOKfWj/wHGrMK2CDkuKteUVBxkHi1I46jrHKhKxiZJ6XK6FumxVMwXJSDvk83c6Zxqbjgv+3Qc8wZQtdEzW56ArHbHdO/xfdg2G7Oy73NvS3JvDGn81ZBBtoxOMSeELja0N18Xf7lR1KJpMoXR3GpWcA4cbA== Received: from BN9PR03CA0574.namprd03.prod.outlook.com (2603:10b6:408:10d::9) by CH0PR12MB8530.namprd12.prod.outlook.com (2603:10b6:610:188::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.339.12; Thu, 27 Aug 2026 14:30:50 +0000 Received: from BN3PEPF0000B36D.namprd21.prod.outlook.com (2603:10b6:408:10d:cafe::95) by BN9PR03CA0574.outlook.office365.com (2603:10b6:408:10d::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.10 via Frontend Transport; Thu, 27 Aug 2026 14:30:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.36) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.36 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.36; helo=wpcosapexchedg5.windmz.agilent.com; pr=C Received: from wpcosapexchedg5.windmz.agilent.com (192.25.218.36) by BN3PEPF0000B36D.mail.protection.outlook.com (10.167.243.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.0 via Frontend Transport; Thu, 27 Aug 2026 14:30:49 +0000 Received: from laplante-B650.lfs.agilent.com (192.25.126.4) by edgeappmail.agilent.com (192.25.218.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Thu, 27 Aug 2026 08:30:14 -0600 From: To: CC: , Chris Laplante Subject: [PATCH 3/4] tests: add fetch_import tests to test bb.fetch2 => bb.fetch migration Date: Thu, 27 Aug 2026 10:29:57 -0400 Message-ID: <20260827142958.547182-3-chris.laplante@agilent.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260827142958.547182-1-chris.laplante@agilent.com> References: <20260827142958.547182-1-chris.laplante@agilent.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B36D:EE_|CH0PR12MB8530:EE_ X-MS-Office365-Filtering-Correlation-Id: 62ca6c27-768b-4139-c6f8-08df0447caaa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|376014|1800799024|23010399003|82310400026|10067099003|56012099006|11063799006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: /Y3QCG3vBxajTdkldjjvA76nkmBAC3COP24B42KRSfCvRucVCXXk5qVxSUoIE50Izum549k8fMeajGwtu92rA00JqHuvDlSxwhAp+0uvmK+8J98HE3JLe1eqXRzJCzyAM9EIHZ1oz7zqQD2BH1bFYGXk2u7CC7Q1KynteORwtvEXIyXwYfLqC2z8wqrctbsntnvHwurcQVP2kl4IXDbBtWLBjkFrLWHuxkVYc63u8fsvMIE+GhCa1e2T4F4gQvuxuIEzRLWRRtuj6TXHx4hpuJgXPfLAIRAqTWqhEXf6vx2FxMhBh9hCDK9BkIWW4t6b6T/dZVahPoZ0B0279fihZ0VjDHlCjnqE0P4jQM5hDsJxaHqFTs2/I+OL0vNfKMAD5LdQxx2KVpElbob193hnLuAnvMxbhLravcROGoOwFymDvSNdq2crzz1C373gpfVNL0batTHapnktM4hI+sSXvbKfFYtsbwMFKLEZI7yGzxGEWK1tKMzRmrjWeEHPAqvL3OuMw1mXFYplDGNmJBO4GXZ/tDFZLhF548wUHkdaMxC1jLWNqkmtM2RKkRX7ImIAhq0JWAIHXkNdhng1tc/7B3VmBi18ygFsp5q+fCp54cCO8Xhtd6qZiB4sGeHmv5ZDJ5ZwX4zxMNzTZRfYnBFQLO29Ve3ZbXx7POaCYHZgQBjBwykO3qqDv8XdfiB2umj/2+RYRJbDio2BRVRwtOL0AA== X-Forefront-Antispam-Report: CIP:192.25.218.36;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:wpcosapexchedg5.windmz.agilent.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(376014)(1800799024)(23010399003)(82310400026)(10067099003)(56012099006)(11063799006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Aj75D25SERE8GaYn07luZaoznm5ikNTT0/lzPKKglly/n5OJuUAPzDScwTUVUai9kNemWAW0uCSWvLtXNC0YhJ/hUji7AdfY7UhfCvzf+d/WSOBInrr9s0OIyClHzKetnigMJNqHkY+AuHYuwH44zL8WodLPfWOOe5jyw8SSME6X+fYk2Yvj+/+HAGC4APC+F32QFoaxBcmp54CaaxlFCefQdpxpw/LbVs+dPHbwYb6qBfO6ReozkC22L4qvn/swn7550OB51sAB6nqjZFO3kdTKaAXqUBEvBrcWQA5Qu8gYNo6TZchcSjUvpExf7N1+YCdJ8+9U82Nt7/SYaEamTkWWEbWtlhAjw/9UBbc3JuPfRRQVr5XaKYUe+T9H2I4LesRcTsOuR/6saiVzbI3RZMGwa1cqSuO3KDdSJNHXmjrTh1pWgCEI8eUJdiREsFur X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2026 14:30:49.7888 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62ca6c27-768b-4139-c6f8-08df0447caaa X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.36];Helo=[wpcosapexchedg5.windmz.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-BN3PEPF0000B36D.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8530 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 27 Aug 2026 14:30:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/20069 From: Chris Laplante Also tests that importing bb.fetch2 (instead of bb.fetch) results in a DeprecationWarning. AI-Generated: GPT-5.6 Sol Signed-off-by: Chris Laplante --- bin/bitbake-selftest | 1 + lib/bb/tests/fetch_import.py | 64 ++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 lib/bb/tests/fetch_import.py diff --git a/bin/bitbake-selftest b/bin/bitbake-selftest index 8ac0aeb5f..27791d2db 100755 --- a/bin/bitbake-selftest +++ b/bin/bitbake-selftest @@ -32,6 +32,7 @@ tests = ["bb.tests.codeparser", "bb.tests.data", "bb.tests.event", "bb.tests.fetch", + "bb.tests.fetch_import", "bb.tests.parse", "bb.tests.runqueue", "bb.tests.setup", diff --git a/lib/bb/tests/fetch_import.py b/lib/bb/tests/fetch_import.py new file mode 100644 index 000000000..3c44a1b3a --- /dev/null +++ b/lib/bb/tests/fetch_import.py @@ -0,0 +1,64 @@ +# +# Copyright (C) 2026 Agilent Technologies, Inc. +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import os +import subprocess +import sys +import unittest + + +class FetchImportTests(unittest.TestCase): + def run_python(self, code): + env = os.environ.copy() + libdir = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..")) + env["PYTHONPATH"] = os.pathsep.join(filter(None, (libdir, env.get("PYTHONPATH")))) + result = subprocess.run( + [sys.executable, "-c", code], + env=env, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + ) + self.assertEqual(result.returncode, 0, result.stderr) + + def test_fetch_is_lazy(self): + self.run_python(""" +import sys +import bb + +assert "bb.fetch" not in sys.modules +assert "bb.fetch2" not in sys.modules +""") + + def test_fetch_import(self): + self.run_python(""" +import sys +import bb.fetch +from bb.fetch import Fetch + +assert sys.modules["bb.fetch"] is bb.fetch +assert Fetch is bb.fetch.Fetch +""") + + def test_fetch2_import_compatibility(self): + self.run_python(""" +import sys +import warnings + +with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + import bb.fetch2 + from bb.fetch2 import Fetch + +assert len(caught) == 1 +assert caught[0].category is DeprecationWarning +assert str(caught[0].message) == "bb.fetch2 is deprecated; use bb.fetch instead" +assert caught[0].filename == "" + +assert bb.fetch2 is bb.fetch +assert sys.modules["bb.fetch2"] is bb.fetch +assert Fetch is bb.fetch.Fetch +""") \ No newline at end of file From patchwork Thu Aug 27 14:29:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 96566 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E063C61DC4 for ; Thu, 27 Aug 2026 14:31:06 +0000 (UTC) Received: from PH0PR06CU001.outbound.protection.outlook.com (PH0PR06CU001.outbound.protection.outlook.com [40.107.208.5]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.37732.1787841059878662804 for ; Thu, 27 Aug 2026 07:31:00 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=hVqMp1b+; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.107.208.5, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BBpaZutQ0LHyBOF2YtEoKKgf8bUKRpO+7QtL3hOmrszfbe4VPLyA7Wf94wk/zWNKD2ljgaOV/gGlHd27mQLEZD6OG2AJiez5/gFEaqtFyCZMORV8tQimm6zVfs5UfHtWALi8dctmS/D7T4Ea0YysCsX3OHsNFeOm0RO3Yq1RREiy/8X1Q3zbsLJW0ZTcGD7g/FiGyRtaWUDlomTD49KTsYE0cLvSebuIz89X4fFK82uOMpvqHzvuQjek2ObX6e6dxVEz8sgpVFQchAdjLqqEZElmpflyLHXdmiBDYeaNo4j9NB3JkL7ek7IG539wJuYrZH6Xie4dwnhP03EVE9qmHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WL6enQx4yHW69uaoNOsgoLooKCrgKEj3A1s4K2Y/9R0=; b=qVSGOziLhml8qc2gcV8MOuNaM0ANoiV0gH2aTA+YK+VKr1qcrsAffSz0RbsjsxjaAiXeeXPaxexqn51Yx1rRNCP5kmBBO/0ESZfdCJlvEEPrwf50P5fI1dugW3Vs43abElUO5O1OPm+t1hK9PC55LhDPhwWKvGql+wHr4j6FvVjcLCj/vlt38eh4Vztk8Ci+Esz1otfKyGas07qM1wnUhG2Q4bd59F5hG2qNGvbE1+goIVMqAUUy6TUngHWAMHLs4HhgJ4UwfpD88AwYvss97xgV2q5E+J7poBUOgRgcXOMYw53XLG8m1LsNIGT/1sBmAe7exEsF1myq8rgGCzL+VA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.36) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WL6enQx4yHW69uaoNOsgoLooKCrgKEj3A1s4K2Y/9R0=; b=hVqMp1b+dzYgMJCQPOaqF62BBgYC2iuI+7zelN4unueOv8kMesW7V6K06XDmhPWNdNjGn+bYljXYQBZqnguR446AwSBfS/24+IEm0p6tjCBAR8OnLu7yrJ0+bo5snstVe3qS3MWsXsNtzK2pKbOchXnIcZiKIg4pBL4MD1jC/zktsqJlc1bsoR9qoGgK1IPG5uoIAxK7NMHLuRcm8SIJ5SrIFCAsQwGzFOgjugGroje07hXxJEBR6fCXsu6NThS6DjueF7TnCVJuHzZtvEjKJg/x4U86Ibu6Nohyuv/B/GTsGNvtJEfLjkZ+Srs0bx5rVtKc9DyomA10QrePXH/HjQ== Received: from BN9PR03CA0599.namprd03.prod.outlook.com (2603:10b6:408:10d::34) by SJ2PR12MB8009.namprd12.prod.outlook.com (2603:10b6:a03:4c7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.10; Thu, 27 Aug 2026 14:30:50 +0000 Received: from BN3PEPF0000B36D.namprd21.prod.outlook.com (2603:10b6:408:10d:cafe::81) by BN9PR03CA0599.outlook.office365.com (2603:10b6:408:10d::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.10 via Frontend Transport; Thu, 27 Aug 2026 14:30:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.36) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.36 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.36; helo=wpcosapexchedg5.windmz.agilent.com; pr=C Received: from wpcosapexchedg5.windmz.agilent.com (192.25.218.36) by BN3PEPF0000B36D.mail.protection.outlook.com (10.167.243.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.0 via Frontend Transport; Thu, 27 Aug 2026 14:30:50 +0000 Received: from laplante-B650.lfs.agilent.com (192.25.126.4) by edgeappmail.agilent.com (192.25.218.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.41; Thu, 27 Aug 2026 08:30:15 -0600 From: To: CC: , Chris Laplante Subject: [PATCH 4/4] doc: update manual to reflect bb.fetch2 => bb.fetch migration Date: Thu, 27 Aug 2026 10:29:58 -0400 Message-ID: <20260827142958.547182-4-chris.laplante@agilent.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260827142958.547182-1-chris.laplante@agilent.com> References: <20260827142958.547182-1-chris.laplante@agilent.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PEPF0000B36D:EE_|SJ2PR12MB8009:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e7405bd-b661-458d-3144-08df0447cb15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|82310400026|376014|36860700016|1800799024|10067099003|6133799003|11063799006|56012099006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: QUzy1518i+SyFeUv9gx3oz1wuWbpaVGZsXHQgzeCqiUlhCqYoIMRoKabj/0MbLX5Z/jGZqh5NJU6wmef1V9tGtPFMOj7qbGCpb3KiO0BcEbKtULcWCUjrnTcbheSdXJC53hhzM1mVK81ILdNMTtQtVI2poT4SgoDeRpR2UiE4TLnZFGiFgIzNY02T2eND09L3Mms0wpaS/ROgs59M9wjrWo8Gu27vQODwQIm7iKCYn/vFwfuJocQfb7w7RMw+JL7dGgVA6Zt20ESPygtexR4AperdyYk/1EgDRO5ixROIPfWPT4w4XkRbPmstIDNa4o6wQXBz9j61JCb+Kg8RvnfgupPFSqE6dj/92FjXhCAyNb5bypz2UYOYjJRCPk/q3wpch9dlyFyp8kQw7tYC99JZ05WCRYXer80ntblQjHo9ZtNel2d1TG6Yy2umkTh3Kr6GruzDOUw91x0DZ8JxicMo/YkiFeqbVPW5o27vY+Pazko0oAkB9dWNOpyqbvlnewD5Hr2Q3MSIK4n/cRCU6V5lEnYwCk5nn9TiAVN18HZMlK6S5bbdnzX2Um7EPo3frUAc+MZW0ZgcIzBtMhObZj9vJ/kCTiozi0En0WXkIqIUKjSpJQxPWQxlYCHM7JFFMY9KqS+Bu+hzql9+Rmjbk8VsGRShi2Sh2n06yOA/Y1/I/lLbL5GGMPu14gv5BEgMgW0Utfr8GJwjjPS3310v982CA== X-Forefront-Antispam-Report: CIP:192.25.218.36;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:wpcosapexchedg5.windmz.agilent.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(23010399003)(82310400026)(376014)(36860700016)(1800799024)(10067099003)(6133799003)(11063799006)(56012099006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: df6owNE3o1TuOtyRN47bogPOv30NaWEJW9q8+lI37+W086Wvf4P8QdYjvCz8nxJ0fwYz3Of09II7e77rYN1J+0NbPMZx9ue+k9wzNwf5WvJg5KIAKKDzldNp2zWNZ8tLOw7uA9cb/+HU7NyMGtathmMBgOm4+RXvOIPCUKFfNpQhN37A+AhSErh75BcEt39xdj1K72BxIGvzO6V70KQXwznp0BcCLe80C3ELcXnyTe2DdiGSw9pmRlnCG0sCkjMWyuJCUKz2x6EXswzrAW/jbvWp36JNwHnH9+70HjAwMGdQANobzR0Mp723Q17bF6oG6j3LK5/zxSbnviLsbuGgm9b5Qk/ooGKaYAE+slmXxoq1srO0i4R1Fekv+ImllmbJw5Cls+LiZFbt5TUu7S7MMJ/XRzzn6dzhoaHyhIaYz5vcfSiVtijicd+l+muVsdQS X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2026 14:30:50.4877 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5e7405bd-b661-458d-3144-08df0447cb15 X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.36];Helo=[wpcosapexchedg5.windmz.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-BN3PEPF0000B36D.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8009 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 27 Aug 2026 14:31:06 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/20071 From: Chris Laplante AI-Generated: GPT-5.6 Sol Signed-off-by: Chris Laplante --- .../bitbake-user-manual-fetching.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst index b96018a4e..d326403fa 100644 --- a/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst +++ b/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst @@ -11,10 +11,11 @@ with the intricacies of downloading source code and files from remote systems. Fetching source code is one of the cornerstones of building software. As such, this module forms an important part of BitBake. -The current fetch module is called "fetch2" and refers to the fact that -it is the second major version of the API. The original version is -obsolete and has been removed from the codebase. Thus, in all cases, -"fetch" refers to "fetch2" in this manual. +The fetch module was previously called ``fetch2`` to distinguish the second +major version of the API from the original version, which is obsolete and has +been removed from the codebase. The module has since been renamed back to +``fetch``. Existing code using ``bb.fetch2`` remains supported by a +compatibility alias, but new code should use ``bb.fetch``. The Download (Fetch) ==================== @@ -30,7 +31,7 @@ The code to execute the first part of this process, a fetch, looks something like the following:: src_uri = (d.getVar('SRC_URI') or "").split() - fetcher = bb.fetch2.Fetch(src_uri, d) + fetcher = bb.fetch.Fetch(src_uri, d) fetcher.download() This code sets up an instance of the fetch class. The instance uses a