Example #1
0
    def test_get_build_arches_koji_tag_arches(self, cfg):
        mmd = load_mmd(read_staged_data("formatted_testmodule"))
        xmd = mmd.get_xmd()
        xmd["mbs"]["koji_tag_arches"] = ["ppc64", "ppc64le"]
        mmd.set_xmd(xmd)

        r = get_build_arches(mmd, conf)
        assert r == ["ppc64", "ppc64le"]
Example #2
0
 def test_get_build_arches_no_arch_set(self, ClientSession):
     """
     When no architecture is set in Koji tag, fallback to conf.arches.
     """
     session = ClientSession.return_value
     session.getTag.return_value = {"arches": ""}
     mmd = load_mmd(read_staged_data("formatted_testmodule"))
     r = get_build_arches(mmd, conf)
     assert set(r) == set(conf.arches)
Example #3
0
    def test_get_build_arches_base_module_override(self):
        mmd = load_mmd(read_staged_data("formatted_testmodule"))
        xmd = mmd.get_xmd()
        mbs_options = xmd["mbs"] if "mbs" in xmd.keys() else {}
        mbs_options["buildrequires"] = {"platform": {"stream": "xx"}}
        xmd["mbs"] = mbs_options
        mmd.set_xmd(xmd)

        r = get_build_arches(mmd, conf)
        assert r == ["x86_64", "i686"]
Example #4
0
    def test_get_build_arches_set_in_mmd(self):
        mmd = load_mmd(read_staged_data("formatted_testmodule"))
        xmd = mmd.get_xmd()
        mbs_options = xmd.get("mbs", {})
        mbs_options["buildrequires"] = {"platform": {"stream": "xx"}}
        xmd["mbs"] = mbs_options
        mmd.set_xmd(xmd)
        try:
            opts = Modulemd.Buildopts()
            opts.add_arch("x86_64")
            mmd.set_buildopts(opts)
            expected_result = ["x86_64"]
        except AttributeError:
            # libmodulemd version < 2.8.3
            expected_result = ["x86_64", "i686"]

        r = get_build_arches(mmd, conf)
        assert r == expected_result
Example #5
0
 def test_get_build_arches(self, ClientSession):
     session = ClientSession.return_value
     session.getTag.return_value = {"arches": "ppc64le"}
     mmd = load_mmd(read_staged_data("formatted_testmodule"))
     r = get_build_arches(mmd, conf)
     assert r == ["ppc64le"]