From 0207260b9f7f641df5d263dd27287afdf212e470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Wed, 5 Jun 2019 12:27:43 +0200 Subject: [PATCH] fus: Support HTTP repos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent version of fus gained ability to download repodata if repo is provided as HTTP url. Signed-off-by: Lubomír Sedlář --- pungi/wrappers/fus.py | 10 +++------- tests/test_fus_wrapper.py | 31 +++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/pungi/wrappers/fus.py b/pungi/wrappers/fus.py index 0c8991f3..64020658 100644 --- a/pungi/wrappers/fus.py +++ b/pungi/wrappers/fus.py @@ -62,13 +62,9 @@ def write_config(conf_file, modules, packages): def _prep_path(path): - """Strip file:// from the path if present or raise exception for other - protocols. - """ - if "://" in path: - proto, path = path.split("://", 2) - if proto != "file": - raise ValueError("Only repositories on local filesystem are supported.") + """Strip file:// from the path if present.""" + if path.startswith("file://"): + return path[len("file://"):] return path diff --git a/tests/test_fus_wrapper.py b/tests/test_fus_wrapper.py index 3555a4ed..64e369d1 100644 --- a/tests/test_fus_wrapper.py +++ b/tests/test_fus_wrapper.py @@ -63,9 +63,19 @@ class TestGetCmd(unittest.TestCase): ], ) - def test_fail_on_http_repo(self): - with self.assertRaises(ValueError): - fus.get_cmd("conf", "x86_64", ["http:///tmp"], []) + def test_preserves_http_protocol(self): + cmd = fus.get_cmd("conf", "x86_64", [], ["http://r"]) + self.assertEqual( + cmd, + [ + "fus", + "--verbose", + "--arch", + "x86_64", + "--repo=lookaside-0,lookaside,http://r", + "@conf", + ], + ) def test_strip_file_protocol_lookaside(self): cmd = fus.get_cmd("conf", "x86_64", [], ["file:///r"]) @@ -81,9 +91,18 @@ class TestGetCmd(unittest.TestCase): ], ) - def test_fail_on_http_repo_lookaside(self): - with self.assertRaises(ValueError): - fus.get_cmd("conf", "x86_64", [], ["http:///tmp"]) + def test_preserves_http_protocol_lookaside(self): + self.assertEqual( + fus.get_cmd("conf", "x86_64", [], ["http:///tmp"]), + [ + "fus", + "--verbose", + "--arch", + "x86_64", + "--repo=lookaside-0,lookaside,http:///tmp", + "@conf", + ] + ) class TestWriteConfig(PungiTestCase):