From de18f1e4a685a3cfa3aec6b3a6510e31ed5194a4 Mon Sep 17 00:00:00 2001 From: Ilkka Laukkanen Date: Tue, 9 Mar 2010 18:25:16 +0200 Subject: [PATCH] Replace tarruby with archive-tar-minitar. Tarruby seems to not compile on 64-bit, and even its author says to use another library. Minitar seems to be more active than libarchive so I used that. Tests not fixed yet. --- Gemfile | 2 +- Rakefile | 4 ++-- lib/vagrant.rb | 2 +- lib/vagrant/actions/box/unpackage.rb | 7 ++----- lib/vagrant/actions/vm/package.rb | 6 +++--- vagrant.gemspec | 6 +++--- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index f0f1fce5a..691ee4b51 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ gem "net-ssh", ">= 2.0.19" gem "net-scp", ">= 1.0.2" gem "git-style-binaries", ">= 0.1.10" gem "json", ">= 1.2.0" -gem "tarruby", ">= 0.1.5" +gem "archive-tar-minitar", ">= 0.5.2" # Gems required for testing only. To install run # gem bundle test diff --git a/Rakefile b/Rakefile index 3bdc3289b..8efd14a39 100644 --- a/Rakefile +++ b/Rakefile @@ -15,7 +15,7 @@ begin gemspec.add_dependency('net-scp', '>= 1.0.2') gemspec.add_dependency('json', '>= 1.2.0') gemspec.add_dependency('git-style-binaries', '>= 0.1.10') - gemspec.add_dependency('tarruby', '>= 0.1.5') + gemspec.add_dependency('archive-tar-minitar', '>= 0.5.2') end Jeweler::GemcutterTasks.new rescue LoadError @@ -38,4 +38,4 @@ begin rescue LoadError puts "Yard not available. Install it with: gem install yard" puts "if you wish to be able to generate developer documentation." -end \ No newline at end of file +end diff --git a/lib/vagrant.rb b/lib/vagrant.rb index c6765e7b1..c26475201 100644 --- a/lib/vagrant.rb +++ b/lib/vagrant.rb @@ -3,7 +3,7 @@ $:.unshift(libdir) PROJECT_ROOT = File.join(libdir, '..') unless defined?(PROJECT_ROOT) # The libs which must be loaded prior to the rest -%w{tempfile open-uri json pathname logger uri net/http virtualbox net/ssh tarruby +%w{tempfile open-uri json pathname logger uri net/http virtualbox net/ssh archive/tar/minitar net/scp fileutils vagrant/util vagrant/actions/base vagrant/downloaders/base vagrant/actions/runner}.each do |f| require f end diff --git a/lib/vagrant/actions/box/unpackage.rb b/lib/vagrant/actions/box/unpackage.rb index 7c67a112c..097c8998b 100644 --- a/lib/vagrant/actions/box/unpackage.rb +++ b/lib/vagrant/actions/box/unpackage.rb @@ -4,7 +4,6 @@ module Vagrant # This action unpackages a downloaded box file into its final # box destination within the vagrant home folder. class Unpackage < Base - TAR_OPTIONS = [File::RDONLY, 0644, Tar::GNU] def execute! @runner.invoke_around_callback(:unpackage) do @@ -38,12 +37,10 @@ msg def decompress Dir.chdir(box_dir) do logger.info "Extracting box to #{box_dir}..." - Tar.open(@runner.temp_path, *TAR_OPTIONS) do |tar| - tar.extract_all - end + Archive::Tar::Minitar.unpack(@runner.temp_path, box_dir) end end end end end -end \ No newline at end of file +end diff --git a/lib/vagrant/actions/vm/package.rb b/lib/vagrant/actions/vm/package.rb index adc966afb..6a2dfc5b0 100644 --- a/lib/vagrant/actions/vm/package.rb +++ b/lib/vagrant/actions/vm/package.rb @@ -38,18 +38,18 @@ module Vagrant def compress logger.info "Packaging VM into #{tar_path} ..." - Tar.open(tar_path, File::CREAT | File::WRONLY, 0644, Tar::GNU) do |tar| + open(tar_path, File::CREAT | File::WRONLY, 0644) do |tar| begin current_dir = FileUtils.pwd @include_files.each do |f| logger.info "Packaging additional file: #{f}" - tar.append_file(f) + Archive::Tar::Minitar.pack(f, tar) end FileUtils.cd(temp_path) # Append tree will append the entire directory tree unless a relative folder reference is used - tar.append_tree(".") + Archive::Tar::Minitar.pack(".", tar) ensure FileUtils.cd(current_dir) end diff --git a/vagrant.gemspec b/vagrant.gemspec index eb3ec54c7..695602ffc 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -161,14 +161,14 @@ Gem::Specification.new do |s| s.add_runtime_dependency(%q, [">= 1.0.2"]) s.add_runtime_dependency(%q, [">= 1.2.0"]) s.add_runtime_dependency(%q, [">= 0.1.10"]) - s.add_runtime_dependency(%q, [">= 0.1.5"]) + s.add_runtime_dependency(%q, [">= 0.1.5"]) else s.add_dependency(%q, [">= 0.5.0"]) s.add_dependency(%q, [">= 2.0.19"]) s.add_dependency(%q, [">= 1.0.2"]) s.add_dependency(%q, [">= 1.2.0"]) s.add_dependency(%q, [">= 0.1.10"]) - s.add_dependency(%q, [">= 0.1.5"]) + s.add_dependency(%q, [">= 0.5.2"]) end else s.add_dependency(%q, [">= 0.5.0"]) @@ -176,7 +176,7 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 1.0.2"]) s.add_dependency(%q, [">= 1.2.0"]) s.add_dependency(%q, [">= 0.1.10"]) - s.add_dependency(%q, [">= 0.1.5"]) + s.add_dependency(%q, [">= 0.5.2"]) end end