Skip to content

cli: Add a fallback to calculate the SHA1 if it is not present in the cache - #459

Merged
pombredanne merged 2 commits into
aboutcode-org:developfrom
sschuberth:spdx-sha1-fixes
Jan 19, 2017
Merged

cli: Add a fallback to calculate the SHA1 if it is not present in the cache#459
pombredanne merged 2 commits into
aboutcode-org:developfrom
sschuberth:spdx-sha1-fixes

Conversation

@sschuberth

@sschuberth sschuberth commented Jan 17, 2017

Copy link
Copy Markdown
Collaborator

@pombredanne I've updated the PR with a commit that addresses your TODO of writing a LicenseRef for licenses not known to SPDX.

@pombredanne

Copy link
Copy Markdown
Member

@sschuberth Thanks!
I am sorry that you have to resort to this... I think instead that I may prefer always adding the checksums (even if the file is empty) and instead add a new file-level flag `is_empty1 that would state the file is essentially empty junk: e.g. really empty, size is 0, or composed only of a single character (e.g. ----- or zeroes) or composed only of white spaces (spaces, tabs, lf, etc).... Let me think about this overnight: this is small and easy change and might be much cleaner.

@sschuberth

Copy link
Copy Markdown
Collaborator Author

I agree that adding hashes even for empty files is more consistent. However, you also told me I shouldn't rely on cache internals, and maybe at some point the info does not expose the SHA1 anymore, so having a fallback to calculate it might make sense anyway.

WRT storing info about empty files, maybe instead of introducing a whole new flag, consider adding another type in filetype.py?

@pombredanne

Copy link
Copy Markdown
Member

The info will always expose a sha1 (the fact that it is also used as a cache key is the only "internal" implementation part).

And you got it right: that would be a new flag in filetype.py

@pombredanne

Copy link
Copy Markdown
Member

@sschuberth I am merging this for now so this is not in your way and I created #461 to update the behavior

@pombredanne
pombredanne merged commit c2af8f5 into aboutcode-org:develop Jan 19, 2017
@sschuberth
sschuberth deleted the spdx-sha1-fixes branch January 19, 2017 12:17
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