コード例 #1
0
ファイル: genconf.py プロジェクト: ssato/python-myrepo
    def test_200_run__deploy(self):
        topdir = os.path.join(self.workdir, "yum")
        repos = mk_local_repos(topdir)
        ctx = mk_ctx(repos[:1])
        ctx["workdir"] = self.workdir
        ctx["deploy"] = True

        repo = repos[0]

        # ensure dirs to deploy rpms exists:
        rpmdirs = [os.path.join(repo.destdir, a) for a
                   in repo.archs + ["sources"]]

        for d in rpmdirs:
            os.makedirs(d)

        self.assertTrue(TT.run(ctx))

        def _list_rpms(d, pat="*.src.rpm"):
            return glob.glob(os.path.join(d, pat))

        srpms = _list_rpms(self.workdir)
        self.assertTrue(srpms)
        self.assertEquals(len(srpms), 1)  # A srpm should exist.
        srpm = Srpm(srpms[0])
        srpm.resolve()

        for d in rpmdirs:
            rpms = _list_rpms(d, "*.rpm")
            self.assertTrue(rpms)
コード例 #2
0
ファイル: genconf.py プロジェクト: ssato/python-myrepo
    def test_202_run__deploy_w_gpgkey(self):
        topdir = os.path.join(self.workdir, "yum")
        repos = mk_local_repos(topdir)
        ctx = mk_ctx(repos[:1])
        ctx["workdir"] = self.workdir
        ctx["deploy"] = True

        repo = repos[0]

        # ensure dirs to deploy rpms exists:
        rpmdirs = [os.path.join(repo.destdir, a) for a
                   in repo.archs + ["sources"]]

        for d in rpmdirs:
            os.makedirs(d)

        keyids = _find_gpg_keyids()
        if keyids:
            ctx["keyid"] = keyid = random.choice(keyids)
        else:
            sys.stderr.write("No GPG keyid was found. Skip this test...\n")
            return

        self.assertTrue(TT.run(ctx))

        def _list_rpms(d, pat="*.src.rpm"):
            return glob.glob(os.path.join(d, pat))

        srpms = _list_rpms(self.workdir)
        self.assertTrue(srpms)
        self.assertEquals(len(srpms), 1)  # A srpm should exist.
        srpm = Srpm(srpms[0])
        srpm.resolve()

        for d in rpmdirs:
            rpms = _list_rpms(d, "*.rpm")
            self.assertTrue(rpms)