summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/fetch.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/fetch.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/fetch.py43
1 files changed, 24 insertions, 19 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fetch.py b/meta/lib/oeqa/selftest/cases/fetch.py
index 67e85d3e4c..44099176fc 100644
--- a/meta/lib/oeqa/selftest/cases/fetch.py
+++ b/meta/lib/oeqa/selftest/cases/fetch.py
@@ -1,4 +1,6 @@
#
+# Copyright OpenEmbedded Contributors
+#
# SPDX-License-Identifier: MIT
#
@@ -24,8 +26,8 @@ class Fetch(OESelftestTestCase):
# No mirrors, should use git to fetch successfully
features = """
DL_DIR = "%s"
-MIRRORS_forcevariable = ""
-PREMIRRORS_forcevariable = ""
+MIRRORS:forcevariable = ""
+PREMIRRORS:forcevariable = ""
""" % dldir
self.write_config(features)
oe.path.remove(dldir, recurse=True)
@@ -34,9 +36,10 @@ PREMIRRORS_forcevariable = ""
# No mirrors and broken git, should fail
features = """
DL_DIR = "%s"
+SRC_URI:pn-dbus-wait = "git://git.yoctoproject.org/dbus-wait;branch=master;protocol=git"
GIT_PROXY_COMMAND = "false"
-MIRRORS_forcevariable = ""
-PREMIRRORS_forcevariable = ""
+MIRRORS:forcevariable = ""
+PREMIRRORS:forcevariable = ""
""" % dldir
self.write_config(features)
oe.path.remove(dldir, recurse=True)
@@ -46,8 +49,9 @@ PREMIRRORS_forcevariable = ""
# Broken git but a specific mirror
features = """
DL_DIR = "%s"
+SRC_URI:pn-dbus-wait = "git://git.yoctoproject.org/dbus-wait;branch=master;protocol=git"
GIT_PROXY_COMMAND = "false"
-MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/sources/"
+MIRRORS:forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/sources/"
""" % dldir
self.write_config(features)
oe.path.remove(dldir, recurse=True)
@@ -55,25 +59,26 @@ MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/so
class Dependencies(OESelftestTestCase):
- def write_recipe(self, content):
- f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb")
- f.write(content)
- f.flush()
+ def write_recipe(self, content, tempdir):
+ f = os.path.join(tempdir, "test.bb")
+ with open(f, "w") as fd:
+ fd.write(content)
return f
def test_dependencies(self):
"""
Verify that the correct dependencies are generated for specific SRC_URI entries.
"""
- with bb.tinfoil.Tinfoil() as tinfoil:
+
+ with bb.tinfoil.Tinfoil() as tinfoil, tempfile.TemporaryDirectory(prefix="selftest-fetch") as tempdir:
tinfoil.prepare(config_only=False, quiet=2)
r = """
LICENSE="CLOSED"
SRC_URI="http://example.com/tarball.zip"
"""
- f = self.write_recipe(textwrap.dedent(r))
- d = tinfoil.parse_recipe_file(f.name)
+ f = self.write_recipe(textwrap.dedent(r), tempdir)
+ d = tinfoil.parse_recipe_file(f)
self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends"))
@@ -82,8 +87,8 @@ class Dependencies(OESelftestTestCase):
LICENSE="CLOSED"
SRC_URI="https://example.com/tarball;downloadfilename=something.zip"
"""
- f = self.write_recipe(textwrap.dedent(r))
- d = tinfoil.parse_recipe_file(f.name)
+ f = self.write_recipe(textwrap.dedent(r), tempdir)
+ d = tinfoil.parse_recipe_file(f)
self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends") or "")
@@ -91,15 +96,15 @@ class Dependencies(OESelftestTestCase):
LICENSE="CLOSED"
SRC_URI="ftp://example.com/tarball.lz"
"""
- f = self.write_recipe(textwrap.dedent(r))
- d = tinfoil.parse_recipe_file(f.name)
+ f = self.write_recipe(textwrap.dedent(r), tempdir)
+ d = tinfoil.parse_recipe_file(f)
self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends"))
self.assertIn("lzip-native", d.getVarFlag("do_unpack", "depends"))
r = """
LICENSE="CLOSED"
- SRC_URI="git://example.com/repo"
+ SRC_URI="git://example.com/repo;branch=master;rev=ffffffffffffffffffffffffffffffffffffffff"
"""
- f = self.write_recipe(textwrap.dedent(r))
- d = tinfoil.parse_recipe_file(f.name)
+ f = self.write_recipe(textwrap.dedent(r), tempdir)
+ d = tinfoil.parse_recipe_file(f)
self.assertIn("git-native", d.getVarFlag("do_fetch", "depends"))