diff options
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/fetch.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/fetch.py b/meta/lib/oeqa/selftest/cases/fetch.py index 76cbadf2ff..67e85d3e4c 100644 --- a/meta/lib/oeqa/selftest/cases/fetch.py +++ b/meta/lib/oeqa/selftest/cases/fetch.py | |||
@@ -2,6 +2,9 @@ | |||
2 | # SPDX-License-Identifier: MIT | 2 | # SPDX-License-Identifier: MIT |
3 | # | 3 | # |
4 | 4 | ||
5 | import tempfile | ||
6 | import textwrap | ||
7 | import bb.tinfoil | ||
5 | import oe.path | 8 | import oe.path |
6 | from oeqa.selftest.case import OESelftestTestCase | 9 | from oeqa.selftest.case import OESelftestTestCase |
7 | from oeqa.utils.commands import bitbake | 10 | from oeqa.utils.commands import bitbake |
@@ -49,3 +52,54 @@ MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/so | |||
49 | self.write_config(features) | 52 | self.write_config(features) |
50 | oe.path.remove(dldir, recurse=True) | 53 | oe.path.remove(dldir, recurse=True) |
51 | bitbake("dbus-wait -c fetch -f") | 54 | bitbake("dbus-wait -c fetch -f") |
55 | |||
56 | |||
57 | class Dependencies(OESelftestTestCase): | ||
58 | def write_recipe(self, content): | ||
59 | f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb") | ||
60 | f.write(content) | ||
61 | f.flush() | ||
62 | return f | ||
63 | |||
64 | def test_dependencies(self): | ||
65 | """ | ||
66 | Verify that the correct dependencies are generated for specific SRC_URI entries. | ||
67 | """ | ||
68 | with bb.tinfoil.Tinfoil() as tinfoil: | ||
69 | tinfoil.prepare(config_only=False, quiet=2) | ||
70 | |||
71 | r = """ | ||
72 | LICENSE="CLOSED" | ||
73 | SRC_URI="http://example.com/tarball.zip" | ||
74 | """ | ||
75 | f = self.write_recipe(textwrap.dedent(r)) | ||
76 | d = tinfoil.parse_recipe_file(f.name) | ||
77 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) | ||
78 | self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends")) | ||
79 | |||
80 | # Verify that the downloadfilename overrides the URI | ||
81 | r = """ | ||
82 | LICENSE="CLOSED" | ||
83 | SRC_URI="https://example.com/tarball;downloadfilename=something.zip" | ||
84 | """ | ||
85 | f = self.write_recipe(textwrap.dedent(r)) | ||
86 | d = tinfoil.parse_recipe_file(f.name) | ||
87 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) | ||
88 | self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends") or "") | ||
89 | |||
90 | r = """ | ||
91 | LICENSE="CLOSED" | ||
92 | SRC_URI="ftp://example.com/tarball.lz" | ||
93 | """ | ||
94 | f = self.write_recipe(textwrap.dedent(r)) | ||
95 | d = tinfoil.parse_recipe_file(f.name) | ||
96 | self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) | ||
97 | self.assertIn("lzip-native", d.getVarFlag("do_unpack", "depends")) | ||
98 | |||
99 | r = """ | ||
100 | LICENSE="CLOSED" | ||
101 | SRC_URI="git://example.com/repo" | ||
102 | """ | ||
103 | f = self.write_recipe(textwrap.dedent(r)) | ||
104 | d = tinfoil.parse_recipe_file(f.name) | ||
105 | self.assertIn("git-native", d.getVarFlag("do_fetch", "depends")) | ||