aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-09-17 17:11:27 -0700
committerAdam Vandenberg2010-09-17 17:11:27 -0700
commit389fdec9d4889401a32b2ff6015902cad308ff71 (patch)
treed4fba8e88ba8c2981ed9a29a5981dd27bd327596 /Library
parentb60a1b1ebe97adb5c3262eeba942d7abf23a3693 (diff)
downloadbrew-389fdec9d4889401a32b2ff6015902cad308ff71.tar.bz2
brew-fetch - warn if checksums differ
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/examples/brew-fetch.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/Library/Contributions/examples/brew-fetch.rb b/Library/Contributions/examples/brew-fetch.rb
index 2f7ddc6f8..28606e3fd 100755
--- a/Library/Contributions/examples/brew-fetch.rb
+++ b/Library/Contributions/examples/brew-fetch.rb
@@ -10,8 +10,19 @@ ARGV.formulae.each do |f|
end
the_tarball = f.downloader.fetch
- if the_tarball.kind_of? Pathname
- puts "MD5: #{the_tarball.md5}"
- puts "SHA1: #{the_tarball.sha1}"
+ next unless the_tarball.kind_of? Pathname
+
+ previous_md5 = f.instance_variable_get(:@md5)
+ previous_sha1 = f.instance_variable_get(:@sha1)
+
+ puts "MD5: #{the_tarball.md5}"
+ puts "SHA1: #{the_tarball.sha1}"
+ puts
+
+ unless previous_md5.nil? or the_tarball.md5 == previous_md5
+ opoo "Formula reports different MD5: #{previous_md5}"
+ end
+ unless previous_sha1.nil? or the_tarball.sha1 == previous_sha1
+ opoo "Formula reports different SHA1: #{previous_sha1}"
end
end