Created
March 21, 2011 20:37
-
-
Save netoneko/880176 to your computer and use it in GitHub Desktop.
homebrew supports binary packing/unpacking, not fully functional
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/homebrew/Library/Homebrew/cmd/--config.rb b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/--config.rb | |
index 6913f65..13326f1 100644 | |
--- a/homebrew/Library/Homebrew/cmd/--config.rb | |
+++ b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/--config.rb | |
@@ -48,6 +48,7 @@ module Homebrew extend self | |
HEAD: #{sha} | |
HOMEBREW_PREFIX: #{HOMEBREW_PREFIX} | |
HOMEBREW_CELLAR: #{HOMEBREW_CELLAR} | |
+ HOMEBREW_ARCHIVE: #{HOMEBREW_ARCHIVE} | |
HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY} | |
HOMEBREW_LIBRARY_PATH: #{HOMEBREW_LIBRARY_PATH} | |
Hardware: #{Hardware.cores_as_words}-core #{Hardware.bits}-bit #{Hardware.intel_family} | |
diff --git a/homebrew/Library/Homebrew/cmd/audit.rb b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/audit.rb | |
index 576a9c7..3e71711 100755 | |
--- a/homebrew/Library/Homebrew/cmd/audit.rb | |
+++ b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/audit.rb | |
@@ -1,12 +1,6 @@ | |
require 'formula' | |
require 'utils' | |
-# Use "brew audit --strict" to enable even stricter checks. | |
- | |
-def strict? | |
- ARGV.flag? "--strict" | |
-end | |
- | |
def ff | |
return Formula.all if ARGV.named.empty? | |
return ARGV.formulae | |
@@ -15,10 +9,6 @@ end | |
def audit_formula_text name, text | |
problems = [] | |
- if text =~ /<Formula/ | |
- problems << " * We now space class inheritance: class Foo < Formula" | |
- end if strict? | |
- | |
# Commented-out cmake support from default template | |
if (text =~ /# depends_on 'cmake'/) or (text =~ /# system "cmake/) | |
problems << " * Commented cmake support found." | |
@@ -102,20 +92,17 @@ def audit_formula_text name, text | |
problems << " * Use separate make calls." | |
end | |
- if text =~ /^\t/ | |
- problems << " * Use spaces instead of tabs for indentation" | |
- end if strict? | |
+ if ARGV.include? "--warn" | |
+ if text =~ /^\t/ | |
+ problems << " * Use spaces instead of tabs for indentation" | |
+ end | |
+ end | |
# Formula depends_on gfortran | |
if text =~ /\s*depends_on\s*(\'|\")gfortran(\'|\")\s*$/ | |
problems << " * Use ENV.fortran during install instead of depends_on 'gfortran'" | |
end unless name == "gfortran" # Gfortran itself has this text in the caveats | |
- # xcodebuild should specify SYMROOT | |
- if text =~ /xcodebuild/ and not text =~ /SYMROOT=/ | |
- problems << " * xcodebuild should be passed an explicit \"SYMROOT\"" | |
- end if strict? | |
- | |
return problems | |
end | |
@@ -196,7 +183,7 @@ def audit_formula_urls f | |
unless p =~ %r[^http://mirrors\.kernel\.org/debian/pool/] | |
problems << " * \"mirrors.kernel.org\" is the preferred mirror for debian software." | |
end | |
- end if strict? | |
+ end | |
return problems | |
end | |
diff --git a/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/pack_binary.rb b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/pack_binary.rb | |
new file mode 100644 | |
index 0000000..6e46305 | |
--- /dev/null | |
+++ b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/pack_binary.rb | |
@@ -0,0 +1,13 @@ | |
+module Homebrew extend self | |
+ def pack_binary | |
+ if !ARGV.empty? | |
+ ARGV.kegs.each do |keg| | |
+ keg_name, keg_version = keg.to_s.sub(HOMEBREW_CELLAR, '').split('/')[1,2] | |
+ archive_name = "#{HOMEBREW_ARCHIVE}/#{keg_name}-#{keg_version}.tgz" | |
+ puts "Packing #{keg_name}-#{keg_version} to #{archive_name}" | |
+ system "cd #{HOMEBREW_CELLAR} && tar cvfz #{archive_name} --exclude .DS_Store #{keg_name}/#{keg_version}" | |
+ puts "Done." | |
+ end | |
+ end | |
+ end | |
+end | |
\ No newline at end of file | |
diff --git a/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/unpack_binary.rb b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/unpack_binary.rb | |
new file mode 100644 | |
index 0000000..fb30be6 | |
--- /dev/null | |
+++ b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/cmd/unpack_binary.rb | |
@@ -0,0 +1,12 @@ | |
+module Homebrew extend self | |
+ def unpack_binary | |
+ if !ARGV.empty? | |
+ ARGV.archives.each do |keg| | |
+ archive_name = keg.to_s.sub(HOMEBREW_ARCHIVE, '').sub('/', '') | |
+ puts "Unpacking binaries from #{HOMEBREW_ARCHIVE}/#{archive_name} to #{HOMEBREW_CELLAR}" | |
+ system "cd /tmp && tar xvfz #{HOMEBREW_ARCHIVE}/#{archive_name}" | |
+ puts "Done." | |
+ end | |
+ end | |
+ end | |
+end | |
\ No newline at end of file | |
diff --git a/homebrew/Library/Homebrew/extend/ARGV.rb b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/extend/ARGV.rb | |
index 604ef27..eea8bf0 100644 | |
--- a/homebrew/Library/Homebrew/extend/ARGV.rb | |
+++ b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/extend/ARGV.rb | |
@@ -27,6 +27,21 @@ module HomebrewArgvExtension | |
raise KegUnspecifiedError if @kegs.empty? | |
@kegs | |
end | |
+ | |
+ def archives | |
+ require 'formula' | |
+ @archives ||= downcased_unique_named.collect do |name| | |
+ d = HOMEBREW_ARCHIVE | |
+ keg_name = Formula.caniconical_name(name) | |
+ files = d.children.select{ |pn| pn.file? && /#{keg_name}-(.*)\.tgz/.match(pn.sub(HOMEBREW_ARCHIVE, '').sub('/', '')) } rescue [] | |
+ raise NoSuchKegError.new(keg_name) if files.length == 0 | |
+ raise MultipleVersionsInstalledError.new(name) if files.length > 1 | |
+ puts files.first | |
+ files.first | |
+ end | |
+ raise KegUnspecifiedError if @archives.empty? | |
+ @archives | |
+ end | |
# self documenting perhaps? | |
def include? arg | |
diff --git a/homebrew/Library/Homebrew/global.rb b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/global.rb | |
index f248ce3..769d3f2 100644 | |
--- a/homebrew/Library/Homebrew/global.rb | |
+++ b/Downloads/mxcl-homebrew-4ee43a4/Library/Homebrew/global.rb | |
@@ -33,6 +33,12 @@ else | |
HOMEBREW_REPOSITORY+"Cellar" | |
end | |
+HOMEBREW_ARCHIVE = if (HOMEBREW_PREFIX+"Archive").exist? | |
+ HOMEBREW_PREFIX+"Archive" | |
+else | |
+ HOMEBREW_REPOSITORY+"Archive" | |
+end | |
+ | |
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp | |
MACOS_VERSION = /(10\.\d+)(\.\d+)?/.match(MACOS_FULL_VERSION).captures.first.to_f | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment