25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +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}) ->
[{p1_zlib, ".*", {git, "git://github.com/processone/zlib"}}];
({riak, true}) ->
[{riakc, ".*",
{git, "git://github.com/basho/riak-erlang-client",
{tag, "1.4.2"}}}];
[{riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", {tag, "1.4.2"}}}];
({json, true}) ->
[{jiffy, ".*", {git, "git://github.com/davisp/jiffy"}}];
({elixir, true}) ->
[{rebar_elixir_plugin, ".*", {git, "git://github.com/yrashk/rebar_elixir_plugin"}},
{elixir, ".*",
{git, "git://github.com/elixir-lang/elixir",
{branch, "v1.0"}}}];
{elixir, ".*", {git, "git://github.com/elixir-lang/elixir", {branch, "v1.0"}}}];
({iconv, true}) ->
[{p1_iconv, ".*", {git, "git://github.com/processone/eiconv"}}];
({lager, true}) ->

View File

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