You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2014/02/05 05:20:14 UTC
[1/5] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to e6724ff
Updated Branches:
refs/heads/1843-feature-bigcouch-multi-repo 2385a37bc -> e6724ffae
Make sure that we don't destroy the current CONFIG
Its possible to also provide a rebar.config which rebar.config.script is
responsible for mutating. This just makes sure we update the provided
CONFIG values rather than possibly dropping unknown configuration
values.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9de0e8c1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9de0e8c1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9de0e8c1
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: 9de0e8c185e180ce8baac23ab1f4aa782e12983c
Parents: 2385a37
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 21:02:36 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 4 21:05:47 2014 -0600
----------------------------------------------------------------------
rebar.config.script | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9de0e8c1/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index 1983e9d..d2ac1b0 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -37,11 +37,15 @@ MakeDep = fun({AppName, RepoName, Version}) ->
{AppName, ".*", {git, Url, Version}}
end,
-[
+AddConfig = [
{deps_dir, "src"},
{deps, lists:map(MakeDep, DepDescs)},
{sub_dirs, ["rel"]},
{lib_dirs, ["src/"]},
{erl_opts, [debug_info]},
{post_hooks, [{compile, "escript support/build_js.escript"}]}
-].
+],
+
+C = lists:foldl(fun({K, V}, CfgAcc) ->
+ lists:keystore(K, 1, CfgAcc, {K, V})
+end, CONFIG, AddConfig).
[4/5] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to e6724ff
Posted by da...@apache.org.
Make the JavaScript test runner work
This is currently removing a bunch of stuff that we normally use during
the test suite so that I can get the test runner going. I full intend to
undo these changes in the future.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/fa70563d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/fa70563d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/fa70563d
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: fa70563d5e169df41717dfd66dc01835cededc29
Parents: d64ef63
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 22:06:00 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 4 22:07:09 2014 -0600
----------------------------------------------------------------------
.gitignore | 2 ++
configure | 4 +++
test/javascript/run.tpl | 68 ++++----------------------------------------
3 files changed, 11 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/fa70563d/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 902035d..8ea2016 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,5 @@ share/server/main.js
src/couch/priv/couch_js/config.h
src/couch/priv/couchjs
src/couch/priv/couchspawnkillable
+
+test/javascript/run
http://git-wip-us.apache.org/repos/asf/couchdb/blob/fa70563d/configure
----------------------------------------------------------------------
diff --git a/configure b/configure
index 7036d7c..24c7cea 100755
--- a/configure
+++ b/configure
@@ -104,6 +104,10 @@ cat > $rootdir/config.erl << EOF
{with_curl, $WITH_CURL}.
EOF
+# Write out the JavaScript test command
+sed -e "s|%rootdir%|$rootdir|" < test/javascript/run.tpl > test/javascript/run
+chmod +x test/javascript/run
+
# finally, a few config files for local development nodes
for i in 1 2 3; do
cat > rel/dev$i.config << EOF
http://git-wip-us.apache.org/repos/asf/couchdb/blob/fa70563d/test/javascript/run.tpl
----------------------------------------------------------------------
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 75192da..c0fd693 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -12,73 +12,26 @@
# License for the specific language governing permissions and limitations under
# the License.
-SRC_DIR=%abs_top_srcdir%
-BUILD_DIR=%abs_top_builddir%
+SRC_DIR=%rootdir%
+BUILD_DIR=%rootdir%
SCRIPT_DIR=$SRC_DIR/share/www/script
JS_TEST_DIR=$SRC_DIR/test/javascript
+COUCHJS=%rootdir%/src/couch/priv/couchjs
-COUCHJS=%abs_top_builddir%/src/couchdb/priv/couchjs
-COUCH_URI_FILE=%localstaterundir%/couch.uri
-
-# make check-js calls us with MAKE=$(MAKE) so BSDish `gmake` invocations
-# will get passed on correctly. If $0 gets run manually, default to
-# `make`
-if [ -z "$MAKE" ]; then
- MAKE=make
-fi
-
-trap 'abort' EXIT INT
-
-start() {
- ./utils/run -b -r 0 -n \
- -a $BUILD_DIR/etc/couchdb/default_dev.ini \
- -a $SRC_DIR/test/random_port.ini \
- -a $BUILD_DIR/etc/couchdb/local_dev.ini 1>/dev/null
-}
-
-stop() {
- ./utils/run -d 1>/dev/null
-}
-
-restart() {
- stop
- start
-}
-
-abort() {
- trap - 0
- stop
- exit 2
-}
-
-process_response() {
- while read data
- do
- if [ $data = 'restart' ];
- then
- if [ -z $COUCHDB_NO_START ]; then
- restart
- fi
- else
- echo "$data"
- fi
- done
-}
run() {
# start the tests
/bin/echo -n "$1 ... "
- $COUCHJS -H -u $COUCH_URI_FILE \
+ $COUCHJS -H \
$SCRIPT_DIR/json2.js \
$SCRIPT_DIR/sha1.js \
$SCRIPT_DIR/oauth.js \
$SCRIPT_DIR/couch.js \
- $SCRIPT_DIR/replicator_db_inc.js \
$SCRIPT_DIR/couch_test_runner.js \
$JS_TEST_DIR/couch_http.js \
$JS_TEST_DIR/test_setup.js \
$1 \
- $JS_TEST_DIR/cli_runner.js | process_response
+ $JS_TEST_DIR/cli_runner.js
if [ -z $RESULT ]; then
RESULT=$?
@@ -100,12 +53,6 @@ run_files() {
done
}
-# start CouchDB
-if [ -z $COUCHDB_NO_START ]; then
- $MAKE dev
- start
-fi
-
echo "Running javascript tests ..."
if [ "$#" -eq 0 ];
@@ -130,9 +77,4 @@ else
run $TEST_SRC
fi
-if [ -z $COUCHDB_NO_START ]; then
- stop
-fi
-
-trap - 0
exit $RESULT
[2/5] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to e6724ff
Posted by da...@apache.org.
Import JavaScript test runner changes
This is the basis for some temporary work to be able to run the
JavaScript test suite as during the merge transition.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/d64ef63c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/d64ef63c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/d64ef63c
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: d64ef63c89ce8903e69d247365032022e36ee8ca
Parents: cd5055d
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 21:47:09 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 4 22:07:09 2014 -0600
----------------------------------------------------------------------
test/javascript/cli_runner.js | 85 +++++++-----------------
test/javascript/run.tpl | 133 ++++++++++++++++++++++++++-----------
test/javascript/test_setup.js | 89 +++++++++++++++++++++++++
3 files changed, 205 insertions(+), 102 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/d64ef63c/test/javascript/cli_runner.js
----------------------------------------------------------------------
diff --git a/test/javascript/cli_runner.js b/test/javascript/cli_runner.js
index 5d82a51..e8ebd2e 100644
--- a/test/javascript/cli_runner.js
+++ b/test/javascript/cli_runner.js
@@ -9,78 +9,39 @@
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
+//
-var console = {
- log: function(arg) {
- var msg = (arg.toString()).replace(/\n/g, "\n ");
- print(msg, true);
- }
-};
+/*
+ * Futon test suite was designed to be able to run all tests populated into
+ * couchTests. Here we should only be loading one test, so we'll pop the first
+ * test off the list and run the test. If more than one item is loaded in the
+ * test object, return an error.
+ */
+function runTest() {
+ var count = 0;
+ var start = new Date().getTime();
-var fmtStack = function(stack) {
- if(!stack) {
- console.log("No stack information");
- return;
- }
- console.log("Trace back (most recent call first):\n");
- var re = new RegExp("(.*?)@([^:]*):(.*)$");
- var lines = stack.split("\n");
- for(var i = 0; i < lines.length; i++) {
- var line = lines[i];
- if(!line.length) continue;
- var match = re.exec(line);
- if(!match) continue
- var source = match[1].substr(0, 70);
- var file = match[2];
- var lnum = match[3];
- while(lnum.length < 3) lnum = " " + lnum;
- console.log(" " + lnum + ": " + file);
- console.log(" " + source);
+ for(var name in couchTests) {
+ count++;
}
-}
-
-function T(arg1, arg2) {
- if(!arg1) {
- var result = (arg2 ? arg2 : arg1);
- throw((result instanceof Error ? result : Error(result)));
+ if (count !== 1) {
+ console.log('Only one test per file is allowed.');
+ quit(1);
}
-}
-function runTestConsole(num, name, func) {
- CouchDB.reloadConfig();
- var passed = false;
try {
- func();
- passed = true;
- print("ok " + num + " " + name);
+ // Add artificial wait for each test of 1 sec
+ while (new Date().getTime() < start + 1200);
+ couchTests[name]();
+ print('OK');
} catch(e) {
- print("not ok " + num + " " + name);
- console.log("Reason: " + e.message);
+ console.log("FAIL\nReason: " + e.message);
fmtStack(e.stack);
+ quit(1);
}
- return passed;
}
-function runAllTestsConsole() {
- var numTests = 0;
- var numPassed = 0;
- for(var t in couchTests) { numTests += 1; }
- print("1.." + numTests);
- var testId = 0;
- for(var t in couchTests) {
- testId += 1;
- if(runTestConsole(testId, t, couchTests[t])) {
- numPassed++;
- }
- }
- if(numPassed != numTests) {
- console.log("Test failures: " + (numTests - numPassed));
- quit(1);
- } else {
- console.log("All tests passed");
- }
-};
+waitForSuccess(CouchDB.isRunning, 'isRunning');
-waitForSuccess(CouchDB.getVersion);
-runAllTestsConsole();
+runTest();
http://git-wip-us.apache.org/repos/asf/couchdb/blob/d64ef63c/test/javascript/run.tpl
----------------------------------------------------------------------
diff --git a/test/javascript/run.tpl b/test/javascript/run.tpl
index 141e9e8..75192da 100644
--- a/test/javascript/run.tpl
+++ b/test/javascript/run.tpl
@@ -17,7 +17,7 @@ BUILD_DIR=%abs_top_builddir%
SCRIPT_DIR=$SRC_DIR/share/www/script
JS_TEST_DIR=$SRC_DIR/test/javascript
-COUCHJS=%abs_top_builddir%/src/couch/priv/couchjs
+COUCHJS=%abs_top_builddir%/src/couchdb/priv/couchjs
COUCH_URI_FILE=%localstaterundir%/couch.uri
# make check-js calls us with MAKE=$(MAKE) so BSDish `gmake` invocations
@@ -27,59 +27,112 @@ if [ -z "$MAKE" ]; then
MAKE=make
fi
-if [ "$#" -eq 0 ];
-then
- TEST_SRC="$SCRIPT_DIR/test/*.js"
-else
- TEST_SRC="$1"
- if [ ! -f $TEST_SRC ]; then
- TEST_SRC="$SCRIPT_DIR/test/$1"
- if [ ! -f $TEST_SRC ]; then
- TEST_SRC="$SCRIPT_DIR/test/$1.js"
- if [ ! -f $TEST_SRC ]; then
- echo "file $1 does not exist"
- exit 1
- fi
- fi
- fi
-fi
+trap 'abort' EXIT INT
+
+start() {
+ ./utils/run -b -r 0 -n \
+ -a $BUILD_DIR/etc/couchdb/default_dev.ini \
+ -a $SRC_DIR/test/random_port.ini \
+ -a $BUILD_DIR/etc/couchdb/local_dev.ini 1>/dev/null
+}
+
+stop() {
+ ./utils/run -d 1>/dev/null
+}
+
+restart() {
+ stop
+ start
+}
-# stop CouchDB on exit from various signals
abort() {
trap - 0
- ./utils/run -d
+ stop
exit 2
}
+process_response() {
+ while read data
+ do
+ if [ $data = 'restart' ];
+ then
+ if [ -z $COUCHDB_NO_START ]; then
+ restart
+ fi
+ else
+ echo "$data"
+ fi
+ done
+}
+
+run() {
+ # start the tests
+ /bin/echo -n "$1 ... "
+ $COUCHJS -H -u $COUCH_URI_FILE \
+ $SCRIPT_DIR/json2.js \
+ $SCRIPT_DIR/sha1.js \
+ $SCRIPT_DIR/oauth.js \
+ $SCRIPT_DIR/couch.js \
+ $SCRIPT_DIR/replicator_db_inc.js \
+ $SCRIPT_DIR/couch_test_runner.js \
+ $JS_TEST_DIR/couch_http.js \
+ $JS_TEST_DIR/test_setup.js \
+ $1 \
+ $JS_TEST_DIR/cli_runner.js | process_response
+
+ if [ -z $RESULT ]; then
+ RESULT=$?
+ elif [ "$?" -eq 1 ]; then
+ RESULT=$?
+ fi
+
+}
+
+run_files() {
+ COUNTER=1
+ FILE_COUNT=$(ls -l $1 | wc -l)
+ FILE_COUNT=$(expr $FILE_COUNT + 0)
+ for TEST_SRC in $1
+ do
+ /bin/echo -n "$COUNTER/$FILE_COUNT "
+ COUNTER=$(expr $COUNTER + 1)
+ run $TEST_SRC
+ done
+}
+
# start CouchDB
if [ -z $COUCHDB_NO_START ]; then
$MAKE dev
- trap 'abort' EXIT INT
- ./utils/run -b -r 1 -n \
- -a $BUILD_DIR/etc/couchdb/default_dev.ini \
- -a $SRC_DIR/test/random_port.ini \
- -a $BUILD_DIR/etc/couchdb/local_dev.ini
- sleep 1 # give it a sec
+ start
fi
-# start the tests
-$COUCHJS -H -u $COUCH_URI_FILE \
- $SCRIPT_DIR/json2.js \
- $SCRIPT_DIR/sha1.js \
- $SCRIPT_DIR/oauth.js \
- $SCRIPT_DIR/couch.js \
- $SCRIPT_DIR/couch_test_runner.js \
- $SCRIPT_DIR/couch_tests.js \
- $TEST_SRC \
- $JS_TEST_DIR/couch_http.js \
- $JS_TEST_DIR/cli_runner.js
+echo "Running javascript tests ..."
-RESULT=$?
+if [ "$#" -eq 0 ];
+then
+ run_files "$SCRIPT_DIR/test/*.js"
+else
+ if [ -d $1 ]; then
+ run_files "$1/*.js"
+ else
+ TEST_SRC="$1"
+ if [ ! -f $TEST_SRC ]; then
+ TEST_SRC="$SCRIPT_DIR/test/$1"
+ if [ ! -f $TEST_SRC ]; then
+ TEST_SRC="$SCRIPT_DIR/test/$1.js"
+ if [ ! -f $TEST_SRC ]; then
+ echo "file $1 does not exist"
+ exit 1
+ fi
+ fi
+ fi
+ fi
+ run $TEST_SRC
+fi
if [ -z $COUCHDB_NO_START ]; then
- # stop CouchDB
- ./utils/run -d
- trap - 0
+ stop
fi
+trap - 0
exit $RESULT
http://git-wip-us.apache.org/repos/asf/couchdb/blob/d64ef63c/test/javascript/test_setup.js
----------------------------------------------------------------------
diff --git a/test/javascript/test_setup.js b/test/javascript/test_setup.js
new file mode 100644
index 0000000..9347455
--- /dev/null
+++ b/test/javascript/test_setup.js
@@ -0,0 +1,89 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+/*
+ * Add global couchTests object required for existing tests.
+ */
+var couchTests = {};
+
+var console = {
+ log: function(arg) {
+ var msg = (arg.toString()).replace(/\n/g, "\n ");
+ print(msg, true);
+ }
+};
+
+var fmtStack = function(stack) {
+ if(!stack) {
+ console.log("No stack information");
+ return;
+ }
+ console.log("Trace back (most recent call first):\n");
+ var re = new RegExp("(.*?)@([^:]*):(.*)$");
+ var lines = stack.split("\n");
+ for(var i = 0; i < lines.length; i++) {
+ var line = lines[i];
+ if(!line.length) continue;
+ var match = re.exec(line);
+ if(!match) continue
+ var match = re.exec(line);
+ if(!match) continue
+ var source = match[1].substr(0, 70);
+ var file = match[2];
+ var lnum = match[3];
+ while(lnum.length < 3) lnum = " " + lnum;
+ console.log(" " + lnum + ": " + file);
+ console.log(" " + source);
+ }
+}
+
+function T(arg1, arg2) {
+ if(!arg1) {
+ var result = (arg2 ? arg2 : arg1);
+ throw((result instanceof Error ? result : Error(result)));
+ }
+}
+
+function waitForSuccess(fun, tag) {
+ var start = new Date().getTime();
+ var complete = false;
+
+ while (!complete) {
+ var now = new Date().getTime();
+ if (now > start + 5000) {
+ complete = true;
+ print('FAIL');
+ print(tag);
+ quit(1);
+ }
+ try {
+ while (new Date().getTime() < now + 500);
+ complete = fun();
+ } catch (e) {}
+ }
+}
+
+function restartServer() {
+ print('restart');
+ var start = new Date().getTime();
+ while (new Date().getTime() < start + 1000);
+ waitForSuccess(CouchDB.isRunning, 'restart');
+}
+
+/*
+ * If last_req is an object, we got something back. This might be an error, but
+ * CouchDB is up and running!
+ */
+CouchDB.isRunning = function() {
+ CouchDB.last_req = CouchDB.request("GET", "/");
+ return typeof CouchDB.last_req == 'object';
+};
[5/5] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to e6724ff
Posted by da...@apache.org.
Don't stop running tests on the first failure
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/e6724ffa
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/e6724ffa
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/e6724ffa
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: e6724ffae471e104b7bff6cefd5341a25f429c89
Parents: fa70563
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 22:19:41 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 4 22:19:41 2014 -0600
----------------------------------------------------------------------
test/javascript/cli_runner.js | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/e6724ffa/test/javascript/cli_runner.js
----------------------------------------------------------------------
diff --git a/test/javascript/cli_runner.js b/test/javascript/cli_runner.js
index e8ebd2e..da2eed0 100644
--- a/test/javascript/cli_runner.js
+++ b/test/javascript/cli_runner.js
@@ -38,7 +38,6 @@ function runTest() {
} catch(e) {
console.log("FAIL\nReason: " + e.message);
fmtStack(e.stack);
- quit(1);
}
}
[3/5] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to e6724ff
Posted by da...@apache.org.
Improved configure scripts
This provides a better help output and argument parsing for the
'./configure' script. It implements a method for pulling config values
into rebar.config.script's so that we can control the build a bit more.
As an example there's now a '-c' option to build couchjs with cURL
bindings.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/cd5055d4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/cd5055d4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/cd5055d4
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: cd5055d462816d2071da8bb51a57abae712690c6
Parents: 9de0e8c
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 21:44:44 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 4 22:07:09 2014 -0600
----------------------------------------------------------------------
.gitignore | 1 +
Makefile | 8 +++-
configure | 117 +++++++++++++++++++++++++++++++----------------
rebar.config.script | 7 ++-
4 files changed, 91 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/cd5055d4/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 7b37cea..902035d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+config.erl
install.mk
rel/*.config
rel/dev*
http://git-wip-us.apache.org/repos/asf/couchdb/blob/cd5055d4/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 8651369..812849d 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,13 @@
all: compile
-compile:
+config.erl:
+ @echo "Apache CouchDB has not been configured."
+ @echo "Try \"./configure -h\" for help."
+ @echo
+ @false
+
+compile: config.erl
@echo "==> couchjs (compile)"
@rebar compile
http://git-wip-us.apache.org/repos/asf/couchdb/blob/cd5055d4/configure
----------------------------------------------------------------------
diff --git a/configure b/configure
index c95a988..7036d7c 100755
--- a/configure
+++ b/configure
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
@@ -13,42 +13,73 @@
PREFIX="/opt/couchdb"
COUCHDB_USER=`whoami`
-ABSPATH="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
-if test ! -n "$DIRPATH"; then DIRPATH=`dirname "$ABSPATH"`; fi
-
-while [ $# -gt 0 ]
-do
- case $1
- in
- -p)
- PREFIX=$2
- shift 2
- ;;
- -t)
- TEMPLATE=$2
- shift 2
- ;;
- -d)
- DATA=$2
- shift 2
- ;;
- -v)
- VIEW=$2
- shift 2
- ;;
- -u)
- COUCHDB_USER=$2
- shift 2
- ;;
- *)
- echo "usage: $0 [-p {prefix} -t {template} -d {data_dir} -v {view_dir} -u {user}]"
- exit
- ;;
- esac
-done
+WITH_CURL="false"
+
+rootdir="$(cd "${0%/*}" 2>/dev/null; echo "$PWD")"
+basename=`basename $0`
+
+
+display_help () {
+ cat << EOF
+Usage: $basename [OPTION]
+
+The $basename command is responsible for generating the build
+system for Apache CouchDB.
+
+Options:
+
+ -h display a short help message and exit
+ -u USER set the username to run as (defaults to $COUCHDB_USER)
+ -p DIRECTORY set the prefix for installation (defaults to $PREFIX)
+ -d DIRECTORY specify the data directory (defaults to $PREFIX/var/lib)
+ -v DIRECTORY specify the view directory (defaults to $PREFIX/var/lib)
+ -c request that couchjs is linked to cURL (default false)
+
+EOF
+}
+
+
+display_error () {
+ if test -n "$1"; then
+ echo $1 >&2
+ fi
+ echo >&2
+ echo "Try \"$basename -h\" for more information." >&2
+ false
+}
+
+
+parse_opts () {
+ set +e
+ options=`getopt hu:p:d:v:c $@`
+ if test ! $? -eq 0; then
+ display_error
+ fi
+ set -e
+ eval set -- $options
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ -h) shift; display_help; exit;;
+ -u) shift; COUCHDB_USER=$1; shift;;
+ -p) shift; PREFIX=$1; shift;;
+ -d) shift; DATA=$1; shift;;
+ -v) shift; VIEW=$1; shift;;
+ -c) shift; WITH_CURL="true";;
+ --) shift; break;;
+ *) display_error "Unknown option: $1" >&2;;
+ esac
+ done
+ if test ! -n "$DATA"; then
+ DATA="$PREFIX/var/lib";
+ fi
+ if test ! -n "$VIEW"; then
+ VIEW="$PREFIX/var/lib";
+ fi
+}
+
+
+parse_opts $@
-if test ! -n "$DATA"; then DATA="$PREFIX/var/lib"; fi
-if test ! -n "$VIEW"; then VIEW="$PREFIX/var/lib"; fi
echo "==> configuring couchdb in rel/couchdb.config"
cat > rel/couchdb.config << EOF
@@ -69,16 +100,22 @@ view_dir = $VIEW
user = $COUCHDB_USER
EOF
+cat > $rootdir/config.erl << EOF
+{with_curl, $WITH_CURL}.
+EOF
+
# finally, a few config files for local development nodes
for i in 1 2 3; do
cat > rel/dev$i.config << EOF
-{prefix, "$DIRPATH/rel/dev$i"}.
-{data_dir, "$DIRPATH/rel/tmpdata/dev$i"}.
-{view_dir, "$DIRPATH/rel/tmpdata/dev$i"}.
+{prefix, "$rootdir/rel/dev$i"}.
+{data_dir, "$rootdir/rel/tmpdata/dev$i"}.
+{view_dir, "$rootdir/rel/tmpdata/dev$i"}.
{node_name, "-name dev$i@127.0.0.1"}.
{cluster_port, `expr 10000 \* $i + 5984`}.
{backend_port, `expr 10000 \* $i + 5986`}.
EOF
done
-rebar get-deps && rebar update-deps && cat rel/couchdb.config
+
+echo "==> updating dependencies"
+rebar get-deps update-deps
http://git-wip-us.apache.org/repos/asf/couchdb/blob/cd5055d4/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index d2ac1b0..cb8e706 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -10,7 +10,11 @@
% License for the specific language governing permissions and limitations under
% the License.
-{require_otp_vsn, "R14B01|R14B03|R14B04|R15B02|R15B03|R16"}.
+% Set the path to the configuration environment generated
+% by `./configure`.
+ConfigureEnv = filename:join(filename:dirname(SCRIPT), "config.erl"),
+os:putenv("COUCHDB_CONFIG", ConfigureEnv).
+
DepDescs = [
{chttpd, "couchdb-chttpd", {branch, import}},
@@ -38,6 +42,7 @@ MakeDep = fun({AppName, RepoName, Version}) ->
end,
AddConfig = [
+ {require_otp_vsn, "R14B01|R14B03|R14B04|R15B02|R15B03|R16"},
{deps_dir, "src"},
{deps, lists:map(MakeDep, DepDescs)},
{sub_dirs, ["rel"]},