Skip to content

Commit

Permalink
Merge pull request #8339 from rolandwalker/remove_homebrew_download_s…
Browse files Browse the repository at this point in the history
…tage

remove homebrew-fork staging logic
  • Loading branch information
rolandwalker committed Dec 20, 2014
2 parents b22e75a + a104592 commit 8b7936f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 71 deletions.
44 changes: 0 additions & 44 deletions lib/homebrew-fork/Library/Homebrew/download_strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def quiet_safe_system *args

# All download strategies are expected to implement these methods
def fetch; end
def stage; end
def cached_location; end
def clear_cache; end
end
Expand Down Expand Up @@ -146,52 +145,13 @@ def buffered_write(tool)
end
end

def stage
case tarball_path.compression_type
when :zip
with_system_path { quiet_safe_system 'unzip', {:quiet_flag => '-qq'}, tarball_path }
chdir
when :gzip_only
with_system_path { buffered_write("gunzip") }
when :bzip2_only
with_system_path { buffered_write("bunzip2") }
when :gzip, :bzip2, :compress, :tar
# Assume these are also tarred
# TODO check if it's really a tar archive
with_system_path { safe_system 'tar', 'xf', tarball_path }
chdir
when :xz
with_system_path { safe_system "#{xzpath} -dc \"#{tarball_path}\" | tar xf -" }
chdir
when :lzip
with_system_path { safe_system "#{lzippath} -dc \"#{tarball_path}\" | tar xf -" }
chdir
when :xar
safe_system "/usr/bin/xar", "-xf", tarball_path
when :rar
quiet_safe_system 'unrar', 'x', {:quiet_flag => '-inul'}, tarball_path
when :p7zip
safe_system '7zr', 'x', tarball_path
else
FileUtils.cp tarball_path, basename_without_params
end
end

private

def curl(*args)
args << '--connect-timeout' << '5' unless mirrors.empty?
super
end

def xzpath
"#{HOMEBREW_PREFIX}/opt/xz/bin/xz"
end

def lzippath
"#{HOMEBREW_PREFIX}/opt/lzip/bin/lzip"
end

def chdir
entries = Dir['*']
case entries.length
Expand Down Expand Up @@ -264,10 +224,6 @@ def fetch
end
end

def stage
quiet_safe_system 'svn', 'export', '--force', @clone, Dir.pwd
end

def shell_quote str
# Oh god escaping shell args.
# See http://notetoself.vrensk.com/2008/08/escaping-single-quotes-in-ruby-harder-than-expected/
Expand Down
27 changes: 0 additions & 27 deletions lib/homebrew-fork/Library/Homebrew/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,6 @@ def clear_cache
downloader.clear_cache
end

# Fetch, verify, and unpack the resource
def stage(target=nil, &block)
verify_download_integrity(fetch)
unpack(target, &block)
end

# If a target is given, unpack there; else unpack to a temp folder
# If block is given, yield to that block
# A target or a block must be given, but not both
def unpack(target=nil)
mktemp(download_name) do
downloader.stage
if block_given?
yield self
elsif target
target = Pathname.new(target) unless target.is_a? Pathname
target.install Dir['*']
end
end
end

Partial = Struct.new(:resource, :files)

def files(*files)
Expand Down Expand Up @@ -150,10 +129,4 @@ def detect_version(val)
raise TypeError, "version '#{val.inspect}' should be a string"
end
end

class Go < Resource
def stage target
super(target/name)
end
end
end

0 comments on commit 8b7936f

Please sign in to comment.