summaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2012-08-12 20:14:27 +0200
committerTuncer Ayaz <tuncer.ayaz@gmail.com>2012-08-13 00:07:00 +0200
commite34b70242320db94a0d44702eb1a3cfb77fa24c6 (patch)
treee40e82831a3c9b573eebb8086435ccea71f63dca /bootstrap
parent08220752507631bb49190644023c5f720377d935 (diff)
bootstrap: fix and enhance VCS_INFO handling
* re-compile rebar.erl instead of rebar_core to define VCS_INFO * append "-dirty" if vcs indicates unclean repo status
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap18
1 files changed, 13 insertions, 5 deletions
diff --git a/bootstrap b/bootstrap
index fc6d1a8..70d8da1 100755
--- a/bootstrap
+++ b/bootstrap
@@ -7,15 +7,16 @@ main(Args) ->
Built = build_time(),
%% Get a string repr of first matching VCS changeset
- VcsInfo = vcs_info([{hg, ".hg", "hg identify -i"},
- {git, ".git", "git describe --always --tags"}]),
+ VcsInfo = vcs_info([{hg, ".hg", "hg identify -i", "hg status"},
+ {git, ".git", "git describe --always --tags",
+ "git status -s"}]),
%% Check for force=1 flag to force a rebuild
case lists:member("force=1", Args) of
true ->
rm("ebin/*.beam");
false ->
- rm("ebin/rebar_core.beam")
+ rm("ebin/rebar.beam")
end,
%% Add check for debug flag
@@ -93,10 +94,17 @@ build_time() ->
vcs_info([]) ->
"No VCS info available.";
-vcs_info([{Id, Dir, Cmd} | Rest]) ->
+vcs_info([{Id, Dir, VsnCmd, StatusCmd} | Rest]) ->
case filelib:is_dir(Dir) of
true ->
- lists:concat([Id, " ", string:strip(os:cmd(Cmd), both, $\n)]);
+ Vsn = string:strip(os:cmd(VsnCmd), both, $\n),
+ Status = case string:strip(os:cmd(StatusCmd), both, $\n) of
+ [] ->
+ "";
+ _ ->
+ "-dirty"
+ end,
+ lists:concat([Id, " ", Vsn, Status]);
false ->
vcs_info(Rest)
end.