Adding SWH-compatible hash for source files of package versions #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is a proof of concept to address fasten-project/fasten#102. A small plugin,
swh-inserter
, is created to add an SWH-compatible hash to the files in the metadata DB.The plugin performs the following steps in order to update the metadata DB with SWH-compatible file hashes:
fasten.SourcesProvider.*
, find its package version ID in the metadata DB.3.1. read its source code file from the disk.
3.2. compute an SWH-compatible hash for the source code in step 3.1.
3.3 insert the obtained file hash into the
metadata
field of thefiles
table by adding{'swh_checksum'}
.Testing
The implementation is tested using the DC. Also, for several random files, the computed hash in the DB is compared with
git hash-object -w
and they match.