Compare commits

...
3 Commits
Author SHA1 Message Date
Dmitry Kakurin 762989b39f Fix Path.absname/1 to correctly handle UNC paths on Windows (#9689) 2020-01-06 21:44:27 +01:00
Lasse Skindstad Ebert 1767df4747 Fix release tar when include_erts is false (#9570)
Now excludes files that does not exist on the file system. This could
happen e.g. if the release is built with `include_erts: false`.

Otherwise building the tar would fail with `:enoent`.
2019-11-22 11:20:54 +01:00
José Valim 055526057a Release v1.9.4 2019-11-05 16:29:34 +01:00
8 changed files with 66 additions and 8 deletions
+8
View File
@@ -58,6 +58,14 @@ Another important change related to configuration is that `mix new` will no long
There are many other enhancements. The Elixir CLI got a handful of new options in order to best support releases. `Logger` now computes its sync/async/discard thresholds in a decentralized fashion, reducing contention. `EEx` templates support more complex expressions than before. Finally, there is a new `~U` sigil for working with UTC DateTimes as well as new functions in the `File`, `Registry`, and `System` modules.
## v1.9.4 (2019-11-05)
### 1. Bug fixes
#### Mix
* [mix local.hex] Remove invalid deprecation warning on `mix local.hex` command
## v1.9.3 (2019-11-05)
Note this release deprecates the use of URLs on `mix archive.install`, `mix escript.install`, and `mix local.rebar`. Support for passing URLs to said commands will be fully removed on Elixir v1.10, as they are unsafe. Thanks to Bram Verburg for the report and for providing a fix.
+1 -1
View File
@@ -1 +1 @@
1.9.3
1.9.4
+7 -2
View File
@@ -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),
+12
View File
@@ -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
+5 -2
View File
@@ -77,8 +77,11 @@ defmodule Mix.Tasks.Archive.Install do
check_extname(path)
end
def check_install_spec({:url, url} = _install_spec, _opts) do
Mix.Utils.warn_install_over_http_deprecated("archive.install", url)
def check_install_spec({:url, url} = _install_spec, opts) do
unless opts[:sha512] do
Mix.Utils.warn_install_over_http_deprecated("archive.install", url)
end
check_extname(url)
end
+5 -2
View File
@@ -75,8 +75,11 @@ defmodule Mix.Tasks.Escript.Install do
end
@impl true
def check_install_spec({:url, url} = _install_spec, _opts) do
Mix.Utils.warn_install_over_http_deprecated("escript.install", url)
def check_install_spec({:url, url} = _install_spec, opts) do
unless opts[:sha512] do
Mix.Utils.warn_install_over_http_deprecated("escript.install", url)
end
:ok
end
+3 -1
View File
@@ -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])
+25
View File
@@ -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 ->