Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

572 righe
23 KiB

support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
support for hex v2, multiple repository fetching, private organizations (#1884) * update to hex_core for hex-v2 repo support (#1865) * update to hex_core for hex-v2 repo support This patch adds only single repo hex-v2 support through hex_core. Packages no longer filtered out by buildtool metadata and the package index is updated per-package instead of fetched as one large ets dump. * tell travis to also build hex_core branch * support list of repos for hex packages (#1866) * support list of repos for hex packages repos are defined under the hex key in rebar configs. They can be defined at the top level of a project or globally, but not in profiles and the repos configured in dependencies are also ignored. Searching for packages involves first checking for a match in the local repo index cache, in the order repos are defined. If not found each repo is checked through the hex api for any known versions of the package and the first repo with a version that fits the constraint is used. * add {repos, replace, []} for overriding the global & default repos * add hex auth handling for repos (#1874) auth token are kept in a hex.config file that is modified by the rebar3 hex plugin. Repo names that have a : separating a parent and child are considered organizations. The parent repo's auth will be included with the child. So an organization named hexpm:rebar3_test will include any hexpm auth tokens found in the rebar3_test organization's configuration. * move packages to top level of of hexpm cache dir (#1876) * move packages to top level of of hexpm cache dir * append organization name to parent's repo_url when parsing repos * only eval config scripts and apply overrides once per app (#1879) * only eval config scripts and apply overrides once per app * move new resource behaviour to rebar_resource_v2 and keep v1 * cleanup use of rebar_resource module and unused functions * cleanup error messages and unused code * when discovering apps support mix packages as unbuilt apps (#1882) * use hex_core tarball unpacking support in pkg resource (#1883) * use hex_core tarball unpacking support in pkg resource * ignore etag if package doesn't exist and delete if checksum fails * add back tests for bad package checksums * improve bad registry checksum error message
6 anni fa
  1. -module(rebar_deps_SUITE).
  2. -compile(export_all).
  3. -include_lib("common_test/include/ct.hrl").
  4. -include_lib("eunit/include/eunit.hrl").
  5. all() -> [sub_app_deps, newly_added_dep, newly_added_after_empty_lock,
  6. http_proxy_settings, https_proxy_settings,
  7. http_os_proxy_settings, https_os_proxy_settings,
  8. semver_matching_lt, semver_matching_lte, semver_matching_gt,
  9. valid_version, top_override, {group, git}, {group, pkg},
  10. deps_cmd_needs_update_called
  11. ].
  12. groups() ->
  13. [{all, [], [flat, pick_highest_left, pick_highest_right,
  14. pick_smallest1, pick_smallest2,
  15. circular1, circular2, circular_skip]},
  16. {git, [], [{group, all}]},
  17. {pkg, [], [{group, all}]}].
  18. init_per_suite(Config) ->
  19. application:start(meck),
  20. Config.
  21. end_per_suite(_Config) ->
  22. application:stop(meck).
  23. init_per_group(git, Config) ->
  24. [{deps_type, git} | Config];
  25. init_per_group(pkg, Config) ->
  26. [{deps_type, pkg} | Config];
  27. init_per_group(_, Config) ->
  28. Config.
  29. end_per_group(_, Config) ->
  30. Config.
  31. init_per_testcase(valid_version, Config) ->
  32. rebar_test_utils:init_rebar_state(Config);
  33. init_per_testcase(semver_matching_lt, Config) ->
  34. rebar_test_utils:init_rebar_state(Config);
  35. init_per_testcase(semver_matching_lte, Config) ->
  36. rebar_test_utils:init_rebar_state(Config);
  37. init_per_testcase(semver_matching_gt, Config) ->
  38. rebar_test_utils:init_rebar_state(Config);
  39. init_per_testcase(newly_added_after_empty_lock, Config) ->
  40. rebar_test_utils:init_rebar_state(Config);
  41. init_per_testcase(newly_added_dep, Config) ->
  42. rebar_test_utils:init_rebar_state(Config);
  43. init_per_testcase(sub_app_deps, Config) ->
  44. rebar_test_utils:init_rebar_state(Config);
  45. init_per_testcase(top_override, Config) ->
  46. rebar_test_utils:init_rebar_state(Config);
  47. init_per_testcase(http_proxy_settings, Config) ->
  48. %% Create private rebar.config
  49. Priv = ?config(priv_dir, Config),
  50. GlobalDir = filename:join(Priv, "global"),
  51. GlobalConfigDir = filename:join([GlobalDir, ".config", "rebar3"]),
  52. GlobalConfig = filename:join([GlobalDir, ".config", "rebar3", "rebar.config"]),
  53. meck:new(rebar_dir, [passthrough]),
  54. meck:expect(rebar_dir, global_config, fun() -> GlobalConfig end),
  55. meck:expect(rebar_dir, global_cache_dir, fun(_) -> GlobalDir end),
  56. %% Insert proxy variables into config
  57. rebar_test_utils:create_config(GlobalConfigDir,
  58. [{http_proxy, "http://localhost:1234"}
  59. ]),
  60. rebar_test_utils:init_rebar_state(Config);
  61. init_per_testcase(https_proxy_settings, Config) ->
  62. SupportsHttpsProxy = case erlang:system_info(otp_release) of
  63. "R16"++_ -> true;
  64. "R"++_ -> false;
  65. _ -> true % 17 and up don't have a "R" in the version
  66. end,
  67. if not SupportsHttpsProxy ->
  68. {skip, https_proxy_unsupported_before_R16};
  69. SupportsHttpsProxy ->
  70. %% Create private rebar.config
  71. Priv = ?config(priv_dir, Config),
  72. GlobalDir = filename:join(Priv, "global"),
  73. GlobalConfigDir = filename:join([GlobalDir, ".config", "rebar3"]),
  74. GlobalConfig = filename:join([GlobalDir, ".config", "rebar3", "rebar.config"]),
  75. meck:new(rebar_dir, [passthrough]),
  76. meck:expect(rebar_dir, global_config, fun() -> GlobalConfig end),
  77. meck:expect(rebar_dir, global_cache_dir, fun(_) -> GlobalDir end),
  78. %% Insert proxy variables into config
  79. rebar_test_utils:create_config(GlobalConfigDir,
  80. [{https_proxy, "http://localhost:1234"}
  81. ]),
  82. %% Add a bad value by default to show config overtakes default
  83. os:putenv("https_proxy", "unparseable-garbage"),
  84. rebar_test_utils:init_rebar_state(Config)
  85. end;
  86. init_per_testcase(http_os_proxy_settings, Config) ->
  87. %% Create private rebar.config
  88. Priv = ?config(priv_dir, Config),
  89. GlobalDir = filename:join(Priv, "global"),
  90. GlobalConfigDir = filename:join([GlobalDir, ".config", "rebar3"]),
  91. GlobalConfig = filename:join([GlobalDir, ".config", "rebar3", "rebar.config"]),
  92. meck:new(rebar_dir, [passthrough]),
  93. meck:expect(rebar_dir, global_config, fun() -> GlobalConfig end),
  94. meck:expect(rebar_dir, global_cache_dir, fun(_) -> GlobalDir end),
  95. %% Insert proxy variables into os env, but not config
  96. os:putenv("http_proxy", "http://localhost:1234"),
  97. rebar_test_utils:create_config(GlobalConfigDir, []),
  98. rebar_test_utils:init_rebar_state(Config);
  99. init_per_testcase(https_os_proxy_settings, Config) ->
  100. SupportsHttpsProxy = case erlang:system_info(otp_release) of
  101. "R16"++_ -> true;
  102. "R"++_ -> false;
  103. _ -> true % 17 and up don't have a "R" in the version
  104. end,
  105. if not SupportsHttpsProxy ->
  106. {skip, https_proxy_unsupported_before_R16};
  107. SupportsHttpsProxy ->
  108. %% Create private rebar.config
  109. Priv = ?config(priv_dir, Config),
  110. GlobalDir = filename:join(Priv, "global"),
  111. GlobalConfigDir = filename:join([GlobalDir, ".config", "rebar3"]),
  112. GlobalConfig = filename:join([GlobalDir, ".config", "rebar3", "rebar.config"]),
  113. meck:new(rebar_dir, [passthrough]),
  114. meck:expect(rebar_dir, global_config, fun() -> GlobalConfig end),
  115. meck:expect(rebar_dir, global_cache_dir, fun(_) -> GlobalDir end),
  116. %% Insert proxy variables into os env, not in config
  117. os:putenv("https_proxy", "http://localhost:1234"),
  118. rebar_test_utils:create_config(GlobalConfigDir, []),
  119. rebar_test_utils:init_rebar_state(Config)
  120. end;
  121. init_per_testcase(deps_cmd_needs_update_called, Config) ->
  122. rebar_test_utils:init_rebar_state(Config);
  123. init_per_testcase(Case, Config) ->
  124. {Deps, Warnings, Expect} = deps(Case),
  125. Expected = case Expect of
  126. {ok, List} -> {ok, format_expected_deps(List)};
  127. {error, Reason} -> {error, Reason}
  128. end,
  129. DepsType = ?config(deps_type, Config),
  130. mock_warnings(),
  131. [{expect, Expected},
  132. {warnings, Warnings}
  133. | setup_project(Case, Config, rebar_test_utils:expand_deps(DepsType, Deps))].
  134. end_per_testcase(https_proxy_settings, Config) ->
  135. os:putenv("https_proxy", ""),
  136. meck:unload(rebar_dir),
  137. Config;
  138. end_per_testcase(http_proxy_settings, Config) ->
  139. meck:unload(rebar_dir),
  140. Config;
  141. end_per_testcase(http_os_proxy_settings, Config) ->
  142. os:putenv("http_proxy", ""),
  143. meck:unload(rebar_dir),
  144. Config;
  145. end_per_testcase(https_os_proxy_settings, Config) ->
  146. os:putenv("https_proxy", ""),
  147. meck:unload(rebar_dir),
  148. Config;
  149. end_per_testcase(_, Config) ->
  150. meck:unload(),
  151. Config.
  152. format_expected_deps(Deps) ->
  153. [case Dep of
  154. {N,V} -> {dep, N, V};
  155. N -> {dep, N}
  156. end || Dep <- Deps].
  157. %% format:
  158. %% {Spec,
  159. %% [Warning],
  160. %% {ok, Result} | {error, Reason}}
  161. %%
  162. %% Spec is a list of levelled dependencies of two possible forms:
  163. %% - {"Name", Spec}
  164. %% - {"Name", "Vsn", Spec}
  165. %%
  166. %% Warnings are going to match on mocked ?WARN(...)
  167. %% calls to be evaluated. An empty list means we do not care about
  168. %% warnings, not that no warnings will be printed. This means
  169. %% the list of warning isn't interpreted to be exhaustive, and more
  170. %% warnings may be generated than are listed.
  171. deps(flat) ->
  172. {[{"B", []},
  173. {"C", []}],
  174. [],
  175. {ok, ["B", "C"]}};
  176. deps(pick_highest_left) ->
  177. {[{"B", [{"C", "2.0.0", []}]},
  178. {"C", "1.0.0", []}],
  179. [{"C","2.0.0"}],
  180. {ok, ["B", {"C", "1.0.0"}]}};
  181. deps(pick_highest_right) ->
  182. {[{"B", "1.0.0", []},
  183. {"C", [{"B", "2.0.0", []}]}],
  184. [{"B","2.0.0"}],
  185. {ok, [{"B","1.0.0"}, "C"]}};
  186. deps(pick_smallest1) ->
  187. {[{"B", [{"D", "1.0.0", []}]},
  188. {"C", [{"D", "2.0.0", []}]}],
  189. [{"D","2.0.0"}],
  190. %% we pick D1 because B < C
  191. {ok, ["B","C",{"D","1.0.0"}]}};
  192. deps(pick_smallest2) ->
  193. {[{"C", [{"D", "2.0.0", []}]},
  194. {"B", [{"D", "1.0.0", []}]}],
  195. [{"D","2.0.0"}],
  196. %% we pick D1 because B < C
  197. {ok, ["B","C",{"D","1.0.0"}]}};
  198. deps(circular1) ->
  199. {[{"B", [{"A", []}]}, % A is the top-level app
  200. {"C", []}],
  201. [],
  202. {error, {rebar_prv_install_deps, {cycles, [[<<"A">>,<<"B">>]]}}}};
  203. deps(circular2) ->
  204. {[{"B", [{"C", [{"B", []}]}]},
  205. {"C", []}],
  206. [],
  207. {error, {rebar_prv_install_deps, {cycles, [[<<"B">>,<<"C">>]]}}}};
  208. deps(circular_skip) ->
  209. %% Never spot the circular dep due to being to low in the deps tree
  210. %% in source deps
  211. {[{"B", [{"C", "2.0.0", [{"B", []}]}]},
  212. {"C", "1.0.0", [{"D",[]}]}],
  213. [{"C","2.0.0"}],
  214. {ok, ["B", {"C","1.0.0"}, "D"]}}.
  215. setup_project(Case, Config0, Deps) ->
  216. DepsType = ?config(deps_type, Config0),
  217. %% spread packages across 3 repos randomly
  218. Repos = [<<"test-repo-1">>, <<"test-repo-2">>, <<"hexpm">>],
  219. Config = rebar_test_utils:init_rebar_state(
  220. [{repos, Repos} | Config0],
  221. atom_to_list(Case)++"_"++atom_to_list(DepsType)++"_"
  222. ),
  223. AppDir = ?config(apps, Config),
  224. rebar_test_utils:create_app(AppDir, "A", "0.0.0", [kernel, stdlib]),
  225. TopDeps = rebar_test_utils:top_level_deps(Deps),
  226. RebarConf = rebar_test_utils:create_config(AppDir, [{deps, TopDeps}]),
  227. {SrcDeps, PkgDeps} = rebar_test_utils:flat_deps(Deps),
  228. mock_git_resource:mock([{deps, SrcDeps}]),
  229. mock_pkg_resource:mock([{pkgdeps, PkgDeps}, {repos, Repos}]),
  230. [{rebarconfig, RebarConf} | Config].
  231. mock_warnings() ->
  232. %% just let it do its thing, we check warnings through
  233. %% the call log.
  234. meck:new(rebar_log, [no_link, passthrough]).
  235. mock_rebar_fetch() ->
  236. meck:new(rebar_fetch, [no_link, passthrough]).
  237. %%% TESTS %%%
  238. flat(Config) -> run(Config).
  239. pick_highest_left(Config) -> run(Config).
  240. pick_highest_right(Config) -> run(Config).
  241. pick_smallest1(Config) -> run(Config).
  242. pick_smallest2(Config) -> run(Config).
  243. circular1(Config) -> run(Config).
  244. circular2(Config) -> run(Config).
  245. circular_skip(Config) -> run(Config).
  246. %% Test that a top-level application overtakes dependencies, and
  247. %% works even if said deps do not exist.
  248. top_override(Config) ->
  249. AppDir = ?config(apps, Config),
  250. ct:pal("dir: ~p", [AppDir]),
  251. Name1 = rebar_test_utils:create_random_name("sub_app1_"),
  252. Name2 = rebar_test_utils:create_random_name("sub_app2_"),
  253. SubAppsDir1 = filename:join([AppDir, "apps", Name1]),
  254. SubAppsDir2 = filename:join([AppDir, "apps", Name2]),
  255. Vsn = rebar_test_utils:create_random_vsn(),
  256. rebar_test_utils:create_app(SubAppsDir1, Name1, Vsn, [kernel, stdlib]),
  257. rebar_test_utils:create_app(SubAppsDir2, Name2, Vsn, [kernel, stdlib]),
  258. rebar_test_utils:create_config(
  259. SubAppsDir1,
  260. [{deps, [list_to_atom(Name2)]}]
  261. ),
  262. rebar_test_utils:create_config(
  263. SubAppsDir2,
  264. [{deps, [{list_to_atom(Name1),
  265. {git, "https://example.org", {branch, "master"}}}]}]
  266. ),
  267. rebar_test_utils:run_and_check(
  268. Config, [], ["compile"],
  269. {ok, [{app, Name1}, {app,Name2}]}
  270. ).
  271. %% Test that the deps of project apps that have their own rebar.config
  272. %% are included, but that top level rebar.config deps take precedence
  273. sub_app_deps(Config) ->
  274. AppDir = ?config(apps, Config),
  275. Deps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  276. ,{"b", "1.0.0", []}
  277. ,{"b", "2.0.0", []}]),
  278. {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
  279. mock_git_resource:mock([{deps, SrcDeps}]),
  280. Name = rebar_test_utils:create_random_name("sub_app1_"),
  281. Vsn = rebar_test_utils:create_random_vsn(),
  282. SubAppsDir = filename:join([AppDir, "apps", Name]),
  283. SubDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  284. ,{"b", "2.0.0", []}])),
  285. rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]),
  286. rebar_test_utils:create_config(SubAppsDir, [{deps, SubDeps}]),
  287. TopDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"b", "1.0.0", []}])),
  288. {ok, RebarConfig} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps}])),
  289. rebar_test_utils:run_and_check(
  290. Config, RebarConfig, ["compile"],
  291. {ok, [{app, Name}, {dep, "a"}, {dep, "b", "1.0.0"}]}).
  292. %% Newly added dependency after locking
  293. newly_added_dep(Config) ->
  294. AppDir = ?config(apps, Config),
  295. Deps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  296. ,{"b", "1.0.0", [{"c", "1.0.0", []}]}
  297. ,{"c", "2.0.0", []}]),
  298. {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
  299. mock_git_resource:mock([{deps, SrcDeps}]),
  300. Name = rebar_test_utils:create_random_name("app_"),
  301. Vsn = rebar_test_utils:create_random_vsn(),
  302. SubAppsDir = filename:join([AppDir, "apps", Name]),
  303. rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]),
  304. TopDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"b", "1.0.0", []}])),
  305. {ok, RebarConfig} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps}])),
  306. rebar_test_utils:run_and_check(
  307. Config, RebarConfig, ["compile"],
  308. {ok, [{app, Name}, {dep, "b", "1.0.0"}, {dep, "c", "1.0.0"}]}),
  309. %% Add a and c to top level
  310. TopDeps2 = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  311. ,{"c", "2.0.0", []}
  312. ,{"b", "1.0.0", []}])),
  313. {ok, RebarConfig2} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps2}])),
  314. LockFile = filename:join(AppDir, "rebar.lock"),
  315. RebarConfig3 = rebar_config:merge_locks(RebarConfig2,
  316. rebar_config:consult_lock_file(LockFile)),
  317. %% a should now be installed and c should not change
  318. rebar_test_utils:run_and_check(
  319. Config, RebarConfig3, ["compile"],
  320. {ok, [{app, Name}, {dep, "a"}, {dep, "b", "1.0.0"}, {dep, "c", "1.0.0"}]}).
  321. newly_added_after_empty_lock(Config) ->
  322. AppDir = ?config(apps, Config),
  323. Deps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}]),
  324. {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
  325. mock_git_resource:mock([{deps, SrcDeps}]),
  326. Name = rebar_test_utils:create_random_name("app_"),
  327. Vsn = rebar_test_utils:create_random_vsn(),
  328. SubAppsDir = filename:join([AppDir, "apps", Name]),
  329. rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]),
  330. TopDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [])),
  331. {ok, RebarConfig} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps}])),
  332. rebar_test_utils:run_and_check(
  333. Config, RebarConfig, ["compile"],
  334. {ok, []}),
  335. %% Add a and c to top level
  336. TopDeps2 = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}])),
  337. {ok, RebarConfig2} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps2}])),
  338. LockFile = filename:join(AppDir, "rebar.lock"),
  339. RebarConfig3 = rebar_config:merge_locks(RebarConfig2,
  340. rebar_config:consult_lock_file(LockFile)),
  341. %% a should now be installed and c should not change
  342. rebar_test_utils:run_and_check(
  343. Config, RebarConfig3, ["compile"],
  344. {ok, [{app, Name}, {dep, "a", "1.0.0"}]}).
  345. http_proxy_settings(_Config) ->
  346. %% Load config
  347. rebar_utils:set_httpc_options(),
  348. rebar3:init_config(),
  349. %% Assert variable is right
  350. ?assertEqual({ok,{{"localhost", 1234}, []}},
  351. httpc:get_option(proxy, rebar)).
  352. https_proxy_settings(_Config) ->
  353. %% Load config
  354. rebar_utils:set_httpc_options(),
  355. rebar3:init_config(),
  356. %% Assert variable is right
  357. ?assertEqual({ok,{{"localhost", 1234}, []}},
  358. httpc:get_option(https_proxy, rebar)).
  359. http_os_proxy_settings(_Config) ->
  360. %% Load config
  361. rebar_utils:set_httpc_options(),
  362. rebar3:init_config(),
  363. %% Assert variable is right
  364. ?assertEqual({ok,{{"localhost", 1234}, []}},
  365. httpc:get_option(proxy, rebar)).
  366. https_os_proxy_settings(_Config) ->
  367. %% Load config
  368. rebar_utils:set_httpc_options(),
  369. rebar3:init_config(),
  370. %% Assert variable is right
  371. ?assertEqual({ok,{{"localhost", 1234}, []}},
  372. httpc:get_option(https_proxy, rebar)).
  373. semver_matching_lt(_Config) ->
  374. MaxVsn = <<"0.2.0">>,
  375. Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>, <<"0.2.1">>],
  376. ?assertEqual({ok, <<"0.1.9">>},
  377. rebar_packages:cmpl_(undefined, MaxVsn, Vsns,
  378. fun ec_semver:lt/2)).
  379. semver_matching_lte(_Config) ->
  380. MaxVsn = <<"0.2.0">>,
  381. Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>, <<"0.2.1">>],
  382. ?assertEqual({ok, <<"0.2.0">>},
  383. rebar_packages:cmpl_(undefined, MaxVsn, Vsns,
  384. fun ec_semver:lte/2)).
  385. semver_matching_gt(_Config) ->
  386. MaxVsn = <<"0.2.0">>,
  387. Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>, <<"0.2.1">>],
  388. ?assertEqual({ok, <<"0.2.1">>},
  389. rebar_packages:cmp_(undefined, MaxVsn, Vsns,
  390. fun ec_semver:gt/2)).
  391. semver_matching_gte(_Config) ->
  392. MaxVsn = <<"0.2.0">>,
  393. Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>],
  394. ?assertEqual({ok, <<"0.2.0">>},
  395. rebar_packages:cmp_(undefined, MaxVsn, Vsns,
  396. fun ec_semver:gt/2)).
  397. valid_version(_Config) ->
  398. ?assert(rebar_packages:valid_vsn(<<"0.1">>)),
  399. ?assert(rebar_packages:valid_vsn(<<"0.1.0">>)),
  400. ?assert(rebar_packages:valid_vsn(<<" 0.1.0">>)),
  401. ?assert(rebar_packages:valid_vsn(<<" 0.1.0">>)),
  402. ?assert(rebar_packages:valid_vsn(<<"<0.1">>)),
  403. ?assert(rebar_packages:valid_vsn(<<"<0.1.0">>)),
  404. ?assert(rebar_packages:valid_vsn(<<"< 0.1.0">>)),
  405. ?assert(rebar_packages:valid_vsn(<<"< 0.1.0">>)),
  406. ?assert(rebar_packages:valid_vsn(<<">0.1">>)),
  407. ?assert(rebar_packages:valid_vsn(<<">0.1.0">>)),
  408. ?assert(rebar_packages:valid_vsn(<<"> 0.1.0">>)),
  409. ?assert(rebar_packages:valid_vsn(<<"> 0.1.0">>)),
  410. ?assert(rebar_packages:valid_vsn(<<"<=0.1">>)),
  411. ?assert(rebar_packages:valid_vsn(<<"<=0.1.0">>)),
  412. ?assert(rebar_packages:valid_vsn(<<"<= 0.1.0">>)),
  413. ?assert(rebar_packages:valid_vsn(<<"<= 0.1.0">>)),
  414. ?assert(rebar_packages:valid_vsn(<<">=0.1">>)),
  415. ?assert(rebar_packages:valid_vsn(<<">=0.1.0">>)),
  416. ?assert(rebar_packages:valid_vsn(<<">= 0.1.0">>)),
  417. ?assert(rebar_packages:valid_vsn(<<">= 0.1.0">>)),
  418. ?assert(rebar_packages:valid_vsn(<<"==0.1">>)),
  419. ?assert(rebar_packages:valid_vsn(<<"==0.1.0">>)),
  420. ?assert(rebar_packages:valid_vsn(<<"== 0.1.0">>)),
  421. ?assert(rebar_packages:valid_vsn(<<"== 0.1.0">>)),
  422. ?assert(rebar_packages:valid_vsn(<<"~>0.1">>)),
  423. ?assert(rebar_packages:valid_vsn(<<"~>0.1.0">>)),
  424. ?assert(rebar_packages:valid_vsn(<<"~> 0.1.0">>)),
  425. ?assert(rebar_packages:valid_vsn(<<"~> 0.1.0">>)),
  426. ?assertNot(rebar_packages:valid_vsn(<<"> 0.1.0 and < 0.2.0">>)),
  427. ok.
  428. run(Config) ->
  429. {ok, RebarConfig} = file:consult(?config(rebarconfig, Config)),
  430. rebar_test_utils:run_and_check(
  431. Config, RebarConfig, ["install_deps"], ?config(expect, Config)
  432. ),
  433. check_warnings(warning_calls(), ?config(warnings, Config), ?config(deps_type, Config)).
  434. deps_cmd_needs_update_called(Config) ->
  435. mock_rebar_fetch(),
  436. AppDir = ?config(apps, Config),
  437. Deps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  438. ,{"b", "1.0.0", [{"c", "1.0.0", []}]}
  439. ,{"c", "2.0.0", []}]),
  440. {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
  441. mock_git_resource:mock([{deps, SrcDeps}]),
  442. Name = rebar_test_utils:create_random_name("app_"),
  443. Vsn = rebar_test_utils:create_random_vsn(),
  444. SubAppsDir = filename:join([AppDir, "apps", Name]),
  445. rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]),
  446. TopDeps = rebar_test_utils:top_level_deps(
  447. rebar_test_utils:expand_deps(git, [{"b", "1.0.0", []}])),
  448. {ok, RebarConfig} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps}])),
  449. rebar_test_utils:run_and_check(Config, RebarConfig, ["deps"], {ok, []}),
  450. [<<"b">>] = rebar_fetch_needs_update_calls_sorted(),
  451. %% Add c to top level
  452. TopDeps2 = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"c", "2.0.0", []}
  453. ,{"b", "1.0.0", []}])),
  454. {ok, RebarConfig2} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps2}])),
  455. rebar_test_utils:run_and_check(Config, RebarConfig2, ["deps"], {ok, []}),
  456. %% Only top level deps are checked for updates
  457. [<<"b">>, <<"b">>, <<"c">>] = rebar_fetch_needs_update_calls_sorted(),
  458. %% Lock deps
  459. rebar_test_utils:run_and_check(Config, RebarConfig2, ["lock"], {ok, []}),
  460. NeedsUpdate1 = rebar_fetch_needs_update_calls_sorted(),
  461. %% Switch c for a as top level deps
  462. TopDeps3 = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  463. ,{"b", "1.0.0", []}])),
  464. {ok, RebarConfig3} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps3}])),
  465. LockFile = filename:join(AppDir, "rebar.lock"),
  466. RebarConfig4 = rebar_config:merge_locks(RebarConfig3,
  467. rebar_config:consult_lock_file(LockFile)),
  468. rebar_test_utils:run_and_check(Config, RebarConfig4, ["deps"], {ok, []}),
  469. NeedsUpdate2 = lists:subtract(rebar_fetch_needs_update_calls_sorted(), NeedsUpdate1),
  470. %% B and C from lock file + install_deps and A, B and C from 'deps'
  471. [<<"a">>, <<"b">>, <<"b">>, <<"c">>, <<"c">>] = NeedsUpdate2.
  472. rebar_fetch_needs_update_calls_sorted() ->
  473. History = meck:history(rebar_fetch),
  474. DepsNames = [rebar_app_info:name(Dep)
  475. || {_, {rebar_fetch, needs_update, [Dep, _]}, _} <- History],
  476. lists:sort(DepsNames).
  477. warning_calls() ->
  478. History = meck:history(rebar_log),
  479. [{Str, Args} || {_, {rebar_log, log, [warn, Str, Args]}, _} <- History].
  480. check_warnings(_, [], _) ->
  481. ok;
  482. check_warnings(Warns, [{Name, Vsn} | Rest], Type) ->
  483. ct:pal("Checking for warning ~p in ~p", [{Name,Vsn},Warns]),
  484. ?assert(in_warnings(Type, Warns, Name, Vsn)),
  485. check_warnings(Warns, Rest, Type).
  486. in_warnings(git, Warns, NameRaw, VsnRaw) ->
  487. Name = iolist_to_binary(NameRaw),
  488. Vsn = iolist_to_binary([$",VsnRaw,$"]),
  489. 1 =< length([1 || {_, [[AppName, $\s,$(,$f,$r,$o,$m,$\s,[${,["git",$,, _URL, $,,[${,["tag",$,, AppVsn], $}]],$}],$)]]} <- Warns,
  490. iolist_to_binary(AppName) =:= Name,
  491. iolist_to_binary(AppVsn) =:= Vsn]);
  492. in_warnings(pkg, Warns, NameRaw, VsnRaw) ->
  493. Name = iolist_to_binary(NameRaw),
  494. Vsn = iolist_to_binary(VsnRaw),
  495. 1 =< length([1 || {_, [[AppName, $\s,$v, AppVsn]]} <- Warns,
  496. iolist_to_binary(AppName) =:= Name,
  497. iolist_to_binary(AppVsn) =:= Vsn]).