25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

set-dep-versions: Cope with branches

Handle the case where a branch name is specified for a rebar dependency,
as we now do for Elixir.
This commit is contained in:
Holger Weiss 2015-02-26 00:02:11 +01:00
parent 5bd8724801
commit 96025bfc6e
2 changed files with 22 additions and 12 deletions

View File

@ -92,16 +92,12 @@ CfgDeps = lists:flatmap(
({zlib, true}) -> ({zlib, true}) ->
[{p1_zlib, ".*", {git, "git://github.com/processone/zlib"}}]; [{p1_zlib, ".*", {git, "git://github.com/processone/zlib"}}];
({riak, true}) -> ({riak, true}) ->
[{riakc, ".*", [{riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", {tag, "1.4.2"}}}];
{git, "git://github.com/basho/riak-erlang-client",
{tag, "1.4.2"}}}];
({json, true}) -> ({json, true}) ->
[{jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}]; [{jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}];
({elixir, true}) -> ({elixir, true}) ->
[{rebar_elixir_plugin, ".*", {git, "git://github.com/yrashk/rebar_elixir_plugin"}}, [{rebar_elixir_plugin, ".*", {git, "git://github.com/yrashk/rebar_elixir_plugin"}},
{elixir, ".*", {elixir, ".*", {git, "git://github.com/elixir-lang/elixir", {branch, "v1.0"}}}];
{git, "git://github.com/elixir-lang/elixir",
{branch, "v1.0"}}}];
({iconv, true}) -> ({iconv, true}) ->
[{p1_iconv, ".*", {git, "git://github.com/processone/eiconv"}}]; [{p1_iconv, ".*", {git, "git://github.com/processone/eiconv"}}];
({lager, true}) -> ({lager, true}) ->

View File

@ -19,9 +19,13 @@ die()
get_dep_list() get_dep_list()
{ {
sed -n \ sed -n '
'/.*{ *\([^,]*\),[^,]*, *{git, *"\([^"]*\)".*/ { /.*{ *\([^,]*\),[^,]*, *{ *git, *"\([^"]*\)" *} *}.*/ {
s//\1,\2/ s//\1,\2,master/
p
}
/.*{ *\([^,]*\),[^,]*, *{ *git, *"\([^"]*\)" *, *{ *branch, *"\([^"]*\)".*/ {
s//\1,\2,\3/
p p
}' "$rebar_script" }' "$rebar_script"
} }
@ -33,7 +37,15 @@ get_dep_name()
get_dep_url() get_dep_url()
{ {
printf '%s' "${1#*,}" dep_url=${1#*,}
dep_url=${dep_url%,*}
printf '%s' "$dep_url"
}
get_dep_branch()
{
printf '%s' "${1##*,}"
} }
get_dep_rev() get_dep_rev()
@ -51,9 +63,10 @@ clone_repo()
{ {
dep_name=$(get_dep_name "$1") dep_name=$(get_dep_name "$1")
dep_url=$(get_dep_url "$1") dep_url=$(get_dep_url "$1")
dep_branch=$(get_dep_branch "$1")
cd "$deps_dir" cd "$deps_dir"
git clone -q "$dep_url" "$dep_name" git clone -q -b "$dep_branch" "$dep_url" "$dep_name"
cd "$OLDPWD" cd "$OLDPWD"
} }
@ -64,7 +77,8 @@ edit_rebar_script()
dep_rev=$(get_dep_rev "$1") dep_rev=$(get_dep_rev "$1")
echo "Using revision $dep_rev of $dep_name" echo "Using revision $dep_rev of $dep_name"
sed "s|\"$dep_url\"[^}]*}|\"$dep_url\", \"$dep_rev\"}|" \ sed -e "s|\"$dep_url\".*{ *branch[^}]*} *}|\"$dep_url\", \"$dep_rev\"}|" \
-e "s|\"$dep_url\"[^}]*}|\"$dep_url\", \"$dep_rev\"}|" \
"$rebar_script" >"$temp_file" "$rebar_script" >"$temp_file"
mv "$temp_file" "$rebar_script" mv "$temp_file" "$rebar_script"
} }