repoclosure: Remove useless wrapper class

We already get namespacing from being in a separate module.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-01-26 08:59:47 +01:00
parent 5693bf9925
commit 7a8fa87172
3 changed files with 31 additions and 46 deletions

View File

@ -18,7 +18,7 @@ import os
from kobo.shortcuts import run
from pungi.wrappers.repoclosure import RepoclosureWrapper
from pungi.wrappers import repoclosure
from pungi.arch import get_valid_arches
from pungi.phases.base import PhaseBase
from pungi.phases.gather import get_lookaside_repos
@ -34,8 +34,6 @@ class TestPhase(PhaseBase):
def run_repoclosure(compose):
repoclosure = RepoclosureWrapper()
# TODO: Special handling for src packages (use repoclosure param builddeps)
msg = "Running repoclosure"

View File

@ -19,43 +19,38 @@ import os
from kobo.shortcuts import force_list
class RepoclosureWrapper(object):
def get_repoclosure_cmd(arch=None, builddeps=False,
repos=None, lookaside=None):
def __init__(self):
self.actual_id = 0
cmd = ["/usr/bin/repoclosure"]
# There are options that are not exposed here, because we don't need
# them. These are:
# --config
# --basearch
# --tempcache
# --quiet
# --newest
# --pkg
# --group
def get_repoclosure_cmd(self, arch=None, builddeps=False,
repos=None, lookaside=None):
for i in force_list(arch or []):
cmd.append("--arch=%s" % i)
cmd = ["/usr/bin/repoclosure"]
# There are options that are not exposed here, because we don't need
# them. These are:
# --config
# --basearch
# --tempcache
# --quiet
# --newest
# --pkg
# --group
if builddeps:
cmd.append("--builddeps")
for i in force_list(arch or []):
cmd.append("--arch=%s" % i)
repos = repos or {}
for repo_id, repo_path in repos.iteritems():
if "://" not in repo_path:
repo_path = "file://%s" % os.path.abspath(repo_path)
cmd.append("--repofrompath=%s,%s" % (repo_id, repo_path))
cmd.append("--repoid=%s" % repo_id)
if builddeps:
cmd.append("--builddeps")
lookaside = lookaside or {}
for repo_id, repo_path in lookaside.iteritems():
if "://" not in repo_path:
repo_path = "file://%s" % os.path.abspath(repo_path)
cmd.append("--repofrompath=%s,%s" % (repo_id, repo_path))
cmd.append("--lookaside=%s" % repo_id)
repos = repos or {}
for repo_id, repo_path in repos.iteritems():
if "://" not in repo_path:
repo_path = "file://%s" % os.path.abspath(repo_path)
cmd.append("--repofrompath=%s,%s" % (repo_id, repo_path))
cmd.append("--repoid=%s" % repo_id)
lookaside = lookaside or {}
for repo_id, repo_path in lookaside.iteritems():
if "://" not in repo_path:
repo_path = "file://%s" % os.path.abspath(repo_path)
cmd.append("--repofrompath=%s,%s" % (repo_id, repo_path))
cmd.append("--lookaside=%s" % repo_id)
return cmd
return cmd

View File

@ -10,25 +10,19 @@ import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
from pungi.wrappers import repoclosure
from pungi.wrappers import repoclosure as rc
class RepoclosureWrapperTestCase(unittest.TestCase):
def test_minimal_command(self):
rc = repoclosure.RepoclosureWrapper()
self.assertEqual(rc.get_repoclosure_cmd(),
['/usr/bin/repoclosure'])
def test_multiple_arches(self):
rc = repoclosure.RepoclosureWrapper()
self.assertEqual(rc.get_repoclosure_cmd(arch=['x86_64', 'ppc64']),
['/usr/bin/repoclosure', '--arch=x86_64', '--arch=ppc64'])
def test_full_command(self):
rc = repoclosure.RepoclosureWrapper()
repos = {'my-repo': '/mnt/koji/repo'}
lookaside = {'fedora': 'http://kojipkgs.fp.o/repo'}
@ -45,7 +39,6 @@ class RepoclosureWrapperTestCase(unittest.TestCase):
'--lookaside=fedora'])
def test_expand_repo(self):
rc = repoclosure.RepoclosureWrapper()
repos = {
'local': '/mnt/koji/repo',
'remote': 'http://kojipkgs.fp.o/repo',
@ -60,7 +53,6 @@ class RepoclosureWrapperTestCase(unittest.TestCase):
'--repoid=remote'])
def test_expand_lookaside(self):
rc = repoclosure.RepoclosureWrapper()
repos = {
'local': '/mnt/koji/repo',
'remote': 'http://kojipkgs.fp.o/repo',