File elixir-1.9.4-git.patch of Package elixir
diff --git a/lib/elixir/lib/path.ex b/lib/elixir/lib/path.ex
index 090899aa7..f2fbd02b8 100644
--- a/lib/elixir/lib/path.ex
+++ b/lib/elixir/lib/path.ex
@@ -95,6 +95,8 @@ defmodule Path do
absname(absname_join(name), cwd)
end
+ @slash [?/, ?\\]
+
# Joins a list
defp absname_join([name1, name2 | rest]), do: absname_join([absname_join(name1, name2) | rest])
@@ -110,6 +112,11 @@ defmodule Path do
do_absname_join(rest, relativename, [?:, uc_letter + ?a - ?A], :win32)
end
+ defp do_absname_join(<<c1, c2, rest::binary>>, relativename, [], :win32)
+ when c1 in @slash and c2 in @slash do
+ do_absname_join(rest, relativename, '//', :win32)
+ end
+
defp do_absname_join(<<?\\, rest::binary>>, relativename, result, :win32),
do: do_absname_join(<<?/, rest::binary>>, relativename, result, :win32)
@@ -254,8 +261,6 @@ defmodule Path do
defp unix_pathtype([list | rest]) when is_list(list), do: unix_pathtype(list ++ rest)
defp unix_pathtype(relative), do: {:relative, relative}
- @slash [?/, ?\\]
-
defp win32_pathtype([list | rest]) when is_list(list), do: win32_pathtype(list ++ rest)
defp win32_pathtype([char, list | rest]) when is_list(list),
diff --git a/lib/elixir/test/elixir/path_test.exs b/lib/elixir/test/elixir/path_test.exs
index 4ad0c9936..6d1daafa1 100644
--- a/lib/elixir/test/elixir/path_test.exs
+++ b/lib/elixir/test/elixir/path_test.exs
@@ -39,6 +39,13 @@ defmodule PathTest do
describe "Windows" do
@describetag :windows
+ test "absname/1" do
+ assert Path.absname("//host/path") == "//host/path"
+ assert Path.absname("\\\\host\\path") == "//host/path"
+ assert Path.absname("\\/host\\path") == "//host/path"
+ assert Path.absname("/\\host\\path") == "//host/path"
+ end
+
test "relative/1" do
assert Path.relative("C:/usr/local/bin") == "usr/local/bin"
assert Path.relative("C:\\usr\\local\\bin") == "usr\\local\\bin"
@@ -67,6 +74,11 @@ defmodule PathTest do
assert Path.type("/usr/local/bin") == :volumerelative
assert Path.type('usr/local/bin') == :relative
assert Path.type("../usr/local/bin") == :relative
+
+ assert Path.type("//host/path") == :absolute
+ assert Path.type("\\\\host\\path") == :absolute
+ assert Path.type("/\\host\\path") == :absolute
+ assert Path.type("\\/host\\path") == :absolute
end
test "split/1" do
diff --git a/lib/mix/lib/mix/tasks/release.ex b/lib/mix/lib/mix/tasks/release.ex
index 9aa1b240d..68b50e85f 100644
--- a/lib/mix/lib/mix/tasks/release.ex
+++ b/lib/mix/lib/mix/tasks/release.ex
@@ -1033,7 +1033,9 @@ defmodule Mix.Tasks.Release do
lib_dirs ++ release_files
files =
- Enum.map(dirs, &{String.to_charlist(&1), String.to_charlist(Path.join(release.path, &1))})
+ dirs
+ |> Enum.filter(&File.exists?(Path.join(release.path, &1)))
+ |> Enum.map(&{String.to_charlist(&1), String.to_charlist(Path.join(release.path, &1))})
File.rm(out_path)
:ok = :erl_tar.create(String.to_charlist(out_path), files, [:dereference, :compressed])
diff --git a/lib/mix/test/mix/tasks/release_test.exs b/lib/mix/test/mix/tasks/release_test.exs
index dde079717..fbae8d766 100644
--- a/lib/mix/test/mix/tasks/release_test.exs
+++ b/lib/mix/test/mix/tasks/release_test.exs
@@ -67,6 +67,8 @@ defmodule Mix.Tasks.ReleaseTest do
assert "releases/0.1.0/vm.args" in files
assert "releases/COOKIE" in files
assert "releases/start_erl.data" in files
+ assert Enum.any?(files, &(&1 =~ "erts"))
+ assert Enum.any?(files, &(&1 =~ "stdlib"))
for dir <- files_with_versions -- ["ignored_app-0.1.0"] do
[name | _] = String.split(dir, "-")
@@ -79,6 +81,29 @@ defmodule Mix.Tasks.ReleaseTest do
end)
end
+ test "tar without ERTS" do
+ in_fixture("release_test", fn ->
+ config = [releases: [demo: [include_erts: false, steps: [:assemble, :tar]]]]
+
+ Mix.Project.in_project(:release_test, ".", config, fn _ ->
+ root = Path.absname("_build/#{Mix.env()}/rel/demo")
+
+ Mix.Task.run("release")
+ tar_path = Path.expand(Path.join([root, "..", "..", "demo-0.1.0.tar.gz"]))
+ message = "* building #{tar_path}"
+ assert_received {:mix_shell, :info, [^message]}
+ assert File.exists?(tar_path)
+
+ {:ok, files} = String.to_charlist(tar_path) |> :erl_tar.table([:compressed])
+ files = Enum.map(files, &to_string/1)
+
+ assert "bin/demo" in files
+ refute Enum.any?(files, &(&1 =~ "erts"))
+ refute Enum.any?(files, &(&1 =~ "stdlib"))
+ end)
+ end)
+ end
+
test "steps" do
in_fixture("release_test", fn ->
last_step = fn release ->