Switch to bsdtar for unpackaging a box

This commit is contained in:
Mitchell Hashimoto 2013-01-28 13:01:43 -08:00
parent a50539bc78
commit e6a0023713
2 changed files with 11 additions and 8 deletions

View File

@ -1,9 +1,10 @@
require "digest/sha1" require "digest/sha1"
require "tmpdir" require "tmpdir"
require "archive/tar/minitar"
require "log4r" require "log4r"
require "vagrant/util/subprocess"
module Vagrant module Vagrant
# Represents a collection a boxes found on disk. This provides methods # Represents a collection a boxes found on disk. This provides methods
# for accessing/finding individual boxes, adding new boxes, or deleting # for accessing/finding individual boxes, adding new boxes, or deleting
@ -89,11 +90,10 @@ module Vagrant
# Extract the box into a temporary directory. # Extract the box into a temporary directory.
@logger.debug("Unpacking box into temporary directory: #{temp_dir}") @logger.debug("Unpacking box into temporary directory: #{temp_dir}")
begin result = Util::Subprocess.execute(
Archive::Tar::Minitar.unpack(path.to_s, temp_dir.to_s) "bsdtar", "-v", "-x", "-C", temp_dir.to_s, "-f", path.to_s)
rescue SystemCallError raise Errors::BoxUnpackageFailure, :output => result.stderr.to_s \
raise Errors::BoxUnpackageFailure if result.exit_code != 0
end
# If we get a V1 box, we want to update it in place # If we get a V1 box, we want to update it in place
if v1_box?(temp_dir) if v1_box?(temp_dir)

View File

@ -669,8 +669,11 @@ en:
box: box:
unpackage: unpackage:
untar_failure: |- untar_failure: |-
The box failed to untar properly. Please verify that the box The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and try again. file you're trying to add is not corrupted and try again. The
output from attempting to unpackage (if any):
%{output}
already_exists: |- already_exists: |-
The box you're attempting to add already exits: The box you're attempting to add already exits: