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 15:35:01 UTC
[1/6] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to 3069c01
Updated Branches:
refs/heads/1843-feature-bigcouch-multi-repo e6724ffae -> 3069c0134 (forced update)
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/0bb58f51
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0bb58f51
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0bb58f51
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: 0bb58f51e68cb58d215d53088a0839f595512b7a
Parents: 03ea534
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 22:06:00 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 5 08:34:52 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/0bb58f51/.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/0bb58f51/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/0bb58f51/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/6] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to 3069c01
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/03ea534c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/03ea534c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/03ea534c
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: 03ea534c0366164055560cc93d8fc32ceb27bf1f
Parents: a204d0a
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 21:47:09 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 5 08:34:52 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/03ea534c/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/03ea534c/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/03ea534c/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';
+};
[6/6] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to 3069c01
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/3069c013
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/3069c013
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/3069c013
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: 3069c0134ef8e8eb416035d1ca2b7018f82e7b88
Parents: 0bb58f5
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 22:19:41 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 5 08:34:53 2014 -0600
----------------------------------------------------------------------
test/javascript/cli_runner.js | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/3069c013/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/6] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to 3069c01
Posted by da...@apache.org.
Move to multiple repositories
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/52689b75
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/52689b75
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/52689b75
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: 52689b75d7a13dd1df4dee48098856cc54857e93
Parents: 26dbcc1
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Feb 3 16:16:43 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 5 08:34:52 2014 -0600
----------------------------------------------------------------------
.gitignore | 1 +
configure | 2 ++
rebar.config | 42 ------------------------------------------
rebar.config.script | 47 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 50 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/52689b75/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index a43a06b..7b37cea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ install.mk
rel/*.config
rel/dev*
rel/tmpdata
+src/
*.o
*.so
http://git-wip-us.apache.org/repos/asf/couchdb/blob/52689b75/configure
----------------------------------------------------------------------
diff --git a/configure b/configure
index 4e59ca6..c95a988 100755
--- a/configure
+++ b/configure
@@ -80,3 +80,5 @@ cat > rel/dev$i.config << EOF
{backend_port, `expr 10000 \* $i + 5986`}.
EOF
done
+
+rebar get-deps && rebar update-deps && cat rel/couchdb.config
http://git-wip-us.apache.org/repos/asf/couchdb/blob/52689b75/rebar.config
----------------------------------------------------------------------
diff --git a/rebar.config b/rebar.config
deleted file mode 100644
index 1372f26..0000000
--- a/rebar.config
+++ /dev/null
@@ -1,42 +0,0 @@
-% 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.
-
-{require_otp_vsn, "R14B01|R14B03|R14B04|R15B02|R15B03|R16"}.
-
-{sub_dirs, [
- "src/ibrowse",
- "src/config",
- "src/couch",
- "src/couch_index",
- "src/couch_mrview",
- "src/mem3",
-
- "src/chttpd",
- "src/couch_replicator",
- "src/ddoc_cache",
- "src/ejson",
- "src/ets_lru",
- "src/fabric",
- "src/mochiweb",
- "src/oauth",
- "src/rexi",
- "src/snappy",
- "src/twig",
-
- "rel"
-]}.
-
-{lib_dirs, ["src/"]}.
-
-{erl_opts, [debug_info]}.
-
-{post_hooks, [{compile, "escript support/build_js.escript"}]}.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/52689b75/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
new file mode 100644
index 0000000..0efa6fa
--- /dev/null
+++ b/rebar.config.script
@@ -0,0 +1,47 @@
+% 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.
+
+{require_otp_vsn, "R14B01|R14B03|R14B04|R15B02|R15B03|R16"}.
+
+DepDescs = [
+ {chttpd, "couchdb-chttpd", {branch, import}},
+ {config, "couchdb-config", {branch, import}},
+ {couch, "couchdb-couch", {branch, import}},
+ {couch_index, "couchdb-couch-index", {branch, import}},
+ {couch_mrview, "couchdb-couch-mrview", {branch, import}},
+ {couch_replicator, "couchdb-couch-replicator", {branch, import}},
+ {ddoc_cache, "couchdb-ddoc-cache", {branch, import}},
+ {ets_lru, "couchdb-ets-lru", {branch, import}},
+ {fabric, "couchdb-fabric", {branch, import}},
+ {ibrowse, "couchdb-ibrowse", {branch, import}},
+ {jiffy, "couchdb-jiffy", {branch, import}},
+ {mem3, "couchdb-mem3", {branch, import}},
+ {mochiweb, "couchdb-mochiweb", {branch, import}},
+ {oauth, "couchdb-oauth", {branch, import}},
+ {rexi, "couchdb-rexi", {branch, import}},
+ {snappy, "couchdb-snappy", {branch, import}},
+ {twig, "couchdb-twig", {branch, import}}
+],
+
+MakeDep = fun({AppName, RepoName, Version}) ->
+ Url = "https://git-wip-us.apache.org/repos/asf/" ++ RepoName ++ ".git",
+ {AppName, ".*", {git, Url, Version}}
+end,
+
+[
+ {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"}]}
+].
[5/6] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to 3069c01
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/a204d0a8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a204d0a8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a204d0a8
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: a204d0a891281b0c2b9b9382312dc78b7f9f7a66
Parents: 0052a9b
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 21:44:44 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 5 08:34:52 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/a204d0a8/.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/a204d0a8/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/a204d0a8/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/a204d0a8/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index b541d02..e572495 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"]},
[4/6] couchdb commit: updated
refs/heads/1843-feature-bigcouch-multi-repo to 3069c01
Posted by da...@apache.org.
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/0052a9b2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0052a9b2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0052a9b2
Branch: refs/heads/1843-feature-bigcouch-multi-repo
Commit: 0052a9b26806d155c56ba539c118fb6cffd61b03
Parents: 52689b7
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 4 21:02:36 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 5 08:34:52 2014 -0600
----------------------------------------------------------------------
rebar.config.script | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/0052a9b2/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index 0efa6fa..b541d02 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).