summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Kocoloski <adam@cloudant.com>2010-08-18 14:57:08 -0400
committerAdam Kocoloski <adam@cloudant.com>2010-08-18 14:57:08 -0400
commit1fda1aa8f69d5870c5711b0068971c7d4594e6cc (patch)
treeedbe28a6e03b9932596f03e294fe33df2c2b1009
parent1b40244642f1099df7b7addecf2ac47e52b8d636 (diff)
new version() call allows for hidden patch releases
-rw-r--r--apps/couch/include/couch_db.hrl2
-rw-r--r--apps/couch/src/couch.app.src2
-rw-r--r--apps/couch/src/couch.erl4
-rw-r--r--apps/couch/src/couch_httpd.erl2
-rw-r--r--apps/couch/src/couch_httpd_misc_handlers.erl2
-rw-r--r--apps/couch/src/couch_server.erl11
-rw-r--r--apps/couch/src/couch_server_sup.erl2
-rwxr-xr-xtest/etap/110-replication-httpc.t6
-rwxr-xr-xtest/etap/111-replication-changes-feed.t2
-rwxr-xr-xtest/etap/112-replication-missing-revs.t2
-rwxr-xr-xtest/etap/160-vhosts.t2
11 files changed, 16 insertions, 21 deletions
diff --git a/apps/couch/include/couch_db.hrl b/apps/couch/include/couch_db.hrl
index f17e6bb1..79af0db6 100644
--- a/apps/couch/include/couch_db.hrl
+++ b/apps/couch/include/couch_db.hrl
@@ -257,7 +257,7 @@
auth = [],
resource = "",
headers = [
- {"User-Agent", "CouchDB/"++couch_server:get_version()},
+ {"User-Agent", "CouchDB/"++couch:version()},
{"Accept", "application/json"},
{"Accept-Encoding", "gzip"}
],
diff --git a/apps/couch/src/couch.app.src b/apps/couch/src/couch.app.src
index 2e25d55a..61bcc1ee 100644
--- a/apps/couch/src/couch.app.src
+++ b/apps/couch/src/couch.app.src
@@ -1,6 +1,6 @@
{application, couch, [
{description, "Apache CouchDB"},
- {vsn, "1.0.1"},
+ {vsn, "1.0.1-patch-1"},
{registered, [
couch_config,
couch_db_update,
diff --git a/apps/couch/src/couch.erl b/apps/couch/src/couch.erl
index 956e9489..f6b048a5 100644
--- a/apps/couch/src/couch.erl
+++ b/apps/couch/src/couch.erl
@@ -37,3 +37,7 @@ reload() ->
{error, Reason} ->
{error, Reason}
end.
+
+version() ->
+ {ok, FullVersion} = application:get_key(couch, vsn),
+ hd(string:tokens(FullVersion, "-")).
diff --git a/apps/couch/src/couch_httpd.erl b/apps/couch/src/couch_httpd.erl
index 8a5c699a..2b952656 100644
--- a/apps/couch/src/couch_httpd.erl
+++ b/apps/couch/src/couch_httpd.erl
@@ -837,7 +837,7 @@ negotiate_content_type(#httpd{mochi_req=MochiReq}) ->
server_header() ->
OTPVersion = "R" ++ integer_to_list(erlang:system_info(compat_rel)) ++ "B",
- [{"Server", "CouchDB/" ++ couch_server:get_version() ++
+ [{"Server", "CouchDB/" ++ couch:version() ++
" (Erlang OTP/" ++ OTPVersion ++ ")"}].
diff --git a/apps/couch/src/couch_httpd_misc_handlers.erl b/apps/couch/src/couch_httpd_misc_handlers.erl
index 0a6f4a42..7b09dccd 100644
--- a/apps/couch/src/couch_httpd_misc_handlers.erl
+++ b/apps/couch/src/couch_httpd_misc_handlers.erl
@@ -32,7 +32,7 @@
handle_welcome_req(#httpd{method='GET'}=Req, WelcomeMessage) ->
send_json(Req, {[
{couchdb, WelcomeMessage},
- {version, list_to_binary(couch_server:get_version())}
+ {version, list_to_binary(couch:version())}
]});
handle_welcome_req(Req, _) ->
send_method_not_allowed(Req, "GET,HEAD").
diff --git a/apps/couch/src/couch_server.erl b/apps/couch/src/couch_server.erl
index b54771be..dfb523b9 100644
--- a/apps/couch/src/couch_server.erl
+++ b/apps/couch/src/couch_server.erl
@@ -14,7 +14,7 @@
-behaviour(gen_server).
-export([open/2,create/2,delete/2,all_databases/0,all_databases/1]).
--export([init/1, handle_call/3,sup_start_link/0,get_version/0]).
+-export([init/1, handle_call/3,sup_start_link/0]).
-export([handle_cast/2,code_change/3,handle_info/2,terminate/2]).
-export([dev_start/0,is_admin/2,has_admins/0,get_stats/0,config_change/4]).
-export([close_lru/0]).
@@ -34,15 +34,6 @@ dev_start() ->
up_to_date = make:all([load, debug_info]),
couch:start().
-get_version() ->
- Apps = application:loaded_applications(),
- case lists:keysearch(couch, 1, Apps) of
- {value, {_, _, Vsn}} ->
- Vsn;
- false ->
- "0.0.0"
- end.
-
get_stats() ->
{ok, #server{start_time=Time,dbs_open=Open}} =
gen_server:call(couch_server, get_server),
diff --git a/apps/couch/src/couch_server_sup.erl b/apps/couch/src/couch_server_sup.erl
index 1f31209b..6f6ca61a 100644
--- a/apps/couch/src/couch_server_sup.erl
+++ b/apps/couch/src/couch_server_sup.erl
@@ -56,7 +56,7 @@ start_server(IniFiles) ->
LogLevel = couch_config:get("log", "level", "info"),
% announce startup
io:format("Apache CouchDB ~s (LogLevel=~s) is starting.~n", [
- couch_server:get_version(),
+ couch:version(),
LogLevel
]),
case LogLevel of
diff --git a/test/etap/110-replication-httpc.t b/test/etap/110-replication-httpc.t
index 529239c5..b534b648 100755
--- a/test/etap/110-replication-httpc.t
+++ b/test/etap/110-replication-httpc.t
@@ -19,7 +19,7 @@
auth = [],
resource = "",
headers = [
- {"User-Agent", "CouchDB/"++couch_server:get_version()},
+ {"User-Agent", "CouchDB/"++couch:version()},
{"Accept", "application/json"},
{"Accept-Encoding", "gzip"}
],
@@ -79,7 +79,7 @@ test_welcome() ->
WelcomeReq = #http_db{url=server()},
Expect = {[
{<<"couchdb">>, <<"Welcome">>},
- {<<"version">>, list_to_binary(couch_server:get_version())}
+ {<<"version">>, list_to_binary(couch:version())}
]},
etap:is(
couch_rep_httpc:request(WelcomeReq),
@@ -91,7 +91,7 @@ test_binary_url() ->
Req = #http_db{url=list_to_binary(server())},
Expect = {[
{<<"couchdb">>, <<"Welcome">>},
- {<<"version">>, list_to_binary(couch_server:get_version())}
+ {<<"version">>, list_to_binary(couch:version())}
]},
etap:is(
couch_rep_httpc:request(Req),
diff --git a/test/etap/111-replication-changes-feed.t b/test/etap/111-replication-changes-feed.t
index 778b99dd..bca12bc7 100755
--- a/test/etap/111-replication-changes-feed.t
+++ b/test/etap/111-replication-changes-feed.t
@@ -22,7 +22,7 @@
auth = [],
resource = "",
headers = [
- {"User-Agent", "CouchDB/"++couch_server:get_version()},
+ {"User-Agent", "CouchDB/"++couch:version()},
{"Accept", "application/json"},
{"Accept-Encoding", "gzip"}
],
diff --git a/test/etap/112-replication-missing-revs.t b/test/etap/112-replication-missing-revs.t
index 750334b9..ea8466f6 100755
--- a/test/etap/112-replication-missing-revs.t
+++ b/test/etap/112-replication-missing-revs.t
@@ -23,7 +23,7 @@
auth = [],
resource = "",
headers = [
- {"User-Agent", "CouchDB/"++couch_server:get_version()},
+ {"User-Agent", "CouchDB/"++couch:version()},
{"Accept", "application/json"},
{"Accept-Encoding", "gzip"}
],
diff --git a/test/etap/160-vhosts.t b/test/etap/160-vhosts.t
index eb704d31..7694010a 100755
--- a/test/etap/160-vhosts.t
+++ b/test/etap/160-vhosts.t
@@ -19,7 +19,7 @@
auth = [],
resource = "",
headers = [
- {"User-Agent", "CouchDB/"++couch_server:get_version()},
+ {"User-Agent", "CouchDB/"++couch:version()},
{"Accept", "application/json"},
{"Accept-Encoding", "gzip"}
],