You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

502 lines
20 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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
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 years ago
  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. groups() ->
  11. [{all, [], [flat, pick_highest_left, pick_highest_right,
  12. pick_smallest1, pick_smallest2,
  13. circular1, circular2, circular_skip]},
  14. {git, [], [{group, all}]},
  15. {pkg, [], [{group, all}]}].
  16. init_per_suite(Config) ->
  17. application:start(meck),
  18. Config.
  19. end_per_suite(_Config) ->
  20. application:stop(meck).
  21. init_per_group(git, Config) ->
  22. [{deps_type, git} | Config];
  23. init_per_group(pkg, Config) ->
  24. [{deps_type, pkg} | Config];
  25. init_per_group(_, Config) ->
  26. Config.
  27. end_per_group(_, Config) ->
  28. Config.
  29. init_per_testcase(valid_version, Config) ->
  30. rebar_test_utils:init_rebar_state(Config);
  31. init_per_testcase(semver_matching_lt, Config) ->
  32. rebar_test_utils:init_rebar_state(Config);
  33. init_per_testcase(semver_matching_lte, Config) ->
  34. rebar_test_utils:init_rebar_state(Config);
  35. init_per_testcase(semver_matching_gt, Config) ->
  36. rebar_test_utils:init_rebar_state(Config);
  37. init_per_testcase(newly_added_after_empty_lock, Config) ->
  38. rebar_test_utils:init_rebar_state(Config);
  39. init_per_testcase(newly_added_dep, Config) ->
  40. rebar_test_utils:init_rebar_state(Config);
  41. init_per_testcase(sub_app_deps, Config) ->
  42. rebar_test_utils:init_rebar_state(Config);
  43. init_per_testcase(top_override, Config) ->
  44. rebar_test_utils:init_rebar_state(Config);
  45. init_per_testcase(http_proxy_settings, Config) ->
  46. %% Create private rebar.config
  47. Priv = ?config(priv_dir, Config),
  48. GlobalDir = filename:join(Priv, "global"),
  49. GlobalConfigDir = filename:join([GlobalDir, ".config", "rebar3"]),
  50. GlobalConfig = filename:join([GlobalDir, ".config", "rebar3", "rebar.config"]),
  51. meck:new(rebar_dir, [passthrough]),
  52. meck:expect(rebar_dir, global_config, fun() -> GlobalConfig end),
  53. meck:expect(rebar_dir, global_cache_dir, fun(_) -> GlobalDir end),
  54. %% Insert proxy variables into config
  55. rebar_test_utils:create_config(GlobalConfigDir,
  56. [{http_proxy, "http://localhost:1234"}
  57. ]),
  58. rebar_test_utils:init_rebar_state(Config);
  59. init_per_testcase(https_proxy_settings, Config) ->
  60. SupportsHttpsProxy = case erlang:system_info(otp_release) of
  61. "R16"++_ -> true;
  62. "R"++_ -> false;
  63. _ -> true % 17 and up don't have a "R" in the version
  64. end,
  65. if not SupportsHttpsProxy ->
  66. {skip, https_proxy_unsupported_before_R16};
  67. SupportsHttpsProxy ->
  68. %% Create private rebar.config
  69. Priv = ?config(priv_dir, Config),
  70. GlobalDir = filename:join(Priv, "global"),
  71. GlobalConfigDir = filename:join([GlobalDir, ".config", "rebar3"]),
  72. GlobalConfig = filename:join([GlobalDir, ".config", "rebar3", "rebar.config"]),
  73. meck:new(rebar_dir, [passthrough]),
  74. meck:expect(rebar_dir, global_config, fun() -> GlobalConfig end),
  75. meck:expect(rebar_dir, global_cache_dir, fun(_) -> GlobalDir end),
  76. %% Insert proxy variables into config
  77. rebar_test_utils:create_config(GlobalConfigDir,
  78. [{https_proxy, "http://localhost:1234"}
  79. ]),
  80. %% Add a bad value by default to show config overtakes default
  81. os:putenv("https_proxy", "unparseable-garbage"),
  82. rebar_test_utils:init_rebar_state(Config)
  83. end;
  84. init_per_testcase(http_os_proxy_settings, Config) ->
  85. %% Create private rebar.config
  86. Priv = ?config(priv_dir, Config),
  87. GlobalDir = filename:join(Priv, "global"),
  88. GlobalConfigDir = filename:join([GlobalDir, ".config", "rebar3"]),
  89. GlobalConfig = filename:join([GlobalDir, ".config", "rebar3", "rebar.config"]),
  90. meck:new(rebar_dir, [passthrough]),
  91. meck:expect(rebar_dir, global_config, fun() -> GlobalConfig end),
  92. meck:expect(rebar_dir, global_cache_dir, fun(_) -> GlobalDir end),
  93. %% Insert proxy variables into os env, but not config
  94. os:putenv("http_proxy", "http://localhost:1234"),
  95. rebar_test_utils:create_config(GlobalConfigDir, []),
  96. rebar_test_utils:init_rebar_state(Config);
  97. init_per_testcase(https_os_proxy_settings, Config) ->
  98. SupportsHttpsProxy = case erlang:system_info(otp_release) of
  99. "R16"++_ -> true;
  100. "R"++_ -> false;
  101. _ -> true % 17 and up don't have a "R" in the version
  102. end,
  103. if not SupportsHttpsProxy ->
  104. {skip, https_proxy_unsupported_before_R16};
  105. SupportsHttpsProxy ->
  106. %% Create private rebar.config
  107. Priv = ?config(priv_dir, Config),
  108. GlobalDir = filename:join(Priv, "global"),
  109. GlobalConfigDir = filename:join([GlobalDir, ".config", "rebar3"]),
  110. GlobalConfig = filename:join([GlobalDir, ".config", "rebar3", "rebar.config"]),
  111. meck:new(rebar_dir, [passthrough]),
  112. meck:expect(rebar_dir, global_config, fun() -> GlobalConfig end),
  113. meck:expect(rebar_dir, global_cache_dir, fun(_) -> GlobalDir end),
  114. %% Insert proxy variables into os env, not in config
  115. os:putenv("https_proxy", "http://localhost:1234"),
  116. rebar_test_utils:create_config(GlobalConfigDir, []),
  117. rebar_test_utils:init_rebar_state(Config)
  118. end;
  119. init_per_testcase(Case, Config) ->
  120. {Deps, Warnings, Expect} = deps(Case),
  121. Expected = case Expect of
  122. {ok, List} -> {ok, format_expected_deps(List)};
  123. {error, Reason} -> {error, Reason}
  124. end,
  125. DepsType = ?config(deps_type, Config),
  126. mock_warnings(),
  127. [{expect, Expected},
  128. {warnings, Warnings}
  129. | setup_project(Case, Config, rebar_test_utils:expand_deps(DepsType, Deps))].
  130. end_per_testcase(https_proxy_settings, Config) ->
  131. os:putenv("https_proxy", ""),
  132. meck:unload(rebar_dir),
  133. Config;
  134. end_per_testcase(http_proxy_settings, Config) ->
  135. meck:unload(rebar_dir),
  136. Config;
  137. end_per_testcase(http_os_proxy_settings, Config) ->
  138. os:putenv("http_proxy", ""),
  139. meck:unload(rebar_dir),
  140. Config;
  141. end_per_testcase(https_os_proxy_settings, Config) ->
  142. os:putenv("https_proxy", ""),
  143. meck:unload(rebar_dir),
  144. Config;
  145. end_per_testcase(_, Config) ->
  146. meck:unload(),
  147. Config.
  148. format_expected_deps(Deps) ->
  149. [case Dep of
  150. {N,V} -> {dep, N, V};
  151. N -> {dep, N}
  152. end || Dep <- Deps].
  153. %% format:
  154. %% {Spec,
  155. %% [Warning],
  156. %% {ok, Result} | {error, Reason}}
  157. %%
  158. %% Spec is a list of levelled dependencies of two possible forms:
  159. %% - {"Name", Spec}
  160. %% - {"Name", "Vsn", Spec}
  161. %%
  162. %% Warnings are going to match on mocked ?WARN(...)
  163. %% calls to be evaluated. An empty list means we do not care about
  164. %% warnings, not that no warnings will be printed. This means
  165. %% the list of warning isn't interpreted to be exhaustive, and more
  166. %% warnings may be generated than are listed.
  167. deps(flat) ->
  168. {[{"B", []},
  169. {"C", []}],
  170. [],
  171. {ok, ["B", "C"]}};
  172. deps(pick_highest_left) ->
  173. {[{"B", [{"C", "2.0.0", []}]},
  174. {"C", "1.0.0", []}],
  175. [{"C","2.0.0"}],
  176. {ok, ["B", {"C", "1.0.0"}]}};
  177. deps(pick_highest_right) ->
  178. {[{"B", "1.0.0", []},
  179. {"C", [{"B", "2.0.0", []}]}],
  180. [{"B","2.0.0"}],
  181. {ok, [{"B","1.0.0"}, "C"]}};
  182. deps(pick_smallest1) ->
  183. {[{"B", [{"D", "1.0.0", []}]},
  184. {"C", [{"D", "2.0.0", []}]}],
  185. [{"D","2.0.0"}],
  186. %% we pick D1 because B < C
  187. {ok, ["B","C",{"D","1.0.0"}]}};
  188. deps(pick_smallest2) ->
  189. {[{"C", [{"D", "2.0.0", []}]},
  190. {"B", [{"D", "1.0.0", []}]}],
  191. [{"D","2.0.0"}],
  192. %% we pick D1 because B < C
  193. {ok, ["B","C",{"D","1.0.0"}]}};
  194. deps(circular1) ->
  195. {[{"B", [{"A", []}]}, % A is the top-level app
  196. {"C", []}],
  197. [],
  198. {error, {rebar_prv_install_deps, {cycles, [[<<"A">>,<<"B">>]]}}}};
  199. deps(circular2) ->
  200. {[{"B", [{"C", [{"B", []}]}]},
  201. {"C", []}],
  202. [],
  203. {error, {rebar_prv_install_deps, {cycles, [[<<"B">>,<<"C">>]]}}}};
  204. deps(circular_skip) ->
  205. %% Never spot the circular dep due to being to low in the deps tree
  206. %% in source deps
  207. {[{"B", [{"C", "2.0.0", [{"B", []}]}]},
  208. {"C", "1.0.0", [{"D",[]}]}],
  209. [{"C","2.0.0"}],
  210. {ok, ["B", {"C","1.0.0"}, "D"]}}.
  211. setup_project(Case, Config0, Deps) ->
  212. DepsType = ?config(deps_type, Config0),
  213. %% spread packages across 3 repos randomly
  214. Repos = [<<"test-repo-1">>, <<"test-repo-2">>, <<"hexpm">>],
  215. Config = rebar_test_utils:init_rebar_state(
  216. [{repos, Repos} | Config0],
  217. atom_to_list(Case)++"_"++atom_to_list(DepsType)++"_"
  218. ),
  219. AppDir = ?config(apps, Config),
  220. rebar_test_utils:create_app(AppDir, "A", "0.0.0", [kernel, stdlib]),
  221. TopDeps = rebar_test_utils:top_level_deps(Deps),
  222. RebarConf = rebar_test_utils:create_config(AppDir, [{deps, TopDeps}]),
  223. {SrcDeps, PkgDeps} = rebar_test_utils:flat_deps(Deps),
  224. mock_git_resource:mock([{deps, SrcDeps}]),
  225. mock_pkg_resource:mock([{pkgdeps, PkgDeps}, {repos, Repos}]),
  226. [{rebarconfig, RebarConf} | Config].
  227. mock_warnings() ->
  228. %% just let it do its thing, we check warnings through
  229. %% the call log.
  230. meck:new(rebar_log, [no_link, passthrough]).
  231. %%% TESTS %%%
  232. flat(Config) -> run(Config).
  233. pick_highest_left(Config) -> run(Config).
  234. pick_highest_right(Config) -> run(Config).
  235. pick_smallest1(Config) -> run(Config).
  236. pick_smallest2(Config) -> run(Config).
  237. circular1(Config) -> run(Config).
  238. circular2(Config) -> run(Config).
  239. circular_skip(Config) -> run(Config).
  240. %% Test that a top-level application overtakes dependencies, and
  241. %% works even if said deps do not exist.
  242. top_override(Config) ->
  243. AppDir = ?config(apps, Config),
  244. ct:pal("dir: ~p", [AppDir]),
  245. Name1 = rebar_test_utils:create_random_name("sub_app1_"),
  246. Name2 = rebar_test_utils:create_random_name("sub_app2_"),
  247. SubAppsDir1 = filename:join([AppDir, "apps", Name1]),
  248. SubAppsDir2 = filename:join([AppDir, "apps", Name2]),
  249. Vsn = rebar_test_utils:create_random_vsn(),
  250. rebar_test_utils:create_app(SubAppsDir1, Name1, Vsn, [kernel, stdlib]),
  251. rebar_test_utils:create_app(SubAppsDir2, Name2, Vsn, [kernel, stdlib]),
  252. rebar_test_utils:create_config(
  253. SubAppsDir1,
  254. [{deps, [list_to_atom(Name2)]}]
  255. ),
  256. rebar_test_utils:create_config(
  257. SubAppsDir2,
  258. [{deps, [{list_to_atom(Name1),
  259. {git, "https://example.org", {branch, "master"}}}]}]
  260. ),
  261. rebar_test_utils:run_and_check(
  262. Config, [], ["compile"],
  263. {ok, [{app, Name1}, {app,Name2}]}
  264. ).
  265. %% Test that the deps of project apps that have their own rebar.config
  266. %% are included, but that top level rebar.config deps take precedence
  267. sub_app_deps(Config) ->
  268. AppDir = ?config(apps, Config),
  269. Deps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  270. ,{"b", "1.0.0", []}
  271. ,{"b", "2.0.0", []}]),
  272. {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
  273. mock_git_resource:mock([{deps, SrcDeps}]),
  274. Name = rebar_test_utils:create_random_name("sub_app1_"),
  275. Vsn = rebar_test_utils:create_random_vsn(),
  276. SubAppsDir = filename:join([AppDir, "apps", Name]),
  277. SubDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  278. ,{"b", "2.0.0", []}])),
  279. rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]),
  280. rebar_test_utils:create_config(SubAppsDir, [{deps, SubDeps}]),
  281. TopDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"b", "1.0.0", []}])),
  282. {ok, RebarConfig} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps}])),
  283. rebar_test_utils:run_and_check(
  284. Config, RebarConfig, ["compile"],
  285. {ok, [{app, Name}, {dep, "a"}, {dep, "b", "1.0.0"}]}).
  286. %% Newly added dependency after locking
  287. newly_added_dep(Config) ->
  288. AppDir = ?config(apps, Config),
  289. Deps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  290. ,{"b", "1.0.0", [{"c", "1.0.0", []}]}
  291. ,{"c", "2.0.0", []}]),
  292. {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
  293. mock_git_resource:mock([{deps, SrcDeps}]),
  294. Name = rebar_test_utils:create_random_name("app_"),
  295. Vsn = rebar_test_utils:create_random_vsn(),
  296. SubAppsDir = filename:join([AppDir, "apps", Name]),
  297. rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]),
  298. TopDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"b", "1.0.0", []}])),
  299. {ok, RebarConfig} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps}])),
  300. rebar_test_utils:run_and_check(
  301. Config, RebarConfig, ["compile"],
  302. {ok, [{app, Name}, {dep, "b", "1.0.0"}, {dep, "c", "1.0.0"}]}),
  303. %% Add a and c to top level
  304. TopDeps2 = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}
  305. ,{"c", "2.0.0", []}
  306. ,{"b", "1.0.0", []}])),
  307. {ok, RebarConfig2} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps2}])),
  308. LockFile = filename:join(AppDir, "rebar.lock"),
  309. RebarConfig3 = rebar_config:merge_locks(RebarConfig2,
  310. rebar_config:consult_lock_file(LockFile)),
  311. %% a should now be installed and c should not change
  312. rebar_test_utils:run_and_check(
  313. Config, RebarConfig3, ["compile"],
  314. {ok, [{app, Name}, {dep, "a"}, {dep, "b", "1.0.0"}, {dep, "c", "1.0.0"}]}).
  315. newly_added_after_empty_lock(Config) ->
  316. AppDir = ?config(apps, Config),
  317. Deps = rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}]),
  318. {SrcDeps, _} = rebar_test_utils:flat_deps(Deps),
  319. mock_git_resource:mock([{deps, SrcDeps}]),
  320. Name = rebar_test_utils:create_random_name("app_"),
  321. Vsn = rebar_test_utils:create_random_vsn(),
  322. SubAppsDir = filename:join([AppDir, "apps", Name]),
  323. rebar_test_utils:create_app(SubAppsDir, Name, Vsn, [kernel, stdlib]),
  324. TopDeps = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [])),
  325. {ok, RebarConfig} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps}])),
  326. rebar_test_utils:run_and_check(
  327. Config, RebarConfig, ["compile"],
  328. {ok, []}),
  329. %% Add a and c to top level
  330. TopDeps2 = rebar_test_utils:top_level_deps(rebar_test_utils:expand_deps(git, [{"a", "1.0.0", []}])),
  331. {ok, RebarConfig2} = file:consult(rebar_test_utils:create_config(AppDir, [{deps, TopDeps2}])),
  332. LockFile = filename:join(AppDir, "rebar.lock"),
  333. RebarConfig3 = rebar_config:merge_locks(RebarConfig2,
  334. rebar_config:consult_lock_file(LockFile)),
  335. %% a should now be installed and c should not change
  336. rebar_test_utils:run_and_check(
  337. Config, RebarConfig3, ["compile"],
  338. {ok, [{app, Name}, {dep, "a", "1.0.0"}]}).
  339. http_proxy_settings(_Config) ->
  340. %% Load config
  341. rebar_utils:set_httpc_options(),
  342. rebar3:init_config(),
  343. %% Assert variable is right
  344. ?assertEqual({ok,{{"localhost", 1234}, []}},
  345. httpc:get_option(proxy, rebar)).
  346. https_proxy_settings(_Config) ->
  347. %% Load config
  348. rebar_utils:set_httpc_options(),
  349. rebar3:init_config(),
  350. %% Assert variable is right
  351. ?assertEqual({ok,{{"localhost", 1234}, []}},
  352. httpc:get_option(https_proxy, rebar)).
  353. http_os_proxy_settings(_Config) ->
  354. %% Load config
  355. rebar_utils:set_httpc_options(),
  356. rebar3:init_config(),
  357. %% Assert variable is right
  358. ?assertEqual({ok,{{"localhost", 1234}, []}},
  359. httpc:get_option(proxy, rebar)).
  360. https_os_proxy_settings(_Config) ->
  361. %% Load config
  362. rebar_utils:set_httpc_options(),
  363. rebar3:init_config(),
  364. %% Assert variable is right
  365. ?assertEqual({ok,{{"localhost", 1234}, []}},
  366. httpc:get_option(https_proxy, rebar)).
  367. semver_matching_lt(_Config) ->
  368. MaxVsn = <<"0.2.0">>,
  369. Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>, <<"0.2.1">>],
  370. ?assertEqual({ok, <<"0.1.9">>},
  371. rebar_packages:cmpl_(undefined, MaxVsn, Vsns,
  372. fun ec_semver:lt/2)).
  373. semver_matching_lte(_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.2.0">>},
  377. rebar_packages:cmpl_(undefined, MaxVsn, Vsns,
  378. fun ec_semver:lte/2)).
  379. semver_matching_gt(_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.1">>},
  383. rebar_packages:cmp_(undefined, MaxVsn, Vsns,
  384. fun ec_semver:gt/2)).
  385. semver_matching_gte(_Config) ->
  386. MaxVsn = <<"0.2.0">>,
  387. Vsns = [<<"0.1.7">>, <<"0.1.9">>, <<"0.1.8">>, <<"0.2.0">>],
  388. ?assertEqual({ok, <<"0.2.0">>},
  389. rebar_packages:cmp_(undefined, MaxVsn, Vsns,
  390. fun ec_semver:gt/2)).
  391. valid_version(_Config) ->
  392. ?assert(rebar_packages:valid_vsn(<<"0.1">>)),
  393. ?assert(rebar_packages:valid_vsn(<<"0.1.0">>)),
  394. ?assert(rebar_packages:valid_vsn(<<" 0.1.0">>)),
  395. ?assert(rebar_packages:valid_vsn(<<" 0.1.0">>)),
  396. ?assert(rebar_packages:valid_vsn(<<"<0.1">>)),
  397. ?assert(rebar_packages:valid_vsn(<<"<0.1.0">>)),
  398. ?assert(rebar_packages:valid_vsn(<<"< 0.1.0">>)),
  399. ?assert(rebar_packages:valid_vsn(<<"< 0.1.0">>)),
  400. ?assert(rebar_packages:valid_vsn(<<">0.1">>)),
  401. ?assert(rebar_packages:valid_vsn(<<">0.1.0">>)),
  402. ?assert(rebar_packages:valid_vsn(<<"> 0.1.0">>)),
  403. ?assert(rebar_packages:valid_vsn(<<"> 0.1.0">>)),
  404. ?assert(rebar_packages:valid_vsn(<<"<=0.1">>)),
  405. ?assert(rebar_packages:valid_vsn(<<"<=0.1.0">>)),
  406. ?assert(rebar_packages:valid_vsn(<<"<= 0.1.0">>)),
  407. ?assert(rebar_packages:valid_vsn(<<"<= 0.1.0">>)),
  408. ?assert(rebar_packages:valid_vsn(<<">=0.1">>)),
  409. ?assert(rebar_packages:valid_vsn(<<">=0.1.0">>)),
  410. ?assert(rebar_packages:valid_vsn(<<">= 0.1.0">>)),
  411. ?assert(rebar_packages:valid_vsn(<<">= 0.1.0">>)),
  412. ?assert(rebar_packages:valid_vsn(<<"==0.1">>)),
  413. ?assert(rebar_packages:valid_vsn(<<"==0.1.0">>)),
  414. ?assert(rebar_packages:valid_vsn(<<"== 0.1.0">>)),
  415. ?assert(rebar_packages:valid_vsn(<<"== 0.1.0">>)),
  416. ?assert(rebar_packages:valid_vsn(<<"~>0.1">>)),
  417. ?assert(rebar_packages:valid_vsn(<<"~>0.1.0">>)),
  418. ?assert(rebar_packages:valid_vsn(<<"~> 0.1.0">>)),
  419. ?assert(rebar_packages:valid_vsn(<<"~> 0.1.0">>)),
  420. ?assertNot(rebar_packages:valid_vsn(<<"> 0.1.0 and < 0.2.0">>)),
  421. ok.
  422. run(Config) ->
  423. {ok, RebarConfig} = file:consult(?config(rebarconfig, Config)),
  424. rebar_test_utils:run_and_check(
  425. Config, RebarConfig, ["install_deps"], ?config(expect, Config)
  426. ),
  427. check_warnings(warning_calls(), ?config(warnings, Config), ?config(deps_type, Config)).
  428. warning_calls() ->
  429. History = meck:history(rebar_log),
  430. [{Str, Args} || {_, {rebar_log, log, [warn, Str, Args]}, _} <- History].
  431. check_warnings(_, [], _) ->
  432. ok;
  433. check_warnings(Warns, [{Name, Vsn} | Rest], Type) ->
  434. ct:pal("Checking for warning ~p in ~p", [{Name,Vsn},Warns]),
  435. ?assert(in_warnings(Type, Warns, Name, Vsn)),
  436. check_warnings(Warns, Rest, Type).
  437. in_warnings(git, Warns, NameRaw, VsnRaw) ->
  438. Name = iolist_to_binary(NameRaw),
  439. 1 =< length([1 || {_, [AppName, {git, _, {_, Vsn}}]} <- Warns,
  440. AppName =:= Name, Vsn =:= VsnRaw]);
  441. in_warnings(pkg, Warns, NameRaw, VsnRaw) ->
  442. Name = iolist_to_binary(NameRaw),
  443. Vsn = iolist_to_binary(VsnRaw),
  444. 1 =< length([1 || {_, [AppName, {pkg, _, AppVsn}]} <- Warns,
  445. AppName =:= Name, AppVsn =:= Vsn]).