summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmadeusz Żołnowski <aidecoe@aidecoe.name>2016-05-26 20:59:11 +0100
committerAmadeusz Żołnowski <aidecoe@gentoo.org>2016-05-29 10:23:21 +0100
commit98ba2191992c67244e50da4e95d38fd426b817ee (patch)
tree39defaaf95140f875eaf92a9929973a91483a591 /eclass/rebar.eclass
parentrebar.eclass: Run unit tests (diff)
downloadgentoo-98ba2191992c67244e50da4e95d38fd426b817ee.tar.gz
gentoo-98ba2191992c67244e50da4e95d38fd426b817ee.tar.bz2
gentoo-98ba2191992c67244e50da4e95d38fd426b817ee.zip
rebar.eclass: Optionally provide alternate rebar config to alter
Some packages have separate configs for build and tests. Build config is always named 'rebar.config' and there seem to be no standard name for tests config.
Diffstat (limited to 'eclass/rebar.eclass')
-rw-r--r--eclass/rebar.eclass14
1 files changed, 11 insertions, 3 deletions
diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 9f3d9e22109e..c8a2cf47c29a 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -93,17 +93,20 @@ erebar() {
}
# @FUNCTION: rebar_fix_include_path
-# @USAGE: <project_name>
+# @USAGE: <project_name> [<rebar_config>]
# @DESCRIPTION:
# Fix path in rebar.config to 'include' directory of dependant project/package,
# so it points to installation in system Erlang lib rather than relative 'deps'
# directory.
#
+# <rebar_config> is optional. Default is 'rebar.config'.
+#
# The function dies on failure.
rebar_fix_include_path() {
debug-print-function ${FUNCNAME} "${@}"
local pn="$1"
+ local rebar_config="${2:-rebar.config}"
local erl_libs="${EPREFIX}$(get_erl_libs)"
local p
@@ -121,19 +124,24 @@ rebar_fix_include_path() {
next;
}
1
-' rebar.config || die "failed to fix include paths in rebar.config for '${pn}'"
+' "${rebar_config}" || die "failed to fix include paths in ${rebar_config} for '${pn}'"
}
# @FUNCTION: rebar_remove_deps
+# @USAGE: [<rebar_config>]
# @DESCRIPTION:
# Remove dependencies list from rebar.config and deceive build rules that any
# dependencies are already fetched and built. Otherwise rebar tries to fetch
# dependencies and compile them.
#
+# <rebar_config> is optional. Default is 'rebar.config'.
+#
# The function dies on failure.
rebar_remove_deps() {
debug-print-function ${FUNCNAME} "${@}"
+ local rebar_config="${1:-rebar.config}"
+
mkdir -p "${S}/deps" && :>"${S}/deps/.got" && :>"${S}/deps/.built" || die
gawk -i inplace '
/^{[[:space:]]*deps[[:space:]]*,/, /}[[:space:]]*\.$/ {
@@ -143,7 +151,7 @@ rebar_remove_deps() {
next;
}
1
-' rebar.config || die "failed to remove deps from rebar.config"
+' "${rebar_config}" || die "failed to remove deps from ${rebar_config}"
}
# @FUNCTION: rebar_set_vsn