fetch.py 1.5 KB

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