diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-05-24 22:35:24 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-05-24 22:35:24 +0300 |
commit | 0e0df451ae365f09d5c0c766b253f23de26901f2 (patch) | |
tree | db4d7d3ce85e02ee01ad58a86ede02ac876aae77 /poky/meta/lib/oeqa/selftest/cases/fetch.py | |
parent | e370fd750e2821620ec427f26f8efab0069824ff (diff) | |
parent | 7e10dee74964afa47859704886128dd256acf854 (diff) | |
download | openbmc-0e0df451ae365f09d5c0c766b253f23de26901f2.tar.xz |
Merge tag '0.52' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into update
Diffstat (limited to 'poky/meta/lib/oeqa/selftest/cases/fetch.py')
-rw-r--r-- | poky/meta/lib/oeqa/selftest/cases/fetch.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/poky/meta/lib/oeqa/selftest/cases/fetch.py b/poky/meta/lib/oeqa/selftest/cases/fetch.py index 76cbadf2f..67e85d3e4 100644 --- a/poky/meta/lib/oeqa/selftest/cases/fetch.py +++ b/poky/meta/lib/oeqa/selftest/cases/fetch.py @@ -2,6 +2,9 @@ # SPDX-License-Identifier: MIT # +import tempfile +import textwrap +import bb.tinfoil import oe.path from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import bitbake @@ -49,3 +52,54 @@ MIRRORS_forcevariable = "git://.*/.* http://downloads.yoctoproject.org/mirror/so self.write_config(features) oe.path.remove(dldir, recurse=True) bitbake("dbus-wait -c fetch -f") + + +class Dependencies(OESelftestTestCase): + def write_recipe(self, content): + f = tempfile.NamedTemporaryFile(mode="wt", suffix=".bb") + f.write(content) + f.flush() + return f + + def test_dependencies(self): + """ + Verify that the correct dependencies are generated for specific SRC_URI entries. + """ + with bb.tinfoil.Tinfoil() as tinfoil: + 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) + self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) + self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends")) + + # Verify that the downloadfilename overrides the URI + r = """ + 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) + self.assertIn("wget-native", d.getVarFlag("do_fetch", "depends")) + self.assertIn("unzip-native", d.getVarFlag("do_unpack", "depends") or "") + + r = """ + LICENSE="CLOSED" + SRC_URI="ftp://example.com/tarball.lz" + """ + f = self.write_recipe(textwrap.dedent(r)) + d = tinfoil.parse_recipe_file(f.name) + 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" + """ + f = self.write_recipe(textwrap.dedent(r)) + d = tinfoil.parse_recipe_file(f.name) + self.assertIn("git-native", d.getVarFlag("do_fetch", "depends")) |