Skip to content

Commit c024f05

Browse files
committed
Fix colon split in read_info() causing sync failure
Fixes #446 Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6fd212e commit c024f05

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

CHANGES/446.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed sync failure on gems with colons in dependency specs (e.g., rails).

pulp_gem/specs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ async def read_info(relative_path, versions_info):
157157
(item.split(":", maxsplit=1) for item in dependencies.split(","))
158158
)
159159
for stmt in back.split(","):
160-
key, value = stmt.split(":")
160+
key, value = stmt.split(":", 1)
161161
if key == "checksum":
162162
gem_info["checksum"] = value
163163
elif key == "ruby":

pulp_gem/tests/unit/test_spec.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from pulp_gem.specs import ruby_ver_cmp, ruby_ver_includes
1+
import asyncio
2+
3+
from pulp_gem.specs import read_info, ruby_ver_cmp, ruby_ver_includes
24

35

46
def test_version_cmp():
@@ -20,3 +22,21 @@ def test_version_includes():
2022
assert ruby_ver_includes(">= 1&< 3", "1.5.a0")
2123
assert ruby_ver_includes(">= 1&< 3", "3.0.0a5")
2224
assert not ruby_ver_includes(">= 1&< 3", "3.0.1a5")
25+
26+
27+
def test_read_info_colon_in_value(tmp_path):
28+
info_file = tmp_path / "info"
29+
info_file.write_text(
30+
"---\n7.0.1 activesupport:= 7.0.1|checksum:abc123,ruby:>= 2.7.0,rubygems:>= 1.8.11\n"
31+
)
32+
versions_info = {"7.0.1": {"version": "7.0.1", "platform": "ruby", "prerelease": False}}
33+
34+
async def _collect():
35+
return [info async for info in read_info(str(info_file), versions_info)]
36+
37+
results = asyncio.run(_collect())
38+
assert len(results) == 1
39+
assert results[0]["checksum"] == "abc123"
40+
assert results[0]["required_ruby_version"] == ">= 2.7.0"
41+
assert results[0]["required_rubygems_version"] == ">= 1.8.11"
42+
assert results[0]["dependencies"] == {"activesupport": "= 7.0.1"}

0 commit comments

Comments
 (0)