Skip to content

Commit

Permalink
temp fix: import_id for versions
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenlei committed Jan 4, 2025
1 parent a18b4c8 commit 7a16c94
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions core/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,17 @@ def insert_versions(self, version_generator: Iterable[dict[str, str]]):
self._insert_batch(Version, versions)

def _process_version(self, item: Dict[str, str]):
package_id = self.package_cache.get(item["import_id"])
if not package_id:
self.logger.warn(f"package {item['import_id']} not found")
return None
# FIXME: this is a hack, the import_id of a version shouldn't be the same as the package's import_id
# but the original logic here tries to use the package's import_id as the version's import_id
# this is a temporary fix (for the implementation of pypi)
# to fix this completely, we need to update the logic of the crates transformer too
if item["package_id"]:
package_id = item["package_id"]
else:
package_id = self.package_cache.get(item["import_id"])
if not package_id:
self.logger.warn(f"package {item['import_id']} not found")
return None

license_id = self.license_cache.get(item["license"])
if not license_id:
Expand Down

0 comments on commit 7a16c94

Please sign in to comment.