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

View File

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