summaryrefslogtreecommitdiff
path: root/test/rebar_deps_SUITE.erl
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2016-09-27 10:23:47 -0400
committerFred Hebert <mononcqc@ferd.ca>2016-09-27 10:51:43 -0400
commit384e9e58dba9ff8cf801bfdbe3c2ec406453aa5f (patch)
tree81206954a476ff6050d4a83271608f0cfcfa4802 /test/rebar_deps_SUITE.erl
parenta40fe42d906fde0be0534b6c6acf7e5868860357 (diff)
Properly support package aliasing and alt names
Aliasing only had a bit of ad-hoc support in rebar3, and various issues have encountered problems related to the package names not mapping properly with the application name. One such issue is https://github.com/erlang/rebar3/issues/1290 The problem has been hard to find because it only impacts transitive dependencies (not top-level ones) of other packages. The root cause for this is that the application name was not being tracked by rebar3's internal index, only the package name and its version were. When a given application was a package app, the data for the application name would be reconstructed from the lock file, but only if it were a top-level app or a dependency of a source application where parsing the lock file is necessary to know what comes next. When a transitive dependency of a package dependency was fetched, we instead read its dependencies directly from the in-memory package index within rebar3. This caused us to only read the package name and version, and lost all information regarding application name. This worked fine for most cases since for the vast majority of packages, the package name matches the app name, but failed for all aliases, which would then be moved to directories that wouldn't match the app name. This in turn broke some aspects of code analysis (in Dialyzer), or other functionality relying on static paths, such as including .hrl files from dependencies. This patch reformats the internal storage format of dependencies to align with the internal one used by rebar3, so that the app name can be carried along with the package name and its version. The fix can only work once `rebar3 update` is called so the index is rebuilt internally, and will the file cached on disk will be incompatible with older rebar3 versions. Currently, the following is not covered: - Tests - Including the package hashes of dependencies so they may match what is in a lock file -- they're being `undefined` instead, which may break some lookups. The previous format did not lend itself to hashing in the same way, and it is possible transitive deps were not being tracked properly, or worked by respecting the current package hierarchy. This will require further analysis For now this commit can allow reviewing and discussion.
Diffstat (limited to 'test/rebar_deps_SUITE.erl')
-rw-r--r--test/rebar_deps_SUITE.erl16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/rebar_deps_SUITE.erl b/test/rebar_deps_SUITE.erl
index 24bf2a0..6b2ecea 100644
--- a/test/rebar_deps_SUITE.erl
+++ b/test/rebar_deps_SUITE.erl
@@ -385,36 +385,36 @@ https_os_proxy_settings(_Config) ->
semver_matching_lt(_Config) ->
Dep = <<"test">>,
- Dep1 = {Dep, <<"1.0.0">>, Dep},
+ Dep1 = {Dep, <<"1.0.0">>, Dep, Dep},
MaxVsn = <<"0.2.0">>,
Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>, <<"0.2.1">>],
- ?assertEqual([{Dep, <<"0.1.9">>}],
+ ?assertEqual([{Dep, {pkg, Dep, <<"0.1.9">>, undefined}}],
rebar_prv_update:cmpl_(undefined, MaxVsn, Vsns, [], Dep1,
fun ec_semver:lt/2)).
semver_matching_lte(_Config) ->
Dep = <<"test">>,
- Dep1 = {Dep, <<"1.0.0">>, Dep},
+ Dep1 = {Dep, <<"1.0.0">>, Dep, Dep},
MaxVsn = <<"0.2.0">>,
Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>, <<"0.2.1">>],
- ?assertEqual([{Dep, <<"0.2.0">>}],
+ ?assertEqual([{Dep, {pkg, Dep, <<"0.2.0">>, undefined}}],
rebar_prv_update:cmpl_(undefined, MaxVsn, Vsns, [], Dep1,
fun ec_semver:lte/2)).
semver_matching_gt(_Config) ->
Dep = <<"test">>,
- Dep1 = {Dep, <<"1.0.0">>, Dep},
+ Dep1 = {Dep, <<"1.0.0">>, Dep, Dep},
MaxVsn = <<"0.2.0">>,
Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>, <<"0.2.1">>],
- ?assertEqual([{Dep, <<"0.2.1">>}],
+ ?assertEqual([{Dep, {pkg, Dep, <<"0.2.1">>, undefined}}],
rebar_prv_update:cmp_(undefined, MaxVsn, Vsns, [], Dep1,
fun ec_semver:gt/2)).
semver_matching_gte(_Config) ->
Dep = <<"test">>,
- Dep1 = {Dep, <<"1.0.0">>, Dep},
+ Dep1 = {Dep, <<"1.0.0">>, Dep, Dep},
MaxVsn = <<"0.2.0">>,
Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>],
- ?assertEqual([{Dep, <<"0.2.0">>}],
+ ?assertEqual([{Dep, {pkg, Dep, <<"0.2.0">>, undefined}}],
rebar_prv_update:cmp_(undefined, MaxVsn, Vsns, [], Dep1,
fun ec_semver:gt/2)).