diff options
author | Robert Newson <robert.newson@cloudant.com> | 2011-10-10 17:55:50 +0100 |
---|---|---|
committer | Robert Newson <robert.newson@cloudant.com> | 2011-10-10 19:04:54 +0100 |
commit | cf630a2e87ac1b6eace26601dc5b7ffdb39273b2 (patch) | |
tree | fe5080dedf417b20112ed372d737eb8c3ca309ff | |
parent | 6e6523d62beff627c444aec3d658ef1a5d534ff1 (diff) | |
parent | da22c19f7a7fdfae015dfb0db93b5bd9453eae6c (diff) |
Merge remote-tracking branch 'apache/1.1.x'
-rw-r--r-- | apps/couch/CHANGES | 21 | ||||
-rw-r--r-- | apps/couch/NEWS | 21 | ||||
-rw-r--r-- | apps/couch/test/javascript/run.tpl | 2 | ||||
-rw-r--r-- | couchjs/c_src/SConscript | 8 | ||||
-rw-r--r-- | couchjs/c_src/help.h | 82 | ||||
-rw-r--r-- | couchjs/c_src/util.c | 25 | ||||
-rw-r--r-- | couchjs/c_src/util.h | 1 | ||||
-rw-r--r-- | couchjs/js/util.js | 5 |
8 files changed, 153 insertions, 12 deletions
diff --git a/apps/couch/CHANGES b/apps/couch/CHANGES index 64b4f3c1..0c619ab9 100644 --- a/apps/couch/CHANGES +++ b/apps/couch/CHANGES @@ -6,8 +6,29 @@ Version 1.1.1 This version has not been released yet. +* Add configurable maximum to the number of bytes returned by _log. +* Allow CommonJS modules to be an empty string. +* Bump minimum Erlang version to R13B02. +* Do not run deleted validate_doc_update functions. * ETags for views include current sequence if include_docs=true. +* Fix bug where duplicates can appear in _changes feed. +* Fix bug where update handlers break after conflict resolution. +* Fix bug with _replicator where include "filter" could crash couch. +* Fix crashes when compacting large views. +* Fix file descriptor leak in _log +* Fix missing revisions in _changes?style=all_docs. +* Improve handling of compaction at max_dbs_open limit. * JSONP responses now send "text/javascript" for Content-Type. +* Link to ICU 4.2 on Windows. +* Permit forward slashes in path to update functions. +* Reap couchjs processes that hit reduce_overflow error. +* Status code can be specified in update handlers. +* Support provides() in show functions. +* _view_cleanup when ddoc has no views now removes all index files. +* max_replication_retry_count now supports "infinity". +* Fix replication crash when source database has a document with empty ID. +* Fix deadlock when assigning couchjs processes to serve requests. +* Fixes to the document multipart PUT API. Version 1.1.0 ------------- diff --git a/apps/couch/NEWS b/apps/couch/NEWS index d7dc7cf1..13e6ac56 100644 --- a/apps/couch/NEWS +++ b/apps/couch/NEWS @@ -12,8 +12,29 @@ Version 1.1.1 This version has not been released yet. +* Add configurable maximum to the number of bytes returned by _log. +* Allow CommonJS modules to be an empty string. +* Bump minimum Erlang version to R13B02. +* Do not run deleted validate_doc_update functions. * ETags for views include current sequence if include_docs=true. +* Fix bug where duplicates can appear in _changes feed. +* Fix bug where update handlers break after conflict resolution. +* Fix bug with _replicator where include "filter" could crash couch. +* Fix crashes when compacting large views. +* Fix file descriptor leak in _log +* Fix missing revisions in _changes?style=all_docs. +* Improve handling of compaction at max_dbs_open limit. * JSONP responses now send "text/javascript" for Content-Type. +* Link to ICU 4.2 on Windows. +* Permit forward slashes in path to update functions. +* Reap couchjs processes that hit reduce_overflow error. +* Status code can be specified in update handlers. +* Support provides() in show functions. +* _view_cleanup when ddoc has no views now removes all index files. +* max_replication_retry_count now supports "infinity". +* Fix replication crash when source database has a document with empty ID. +* Fix deadlock when assigning couchjs processes to serve requests. +* Fixes to the document multipart PUT API. Version 1.1.0 ------------- diff --git a/apps/couch/test/javascript/run.tpl b/apps/couch/test/javascript/run.tpl index 1389a4f9..5f971581 100644 --- a/apps/couch/test/javascript/run.tpl +++ b/apps/couch/test/javascript/run.tpl @@ -27,4 +27,4 @@ cat $SCRIPT_DIR/json2.js \ $SCRIPT_DIR/test/*.js \ $JS_TEST_DIR/couch_http.js \ $JS_TEST_DIR/cli_runner.js \ - | $COUCHJS --http - + | $COUCHJS -H - diff --git a/couchjs/c_src/SConscript b/couchjs/c_src/SConscript index b014e2ec..a3e0cc07 100644 --- a/couchjs/c_src/SConscript +++ b/couchjs/c_src/SConscript @@ -13,6 +13,7 @@ # the License. import os import commands +import subprocess def require_lib(name): if not conf.CheckLib(name): @@ -86,6 +87,13 @@ if not env.GetOption('clean'): conf.Define(vsn) break + ## Define properties for -h / -V + + vsn = subprocess.check_output(["git","describe","--match","1.*"]) + conf.Define("PACKAGE_STRING", '"%s"' % vsn.rstrip()) + conf.Define("PACKAGE_NAME", '"Cloudant BigCouch"') + conf.Define("PACKAGE_BUGREPORT", '"https://github.com/cloudant/bigcouch/issues"') + env = conf.Finish() env.Program('couchjs', ['main.c', 'http.c', 'utf8.c', 'util.c']) diff --git a/couchjs/c_src/help.h b/couchjs/c_src/help.h new file mode 100644 index 00000000..84c83c06 --- /dev/null +++ b/couchjs/c_src/help.h @@ -0,0 +1,82 @@ +// 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. + +#ifndef COUCHJS_HELP_H +#define COUCHJS_HELP_H + +#include <libgen.h> + +#include "config.h" + +static const char VERSION_TEMPLATE[] = + "%s - %s\n" + "\n" + "Licensed under the Apache License, Version 2.0 (the \"License\"); you may " + "not use\n" + "this file except in compliance with the License. You may obtain a copy of" + "the\n" + "License at\n" + "\n" + " http://www.apache.org/licenses/LICENSE-2.0\n" + "\n" + "Unless required by applicable law or agreed to in writing, software " + "distributed\n" + "under the License is distributed on an \"AS IS\" BASIS, WITHOUT " + "WARRANTIES OR\n" + "CONDITIONS OF ANY KIND, either express or implied. See the License " + "for the\n" + "specific language governing permissions and limitations under the " + "License.\n"; + +static const char USAGE_TEMPLATE[] = + "Usage: %s [FILE]\n" + "\n" + "The %s command runs the %s JavaScript interpreter.\n" + "\n" + "The exit status is 0 for success or 1 for failure.\n" + "\n" + "Options:\n" + "\n" + " -h display a short help message and exit\n" + " -V display version information and exit\n" + " -H enable %s cURL bindings (only avaiable\n" + " if package was built with cURL available)\n" + " -S SIZE specify that the interpreter should set the\n" + " the stack quota for JS contexts to SIZE bytes\n" + "\n" + "Report bugs at <%s>.\n"; + +#define BASENAME basename((char*)argv[0]) + +#define couch_version(basename) \ + fprintf( \ + stdout, \ + VERSION_TEMPLATE, \ + basename, \ + PACKAGE_STRING) + +#define DISPLAY_VERSION couch_version(BASENAME) + + +#define couch_usage(basename) \ + fprintf( \ + stdout, \ + USAGE_TEMPLATE, \ + basename, \ + basename, \ + PACKAGE_NAME, \ + basename, \ + PACKAGE_BUGREPORT) + +#define DISPLAY_USAGE couch_usage(BASENAME) + +#endif // Included help.h diff --git a/couchjs/c_src/util.c b/couchjs/c_src/util.c index f5ef3e82..bd7be4c9 100644 --- a/couchjs/c_src/util.c +++ b/couchjs/c_src/util.c @@ -13,6 +13,7 @@ #include <stdlib.h> #include <string.h> +#include "help.h" #include "util.h" #include "utf8.h" @@ -77,15 +78,30 @@ couch_parse_args(int argc, const char* argv[]) args->stack_size = 8L * 1024L; while(i < argc) { - if(strcmp("--http", argv[i]) == 0) { + if(strcmp("-h", argv[i]) == 0) { + DISPLAY_USAGE; + exit(0); + } else if(strcmp("-V", argv[i]) == 0) { + DISPLAY_VERSION; + exit(0); + } else if(strcmp("-H", argv[i]) == 0) { args->use_http = 1; - } else if(strcmp("--stack-size", argv[i]) == 0) { - args->stack_size = atoi(argv[i+1]); + } else if(strcmp("-S", argv[i]) == 0) { + args->stack_size = atoi(argv[++i]); if(args->stack_size <= 0) { fprintf(stderr, "Invalid stack size.\n"); exit(2); } + } else if(strcmp("--", argv[i]) == 0) { + i++; + break; } else { + break; + } + i++; + } + + while(i < argc) { args->script = slurp_file(args->script, argv[i]); if(args->script_name == NULL) { if(strcmp(argv[i], "-") == 0) { @@ -96,12 +112,11 @@ couch_parse_args(int argc, const char* argv[]) } else { args->script_name = "<multiple_files>"; } - } i++; } if(args->script_name == NULL || args->script == NULL) { - fprintf(stderr, "No script provided.\n"); + DISPLAY_USAGE; exit(3); } diff --git a/couchjs/c_src/util.h b/couchjs/c_src/util.h index 54ccdaa5..b082aa60 100644 --- a/couchjs/c_src/util.h +++ b/couchjs/c_src/util.h @@ -22,7 +22,6 @@ typedef struct { char* script; } couch_args; -void couch_usage(); couch_args* couch_parse_args(int argc, const char* argv[]); int couch_fgets(char* buf, int size, FILE* fp); JSString* couch_readline(JSContext* cx, FILE* fp); diff --git a/couchjs/js/util.js b/couchjs/js/util.js index d498ee64..a7449315 100644 --- a/couchjs/js/util.js +++ b/couchjs/js/util.js @@ -63,11 +63,6 @@ var Couch = { }, compileFunction : function(source, ddoc) { if (!source) throw(["error","not_found","missing function"]); - // Some newer SpiderMonkey's appear to not like evaluating - // an anonymous function at global scope. Simple fix just - // wraps the source with parens so the function object is - // returned correctly. - source = "(" + source + ")"; try { if (sandbox) { if (ddoc) { |