You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/09/28 16:50:04 UTC
[35/39] couchdb commit: updated refs/heads/developer-preview-2.0 to
3ac3db6
Add introspect script to compare what we currently point to versus the latest for all deps
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/75e54ea3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/75e54ea3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/75e54ea3
Branch: refs/heads/developer-preview-2.0
Commit: 75e54ea36006ecf2e0818a2f552985f0f5d40dec
Parents: a3bdfc6
Author: Robert Newson <rn...@apache.org>
Authored: Thu Sep 24 16:36:42 2015 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Thu Sep 24 16:36:42 2015 +0100
----------------------------------------------------------------------
Makefile | 5 ++++
introspect | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/75e54ea3/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index e3c98c6..a56ff32 100644
--- a/Makefile
+++ b/Makefile
@@ -185,3 +185,8 @@ ifeq ($(with_fauxton), 1)
@echo "Building Fauxton"
@cd src/fauxton && npm install && ./node_modules/grunt-cli/bin/grunt couchdb
endif
+
+.PHONY: introspect
+introspect:
+ rebar -r update-deps
+ ./introspect
http://git-wip-us.apache.org/repos/asf/couchdb/blob/75e54ea3/introspect
----------------------------------------------------------------------
diff --git a/introspect b/introspect
new file mode 100755
index 0000000..9b52745
--- /dev/null
+++ b/introspect
@@ -0,0 +1,73 @@
+#!/usr/bin/env escript
+%% -*- mode: erlang -*-
+
+main(_) ->
+ introspect("rebar.config.script").
+
+introspect(File) ->
+ Bindings = [{'SCRIPT', File}, {'CONFIG', []}],
+ {ok, Config} = file:script(File, Bindings),
+ {deps, Deps} = lists:keyfind(deps, 1, Config),
+ introspect_deps(Deps).
+
+introspect_deps([]) ->
+ ok;
+introspect_deps([Dep | Rest]) ->
+ introspect_dep(Dep),
+ introspect_deps(Rest).
+
+introspect_dep({App, VsnRegex, {git, Url, From}, _Raw}) ->
+ introspect_dep({App, VsnRegex, {git, Url, From}});
+introspect_dep({App, _VsnRegex, {git, _Url, From}}) ->
+ io:format(bold("~s~n"), [App]),
+ introspect_diff(App, From),
+ io:format("~n", []),
+ ok.
+
+revision({branch, Branch}) ->
+ Branch;
+revision({tag, Tag}) ->
+ Tag;
+revision(Rev) ->
+ Rev.
+
+introspect_diff(App, From) ->
+ introspect_diff(App, revision(From), "origin/master").
+
+introspect_diff(App, From, ToBranch) ->
+ {ok, Log} = sh(App, io_lib:format("git log --pretty=oneline ~s..~s", [From, ToBranch])),
+ case Log of
+ [] ->
+ io:format(" up to date on ~s~n", [bold(ToBranch)]);
+ _ ->
+ io:format(" ~B commits behind ~s~n", [length(Log), bold(ToBranch)]),
+ io:format("~s~n~n", [string:join([" " ++ L || L <- Log], "\n")])
+ end.
+
+sh(App, Cmd) ->
+ Dir = lists:flatten(["src/", atom_to_list(App)]),
+ Port = open_port({spawn, lists:flatten(Cmd)},
+ [{cd, Dir},
+ {line, 16384},
+ exit_status,
+ stderr_to_stdout,
+ use_stdio]),
+ read_port(Port).
+
+read_port(Port) ->
+ read_port(Port, []).
+
+read_port(Port, Acc) ->
+ receive
+ {Port, {data, {eol, Line}}} ->
+ read_port(Port, [Line | Acc]);
+ {Port, {data, {noeol, Line}}} ->
+ read_port(Port, [Line | Acc]);
+ {Port, {exit_status, 0}} ->
+ {ok, lists:reverse(Acc)};
+ {Port, {exit_status, Code}} ->
+ {error, Code, Acc}
+ end.
+
+bold(Text) ->
+ "\e[1m" ++ Text ++ "\e[0m".