* [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch
@ 2026-08-27 14:29 chris.laplante
2026-08-27 14:29 ` [PATCH 2/4] bin, lib, conf: use bb.fetch instead of bb.fetch2 chris.laplante
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: chris.laplante @ 2026-08-27 14:29 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, Chris Laplante
From: Chris Laplante <chris.laplante@agilent.com>
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 <chris.laplante@agilent.com>
---
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 <armccurdy@gmail.com>
#
-# 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 <olof.johansson@axis.com>
#
-# 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
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] bin, lib, conf: use bb.fetch instead of bb.fetch2
2026-08-27 14:29 [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch chris.laplante
@ 2026-08-27 14:29 ` chris.laplante
2026-08-27 14:29 ` [PATCH 3/4] tests: add fetch_import tests to test bb.fetch2 => bb.fetch migration chris.laplante
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: chris.laplante @ 2026-08-27 14:29 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, Chris Laplante
From: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
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://<ud.clonedir>'.
"""
# 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:
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] tests: add fetch_import tests to test bb.fetch2 => bb.fetch migration
2026-08-27 14:29 [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch chris.laplante
2026-08-27 14:29 ` [PATCH 2/4] bin, lib, conf: use bb.fetch instead of bb.fetch2 chris.laplante
@ 2026-08-27 14:29 ` chris.laplante
2026-08-27 14:29 ` [PATCH 4/4] doc: update manual to reflect " chris.laplante
2026-08-28 5:51 ` [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch Mathieu Dubois-Briand
3 siblings, 0 replies; 9+ messages in thread
From: chris.laplante @ 2026-08-27 14:29 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, Chris Laplante
From: Chris Laplante <chris.laplante@agilent.com>
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 <chris.laplante@agilent.com>
---
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 == "<string>"
+
+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
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] doc: update manual to reflect bb.fetch2 => bb.fetch migration
2026-08-27 14:29 [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch chris.laplante
2026-08-27 14:29 ` [PATCH 2/4] bin, lib, conf: use bb.fetch instead of bb.fetch2 chris.laplante
2026-08-27 14:29 ` [PATCH 3/4] tests: add fetch_import tests to test bb.fetch2 => bb.fetch migration chris.laplante
@ 2026-08-27 14:29 ` chris.laplante
2026-08-28 5:51 ` [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch Mathieu Dubois-Briand
3 siblings, 0 replies; 9+ messages in thread
From: chris.laplante @ 2026-08-27 14:29 UTC (permalink / raw)
To: bitbake-devel; +Cc: docs, Chris Laplante
From: Chris Laplante <chris.laplante@agilent.com>
AI-Generated: GPT-5.6 Sol
Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
.../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
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch
2026-08-27 14:29 [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch chris.laplante
` (2 preceding siblings ...)
2026-08-27 14:29 ` [PATCH 4/4] doc: update manual to reflect " chris.laplante
@ 2026-08-28 5:51 ` Mathieu Dubois-Briand
2026-08-28 12:00 ` [bitbake-devel] " Peter Kjellerstedt
3 siblings, 1 reply; 9+ messages in thread
From: Mathieu Dubois-Briand @ 2026-08-28 5:51 UTC (permalink / raw)
To: chris.laplante, bitbake-devel; +Cc: docs
On Thu Aug 27, 2026 at 4:29 PM CEST, Chris Laplante via lists.yoctoproject.org wrote:
> From: Chris Laplante <chris.laplante@agilent.com>
>
> 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 <chris.laplante@agilent.com>
> ---
Hi Chris,
I suspect some renaming is missing on the oecore side. We have this
error on all builds:
Running '. ./init-build-env; bitbake world -k' with output to /srv/pokybuild/yocto-worker/qemux86-world-alt/build/build/command-1-build-targets.log in /srv/pokybuild/yocto-worker/qemux86-world-alt/build/build
ERROR: Execution of event handler 'check_sanity_eventhandler' failed
Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/qemux86-world-alt/build/layers/openembedded-core/meta/classes-global/sanity.bbclass", line 169, in check_sanity_eventhandler
oe.sanity.check_sanity(sanity_data)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/qemux86-world-alt/build/layers/openembedded-core/meta/lib/oe/sanity.py", line 1007, in check_sanity
check_sanity_everybuild(status, sanity_data)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/qemux86-world-alt/build/layers/openembedded-core/meta/lib/oe/sanity.py", line 890, in check_sanity_everybuild
decoded = bb.fetch2.decodeurl(pattern)
^^^^^^^^^
AttributeError: module 'bb' has no attribute 'fetch2'. Did you mean: 'fetch'?
https://autobuilder.yoctoproject.org/valkyrie/#/builders/17/builds/4359
Can you have a look at the issue?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [bitbake-devel] [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch
2026-08-28 5:51 ` [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch Mathieu Dubois-Briand
@ 2026-08-28 12:00 ` Peter Kjellerstedt
2026-08-28 14:37 ` chris.laplante
0 siblings, 1 reply; 9+ messages in thread
From: Peter Kjellerstedt @ 2026-08-28 12:00 UTC (permalink / raw)
To: mathieu.dubois-briand@bootlin.com, chris.laplante@agilent.com,
bitbake-devel@lists.openembedded.org
Cc: docs@lists.yoctoproject.org
> -----Original Message-----
> From: bitbake-devel@lists.openembedded.org <bitbake-devel@lists.openembedded.org> On Behalf Of Mathieu Dubois-Briand via lists.openembedded.org
> Sent: den 28 augusti 2026 07:52
> To: chris.laplante@agilent.com; bitbake-devel@lists.openembedded.org
> Cc: docs@lists.yoctoproject.org
> Subject: Re: [bitbake-devel] [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch
>
> On Thu Aug 27, 2026 at 4:29 PM CEST, Chris Laplante via lists.yoctoproject.org wrote:
> > From: Chris Laplante <chris.laplante@agilent.com>
> >
> > 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 <chris.laplante@agilent.com>
> > ---
>
> Hi Chris,
>
> I suspect some renaming is missing on the oecore side. We have this
> error on all builds:
>
> Running '. ./init-build-env; bitbake world -k' with output to /srv/pokybuild/yocto-worker/qemux86-world-alt/build/build/command-1-build-targets.log in /srv/pokybuild/yocto-worker/qemux86-world-alt/build/build
> ERROR: Execution of event handler 'check_sanity_eventhandler' failed
> Traceback (most recent call last):
> File "/srv/pokybuild/yocto-worker/qemux86-world-alt/build/layers/openembedded-core/meta/classes-global/sanity.bbclass", line 169, in check_sanity_eventhandler
> oe.sanity.check_sanity(sanity_data)
> ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
> File "/srv/pokybuild/yocto-worker/qemux86-world-alt/build/layers/openembedded-core/meta/lib/oe/sanity.py", line 1007, in check_sanity
> check_sanity_everybuild(status, sanity_data)
> ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
> File "/srv/pokybuild/yocto-worker/qemux86-world-alt/build/layers/openembedded-core/meta/lib/oe/sanity.py", line 890, in check_sanity_everybuild
> decoded = bb.fetch2.decodeurl(pattern)
> ^^^^^^^^^
> AttributeError: module 'bb' has no attribute 'fetch2'. Did you mean:
> 'fetch'?
>
> https://autobuilder.yoctoproject.org/valkyrie/#/builders/17/builds/4359
>
> Can you have a look at the issue?
>
> Thanks,
> Mathieu
>
> --
> Mathieu Dubois-Briand, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
Isn't the bb.fetch2 shim expected to take care of that?
//Peter
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [bitbake-devel] [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch
2026-08-28 12:00 ` [bitbake-devel] " Peter Kjellerstedt
@ 2026-08-28 14:37 ` chris.laplante
2026-08-28 14:45 ` chris.laplante
0 siblings, 1 reply; 9+ messages in thread
From: chris.laplante @ 2026-08-28 14:37 UTC (permalink / raw)
To: Peter Kjellerstedt, mathieu.dubois-briand@bootlin.com,
bitbake-devel@lists.openembedded.org
Cc: docs@lists.yoctoproject.org
> > File "/srv/pokybuild/yocto-worker/qemux86-world-
> alt/build/layers/openembedded-core/meta/lib/oe/sanity.py", line 890, in
> check_sanity_everybuild
> > decoded = bb.fetch2.decodeurl(pattern)
> > ^^^^^^^^^
> > AttributeError: module 'bb' has no attribute 'fetch2'. Did you mean:
> > 'fetch'?
> >
> > https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fauto
> > builder.yoctoproject.org%2Fvalkyrie%2F%23%2Fbuilders%2F17%2Fbuilds%2F4
> >
> 359&data=05%7C02%7Cchris.laplante%40agilent.com%7Cdad5794551c641d9d
> d69
> >
> 08df04fc0645%7Ca9c0bc098b46420693512ba12fb4a5c0%7C0%7C0%7C639235
> 152676
> >
> 411590%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLj
> AuMDA
> >
> wMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C
> &sda
> > ta=LIOLbRmNl9Dm8MudX%2FGHLYKh6e4FoZrOByT9621lIn0%3D&reserved=0
> >
> > Can you have a look at the issue?
> >
> > Thanks,
> > Mathieu
> >
> > --
> > Mathieu Dubois-Briand, Bootlin
> > Embedded Linux and Kernel engineering
> > https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fboot
> >
> lin.com%2F&data=05%7C02%7Cchris.laplante%40agilent.com%7Cdad5794551c
> 64
> >
> 1d9dd6908df04fc0645%7Ca9c0bc098b46420693512ba12fb4a5c0%7C0%7C0%7
> C63923
> >
> 5152676440948%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsI
> lYiOiIw
> >
> LjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C
> %7C
> >
> %7C&sdata=NM5g2OmqXtTBYvIZEK%2BZhXJEgw3kUdwosF6Ptn8heOo%3D&rese
> rved=0
>
> Isn't the bb.fetch2 shim expected to take care of that?
Yes, this is what the shim is for. With the full patchset applied things should work (TM).
Thanks,
Chris
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [bitbake-devel] [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch
2026-08-28 14:37 ` chris.laplante
@ 2026-08-28 14:45 ` chris.laplante
2026-08-28 14:59 ` chris.laplante
0 siblings, 1 reply; 9+ messages in thread
From: chris.laplante @ 2026-08-28 14:45 UTC (permalink / raw)
To: Peter Kjellerstedt, mathieu.dubois-briand@bootlin.com,
bitbake-devel@lists.openembedded.org
Cc: docs@lists.yoctoproject.org
> %7C&sdata=NM5g2OmqXtTBYvIZEK%2BZhXJEgw3kUdwosF6Ptn8heOo%3D&rese
> > rved=0
> >
> > Isn't the bb.fetch2 shim expected to take care of that?
>
> Yes, this is what the shim is for. With the full patchset applied things should
> work (TM).
I take that back, the shim should already be in place as of this patch :(. I will investigate.
Thanks,
Chris
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [bitbake-devel] [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch
2026-08-28 14:45 ` chris.laplante
@ 2026-08-28 14:59 ` chris.laplante
0 siblings, 0 replies; 9+ messages in thread
From: chris.laplante @ 2026-08-28 14:59 UTC (permalink / raw)
To: Peter Kjellerstedt, mathieu.dubois-briand@bootlin.com,
bitbake-devel@lists.openembedded.org
Cc: docs@lists.yoctoproject.org
> >
> %7C&sdata=NM5g2OmqXtTBYvIZEK%2BZhXJEgw3kUdwosF6Ptn8heOo%3D&rese
> > > rved=0
> > >
> > > Isn't the bb.fetch2 shim expected to take care of that?
> >
> > Yes, this is what the shim is for. With the full patchset applied
> > things should work (TM).
>
> I take that back, the shim should already be in place as of this patch :(. I will
> investigate.
I see the issue. Nothing in sanity.py imports bb.fetch2 (or even bb for that matter), so it's relying on transitive imports and also the fact that the old shim inserted 'fetch2' and 'fetch' into 'bb' as essentially attributes.
The short-term fix is to just add a __getattr__ to __init__.py that lazily makes fetch2 available. Then we can work on manually fixing up things to actually import bb.fetch, rather than relying on transitive imports. I'll submit a v2.
Thanks,
Chris
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-08-28 14:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 14:29 [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch chris.laplante
2026-08-27 14:29 ` [PATCH 2/4] bin, lib, conf: use bb.fetch instead of bb.fetch2 chris.laplante
2026-08-27 14:29 ` [PATCH 3/4] tests: add fetch_import tests to test bb.fetch2 => bb.fetch migration chris.laplante
2026-08-27 14:29 ` [PATCH 4/4] doc: update manual to reflect " chris.laplante
2026-08-28 5:51 ` [docs] [PATCH 1/4] lib: rename fetch2 as fetch; invert compat shim to make bb.fetch2 = bb.fetch Mathieu Dubois-Briand
2026-08-28 12:00 ` [bitbake-devel] " Peter Kjellerstedt
2026-08-28 14:37 ` chris.laplante
2026-08-28 14:45 ` chris.laplante
2026-08-28 14:59 ` chris.laplante
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.