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