repoclosure: Remove duplicated code

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2017-01-26 09:01:44 +01:00
parent 7a8fa87172
commit 56932f9067
1 changed files with 8 additions and 6 deletions

View File

@ -41,16 +41,18 @@ def get_repoclosure_cmd(arch=None, builddeps=False,
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("--repofrompath=%s,%s" % (repo_id, _to_url(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("--repofrompath=%s,%s" % (repo_id, _to_url(repo_path)))
cmd.append("--lookaside=%s" % repo_id)
return cmd
def _to_url(path):
if "://" not in path:
return "file://%s" % os.path.abspath(path)
return path