blob: 76cbadf2ff936143bf8f547bba778708e7b80926 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001#
2# SPDX-License-Identifier: MIT
3#
4
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08005import oe.path
6from oeqa.selftest.case import OESelftestTestCase
7from oeqa.utils.commands import bitbake
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08008
9class Fetch(OESelftestTestCase):
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010 def test_git_mirrors(self):
11 """
12 Verify that the git fetcher will fall back to the HTTP mirrors. The
13 recipe needs to be one that we have on the Yocto Project source mirror
14 and is hosted in git.
15 """
16
17 # TODO: mktempd instead of hardcoding
18 dldir = os.path.join(self.builddir, "download-git-mirrors")
19 self.track_for_cleanup(dldir)
20
21 # No mirrors, should use git to fetch successfully
22 features = """
23DL_DIR = "%s"
24MIRRORS_forcevariable = ""
25PREMIRRORS_forcevariable = ""
26""" % dldir
27 self.write_config(features)
28 oe.path.remove(dldir, recurse=True)
29 bitbake("dbus-wait -c fetch -f")
30
31 # No mirrors and broken git, should fail
32 features = """
33DL_DIR = "%s"
34GIT_PROXY_COMMAND = "false"
35MIRRORS_forcevariable = ""
36PREMIRRORS_forcevariable = ""
37""" % dldir
38 self.write_config(features)
39 oe.path.remove(dldir, recurse=True)
40 with self.assertRaises(AssertionError):
41 bitbake("dbus-wait -c fetch -f")
42
43 # Broken git but a specific mirror
44 features = """
45DL_DIR = "%s"
46GIT_PROXY_COMMAND = "false"
47MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/sources/"
48""" % dldir
49 self.write_config(features)
50 oe.path.remove(dldir, recurse=True)
51 bitbake("dbus-wait -c fetch -f")