Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/mix_hex_advisory.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Display-time deduplication of security advisories.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_auth.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Authentication.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_key.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Keys.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_oauth.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - OAuth.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_organization.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Organizations.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_organization_member.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Organization Members.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_package.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Packages.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_package_owner.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Package Owners.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_release.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Releases.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_short_url.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Short URLs.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_api_user.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex HTTP API - Users.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_cli_auth.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Authentication handling with callback functions for build-tool-specific operations.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_core.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% `hex_core' entrypoint module.
Expand Down
4 changes: 2 additions & 2 deletions src/mix_hex_core.hrl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

-define(HEX_CORE_VERSION, "0.21.0").
-define(HEX_CORE_VERSION, "0.21.1").
2 changes: 1 addition & 1 deletion src/mix_hex_deflate.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Pure-Erlang raw DEFLATE (RFC 1951) encoder. The output only depends on the
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_erl_tar.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% This file is a copy of erl_tar.erl from OTP with the following modifications:
%% 1. Module renamed from erl_tar to mix_hex_erl_tar
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_erl_tar.hrl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% This file is a copy of erl_tar.hrl from OTP without modifications.
%%
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_http.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% HTTP contract.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_http_httpc.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% httpc-based implementation of {@link mix_hex_http} contract.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_licenses.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Hex Licenses.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_oidc.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% OIDC token issuance for CI providers, used by Workload Identity.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_pb_names.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% -*- coding: utf-8 -*-
%% % this file is @generated
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_pb_package.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% -*- coding: utf-8 -*-
%% % this file is @generated
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_pb_policy.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% -*- coding: utf-8 -*-
%% % this file is @generated
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_pb_signed.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% -*- coding: utf-8 -*-
%% % this file is @generated
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_pb_versions.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% -*- coding: utf-8 -*-
%% % this file is @generated
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_registry.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Functions for encoding and decoding Hex registries.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_repo.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Repo API.
Expand Down
2 changes: 1 addition & 1 deletion src/mix_hex_safe_binary_to_term.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @hidden
%% Safe deserialization of Erlang terms from binary.
Expand Down
14 changes: 11 additions & 3 deletions src/mix_hex_tarball.erl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%% @doc
%% Functions for creating and unpacking Hex tarballs.
Expand Down Expand Up @@ -1130,8 +1130,16 @@ validate_create_files([], _FilesRoot, Acc) ->
{ok, lists:reverse(Acc)};
validate_create_files([File | Rest], FilesRoot, Acc) ->
case validate_create_file(File, FilesRoot) of
{ok, ValidatedFile} -> validate_create_files(Rest, FilesRoot, [ValidatedFile | Acc]);
{error, _} = Error -> Error
{ok, {ArchiveName, Entry} = ValidatedFile} ->
%% The archive root always exists, so a directory named after it
%% isn't stored and other entries can't take its name
case {archive_path_parts(ArchiveName), Entry} of
{[], directory} -> validate_create_files(Rest, FilesRoot, Acc);
{[], _} -> {error, {tarball, {unsafe_path, ArchiveName}}};
_ -> validate_create_files(Rest, FilesRoot, [ValidatedFile | Acc])
end;
{error, _} = Error ->
Error
end.

validate_create_file({Filename, Source, Options}, FilesRoot) when is_map(Options) ->
Expand Down
2 changes: 1 addition & 1 deletion src/mix_safe_erl_term.xrl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Vendored from hex_core v0.21.0 (564a33e), do not edit manually
%% Vendored from hex_core v0.21.1 (d366662), do not edit manually

%%% Author : Robert Virding
%%% Purpose : Token definitions for Erlang.
Expand Down
20 changes: 20 additions & 0 deletions test/mix/tasks/hex.build_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,26 @@ defmodule Mix.Tasks.Hex.BuildTest do
purge([ReleaseExcludePatterns.MixProject])
end

test "create with the project directory in files" do
Process.put(:hex_test_app_name, :build_with_project_dir)
Mix.Project.push(ReleaseProjectDir.MixProject)

in_tmp(fn ->
Hex.State.put(:cache_home, tmp_path())

File.write!("myfile.txt", "hello")
File.mkdir!("dir")
File.write!("dir/test.txt", "world")

Mix.Tasks.Hex.Build.run([])

extract("build_with_project_dir-0.0.1.tar", "unzip")
assert extracted_files("unzip") == ["dir/test.txt", "myfile.txt"]
end)
after
purge([ReleaseProjectDir.MixProject])
end

test "excludes junk files at any depth" do
Process.put(:hex_test_app_name, :build_junk_files)
Mix.Project.push(ReleaseDefaultFiles.MixProject)
Expand Down
15 changes: 15 additions & 0 deletions test/support/release_samples.ex
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ defmodule ReleaseExcludePatterns.MixProject do
end
end

defmodule ReleaseProjectDir.MixProject do
def project do
[
app: Process.get(:hex_test_app_name) || raise("missing app name"),
version: "0.0.1",
description: "foo",
package: [
files: ["."],
licenses: ["MIT"],
links: %{"a" => "http://a"}
]
]
end
end

defmodule ReleaseEscapingFiles.MixProject do
def project do
[
Expand Down
Loading