Example #1
0
def prepare(repos):
    """
    Make up list of command strings to update metadata of given repos.
    It's similar to above ``prepare_0`` but applicable to multiple repos.

    :param repos: List of Repo instances

    :return: List of command strings to deploy built RPMs.
    """
    return MU.concat(prepare_0(repo) for repo in repos)
Example #2
0
def prepare(repos, srpm, build=False):
    """
    Make up list of command strings to update metadata of given repos.
    It's similar to above ``prepare_0`` but applicable to multiple repos.

    :param repos: List of Repo instances
    :param srpm: myrepo.srpm.Srpm instance
    :param build: Build given srpm before deployment

    :return: List of command strings to deploy built RPMs.
    """
    return MU.concat(prepare_0(repo, srpm, build) for repo in repos)
Example #3
0
    def test_10_prepare__localhost(self):
        repos = [MR.Repo("fedora", 18, ["x86_64", "i386"], self.server),
                 MR.Repo("fedora", 19, ["x86_64", "i386"], self.server),
                 MR.Repo("rhel", 6, ["x86_64", ], self.server)]

        def cs_expected_gen(repo):
            subdirs = ["sources"] + repo.archs
            return ["cd %s && %s" % (os.path.join(repo.destdir, a),
                                     TT._CMD_TEMPLATE) for a in subdirs]

        cs_expected = MU.concat(cs_expected_gen(repo) for repo in repos)
        cs = TT.prepare(repos)
        self.assertListEqual(cs, cs_expected)
Example #4
0
def prepare(repos, ctx, deploy=False, eof=None):
    """
    Make up list of command strings to update metadata of given repos.
    It's similar to above ``prepare_0`` but applicable to multiple repos.

    :param repos: List of Repo instances
    :param ctx: Context object to instantiate the template
    :param deploy: Deploy generated yum repo metadata RPMs also if True
    :param eof: The function to generate EOF marker strings for here docuemnts
        or None, that is, it will be generated automatically.

    :return: List of command strings to deploy built RPMs.
    """
    return MU.concat(prepare_0(repo, ctx, deploy, eof) for repo in repos)
Example #5
0
    def test_20_run__localhost(self):
        topdir = os.path.join(self.workdir, "yum")
        server = MR.Server("localhost", topdir=topdir, baseurl="file:///tmp")
        repos = [MR.Repo("fedora", 18, ["x86_64", "i386"], server),
                 MR.Repo("fedora", 19, ["x86_64", "i386"], server),
                 MR.Repo("rhel", 6, ["x86_64", ], server)]
        ctx = dict(repos=repos)

        repos_destdirs = MU.concat([os.path.join(repo.destdir, a) for a in
                                    ["sources"] + repo.archs] for repo in
                                   repos)

        for d in repos_destdirs:
            os.makedirs(d)  # Create repo dirs instead of initialization.

        self.assertTrue(TT.run(ctx))

        for d in repos_destdirs:
            self.assertTrue(os.path.exists(os.path.join(d, "repodata")),
                            "Failed to create %s/repodata !" % d)