+ loader.debian: Make sense of the actual revision resolution algo
The logic in that function is messing me up a little bit, probably because it's missing a docstring explaining what the arguments are. Could you add one?
I'm guessing artifact_metadata is one of the packages you're currently processing, and known_package_artifacts come from the previous snapshot?
I've also suggested a way to make the logic a little bit less mind-bending.
these lines are backwards
It looks like what we want is to match the artifacts of the current package with all packages referenced in the previous snapshot in turn.
I _think_ that the logic in this loop is inverted, but I have a hard time comprehending it. The comments are backwards too :(
The logic would be much clearer if we did the comparison using set logic:
We could even make these sets ordered by filename, which lets us turn them into (hashable) tuples, which lets us build a dict mapping ((filename, (hash, hash, size)), ...) to revision_ids directly when fetching the previous snapshot, making this function a plain dict lookup.
This try block feels overly broad.
Could you just do
if 'files' not in artifact_metadata: logger.warning(...) return None # or even artifact_metadata.get('revision_id')
at the beginning of the function instead?
i agree the try is long.
So it should fail only for that.
this i found backward...
8d073f5dc6c8b7a322618c35'}}, 'version': '0.3.9-2', 'revision_id': None}} Dec 19 14:58:02 worker01 python3: [2019-12-19 14:58:02,443: ERROR/ForkPoolWorker-1] Fail to load deb://Debian/packages/freshplayerplugin Traceback (most recent call last): File "/usr/lib/python3/dist-packages/swh/loader/package/loader.py", line 286, in load known_artifacts, p_info['raw']) File "/usr/lib/python3/dist-packages/swh/loader/package/debian/loader.py", line 104, in resolve_revision_from known_artifacts = known_artifacts['extrinsic']['raw']['files'] KeyError: 'extrinsic'
docstring is in the main class 
i do not know how we can deal with that properly without replicating stuff.