   end
 
   defp update_tar(release, name, output_dir, overlays) do
+    Logger.debug "Updating tarball"
     tarfile = '#{Path.join([output_dir, "releases", release.version, name <> ".tar.gz"])}'
     tmpdir = Utils.insecure_mkdtemp!
     :erl_tar.extract(tarfile, [{:cwd, '#{tmpdir}'}, :compressed])

  @moduledoc """
  This module is responsible for packaging a release into a tarball.
  """
  alias Mix.Releases.{Release, Overlays, Utils}

  def archive(%Release{} = release) do
    name = "#{release.name}"
    output_dir = Path.relative_to_cwd(Path.join("rel", "#{release.name}"))

    case make_tar(release, name, output_dir) do
      {:error, _} = err ->
        err

  end

  defp generate_overlay_vars(release) do
    vars = [erts_vsn: Utils.erts_version(),
            release_name: release.name,
            release_version: release.version]
    Logger.debug "Generated overlay vars:"
    IO.puts "#{IO.ANSI.cyan}  " <>
      "#{Enum.map(vars, fn {k,v} -> "#{k}=#{inspect v}" end) |> Enum.join("\n  ")}" <>
      IO.ANSI.reset
    vars
  end
end
