示例#1
0
    def test_createrepo_not_last_batch(self):
        module = self._create_module_with_filters(
            db_session, 2, koji.BUILD_STATES["COMPLETE"])

        builder = MockModuleBuilder(db_session, "mcurlej", module, conf,
                                    module.koji_tag, module.component_builds)
        builder.resultsdir = self.resultdir
        rpms = [
            "ed-1.14.1-4.module+24957a32.x86_64.rpm",
            "mksh-56b-1.module+24957a32.x86_64.rpm",
        ]
        rpm_qf_output = dedent("""\
            ed 0 1.14.1 4.module+24957a32 x86_64
            mksh 0 56b-1 module+24957a32 x86_64
        """)
        with mock.patch("os.listdir", return_value=rpms):
            with mock.patch("subprocess.check_output",
                            return_value=rpm_qf_output):
                builder._createrepo()

        with open(os.path.join(self.resultdir, "pkglist"), "r") as fd:
            pkglist = fd.read().strip()
            rpm_names = [
                kobo.rpmlib.parse_nvr(rpm)["name"]
                for rpm in pkglist.split("\n")
            ]
            assert "ed" in rpm_names
示例#2
0
    def test_createrepo_empty_rmp_list(self):
        module = self._create_module_with_filters(
            db_session, 3, koji.BUILD_STATES["COMPLETE"])

        builder = MockModuleBuilder(db_session, "mcurlej", module, conf,
                                    module.koji_tag, module.component_builds)
        builder.resultsdir = self.resultdir
        rpms = []
        with mock.patch("os.listdir", return_value=rpms):
            builder._createrepo()

        with open(os.path.join(self.resultdir, "pkglist"), "r") as fd:
            pkglist = fd.read().strip()
            assert not pkglist
示例#3
0
    def test_buildroot_add_repos(self, write_config, load_config, patched_open,
                                 base_module_repofiles):
        import_fake_base_module("platform:f29:1:000000")

        platform = ModuleBuild.get_last_build_in_stream(
            db_session, "platform", "f29")
        module_deps = [{
            "requires": {
                "platform": ["f29"]
            },
            "buildrequires": {
                "platform": ["f29"]
            },
        }]
        foo = make_module_in_db("foo:1:1:1", module_deps)
        app = make_module_in_db("app:1:1:1", module_deps)

        patched_open.side_effect = [
            mock.mock_open(read_data="[fake]\nrepofile 1\n").return_value,
            mock.mock_open(read_data="[fake]\nrepofile 2\n").return_value,
            mock.mock_open(read_data="[fake]\nrepofile 3\n").return_value,
        ]

        builder = MockModuleBuilder(db_session, "user", app, conf,
                                    "module-app", [])

        dependencies = {
            "repofile://": [platform.mmd()],
            "repofile:///etc/yum.repos.d/foo.repo": [foo.mmd(),
                                                     app.mmd()],
        }

        builder.buildroot_add_repos(dependencies)

        assert "repofile 1" in builder.yum_conf
        assert "repofile 2" in builder.yum_conf
        assert "repofile 3" in builder.yum_conf

        assert set(builder.enabled_modules) == {"foo:1", "app:1"}