From 35aef1aa0b049d2d671ff32b81579ef556716c86 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 28 Jan 2013 13:18:07 -0800 Subject: [PATCH] Use bsdtar to repackage boxes --- lib/vagrant/box.rb | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/lib/vagrant/box.rb b/lib/vagrant/box.rb index 320ecdcfd..56e10760a 100644 --- a/lib/vagrant/box.rb +++ b/lib/vagrant/box.rb @@ -1,10 +1,10 @@ require 'fileutils' -require 'archive/tar/minitar' require "json" require "log4r" require "vagrant/util/platform" +require "vagrant/util/subprocess" module Vagrant # Represents a "box," which is a package Vagrant environment that is used @@ -68,26 +68,12 @@ module Vagrant def repackage(path) @logger.debug("Repackaging box '#{@name}' to: #{path}") - path.open(Util::Platform.tar_file_options) do |f| - Archive::Tar::Minitar::Output.open(f) do |output| - # Store the current working directory since we need to change - # for the tar library. - current_dir = FileUtils.pwd + Dir.chdir(@directory) do + # Find all the files in our current directory and tar it up! + files = Dir.glob(File.join(".", "**", "*")) - begin - FileUtils.cd(@directory) - - # Find all the files in our current directory and tar it up! - Dir.glob(File.join(".", "**", "*")).each do |entry| - @logger.debug("Packing file: #{entry}") - Archive::Tar::Minitar.pack_file(entry, output) - end - ensure - # Make sure we always cd back into our previous working - # directory. - FileUtils.cd(current_dir) - end - end + # Package! + Util::Subprocess.execute("bsdtar", "-czf", path.to_s, *files) end @logger.info("Repackaged box '#{@name}' successfully: #{path}")