aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2012-06-26 00:51:02 -0500
committerJack Nagel2012-07-04 22:47:34 -0500
commit96f396c9d461aa50049e0856e8f32667ad3a9c37 (patch)
tree980e174b02248f722b4c3594c2210e176c1456f6
parent078cfc51586bc834418a86c423ec419935c4d302 (diff)
downloadhomebrew-96f396c9d461aa50049e0856e8f32667ad3a9c37.tar.bz2
fetch: use new checksum verification
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
-rw-r--r--Library/Homebrew/cmd/fetch.rb12
-rw-r--r--Library/Homebrew/exceptions.rb8
2 files changed, 9 insertions, 11 deletions
diff --git a/Library/Homebrew/cmd/fetch.rb b/Library/Homebrew/cmd/fetch.rb
index 9e0dfbe9a..42a7199b5 100644
--- a/Library/Homebrew/cmd/fetch.rb
+++ b/Library/Homebrew/cmd/fetch.rb
@@ -36,14 +36,10 @@ module Homebrew extend self
puts "SHA1: #{the_tarball.sha1}"
puts "SHA256: #{the_tarball.sha2}"
- unless previous_md5.nil? or previous_md5.empty? or the_tarball.md5 == previous_md5
- opoo "Formula reports different MD5: #{previous_md5}"
- end
- unless previous_sha1.nil? or previous_sha1.empty? or the_tarball.sha1 == previous_sha1
- opoo "Formula reports different SHA1: #{previous_sha1}"
- end
- unless previous_sha2.nil? or previous_sha2.empty? or the_tarball.sha2 == previous_sha2
- opoo "Formula reports different SHA256: #{previous_sha2}"
+ begin
+ f.verify_download_integrity the_tarball
+ rescue ChecksumMismatchError => e
+ opoo "Formula reports different #{e.hash_type}: #{e.expected}"
end
end
end
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 2b7f6542c..431d89dfd 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -158,15 +158,17 @@ class ChecksumMismatchError < RuntimeError
attr :advice, true
attr :expected
attr :actual
+ attr :hash_type
def initialize expected, actual
@expected = expected
@actual = actual
+ @hash_type = expected.hash_type.to_s.upcase
super <<-EOS.undent
- #{expected.hash_type.to_s.upcase} mismatch
- Expected: #{expected}
- Actual: #{actual}
+ #{@hash_type} mismatch
+ Expected: #{@expected}
+ Actual: #{@actual}
EOS
end