Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a double-delimiter bug in the CentOS finder #37

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions soufi/finders/centos.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ def get_source_repos(self):
"""
for dir in self._get_dirs():
for subdir in self.repos:
url = f"{VAULT}/{dir}/{subdir}/Source/"
url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/Source/"
if self.test_url(url + "repodata/"):
yield url
if self.optimal_repos:
for subdir in OPTIMAL_SEARCH:
url = f"{VAULT}/{dir}/{subdir}/Source/"
url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/Source/"
if self.test_url(url + "repodata/"):
yield url

Expand All @@ -112,8 +112,8 @@ def get_binary_repos(self):
"""

def _find_valid_repo_url(dir, subdir):
vault_url = f"{VAULT}/{dir}/{subdir}/x86_64/"
mirror_url = f"{MIRROR}/{dir}/{subdir}/x86_64/"
vault_url = f"{VAULT.rstrip('/')}/{dir}/{subdir}/x86_64/"
mirror_url = f"{MIRROR.rstrip('/')}/{dir}/{subdir}/x86_64/"
for url in vault_url, mirror_url:
if self.test_url(url + "os/repodata/"):
yield url + "os/"
Expand Down
20 changes: 10 additions & 10 deletions soufi/tests/finders/test_centos_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test__get_source_repos(self):
test_url.return_value = True
result = list(finder.get_source_repos())
expected = [
f"{centos.VAULT}/{dir}/{subdir}/Source/"
f"{centos.VAULT}{dir}/{subdir}/Source/"
for dir in dirs
for subdir in subdirs
]
Expand All @@ -86,7 +86,7 @@ def test__get_source_repos_optimal(self):
test_url.return_value = True
result = list(finder.get_source_repos())
expected = [
f"{centos.VAULT}/{dir}/{subdir}/Source/"
f"{centos.VAULT}{dir}/{subdir}/Source/"
for dir in dirs
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
]
Expand All @@ -102,7 +102,7 @@ def test__get_binary_repos(self):
test_url.return_value = True
result = list(finder.get_binary_repos())
expected = [
f"{centos.VAULT}/{dir}/{subdir}/x86_64/os/"
f"{centos.VAULT}{dir}/{subdir}/x86_64/os/"
for dir in dirs
for subdir in subdirs
]
Expand All @@ -118,7 +118,7 @@ def test__get_binary_repos_old_style(self):
test_url.side_effect = itertools.cycle((False, True))
result = list(finder.get_binary_repos())
expected = [
f"{centos.VAULT}/{dir}/{subdir}/x86_64/"
f"{centos.VAULT}{dir}/{subdir}/x86_64/"
for dir in dirs
for subdir in subdirs
]
Expand All @@ -134,7 +134,7 @@ def test__get_binary_repos_using_mirror(self):
test_url.side_effect = itertools.cycle((False, False, True))
result = list(finder.get_binary_repos())
expected = [
f"{centos.MIRROR}/{dir}/{subdir}/x86_64/os/"
f"{centos.MIRROR}{dir}/{subdir}/x86_64/os/"
for dir in dirs
for subdir in subdirs
]
Expand All @@ -150,7 +150,7 @@ def test__get_binary_repos_old_style_using_mirror(self):
test_url.side_effect = itertools.cycle((False, False, False, True))
result = list(finder.get_binary_repos())
expected = [
f"{centos.MIRROR}/{dir}/{subdir}/x86_64/"
f"{centos.MIRROR}{dir}/{subdir}/x86_64/"
for dir in dirs
for subdir in subdirs
]
Expand All @@ -166,7 +166,7 @@ def test__get_binary_repos_optimal(self):
test_url.return_value = True
result = list(finder.get_binary_repos())
expected = [
f"{centos.VAULT}/{dir}/{subdir}/x86_64/os/"
f"{centos.VAULT}{dir}/{subdir}/x86_64/os/"
for dir in dirs
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
]
Expand All @@ -182,7 +182,7 @@ def test__get_binary_repos_optimal_old_style(self):
test_url.side_effect = itertools.cycle((False, True))
result = list(finder.get_binary_repos())
expected = [
f"{centos.VAULT}/{dir}/{subdir}/x86_64/"
f"{centos.VAULT}{dir}/{subdir}/x86_64/"
for dir in dirs
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
]
Expand All @@ -198,7 +198,7 @@ def test__get_binary_repos_optimal_using_mirror(self):
test_url.side_effect = itertools.cycle((False, False, True))
result = list(finder.get_binary_repos())
expected = [
f"{centos.MIRROR}/{dir}/{subdir}/x86_64/os/"
f"{centos.MIRROR}{dir}/{subdir}/x86_64/os/"
for dir in dirs
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
]
Expand All @@ -214,7 +214,7 @@ def test__get_binary_repos_optimal_old_style_using_mirror(self):
test_url.side_effect = itertools.cycle((False, False, False, True))
result = list(finder.get_binary_repos())
expected = [
f"{centos.MIRROR}/{dir}/{subdir}/x86_64/"
f"{centos.MIRROR}{dir}/{subdir}/x86_64/"
for dir in dirs
for subdir in (centos.DEFAULT_SEARCH + centos.OPTIMAL_SEARCH)
]
Expand Down