Skip to content

Commit

Permalink
Use 7z instead of unzip, it handles more zipfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
bronson committed Jun 3, 2011
1 parent 151292f commit e87b106
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions scraper
Expand Up @@ -6,8 +6,8 @@
# #
# DEPENDENCIES # DEPENDENCIES
# This script requires Ruby 1.9.2+. # This script requires Ruby 1.9.2+.
# Make sure you have unzip, unrar, 7za, and xz installed. # Make sure you have unrar, 7za, and xz installed.
# Ubuntu: sudo apt-get install unzip unrar p7zip-full xz-utils # Ubuntu: sudo apt-get install unrar p7zip-full xz-utils
# Macintosh: sudo port install unrar p7zip xz # Macintosh: sudo port install unrar p7zip xz
# #
# FULL SCRAPE: # FULL SCRAPE:
Expand Down Expand Up @@ -969,8 +969,7 @@ def unshell repo, script, localpath, cmd
fullpath = File.expand_path(localpath) fullpath = File.expand_path(localpath)
Dir.chdir(tmpdir) do Dir.chdir(tmpdir) do
cmd = [*cmd, fullpath] cmd = [*cmd, fullpath]
# unzip returns a 1 exit code for success with warnings unless system *cmd
unless system(*cmd) || (cmd[0] == 'unzip' && $?.exitstatus == 1)
raise "couldn't run #{cmd.join(' ')}: #{$?}" raise "couldn't run #{cmd.join(' ')}: #{$?}"
end end
end end
Expand Down Expand Up @@ -1113,17 +1112,12 @@ def add_version repo, version, script


case actual_name case actual_name
when nil then # do nothing when nil then # do nothing

# horrible special case for 3584 - checklist.vim
when /checklist-v0.51.zip$/ then unshell repo, script, pkgfile, ['7z', 'x']

when /#{$textext}/ then smart_copy_file repo, script, actual_name, File.read(pkgfile) when /#{$textext}/ then smart_copy_file repo, script, actual_name, File.read(pkgfile)
when /\.zip$/i then unshell repo, script, pkgfile, ['unzip'] when /\.zip$|\.7z$/i then unshell repo, script, pkgfile, ['7z', 'x']
when /\.tar$/ then unshell repo, script, pkgfile, ['tar', 'xf'] when /\.tar$/ then unshell repo, script, pkgfile, ['tar', 'xf']
when /\.t?gz$/i then ungzip(pkgfile) { |contents| sense_zipped_file(repo, script, version['filename'].sub(/\.t?gz$/, ''), contents) } when /\.t?gz$/i then ungzip(pkgfile) { |contents| sense_zipped_file(repo, script, version['filename'].sub(/\.t?gz$/, ''), contents) }
when /\.t?bz2?$/i then unbzip2(pkgfile) { |contents| sense_zipped_file(repo, script, version['filename'].sub(/\.t?bz2?$/, ''), contents) } when /\.t?bz2?$/i then unbzip2(pkgfile) { |contents| sense_zipped_file(repo, script, version['filename'].sub(/\.t?bz2?$/, ''), contents) }
when /\.xz$/ then unxz(pkgfile) { |contents| sense_zipped_file(repo, script, version['filename'].sub(/\.xz$/, ''), contents) } when /\.xz$/ then unxz(pkgfile) { |contents| sense_zipped_file(repo, script, version['filename'].sub(/\.xz$/, ''), contents) }
when /\.7z$/ then unshell repo, script, pkgfile, ['7za', 'x']
when /\.rar$/ then unshell repo, script, pkgfile, ['unrar', 'x'] when /\.rar$/ then unshell repo, script, pkgfile, ['unrar', 'x']
when /\.vba$|\.vimball$/ then unvimball repo, script, pkgfile when /\.vba$|\.vimball$/ then unvimball repo, script, pkgfile
when /\.jar$/ then copy_file repo, actual_name, File.read(pkgfile) when /\.jar$/ then copy_file repo, actual_name, File.read(pkgfile)
Expand Down

0 comments on commit e87b106

Please sign in to comment.