2010-06-15 12:35:55 -07:00
|
|
|
# Downloads the tarballs for the given formulae to the Cache
|
|
|
|
|
|
|
|
require 'formula'
|
2010-06-15 21:52:11 -07:00
|
|
|
require 'fileutils'
|
2010-06-15 12:35:55 -07:00
|
|
|
|
|
|
|
ARGV.formulae.each do |f|
|
2010-06-15 21:52:11 -07:00
|
|
|
if ARGV.include? "--force" or ARGV.include? "-f"
|
|
|
|
where_to = `brew --cache #{f.name}`.strip
|
|
|
|
FileUtils.rm_rf where_to unless where_to.empty?
|
|
|
|
end
|
|
|
|
|
2010-07-04 10:42:44 -07:00
|
|
|
the_tarball = f.downloader.fetch
|
2010-09-17 17:11:27 -07:00
|
|
|
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}"
|
2010-07-07 21:31:55 -07:00
|
|
|
end
|
2010-06-15 12:35:55 -07:00
|
|
|
end
|