diff options
author | Alexey Romanov <alexey.v.romanov@gmail.com> | 2010-12-11 15:58:20 +0300 |
---|---|---|
committer | Alexey Romanov <alexey.v.romanov@gmail.com> | 2010-12-11 15:58:20 +0300 |
commit | 2ceeb3272139b7569c8dabc215ca1e7063b0d385 (patch) | |
tree | ed38fc14792cdc4702991d3712ed516f67b828cb /src/rebar_deps.erl | |
parent | d9f0cdeddd6e7499d3901e9f10f6126d0fc1cc54 (diff) | |
parent | 90c5da80334eed4b97f475e1c0553567a9f14f0a (diff) |
Merge branch 'master' of git://github.com/basho/rebar
Conflicts:
priv/templates/simplenode.runner
Diffstat (limited to 'src/rebar_deps.erl')
-rw-r--r-- | src/rebar_deps.erl | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/rebar_deps.erl b/src/rebar_deps.erl index 317814f..0852b01 100644 --- a/src/rebar_deps.erl +++ b/src/rebar_deps.erl @@ -297,11 +297,21 @@ download_source(AppDir, {svn, Url, Rev}) -> filename:dirname(AppDir)). update_source(Dep) -> - ?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]), - require_source_engine(Dep#dep.source), - update_source(filename:join(get_deps_dir(), Dep#dep.app), - Dep#dep.source), - Dep. + %% It's possible when updating a source, that a given dep does not have a + %% VCS directory, such as when a source archive is built of a project, with + %% all deps already downloaded/included. So, verify that the necessary VCS + %% directory exists before attempting to do the update. + AppDir = filename:join(get_deps_dir(), Dep#dep.app), + case has_vcs_dir(element(1, Dep#dep.source), AppDir) of + true -> + ?CONSOLE("Updating ~p from ~p\n", [Dep#dep.app, Dep#dep.source]), + require_source_engine(Dep#dep.source), + update_source(AppDir, Dep#dep.source), + Dep; + false -> + ?WARN("Skipping update for ~p: no VCS directory available!\n", [Dep]), + Dep + end. update_source(AppDir, {git, _Url, {branch, Branch}}) -> rebar_utils:sh(?FMT("git fetch origin", []), [], AppDir), @@ -358,3 +368,15 @@ scm_client_vsn(bzr) -> scm_client_vsn(rebar_utils:find_executable("bzr"), " --version", "Bazaar \\(bzr\\) (\\d+).(\\d+)"); scm_client_vsn(svn) -> scm_client_vsn(rebar_utils:find_executable("svn"), " --version", "svn, version (\\d+).(\\d+)"). + +has_vcs_dir(git, Dir) -> + filelib:is_dir(filename:join(Dir, ".git")); +has_vcs_dir(hg, Dir) -> + filelib:is_dir(filename:join(Dir, ".hg")); +has_vcs_dir(bzr, Dir) -> + filelib:is_dir(filename:join(Dir, ".bzr")); +has_vcs_dir(svn, Dir) -> + filelib:is_dir(filename:join(Dir, ".svn")) + orelse filelib:is_dir(filename:join(Dir, "_svn")); +has_vcs_dir(_, _) -> + true. |