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

Add vendored sha256 #2684

Merged
merged 2 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions Library/Homebrew/cmd/vendor-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ fetch() {
elif [[ -x "$(which sha256sum)" ]]
then
sha="$(sha256sum "$CACHED_LOCATION" | cut -d' ' -f1)"
elif [[ -x "$(which ruby)" ]]
then
sha="$(ruby <<EOSCRIPT
require 'digest/sha2'
digest = Digest::SHA256.new
File.open('$CACHED_LOCATION', 'rb') { |f| digest.update(f.read) }
puts digest.hexdigest
Copy link
Member

Choose a reason for hiding this comment

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

Nice!

EOSCRIPT
)"
else
odie "Cannot verify the checksum ('shasum' or 'sha256sum' not found)!"
fi
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/extend/pathname.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def incremental_hash(klass)

def sha256
require "digest/sha2"
incremental_hash(Digest::SHA2)
incremental_hash(Digest::SHA256)
end

def verify_checksum(expected)
Expand Down