Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9339411
D2479.id8812.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
D2479.id8812.diff
View Options
diff --git a/swh/loader/package/debian/loader.py b/swh/loader/package/debian/loader.py
--- a/swh/loader/package/debian/loader.py
+++ b/swh/loader/package/debian/loader.py
@@ -89,31 +89,38 @@
yield release_name(version), p_info
def resolve_revision_from(
- self, known_package_artifacts: Dict, artifact_metadata: Dict) \
+ self, known_package_artifacts: Mapping,
+ artifact_metadata: Mapping[str, Any]) \
-> Optional[bytes]:
- artifacts_to_fetch = artifact_metadata['files']
- logger.debug('k_p_artifacts: %s', known_package_artifacts)
- logger.debug('artifacts_to_fetch: %s', artifacts_to_fetch)
- for rev_id, known_artifacts in known_package_artifacts.items():
- logger.debug('Revision: %s', rev_id)
- logger.debug('Associated known_artifacts: %s', known_artifacts)
- known_artifacts = known_artifacts['extrinsic']['raw']['files']
- rev_found = True
- for a_name, k_artifact in known_artifacts.items():
- artifact_to_fetch = artifacts_to_fetch.get(a_name)
- logger.debug('artifact_to_fetch: %s', artifact_to_fetch)
- if artifact_to_fetch is None:
- # as soon as we do not see an artifact, we consider we need
- # to check the other revision
- rev_found = False
- if k_artifact['sha256'] != artifact_to_fetch['sha256']:
- # Hash is different, we consider we need to check the other
- # revisions
- rev_found = False
- if rev_found:
- logger.debug('Existing revision %s found for new artifacts.',
- rev_id)
- return rev_id
+ try:
+ artifacts_to_fetch = artifact_metadata['files']
+ logger.debug('k_p_artifacts: %s', known_package_artifacts)
+ logger.debug('artifacts_to_fetch: %s', artifacts_to_fetch)
+ for rev_id, known_artifacts in known_package_artifacts.items():
+ logger.debug('Revision: %s', rev_id)
+ logger.debug('Associated known_artifacts: %s', known_artifacts)
+ known_artifacts = known_artifacts['extrinsic']['raw']['files']
+ rev_found = False
+ for a_name, k_artifact in known_artifacts.items():
+ artifact_to_fetch = artifacts_to_fetch.get(a_name)
+ logger.debug('artifact_to_fetch: %s', artifact_to_fetch)
+ if artifact_to_fetch is None:
+ # as soon as we do not see an artifact, we consider we
+ # need to check the other revision
+ continue
+ if k_artifact['sha256'] == artifact_to_fetch['sha256']:
+ # Hash is different, we consider we need to check the
+ # other revisions
+ rev_found = True
+ break
+ if rev_found:
+ logger.debug(
+ 'Existing revision %s found for new artifacts.',
+ rev_id)
+ return rev_id
+ except KeyError as e:
+ logger.warning(
+ 'Older revision format detected, skipping. Reason: %s', e)
logger.debug('No existing revision found for the new artifacts.')
return None
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jul 3 2025, 9:40 AM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221577
Attached To
D2479: debian.loader: Improve resolution computation and fix corner cases
Event Timeline
Log In to Comment