Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding SWH-compatible hash for source files of package versions #32

Merged
merged 5 commits into from
Aug 15, 2022

Conversation

mir-am
Copy link
Contributor

@mir-am mir-am commented Aug 15, 2022

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:

  1. Given a package version from fasten.SourcesProvider.*, find its package version ID in the metadata DB.
  2. From the metadata DB, retrieve the file paths for the package version ID in step 1.
  3. For each file in step 2, do:
    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 the files 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.

@mir-am mir-am self-assigned this Aug 15, 2022
Copy link
Contributor

@proksch proksch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the pair programming session, I am happy with the current version.

@mir-am mir-am merged commit 0f66d16 into main Aug 15, 2022
@mir-am mir-am deleted the swh-inserter branch August 15, 2022 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants