Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGES/446.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed sync failure on gems with colons in dependency specs (e.g., rails).
2 changes: 1 addition & 1 deletion pulp_gem/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ async def read_info(relative_path, versions_info):
(item.split(":", maxsplit=1) for item in dependencies.split(","))
)
for stmt in back.split(","):
key, value = stmt.split(":")
key, value = stmt.split(":", 1)
if key == "checksum":
gem_info["checksum"] = value
elif key == "ruby":
Expand Down
22 changes: 21 additions & 1 deletion pulp_gem/tests/unit/test_spec.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from pulp_gem.specs import ruby_ver_cmp, ruby_ver_includes
import asyncio

from pulp_gem.specs import read_info, ruby_ver_cmp, ruby_ver_includes


def test_version_cmp():
Expand All @@ -20,3 +22,21 @@ def test_version_includes():
assert ruby_ver_includes(">= 1&< 3", "1.5.a0")
assert ruby_ver_includes(">= 1&< 3", "3.0.0a5")
assert not ruby_ver_includes(">= 1&< 3", "3.0.1a5")


def test_read_info_colon_in_value(tmp_path):
info_file = tmp_path / "info"
info_file.write_text(
"---\n7.0.1 activesupport:= 7.0.1|checksum:abc123,ruby:>= 2.7.0,rubygems:>= 1.8.11\n"
)
versions_info = {"7.0.1": {"version": "7.0.1", "platform": "ruby", "prerelease": False}}

async def _collect():
return [info async for info in read_info(str(info_file), versions_info)]

results = asyncio.run(_collect())
assert len(results) == 1
assert results[0]["checksum"] == "abc123"
assert results[0]["required_ruby_version"] == ">= 2.7.0"
assert results[0]["required_rubygems_version"] == ">= 1.8.11"
assert results[0]["dependencies"] == {"activesupport": "= 7.0.1"}