diff mbox series

[2/3] lib: use bb.fetch2, not bb.fetch

Message ID 20260821170624.436725-3-chris.laplante@agilent.com
State New
Headers show
Series Remove bb.fetch compatibility shim module | expand

Commit Message

chris.laplante@agilent.com Aug. 21, 2026, 5:06 p.m. UTC
From: Chris Laplante <chris.laplante@agilent.com>

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/command.py         |   2 +-
 lib/bb/cooker.py          |   6 +-
 lib/bb/cookerdata.py      |   2 +-
 lib/bb/fetch2/gitannex.py |   8 +-
 lib/bb/fetch2/wget.py     |   6 +-
 lib/bb/tests/fetch.py     | 244 +++++++++++++++++++-------------------
 6 files changed, 134 insertions(+), 134 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/command.py b/lib/bb/command.py
index 1b16884fa..953d546a4 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -765,7 +765,7 @@  class CommandsAsync:
         """
         Parse the .bb files
         """
-        if bb.fetch.fetcher_compare_revisions(command.cooker.data):
+        if bb.fetch2.fetcher_compare_revisions(command.cooker.data):
             command.finishAsyncCommand(code=1)
         else:
             command.finishAsyncCommand()
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 0321478d3..94452027e 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1310,7 +1310,7 @@  You can also remove the BB_HASHSERVE_UPSTREAM setting, but this may result in si
         file associated with a recipe might have been modified by the user).
         """
         build.reset_cache()
-        bb.fetch._checksum_cache.mtime_cache.clear()
+        bb.fetch2._checksum_cache.mtime_cache.clear()
         siggen_cache = getattr(bb.parse.siggen, 'checksum_cache', None)
         if siggen_cache:
             bb.parse.siggen.checksum_cache.mtime_cache.clear()
@@ -2092,7 +2092,7 @@  class Parser(multiprocessing.Process):
         signal.signal(signal.SIGINT, self.catch_sig)
         bb.utils.set_process_name(multiprocessing.current_process().name)
         multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, exitpriority=1)
-        multiprocessing.util.Finalize(None, bb.fetch.fetcher_parse_save, exitpriority=1)
+        multiprocessing.util.Finalize(None, bb.fetch2.fetcher_parse_save, exitpriority=1)
 
         pending = []
         havejobs = True
@@ -2286,7 +2286,7 @@  class CookerParser(object):
         bb.codeparser.parser_cache_save()
         bb.codeparser.parser_cache_savemerge()
         bb.cache.SiggenRecipeInfo.reset()
-        bb.fetch.fetcher_parse_done()
+        bb.fetch2.fetcher_parse_done()
         if self.cooker.configuration.profile:
             profiles = []
             for i in self.process_names:
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index 59f808c96..c5fcd71be 100644
--- a/lib/bb/cookerdata.py
+++ b/lib/bb/cookerdata.py
@@ -277,7 +277,7 @@  class CookerDataBuilder(object):
             self.data = self.parseConfigurationFiles(self.prefiles, self.postfiles)
 
             servercontext = self.data.getVar("BB_WORKERCONTEXT", False) is None and not worker
-            bb.fetch.fetcher_init(self.data, servercontext)
+            bb.fetch2.fetcher_init(self.data, servercontext)
             bb.parse.init_parser(self.data)
 
             bb.event.fire(bb.event.ConfigParsed(), self.data)
diff --git a/lib/bb/fetch2/gitannex.py b/lib/bb/fetch2/gitannex.py
index c378cc36d..faac23d58 100644
--- a/lib/bb/fetch2/gitannex.py
+++ b/lib/bb/fetch2/gitannex.py
@@ -29,7 +29,7 @@  class GitANNEX(Git):
             try:
                 runfetchcmd(ud.basecmd + ['rev-list', 'git-annex'], d, quiet=True, workdir=wd)
                 return True
-            except bb.fetch.FetchError:
+            except bb.fetch2.FetchError:
                 pass
 
         return False
@@ -37,7 +37,7 @@  class GitANNEX(Git):
     def update_annex(self, ud, d, wd):
         try:
             runfetchcmd(ud.basecmd + ['annex', 'get', '--all'], d, quiet=True, workdir=wd)
-        except bb.fetch.FetchError:
+        except bb.fetch2.FetchError:
             return False
         runfetchcmd(['chmod', 'u+w', '-R', '%s/annex' % ud.clonedir], d, quiet=True, workdir=wd)
 
@@ -55,7 +55,7 @@  class GitANNEX(Git):
 
         try:
             runfetchcmd(ud.basecmd + ['annex', 'init'], d, workdir=dest)
-        except bb.fetch.FetchError:
+        except bb.fetch2.FetchError:
             pass
 
         if self.uses_annex(ud, d, dest):
@@ -67,7 +67,7 @@  class GitANNEX(Git):
 
         try:
             runfetchcmd(ud.basecmd + ['annex' ,'init'], d, workdir=ud.destdir)
-        except bb.fetch.FetchError:
+        except bb.fetch2.FetchError:
             pass
 
         annex = self.uses_annex(ud, d, ud.destdir)
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 0d2b7f5c8..9cb021419 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -632,7 +632,7 @@  class Wget(FetchMethod):
         else:
             version_dir[1] = dirver
 
-        dirs_uri = bb.fetch.encodeurl([ud.type, ud.host,
+        dirs_uri = bb.fetch2.encodeurl([ud.type, ud.host,
                 ud.path.split(dirver)[0], ud.user, ud.pswd, {}])
         bb.debug(3, "DirURL: %s, %s" % (dirs_uri, package))
 
@@ -658,7 +658,7 @@  class Wget(FetchMethod):
                     dirver_new = spfx + sver
                     path = ud.path.replace(dirver, dirver_new, True) \
                         .split(package)[0]
-                    uri = bb.fetch.encodeurl([ud.type, ud.host, path,
+                    uri = bb.fetch2.encodeurl([ud.type, ud.host, path,
                         ud.user, ud.pswd, {}])
 
                     pupver = self._check_latest_version(uri,
@@ -765,7 +765,7 @@  class Wget(FetchMethod):
                     return (self._check_latest_version_by_dir(dirver,
                         package, package_regex, current_version, ud, d, filter_regex), '')
 
-            uri = bb.fetch.encodeurl([ud.type, ud.host, path, ud.user, ud.pswd, {}])
+            uri = bb.fetch2.encodeurl([ud.type, ud.host, path, ud.user, ud.pswd, {}])
         else:
             uri = regex_uri
 
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index a1e4b45f8..c0b2f155a 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -518,28 +518,28 @@  class MirrorUriTest(FetcherTest):
     def test_urireplace(self):
         self.d.setVar("FILESPATH", ".")
         for k, v in self.replaceuris.items():
-            ud = bb.fetch.FetchData(k[0], self.d)
+            ud = bb.fetch2.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)
             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)
+        fetcher = bb.fetch2.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)
         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)
+        fetcher = bb.fetch2.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)
         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)
+        fetcher = bb.fetch2.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)
         self.assertEqual(uris, ['svn://svn.server2.com/isource/svnroot/reponame/tags/tagname;module=path_in_tagnamefolder;protocol=https;rev=2'])
@@ -548,7 +548,7 @@  class MirrorUriTest(FetcherTest):
         # Test if mirror of a mirror works
         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)
+        fetcher = bb.fetch2.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)
         self.assertEqual(uris, ['file:///somepath/downloads/bitbake-1.0.tar.gz',
@@ -560,7 +560,7 @@  class MirrorUriTest(FetcherTest):
                    "https://.*/[^/]*    https://bbbb/B/B/B/"
 
     def test_recursive(self):
-        fetcher = bb.fetch.FetchData("https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", self.d)
+        fetcher = bb.fetch2.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)
         self.assertEqual(uris, ['http://aaaa/A/A/A/bitbake/bitbake-1.0.tar.gz',
@@ -584,7 +584,7 @@  class GitDownloadDirectoryNamingTest(FetcherTest):
     @skipIfNoNetwork()
     def test_that_directory_is_named_after_recipe_url_when_no_mirroring_is_used(self):
         self.setup_mirror_rewrite()
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
 
@@ -594,7 +594,7 @@  class GitDownloadDirectoryNamingTest(FetcherTest):
     @skipIfNoNetwork()
     def test_that_directory_exists_for_mirrored_url_and_recipe_url_when_mirroring_is_used(self):
         self.setup_mirror_rewrite()
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
 
@@ -605,9 +605,9 @@  class GitDownloadDirectoryNamingTest(FetcherTest):
     @skipIfNoNetwork()
     def test_that_recipe_directory_and_mirrored_directory_exists_when_mirroring_is_used_and_the_mirrored_directory_already_exists(self):
         self.setup_mirror_rewrite()
-        fetcher = bb.fetch.Fetch([self.mirror_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.mirror_url], self.d)
         fetcher.download()
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
 
@@ -632,7 +632,7 @@  class TarballNamingTest(FetcherTest):
 
     @skipIfNoNetwork()
     def test_that_the_recipe_tarball_is_created_when_no_mirroring_is_used(self):
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
 
@@ -642,7 +642,7 @@  class TarballNamingTest(FetcherTest):
     @skipIfNoNetwork()
     def test_that_the_mirror_tarball_is_created_when_mirroring_is_used(self):
         self.setup_mirror_rewrite()
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
 
@@ -667,7 +667,7 @@  class GitShallowTarballNamingTest(FetcherTest):
 
     @skipIfNoNetwork()
     def test_that_the_tarball_is_named_after_recipe_url_when_no_mirroring_is_used(self):
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
 
@@ -677,7 +677,7 @@  class GitShallowTarballNamingTest(FetcherTest):
     @skipIfNoNetwork()
     def test_that_the_mirror_tarball_is_created_when_mirroring_is_used(self):
         self.setup_mirror_rewrite()
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
 
@@ -696,7 +696,7 @@  class CleanTarballTest(FetcherTest):
 
     @skipIfNoNetwork()
     def test_that_the_tarball_contents_does_not_leak_info(self):
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
 
@@ -770,7 +770,7 @@  class FetcherLocalTest(FetcherTest):
         return package_name
 
     def fetchUnpack(self, uris):
-        fetcher = bb.fetch.Fetch(uris, self.d)
+        fetcher = bb.fetch2.Fetch(uris, self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
         flst = []
@@ -783,7 +783,7 @@  class FetcherLocalTest(FetcherTest):
     def test_local_checksum_fails_no_file(self):
         self.d.setVar("SRC_URI", "file://404")
         with self.assertRaises(bb.BBHandledException):
-            bb.fetch.get_checksum_file_list(self.d)
+            bb.fetch2.get_checksum_file_list(self.d)
 
     def test_local(self):
         tree = self.fetchUnpack(['file://a', 'file://dir/c'])
@@ -892,7 +892,7 @@  class FetcherLocalTest(FetcherTest):
         self.d.setVar("SRCREV", "AUTOINC")
         self.d.setVar("__BBSRCREV_SEEN", "1")
         url = "git://" + self.gitdir + ";branch=master;protocol=file;" + suffix
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
         unpack_rev = self.git(['rev-parse', 'HEAD'],
@@ -930,7 +930,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)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/test-file.tar.gz"], self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
 
@@ -945,7 +945,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)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/test-file.tar.gz"], self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz.done")))
 
@@ -960,7 +960,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)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/test-file.tar.gz"], self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
         # the existing file should not exist or should have be moved to "bad-checksum"
@@ -970,7 +970,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")))
         # ssh fetch does not support checksums
-        fetcher = bb.fetch.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d)
         # attempts to download with missing donestamp
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
@@ -983,7 +983,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")))
         # ssh fetch does not support checksums
-        fetcher = bb.fetch.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d)
         # attempts to download with missing donestamp
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
@@ -998,7 +998,7 @@  class FetcherNoNetworkTest(FetcherTest):
         self.assertTrue(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz")))
         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)
+        fetcher = bb.fetch2.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d)
         # should not fetch
         fetcher.download()
         # both files should still exist
@@ -1013,7 +1013,7 @@  class FetcherNoNetworkTest(FetcherTest):
         self.assertFalse(os.path.exists(os.path.join(self.dldir, "test-file.tar.gz")))
         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)
+        fetcher = bb.fetch2.Fetch(["ssh://invalid@invalid.yoctoproject.org/test-file.tar.gz"], self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
         # both files should still exist
@@ -1023,12 +1023,12 @@  class FetcherNoNetworkTest(FetcherTest):
 class FetcherNetworkTest(FetcherTest):
     @skipIfNoNetwork()
     def test_fetch(self):
-        fetcher = bb.fetch.Fetch(["https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d)
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.1.tar.gz"), 57892)
         self.d.setVar("BB_NO_NETWORK", "1")
-        fetcher = bb.fetch.Fetch(["https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz", "https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz"], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
         self.assertEqual(len(os.listdir(self.unpackdir + "/bitbake-1.0/")), 9)
@@ -1037,14 +1037,14 @@  class FetcherNetworkTest(FetcherTest):
     @skipIfNoNetwork()
     def test_fetch_mirror(self):
         self.d.setVar("MIRRORS", "http://.*/.* https://downloads.yoctoproject.org/releases/bitbake")
-        fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
 
     @skipIfNoNetwork()
     def test_fetch_mirror_of_mirror(self):
         self.d.setVar("MIRRORS", "http://.*/.* http://invalid2.yoctoproject.org/ http://invalid2.yoctoproject.org/.* https://downloads.yoctoproject.org/releases/bitbake")
-        fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
 
@@ -1052,7 +1052,7 @@  class FetcherNetworkTest(FetcherTest):
     def test_fetch_file_mirror_of_mirror(self):
         self.d.setVar("FILESPATH", ".")
         self.d.setVar("MIRRORS", "http://.*/.* file:///some1where/ file:///some1where/.* file://some2where/ file://some2where/.* https://downloads.yoctoproject.org/releases/bitbake")
-        fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
         os.mkdir(self.dldir + "/some2where")
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
@@ -1060,20 +1060,20 @@  class FetcherNetworkTest(FetcherTest):
     @skipIfNoNetwork()
     def test_fetch_premirror(self):
         self.d.setVar("PREMIRRORS", "http://.*/.* https://downloads.yoctoproject.org/releases/bitbake")
-        fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz"], self.d)
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
 
     @skipIfNoNetwork()
     def test_fetch_specify_downloadfilename(self):
-        fetcher = bb.fetch.Fetch(["https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz;downloadfilename=bitbake-v1.0.0.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz;downloadfilename=bitbake-v1.0.0.tar.gz"], self.d)
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-v1.0.0.tar.gz"), 57749)
 
     @skipIfNoNetwork()
     def test_fetch_premirror_specify_downloadfilename_regex_uri(self):
         self.d.setVar("PREMIRRORS", "http://.*/.* https://downloads.yoctoproject.org/releases/bitbake/")
-        fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/1.0.tar.gz;downloadfilename=bitbake-1.0.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/1.0.tar.gz;downloadfilename=bitbake-1.0.tar.gz"], self.d)
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
 
@@ -1081,7 +1081,7 @@  class FetcherNetworkTest(FetcherTest):
     # BZ13039
     def test_fetch_premirror_specify_downloadfilename_specific_uri(self):
         self.d.setVar("PREMIRRORS", "http://invalid.yoctoproject.org/releases/bitbake https://downloads.yoctoproject.org/releases/bitbake")
-        fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/1.0.tar.gz;downloadfilename=bitbake-1.0.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/1.0.tar.gz;downloadfilename=bitbake-1.0.tar.gz"], self.d)
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
 
@@ -1089,7 +1089,7 @@  class FetcherNetworkTest(FetcherTest):
     def test_fetch_premirror_use_downloadfilename_to_fetch(self):
         # Ensure downloadfilename is used when fetching from premirror.
         self.d.setVar("PREMIRRORS", "http://.*/.* https://downloads.yoctoproject.org/releases/bitbake")
-        fetcher = bb.fetch.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz;downloadfilename=bitbake-1.0.tar.gz"], self.d)
+        fetcher = bb.fetch2.Fetch(["http://invalid.yoctoproject.org/releases/bitbake/bitbake-1.1.tar.gz;downloadfilename=bitbake-1.0.tar.gz"], self.d)
         fetcher.download()
         self.assertEqual(os.path.getsize(self.dldir + "/bitbake-1.0.tar.gz"), 57749)
 
@@ -1103,14 +1103,14 @@  class FetcherNetworkTest(FetcherTest):
 
         self.d.setVar("BB_GENERATE_MIRROR_TARBALLS", "1")
         self.d.setVar("SRCREV", "270a05b0b4ba0959fe0624d2a4885d7b70426da5")
-        fetcher = bb.fetch.Fetch([url1], self.d)
+        fetcher = bb.fetch2.Fetch([url1], self.d)
         fetcher.download()
         checkrevision(self, fetcher)
         # Wipe out the dldir clone and the unpacked source, turn off the network and check mirror tarball works
         bb.utils.prunedir(self.dldir + "/git2/")
         bb.utils.prunedir(self.unpackdir)
         self.d.setVar("BB_NO_NETWORK", "1")
-        fetcher = bb.fetch.Fetch([url2], self.d)
+        fetcher = bb.fetch2.Fetch([url2], self.d)
         fetcher.download()
         checkrevision(self, fetcher)
 
@@ -1129,7 +1129,7 @@  class FetcherNetworkTest(FetcherTest):
     def test_gitfetch_badsrcrev(self):
         # SRCREV is set but does not match rev= parameter
         url1 = url2 = "git://git.openembedded.org/bitbake;rev=dead05b0b4ba0959fe0624d2a4885d7b70426da5;branch=master;protocol=https"
-        self.assertRaises(bb.fetch.FetchError, self.gitfetcher, url1, url2)
+        self.assertRaises(bb.fetch2.FetchError, self.gitfetcher, url1, url2)
 
     @skipIfNoNetwork()
     def test_gitfetch_usehead(self):
@@ -1138,7 +1138,7 @@  class FetcherNetworkTest(FetcherTest):
         # test_local_gitfetch_usehead() for a positive use of the usehead
         # feature.
         url = "git://git.openembedded.org/bitbake;usehead=1;branch=master;protocol=https"
-        self.assertRaises(bb.fetch.ParameterError, self.gitfetcher, url, url)
+        self.assertRaises(bb.fetch2.ParameterError, self.gitfetcher, url, url)
 
     @skipIfNoNetwork()
     def test_gitfetch_usehead_withname(self):
@@ -1147,7 +1147,7 @@  class FetcherNetworkTest(FetcherTest):
         # test_local_gitfetch_usehead() for a positive use of the usehead
         # feature.
         url = "git://git.openembedded.org/bitbake;usehead=1;name=newName;branch=master;protocol=https"
-        self.assertRaises(bb.fetch.ParameterError, self.gitfetcher, url, url)
+        self.assertRaises(bb.fetch2.ParameterError, self.gitfetcher, url, url)
 
     @skipIfNoNetwork()
     def test_gitfetch_finds_local_tarball_for_mirrored_url_when_previous_downloaded_by_the_recipe_url(self):
@@ -1178,7 +1178,7 @@  class FetcherNetworkTest(FetcherTest):
         url = "gitsm://git.yoctoproject.org/git-submodule-test;branch=ssh-gitsm-tests;rev=049da4a6cb198d7c0302e9e8b243a1443cb809a7;branch=master;protocol=https"
         # Original URL (comment this if you have ssh access to git.yoctoproject.org)
         url = "gitsm://git.yoctoproject.org/git-submodule-test;branch=master;rev=38e61644af90dccd73c03ed3acaed98c8dda9294;branch=master;protocol=https"
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         # Previous cwd has been deleted
         os.chdir(os.path.dirname(self.unpackdir))
@@ -1203,13 +1203,13 @@  class FetcherNetworkTest(FetcherTest):
         dl_premirror = os.path.join(tempdir, "download-premirror")
         os.mkdir(dl_premirror)
         self.d.setVar("DL_DIR", dl_premirror)
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         # now use the premirror in restricted network
         self.d.setVar("DL_DIR", self.dldir)
         self.d.setVar("PREMIRRORS", "gitsm://.*/.* gitsm://%s/git2/MIRRORNAME;protocol=file" % dl_premirror)
         self.d.setVar("BB_ALLOWED_NETWORKS", "*.some.domain")
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
 
     @skipIfNoNetwork()
@@ -1217,7 +1217,7 @@  class FetcherNetworkTest(FetcherTest):
         # The following external repositories have show failures in fetch and unpack operations
         # We want to avoid regressions!
         url = "gitsm://github.com/bus1/dbus-broker;protocol=https;rev=fc874afa0992d0c75ec25acb43d344679f0ee7d2;branch=main"
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         # Previous cwd has been deleted
         os.chdir(os.path.dirname(self.unpackdir))
@@ -1233,7 +1233,7 @@  class FetcherNetworkTest(FetcherTest):
     @skipIfNoNetwork()
     def test_git_submodule_CLI11(self):
         url = "gitsm://github.com/CLIUtils/CLI11;protocol=https;rev=bd4dc911847d0cde7a6b41dfa626a85aab213baf;branch=main"
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         # Previous cwd has been deleted
         os.chdir(os.path.dirname(self.unpackdir))
@@ -1248,12 +1248,12 @@  class FetcherNetworkTest(FetcherTest):
     def test_git_submodule_update_CLI11(self):
         """ Prevent regression on update detection not finding missing submodule, or modules without needed commits """
         url = "gitsm://github.com/CLIUtils/CLI11;protocol=https;rev=cf6a99fa69aaefe477cc52e3ef4a7d2d7fa40714;branch=main"
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
 
         # CLI11 that pulls in a newer nlohmann-json
         url = "gitsm://github.com/CLIUtils/CLI11;protocol=https;rev=49ac989a9527ee9bb496de9ded7b4872c2e0e5ca;branch=main"
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         # Previous cwd has been deleted
         os.chdir(os.path.dirname(self.unpackdir))
@@ -1267,7 +1267,7 @@  class FetcherNetworkTest(FetcherTest):
     @skipIfNoNetwork()
     def test_git_submodule_aktualizr(self):
         url = "gitsm://github.com/advancedtelematic/aktualizr;branch=master;protocol=https;rev=d00d1a04cc2366d1a5f143b84b9f507f8bd32c44"
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         # Previous cwd has been deleted
         os.chdir(os.path.dirname(self.unpackdir))
@@ -1287,7 +1287,7 @@  class FetcherNetworkTest(FetcherTest):
 
         # This repository also has submodules where the module (name), path and url do not align
         url = "gitsm://github.com/azure/iotedge.git;protocol=https;rev=d76e0316c6f324345d77c48a83ce836d09392699;branch=main"
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         # Previous cwd has been deleted
         os.chdir(os.path.dirname(self.unpackdir))
@@ -1314,7 +1314,7 @@  class FetcherNetworkTest(FetcherTest):
         self.recipe_url = "gitsm://github.com/gflags/gflags.git;protocol=https;branch=master"
         self.d.setVar("SRCREV", "14e1138441bbbb584160cb1c0a0426ec1bac35f1")
         with Timeout(60):
-            fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+            fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
             with self.assertRaises(bb.fetch2.FetchError):
                 fetcher.download()
 
@@ -1374,7 +1374,7 @@  class SVNTest(FetcherTest):
     def test_noexternal_svn(self):
         # Always match the rev count from setUp (currently rev 2)
         url = "svn://%s;module=trunk;protocol=file;rev=2" % self.repo_url.replace('file://', '')
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         os.chdir(os.path.dirname(self.unpackdir))
         fetcher.unpack(self.unpackdir)
@@ -1388,7 +1388,7 @@  class SVNTest(FetcherTest):
     def test_external_svn(self):
         # Always match the rev count from setUp (currently rev 2)
         url = "svn://%s;module=trunk;protocol=file;externals=allowed;rev=2" % self.repo_url.replace('file://', '')
-        fetcher = bb.fetch.Fetch([url], self.d)
+        fetcher = bb.fetch2.Fetch([url], self.d)
         fetcher.download()
         os.chdir(os.path.dirname(self.unpackdir))
         fetcher.unpack(self.unpackdir)
@@ -1403,43 +1403,43 @@  class TrustedNetworksTest(FetcherTest):
         # Ensure trusted_network returns False when the host IS in the list.
         url = "git://Someserver.org/foo;rev=1;branch=master"
         self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org someserver.org server2.org server3.org")
-        self.assertTrue(bb.fetch.trusted_network(self.d, url))
+        self.assertTrue(bb.fetch2.trusted_network(self.d, url))
 
     def test_wild_trusted_network(self):
         # Ensure trusted_network returns true when the *.host IS in the list.
         url = "git://Someserver.org/foo;rev=1;branch=master"
         self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org")
-        self.assertTrue(bb.fetch.trusted_network(self.d, url))
+        self.assertTrue(bb.fetch2.trusted_network(self.d, url))
 
     def test_prefix_wild_trusted_network(self):
         # Ensure trusted_network returns true when the prefix matches *.host.
         url = "git://git.Someserver.org/foo;rev=1;branch=master"
         self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org")
-        self.assertTrue(bb.fetch.trusted_network(self.d, url))
+        self.assertTrue(bb.fetch2.trusted_network(self.d, url))
 
     def test_two_prefix_wild_trusted_network(self):
         # Ensure trusted_network returns true when the prefix matches *.host.
         url = "git://something.git.Someserver.org/foo;rev=1;branch=master"
         self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org *.someserver.org server2.org server3.org")
-        self.assertTrue(bb.fetch.trusted_network(self.d, url))
+        self.assertTrue(bb.fetch2.trusted_network(self.d, url))
 
     def test_port_trusted_network(self):
         # Ensure trusted_network returns True, even if the url specifies a port.
         url = "git://someserver.org:8080/foo;rev=1;branch=master"
         self.d.setVar("BB_ALLOWED_NETWORKS", "someserver.org")
-        self.assertTrue(bb.fetch.trusted_network(self.d, url))
+        self.assertTrue(bb.fetch2.trusted_network(self.d, url))
 
     def test_untrusted_network(self):
         # Ensure trusted_network returns False when the host is NOT in the list.
         url = "git://someserver.org/foo;rev=1;branch=master"
         self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org server2.org server3.org")
-        self.assertFalse(bb.fetch.trusted_network(self.d, url))
+        self.assertFalse(bb.fetch2.trusted_network(self.d, url))
 
     def test_wild_untrusted_network(self):
         # Ensure trusted_network returns False when the host is NOT in the list.
         url = "git://*.someserver.org/foo;rev=1;branch=master"
         self.d.setVar("BB_ALLOWED_NETWORKS", "server1.org server2.org server3.org")
-        self.assertFalse(bb.fetch.trusted_network(self.d, url))
+        self.assertFalse(bb.fetch2.trusted_network(self.d, url))
 
 class URLHandle(unittest.TestCase):
     # Quote password as per RFC3986
@@ -1462,12 +1462,12 @@  class URLHandle(unittest.TestCase):
 
     def test_decodeurl(self):
         for k, v in self.decodedata.items():
-            result = bb.fetch.decodeurl(k)
+            result = bb.fetch2.decodeurl(k)
             self.assertEqual(result, v)
 
     def test_encodeurl(self):
         for k, v in self.datatable.items():
-            result = bb.fetch.encodeurl(v)
+            result = bb.fetch2.encodeurl(v)
             if result.startswith("file:"):
                 result = urllib.parse.unquote(result)
             self.assertEqual(result, k)
@@ -2278,7 +2278,7 @@  class GitShallowTest(FetcherTest):
         premirror = os.path.join(self.tempdir, "premirror")
         os.mkdir(premirror)
         d.setVar("DL_DIR", premirror)
-        fetcher = bb.fetch.Fetch([url], d)
+        fetcher = bb.fetch2.Fetch([url], d)
         fetcher.download()
 
         # set PREMIRRORS
@@ -2286,7 +2286,7 @@  class GitShallowTest(FetcherTest):
 
         # set DL_DIR back and use the same url multiple times to fetch
         d.setVar("DL_DIR", self.dldir)
-        fetcher2 = bb.fetch.Fetch([url, url], d)
+        fetcher2 = bb.fetch2.Fetch([url, url], d)
         fetcher2.download()
 
     def test_shallow_invalid_depth(self):
@@ -2830,7 +2830,7 @@  class GitURLWithSpacesTest(FetcherTest):
 
         for test_git_url, ref in self.test_git_urls.items():
 
-            fetcher = bb.fetch.Fetch([test_git_url], self.d)
+            fetcher = bb.fetch2.Fetch([test_git_url], self.d)
             ud = fetcher.ud[fetcher.urls[0]]
 
             self.assertEqual(ud.url, ref['url'])
@@ -3016,7 +3016,7 @@  class NPMTest(FetcherTest):
         urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=1.0.0'
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3033,7 +3033,7 @@  class NPMTest(FetcherTest):
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
         # Fetch once to get a tarball
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3054,7 +3054,7 @@  class NPMTest(FetcherTest):
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
         # Fetch once to get a tarball
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3074,7 +3074,7 @@  class NPMTest(FetcherTest):
         # while the fetcher object exists, which it does when we rename the
         # download directory to "mirror" above. Thus we need a new fetcher to go
         # with the now empty download directory.
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3086,7 +3086,7 @@  class NPMTest(FetcherTest):
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
         # Fetch once to get a tarball
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3109,7 +3109,7 @@  class NPMTest(FetcherTest):
         urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=1.0.0'
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3137,7 +3137,7 @@  class NPMTest(FetcherTest):
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223'
                 ';destsuffix=foo/bar;downloadfilename=foo-bar.tgz']
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'foo-bar.tgz')))
         fetcher.unpack(self.unpackdir)
@@ -3150,7 +3150,7 @@  class NPMTest(FetcherTest):
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
         self.d.setVar('BB_NO_NETWORK', '1')
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
 
@@ -3161,7 +3161,7 @@  class NPMTest(FetcherTest):
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
         # Fetch once to get a tarball
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         fetcher.download()
         # Disable network access
         self.d.setVar('BB_NO_NETWORK', '1')
@@ -3177,7 +3177,7 @@  class NPMTest(FetcherTest):
         urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=1.0.0'
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
         unpackdir = os.path.join(self.unpackdir, 'npm')
@@ -3187,7 +3187,7 @@  class NPMTest(FetcherTest):
     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):
-            bb.fetch.Fetch(url, self.d)
+            bb.fetch2.Fetch(url, self.d)
 
     @skipIfNoNpm()
     @skipIfNoNetwork()
@@ -3195,7 +3195,7 @@  class NPMTest(FetcherTest):
         urls = ['npm://registry.invalid.org;package=@savoirfairelinux/node-server-example;version=1.0.0'
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         with self.assertRaises(bb.fetch2.FetchError):
             fetcher.download()
 
@@ -3205,7 +3205,7 @@  class NPMTest(FetcherTest):
         urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/invalid;version=1.0.0'
                 ';sha512sum=f2dd7d88cb9a129fbb97eb87a8b5103bab24f783420fd7587f8000a355a12bf7'
                 '83f1263230afc588123958b73e36bb241f63eaf08119aac5aa2a870bc4de9223']
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         with self.assertRaises(bb.fetch2.FetchError):
             fetcher.download()
 
@@ -3214,7 +3214,7 @@  class NPMTest(FetcherTest):
     def test_npm_version_invalid(self):
         urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example;version=invalid']
         with self.assertRaises(bb.fetch2.ParameterError):
-            fetcher = bb.fetch.Fetch(urls, self.d)
+            fetcher = bb.fetch2.Fetch(urls, self.d)
 
     @skipIfNoNpm()
     @skipIfNoNetwork()
@@ -3237,7 +3237,7 @@  class NPMTest(FetcherTest):
         checksum_name, hexsum = npm_integrity(integrity)
         urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example'
                 ';version=1.0.0;%s=%s' % (checksum_name, hexsum)]
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3248,7 +3248,7 @@  class NPMTest(FetcherTest):
         """A wrong sha512sum param in SRC_URI causes the fetch to fail."""
         urls = ['npm://registry.npmjs.org;package=@savoirfairelinux/node-server-example'
                 ';version=1.0.0;sha512sum=deadbeef00']
-        fetcher = bb.fetch.Fetch(urls, self.d)
+        fetcher = bb.fetch2.Fetch(urls, self.d)
         with self.assertRaises(bb.fetch2.FetchError):
             fetcher.download()
 
@@ -3268,28 +3268,28 @@  class NPMTest(FetcherTest):
             else:
                 self.d.setVar('BB_STRICT_CHECKSUM', strict)
             with self.assertRaises(bb.fetch2.MissingParameterError):
-                bb.fetch.Fetch(urls, self.d)
+                bb.fetch2.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):
-            fetcher = bb.fetch.Fetch(urls, self.d)
+            fetcher = bb.fetch2.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):
-            fetcher = bb.fetch.Fetch(urls, self.d)
+            fetcher = bb.fetch2.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):
-            fetcher = bb.fetch.Fetch(urls, self.d)
+            fetcher = bb.fetch2.Fetch(urls, self.d)
 
     def create_shrinkwrap_file(self, data):
         import json
@@ -3325,7 +3325,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz')))
         self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'content-type-1.0.4.tgz')))
@@ -3345,7 +3345,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(os.path.join(self.dldir, 'git2', 'github.com.jshttp.cookie.git')))
 
@@ -3367,12 +3367,12 @@  class NPMTest(FetcherTest):
             }
         })
         # Fetch with dev disabled
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz')))
         self.assertFalse(os.path.exists(os.path.join(self.dldir, 'npm2', 'content-type-1.0.4.tgz')))
         # Fetch with dev enabled
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile + ';dev=1'], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile + ';dev=1'], self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz')))
         self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'content-type-1.0.4.tgz')))
@@ -3388,7 +3388,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile + ';destsuffix=foo/bar'], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile + ';destsuffix=foo/bar'], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
         self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'foo', 'bar', 'node_modules', 'array-flatten', 'package.json')))
@@ -3404,7 +3404,7 @@  class NPMTest(FetcherTest):
             }
         })
         self.d.setVar('BB_NO_NETWORK', '1')
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
 
@@ -3412,7 +3412,7 @@  class NPMTest(FetcherTest):
     @skipIfNoNetwork()
     def test_npmsw_no_network_with_tarball(self):
         # Fetch once to get a tarball
-        fetcher = bb.fetch.Fetch(['npm://registry.npmjs.org;package=array-flatten;version=1.1.1;sha1sum=9a5f699051b1e7073328f2a008968b64ea2955d2'], self.d)
+        fetcher = bb.fetch2.Fetch(['npm://registry.npmjs.org;package=array-flatten;version=1.1.1;sha1sum=9a5f699051b1e7073328f2a008968b64ea2955d2'], self.d)
         fetcher.download()
         # Disable network access
         self.d.setVar('BB_NO_NETWORK', '1')
@@ -3426,7 +3426,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
         self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'node_modules', 'array-flatten', 'package.json')))
@@ -3443,12 +3443,12 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         # Disable network access
         self.d.setVar('BB_NO_NETWORK', '1')
         # Fetch again with npm
-        fetcher = bb.fetch.Fetch(['npm://registry.npmjs.org;package=array-flatten;version=1.1.1;sha1sum=9a5f699051b1e7073328f2a008968b64ea2955d2'], self.d)
+        fetcher = bb.fetch2.Fetch(['npm://registry.npmjs.org;package=array-flatten;version=1.1.1;sha1sum=9a5f699051b1e7073328f2a008968b64ea2955d2'], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
         self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'npm', 'package.json')))
@@ -3465,7 +3465,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         with self.assertRaises(bb.fetch2.FetchError):
             fetcher.download()
         # Fetch correctly to get a tarball
@@ -3478,7 +3478,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         localpath = os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz')
         self.assertTrue(os.path.exists(localpath))
@@ -3496,7 +3496,7 @@  class NPMTest(FetcherTest):
     @skipIfNoNetwork()
     def test_npmsw_premirrors(self):
         # Fetch once to get a tarball
-        fetcher = bb.fetch.Fetch(['npm://registry.npmjs.org;package=array-flatten;version=1.1.1;sha1sum=9a5f699051b1e7073328f2a008968b64ea2955d2'], self.d)
+        fetcher = bb.fetch2.Fetch(['npm://registry.npmjs.org;package=array-flatten;version=1.1.1;sha1sum=9a5f699051b1e7073328f2a008968b64ea2955d2'], self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3517,7 +3517,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
 
@@ -3525,7 +3525,7 @@  class NPMTest(FetcherTest):
     @skipIfNoNetwork()
     def test_npmsw_mirrors(self):
         # Fetch once to get a tarball
-        fetcher = bb.fetch.Fetch(['npm://registry.npmjs.org;package=array-flatten;version=1.1.1;sha1sum=9a5f699051b1e7073328f2a008968b64ea2955d2'], self.d)
+        fetcher = bb.fetch2.Fetch(['npm://registry.npmjs.org;package=array-flatten;version=1.1.1;sha1sum=9a5f699051b1e7073328f2a008968b64ea2955d2'], self.d)
         ud = fetcher.ud[fetcher.urls[0]]
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
@@ -3545,7 +3545,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(ud.localpath))
 
@@ -3566,7 +3566,7 @@  class NPMTest(FetcherTest):
                 }
             }
         })
-        fetcher = bb.fetch.Fetch(['npmsw://' + swfile], self.d)
+        fetcher = bb.fetch2.Fetch(['npmsw://' + swfile], self.d)
         fetcher.download()
         self.assertTrue(os.path.exists(os.path.join(self.dldir, 'npm2', 'array-flatten-1.1.1.tgz')))
         self.assertFalse(os.path.exists(os.path.join(self.dldir, 'npm2', 'content-type-1.0.4.tgz')))
@@ -3580,7 +3580,7 @@  class GitSharedTest(FetcherTest):
 
     @skipIfNoNetwork()
     def test_shared_unpack(self):
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
         fetcher.unpack(self.unpackdir)
@@ -3591,7 +3591,7 @@  class GitSharedTest(FetcherTest):
     def test_noshared_unpack(self):
         self.d.setVar('BB_GIT_NOSHARED', '1')
         self.unpackdir += '_noshared'
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
 
         fetcher.download()
         fetcher.unpack(self.unpackdir)
@@ -3603,14 +3603,14 @@  class GitTagVerificationTests(FetcherTest):
     @skipIfNoNetwork()
     def test_tag_rev_match(self):
         # Test a url with rev= and tag= set works
-        fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d)
+        fetcher = bb.fetch2.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
 
     def test_annotated_tag_rev_match(self):
         # Test a url with rev= and tag= set works
         # rev is the annotated tag revision in this case
-        fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=fa30183549bd09f33fd4eebf56771ca5393526a6;tag=2.12.0"], self.d)
+        fetcher = bb.fetch2.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=fa30183549bd09f33fd4eebf56771ca5393526a6;tag=2.12.0"], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
 
@@ -3618,7 +3618,7 @@  class GitTagVerificationTests(FetcherTest):
     def test_tag_rev_match2(self):
         # Test a url with SRCREV and tag= set works
         self.d.setVar('SRCREV', '5b4e20377eea8d428edf1aeb2187c18f82ca6757')
-        fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;tag=2.12.0"], self.d)
+        fetcher = bb.fetch2.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;tag=2.12.0"], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
 
@@ -3626,7 +3626,7 @@  class GitTagVerificationTests(FetcherTest):
     def test_tag_rev_match3(self):
         # Test a url with SRCREV, rev= and tag= set works
         self.d.setVar('SRCREV', '5b4e20377eea8d428edf1aeb2187c18f82ca6757')
-        fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d)
+        fetcher = bb.fetch2.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
 
@@ -3635,14 +3635,14 @@  class GitTagVerificationTests(FetcherTest):
         # Test a url with SRCREV and rev= mismatching errors
         self.d.setVar('SRCREV', 'bade540fc31a1c26839efd2c7785a751ce24ebfb')
         with self.assertRaises(bb.fetch2.FetchError):
-            fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d)
+            fetcher = bb.fetch2.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d)
 
     @skipIfNoNetwork()
     def test_tag_rev_match5(self):
         # Test a url with SRCREV, rev= and tag= set works when using shallow clones
         self.d.setVar('BB_GIT_SHALLOW', '1')
         self.d.setVar('SRCREV', '5b4e20377eea8d428edf1aeb2187c18f82ca6757')
-        fetcher = bb.fetch.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d)
+        fetcher = bb.fetch2.Fetch(["git://git.openembedded.org/bitbake;branch=2.12;protocol=https;rev=5b4e20377eea8d428edf1aeb2187c18f82ca6757;tag=2.12.0"], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
 
@@ -3650,7 +3650,7 @@  class GitTagVerificationTests(FetcherTest):
     def test_tag_rev_match6(self):
         # Test a url with SRCREV, rev= and a mismatched tag= when using shallow clones
         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 = bb.fetch2.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):
             fetcher.unpack(self.unpackdir)
@@ -3659,7 +3659,7 @@  class GitTagVerificationTests(FetcherTest):
     def test_tag_rev_match7(self):
         # Test a url with SRCREV, rev= and a mismatched tag=
         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 = bb.fetch2.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):
             fetcher.unpack(self.unpackdir)
@@ -3711,17 +3711,17 @@  class FetchPremirroronlyLocalTest(FetcherTest):
     def test_mirror_multiple_fetches(self):
         self.make_git_repo()
         self.d.setVar("SRCREV", self.git_new_commit())
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
         ## New commit in premirror. it's not in the download_dir
         self.d.setVar("SRCREV", self.git_new_commit())
-        fetcher2 = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher2 = bb.fetch2.Fetch([self.recipe_url], self.d)
         fetcher2.download()
         fetcher2.unpack(self.unpackdir)
         ## New commit in premirror. it's not in the download_dir
         self.d.setVar("SRCREV", self.git_new_commit())
-        fetcher3 = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher3 = bb.fetch2.Fetch([self.recipe_url], self.d)
         fetcher3.download()
         fetcher3.unpack(self.unpackdir)
 
@@ -3729,20 +3729,20 @@  class FetchPremirroronlyLocalTest(FetcherTest):
     def test_mirror_commit_nonexistent(self):
         self.make_git_repo()
         self.d.setVar("SRCREV", "0"*40)
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
 
     def test_mirror_commit_exists(self):
         self.make_git_repo()
         self.d.setVar("SRCREV", self.git_new_commit())
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         fetcher.download()
         fetcher.unpack(self.unpackdir)
 
     def test_mirror_tarball_nonexistent(self):
         self.d.setVar("SRCREV", "0"*40)
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
 
@@ -3775,7 +3775,7 @@  class FetchPremirroronlyNetworkTest(FetcherTest):
         self.make_git_repo()
         ## Upstream commit is in the mirror
         self.d.setVar("SRCREV", "15413486df1f5a5b5af699b6f3ba5f0984e52a9f")
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         fetcher.download()
 
     @skipIfNoNetwork()
@@ -3783,7 +3783,7 @@  class FetchPremirroronlyNetworkTest(FetcherTest):
         self.make_git_repo()
         ## Upstream commit not in the mirror
         self.d.setVar("SRCREV", "49d65d53c2bf558ae6e9185af0f3af7b79d255ec")
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         with self.assertRaises(bb.fetch2.NetworkAccess):
             fetcher.download()
 
@@ -3811,7 +3811,7 @@  class FetchPremirroronlyMercurialTest(FetcherTest):
         Ask bitbake to download repo and prepare mirror tarball for us
         """
         self.d.setVar("BB_GENERATE_MIRROR_TARBALLS", "1")
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         fetcher.download()
         mirrorfile = os.path.join(self.d.getVar("DL_DIR"), self.mirrorname)
         self.assertTrue(os.path.exists(mirrorfile), "Mirror tarball {} has not been created".format(mirrorfile))
@@ -3827,7 +3827,7 @@  class FetchPremirroronlyMercurialTest(FetcherTest):
         self.d.setVar("PREMIRRORS", self.recipe_url + " " + "file://{}".format(self.mirrordir) + " \n")
         self.d.setVar("BB_FETCH_PREMIRRORONLY", "1")
         self.d.setVar("BB_NO_NETWORK", "1")
-        fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         fetcher.download()
 
 class FetchPremirroronlyBrokenTarball(FetcherTest):
@@ -3848,7 +3848,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)
+        fetcher = bb.fetch2.Fetch([self.recipe_url], self.d)
         with self.assertRaises(bb.fetch2.FetchError), self.assertLogs() as logs:
             fetcher.download()
         output = "".join(logs.output)