Skip to content
Closed
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/331.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed synchronization in NpmFirstStage to correctly handle version strings with `||` and `~`.
13 changes: 10 additions & 3 deletions pulp_npm/app/tasks/synchronizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,24 @@ async def run(self):
while to_download:
next_batch = []
for name, version in to_download:
if version is None:
raise ValueError(f"Version for {name} is None")
version_clean = (
version.split("||")[-1].strip().replace("~", "").replace("^", "")
)

new_url = self.remote.url.replace(data[0]["name"], name)
new_url = new_url.replace(data[0]["version"], version.replace("^", ""))
new_url = new_url.replace(data[0]["version"], version_clean)

downloader = self.remote.get_downloader(url=new_url)
result = await downloader.run()

new_data = self.get_json_data(result.path)
data.append(new_data)
next_batch.extend(new_data.get("dependencies", {}).items())
downloaded.append((name, version))
downloaded.append((name, version_clean))

to_download.extend(next_batch)

for dependency in downloaded:
if dependency in to_download:
to_download.remove(dependency)
Expand Down
Loading