You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/11/27 09:19:51 UTC

svn commit: r1545958 [15/15] - in /subversion/branches/log-addressing: ./ build/ build/ac-macros/ build/generator/ build/generator/templates/ build/win32/ contrib/server-side/ contrib/server-side/svncutter/ notes/ subversion/bindings/javahl/native/ sub...

Modified: subversion/branches/log-addressing/tools/client-side/svn-bench/svn-bench.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/client-side/svn-bench/svn-bench.c?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/client-side/svn-bench/svn-bench.c (original)
+++ subversion/branches/log-addressing/tools/client-side/svn-bench/svn-bench.c Wed Nov 27 08:19:45 2013
@@ -322,22 +322,13 @@ svn_cl__check_cancel(void *baton)
 
 /*** Main. ***/
 
-/* Report and clear the error ERR, and return EXIT_FAILURE. */
-#define EXIT_ERROR(err)                                                 \
-  svn_cmdline_handle_exit_error(err, NULL, "svn: ")
-
-/* A redefinition of the public SVN_INT_ERR macro, that suppresses the
- * error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR. */
-#undef SVN_INT_ERR
-#define SVN_INT_ERR(expr)                                        \
-  do {                                                           \
-    svn_error_t *svn_err__temp = (expr);                         \
-    if (svn_err__temp)                                           \
-      return EXIT_ERROR(svn_err__temp);                          \
-  } while (0)
-
-static int
-sub_main(int argc, const char *argv[], apr_pool_t *pool)
+/*
+ * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
+ * either return an error to be displayed, or set *EXIT_CODE to non-zero and
+ * return SVN_NO_ERROR.
+ */
+static svn_error_t *
+sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
 {
   svn_error_t *err;
   int opt_id;
@@ -356,18 +347,18 @@ sub_main(int argc, const char *argv[], a
   received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
 
   /* Check library versions */
-  SVN_INT_ERR(check_lib_versions());
+  SVN_ERR(check_lib_versions());
 
 #if defined(WIN32) || defined(__CYGWIN__)
   /* Set the working copy administrative directory name. */
   if (getenv("SVN_ASP_DOT_NET_HACK"))
     {
-      SVN_INT_ERR(svn_wc_set_adm_dir("_svn", pool));
+      SVN_ERR(svn_wc_set_adm_dir("_svn", pool));
     }
 #endif
 
   /* Initialize the RA library. */
-  SVN_INT_ERR(svn_ra_initialize(pool));
+  SVN_ERR(svn_ra_initialize(pool));
 
   /* Begin processing arguments. */
   opt_state.start_revision.kind = svn_opt_revision_unspecified;
@@ -379,12 +370,13 @@ sub_main(int argc, const char *argv[], a
   /* No args?  Show usage. */
   if (argc <= 1)
     {
-      SVN_INT_ERR(svn_cl__help(NULL, NULL, pool));
-      return EXIT_FAILURE;
+      SVN_ERR(svn_cl__help(NULL, NULL, pool));
+      *exit_code = EXIT_FAILURE;
+      return SVN_NO_ERROR;
     }
 
   /* Else, parse options. */
-  SVN_INT_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
+  SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
 
   os->interleave = 1;
   while (1)
@@ -399,8 +391,9 @@ sub_main(int argc, const char *argv[], a
         break;
       else if (apr_err)
         {
-          SVN_INT_ERR(svn_cl__help(NULL, NULL, pool));
-          return EXIT_FAILURE;
+          SVN_ERR(svn_cl__help(NULL, NULL, pool));
+          *exit_code = EXIT_FAILURE;
+          return SVN_NO_ERROR;
         }
 
       /* Stash the option code in an array before parsing it. */
@@ -412,15 +405,13 @@ sub_main(int argc, const char *argv[], a
           err = svn_cstring_atoi(&opt_state.limit, opt_arg);
           if (err)
             {
-              err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, err,
-                                     _("Non-numeric limit argument given"));
-              return EXIT_ERROR(err);
+              return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, err,
+                                      _("Non-numeric limit argument given"));
             }
           if (opt_state.limit <= 0)
             {
-              err = svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
-                                    _("Argument to --limit must be positive"));
-              return EXIT_ERROR(err);
+              return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
+                                      _("Argument to --limit must be positive"));
             }
         }
         break;
@@ -454,12 +445,11 @@ sub_main(int argc, const char *argv[], a
                 {
                   if (changeno < 0 || is_negative)
                     {
-                      err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
-                                              NULL,
-                                              _("Negative number in range (%s)"
-                                                " not supported with -c"),
-                                              change_str);
-                      return EXIT_ERROR(err);
+                      return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
+                                               NULL,
+                                               _("Negative number in range (%s)"
+                                                 " not supported with -c"),
+                                               change_str);
                     }
                   s = end + 1;
                   while (*s == 'r')
@@ -468,17 +458,15 @@ sub_main(int argc, const char *argv[], a
                 }
               if (end == change_str || *end != '\0')
                 {
-                  err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                          _("Non-numeric change argument (%s) "
-                                            "given to -c"), change_str);
-                  return EXIT_ERROR(err);
+                  return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                           _("Non-numeric change argument (%s) "
+                                             "given to -c"), change_str);
                 }
 
               if (changeno == 0)
                 {
-                  err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                         _("There is no change 0"));
-                  return EXIT_ERROR(err);
+                  return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                          _("There is no change 0"));
                 }
 
               if (is_negative)
@@ -517,12 +505,11 @@ sub_main(int argc, const char *argv[], a
         if (svn_opt_parse_revision_to_range(opt_state.revision_ranges,
                                             opt_arg, pool) != 0)
           {
-            SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
-            err = svn_error_createf
+            SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+            return svn_error_createf
                 (SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
                  _("Syntax error in revision argument '%s'"),
                  utf8_opt_arg);
-            return EXIT_ERROR(err);
           }
         break;
       case 'v':
@@ -543,9 +530,9 @@ sub_main(int argc, const char *argv[], a
              the targets into an array, because otherwise we wouldn't
              know what delimiter to use for svn_cstring_split().  */
 
-          SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
-          SVN_INT_ERR(svn_stringbuf_from_file2(&buffer, utf8_opt_arg, pool));
-          SVN_INT_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
+          SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+          SVN_ERR(svn_stringbuf_from_file2(&buffer, utf8_opt_arg, pool));
+          SVN_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
           opt_state.targets = svn_cstring_split(buffer_utf8->data, "\n\r",
                                                 TRUE, pool);
         }
@@ -559,31 +546,29 @@ sub_main(int argc, const char *argv[], a
       case opt_depth:
         err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool);
         if (err)
-          return EXIT_ERROR
-            (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
-                               _("Error converting depth "
-                                 "from locale to UTF-8")));
+          return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
+                                   _("Error converting depth "
+                                     "from locale to UTF-8"));
         opt_state.depth = svn_depth_from_word(utf8_opt_arg);
         if (opt_state.depth == svn_depth_unknown
             || opt_state.depth == svn_depth_exclude)
           {
-            return EXIT_ERROR
-              (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                 _("'%s' is not a valid depth; try "
-                                   "'empty', 'files', 'immediates', "
-                                   "or 'infinity'"),
-                                 utf8_opt_arg));
+            return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                     _("'%s' is not a valid depth; try "
+                                       "'empty', 'files', 'immediates', "
+                                       "or 'infinity'"),
+                                     utf8_opt_arg);
           }
         break;
       case opt_version:
         opt_state.version = TRUE;
         break;
       case opt_auth_username:
-        SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_username,
+        SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_username,
                                             opt_arg, pool));
         break;
       case opt_auth_password:
-        SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
+        SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
                                             opt_arg, pool));
         break;
       case opt_stop_on_copy:
@@ -602,13 +587,13 @@ sub_main(int argc, const char *argv[], a
         opt_state.trust_server_cert = TRUE;
         break;
       case 'x':
-        SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.extensions,
+        SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.extensions,
                                             opt_arg, pool));
         break;
       case opt_config_dir:
         {
           const char *path_utf8;
-          SVN_INT_ERR(svn_utf_cstring_to_utf8(&path_utf8, opt_arg, pool));
+          SVN_ERR(svn_utf_cstring_to_utf8(&path_utf8, opt_arg, pool));
           opt_state.config_dir = svn_dirent_internal_style(path_utf8, pool);
         }
         break;
@@ -618,8 +603,8 @@ sub_main(int argc, const char *argv[], a
                    apr_array_make(pool, 1,
                                   sizeof(svn_cmdline__config_argument_t*));
 
-        SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_arg, opt_arg, pool));
-        SVN_INT_ERR(svn_cmdline__parse_config_option(opt_state.config_options,
+        SVN_ERR(svn_utf_cstring_to_utf8(&opt_arg, opt_arg, pool));
+        SVN_ERR(svn_cmdline__parse_config_option(opt_state.config_options,
                                                      opt_arg, pool));
         break;
       case opt_with_all_revprops:
@@ -631,7 +616,7 @@ sub_main(int argc, const char *argv[], a
         opt_state.no_revprops = TRUE;
         break;
       case opt_with_revprop:
-        SVN_INT_ERR(svn_opt_parse_revprop(&opt_state.revprop_table,
+        SVN_ERR(svn_opt_parse_revprop(&opt_state.revprop_table,
                                           opt_arg, pool));
         break;
       case 'g':
@@ -657,7 +642,7 @@ sub_main(int argc, const char *argv[], a
      hand, the alternative is effectively to demand that they call
      svn_config_ensure() instead, so maybe we should have a generic
      init function anyway.  Thoughts?  */
-  SVN_INT_ERR(svn_config_ensure(opt_state.config_dir, pool));
+  SVN_ERR(svn_config_ensure(opt_state.config_dir, pool));
 
   /* If the user asked for help, then the rest of the arguments are
      the names of subcommands to get help on (if any), or else they're
@@ -690,8 +675,9 @@ sub_main(int argc, const char *argv[], a
               svn_error_clear
                 (svn_cmdline_fprintf(stderr, pool,
                                      _("Subcommand argument required\n")));
-              SVN_INT_ERR(svn_cl__help(NULL, NULL, pool));
-              return EXIT_FAILURE;
+              SVN_ERR(svn_cl__help(NULL, NULL, pool));
+              *exit_code = EXIT_FAILURE;
+              return SVN_NO_ERROR;
             }
         }
       else
@@ -702,14 +688,15 @@ sub_main(int argc, const char *argv[], a
           if (subcommand == NULL)
             {
               const char *first_arg_utf8;
-              SVN_INT_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
+              SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
                                                   first_arg, pool));
               svn_error_clear
                 (svn_cmdline_fprintf(stderr, pool,
                                      _("Unknown subcommand: '%s'\n"),
                                      first_arg_utf8));
-              SVN_INT_ERR(svn_cl__help(NULL, NULL, pool));
-              return EXIT_FAILURE;
+              SVN_ERR(svn_cl__help(NULL, NULL, pool));
+              *exit_code = EXIT_FAILURE;
+              return SVN_NO_ERROR;
             }
         }
     }
@@ -735,14 +722,15 @@ sub_main(int argc, const char *argv[], a
                                           subcommand, pool);
           svn_opt_format_option(&optstr, badopt, FALSE, pool);
           if (subcommand->name[0] == '-')
-            SVN_INT_ERR(svn_cl__help(NULL, NULL, pool));
+            SVN_ERR(svn_cl__help(NULL, NULL, pool));
           else
             svn_error_clear
               (svn_cmdline_fprintf
                (stderr, pool, _("Subcommand '%s' doesn't accept option '%s'\n"
                                 "Type 'svn-bench help %s' for usage.\n"),
                 subcommand->name, optstr, subcommand->name));
-          return EXIT_FAILURE;
+          *exit_code = EXIT_FAILURE;
+          return SVN_NO_ERROR;
         }
     }
 
@@ -751,11 +739,10 @@ sub_main(int argc, const char *argv[], a
     {
       if (opt_state.revision_ranges->nelts > 1)
         {
-          err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                 _("Multiple revision arguments "
-                                   "encountered; can't specify -c twice, "
-                                   "or both -c and -r"));
-          return EXIT_ERROR(err);
+          return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                  _("Multiple revision arguments "
+                                    "encountered; can't specify -c twice, "
+                                    "or both -c and -r"));
         }
     }
 
@@ -763,29 +750,26 @@ sub_main(int argc, const char *argv[], a
      --with-no-revprops.  */
   if (opt_state.all_revprops && opt_state.no_revprops)
     {
-      err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                             _("--with-all-revprops and --with-no-revprops "
-                               "are mutually exclusive"));
-      return EXIT_ERROR(err);
+      return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                              _("--with-all-revprops and --with-no-revprops "
+                                "are mutually exclusive"));
     }
 
   /* Disallow simultaneous use of both --with-revprop and
      --with-no-revprops.  */
   if (opt_state.revprop_table && opt_state.no_revprops)
     {
-      err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                             _("--with-revprop and --with-no-revprops "
-                               "are mutually exclusive"));
-      return EXIT_ERROR(err);
+      return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                              _("--with-revprop and --with-no-revprops "
+                                "are mutually exclusive"));
     }
 
   /* --trust-server-cert can only be used with --non-interactive */
   if (opt_state.trust_server_cert && !opt_state.non_interactive)
     {
-      err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                             _("--trust-server-cert requires "
-                               "--non-interactive"));
-      return EXIT_ERROR(err);
+      return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                              _("--trust-server-cert requires "
+                                "--non-interactive"));
     }
 
   /* Ensure that 'revision_ranges' has at least one item, and make
@@ -805,7 +789,7 @@ sub_main(int argc, const char *argv[], a
 
   /* Create a client context object. */
   command_baton.opt_state = &opt_state;
-  SVN_INT_ERR(svn_client_create_context2(&ctx, NULL, pool));
+  SVN_ERR(svn_client_create_context2(&ctx, NULL, pool));
   command_baton.ctx = ctx;
 
   /* Only a few commands can accept a revision range; the rest can take at
@@ -814,8 +798,7 @@ sub_main(int argc, const char *argv[], a
     {
       if (opt_state.end_revision.kind != svn_opt_revision_unspecified)
         {
-          err = svn_error_create(SVN_ERR_CLIENT_REVISION_RANGE, NULL, NULL);
-          return EXIT_ERROR(err);
+          return svn_error_create(SVN_ERR_CLIENT_REVISION_RANGE, NULL, NULL);
         }
     }
 
@@ -836,7 +819,7 @@ sub_main(int argc, const char *argv[], a
           svn_error_clear(err);
         }
       else
-        return EXIT_ERROR(err);
+        return err;
     }
 
   cfg_config = apr_hash_get(ctx->config, SVN_CONFIG_CATEGORY_CONFIG,
@@ -861,7 +844,7 @@ sub_main(int argc, const char *argv[], a
     use_notifier = FALSE;
   if (use_notifier)
     {
-      SVN_INT_ERR(svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2,
+      SVN_ERR(svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2,
                                        pool));
     }
 
@@ -892,7 +875,7 @@ sub_main(int argc, const char *argv[], a
 #endif
 
   /* Set up Authentication stuff. */
-  SVN_INT_ERR(svn_cmdline_create_auth_baton(&ab,
+  SVN_ERR(svn_cmdline_create_auth_baton(&ab,
                                             opt_state.non_interactive,
                                             opt_state.auth_username,
                                             opt_state.auth_password,
@@ -942,26 +925,21 @@ sub_main(int argc, const char *argv[], a
                          "(type 'svn help cleanup' for details)"));
         }
 
-      return EXIT_ERROR(err);
+      return err;
     }
-  else
-    {
-      /* Ensure that stdout is flushed, so the user will see any write errors.
-         This makes sure that output is not silently lost. */
-      SVN_INT_ERR(svn_cmdline_fflush(stdout));
 
-      return EXIT_SUCCESS;
-    }
+  return SVN_NO_ERROR;
 }
 
 int
 main(int argc, const char *argv[])
 {
   apr_pool_t *pool;
-  int exit_code;
+  int exit_code = EXIT_SUCCESS;
+  svn_error_t *err;
 
   /* Initialize the app. */
-  if (svn_cmdline_init("svn", stderr) != EXIT_SUCCESS)
+  if (svn_cmdline_init("svn-bench", stderr) != EXIT_SUCCESS)
     return EXIT_FAILURE;
 
   /* Create our top-level pool.  Use a separate mutexless allocator,
@@ -969,7 +947,17 @@ main(int argc, const char *argv[])
    */
   pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
 
-  exit_code = sub_main(argc, argv, pool);
+  err = sub_main(&exit_code, argc, argv, pool);
+
+  /* Flush stdout and report if it fails. It would be flushed on exit anyway
+     but this makes sure that output is not silently lost if it fails. */
+  err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
+
+  if (err)
+    {
+      exit_code = EXIT_FAILURE;
+      svn_cmdline_handle_exit_error(err, NULL, "svn-bench: ");
+    }
 
   svn_pool_destroy(pool);
   return exit_code;

Modified: subversion/branches/log-addressing/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c (original)
+++ subversion/branches/log-addressing/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c Wed Nov 27 08:19:45 2013
@@ -49,22 +49,6 @@
 
 #define OPT_VERSION SVN_OPT_FIRST_LONGOPT_ID
 
-/** A statement macro, similar to @c SVN_INT_ERR, but issues a
- * message saying "svnraisetreeconflict:" instead of "svn:".
- *
- * Evaluate @a expr. If it yields an error, handle that error and
- * return @c EXIT_FAILURE.
- */
-#define SVNRAISETC_INT_ERR(expr)                                 \
-  do {                                                           \
-    svn_error_t *svn_err__temp = (expr);                         \
-    if (svn_err__temp) {                                         \
-      svn_handle_error2(svn_err__temp, stderr, FALSE,            \
-                        "svnraisetreeconflict: ");               \
-      svn_error_clear(svn_err__temp);                            \
-      return EXIT_FAILURE; }                                     \
-  } while (0)
-
 static svn_error_t *
 version(apr_pool_t *pool)
 {
@@ -78,7 +62,6 @@ usage(apr_pool_t *pool)
   svn_error_clear(svn_cmdline_fprintf
                   (stderr, pool,
                    _("Type 'svnraisetreeconflict --help' for usage.\n")));
-  exit(1);
 }
 
 /***************************************************************************
@@ -295,7 +278,6 @@ help(const apr_getopt_option_t *options,
       get_enum_str(node_kind_map, svn_node_file),
       get_enum_str(node_kind_map, svn_node_none)
       ));
-  exit(0);
 }
 
 
@@ -314,11 +296,14 @@ check_lib_versions(void)
   return svn_ver_check_list2(&my_version, checklist, svn_ver_equal);
 }
 
-int
-main(int argc, const char *argv[])
+/*
+ * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
+ * either return an error to be displayed, or set *EXIT_CODE to non-zero and
+ * return SVN_NO_ERROR.
+ */
+static svn_error_t *
+sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
 {
-  apr_pool_t *pool;
-  svn_error_t *err;
   apr_getopt_t *os;
   const apr_getopt_option_t options[] =
     {
@@ -329,33 +314,18 @@ main(int argc, const char *argv[])
     };
   apr_array_header_t *remaining_argv;
 
-  /* Initialize the app. */
-  if (svn_cmdline_init("svnraisetreeconflict", stderr) != EXIT_SUCCESS)
-    return EXIT_FAILURE;
-
-  /* Create our top-level pool.  Use a separate mutexless allocator,
-   * given this application is single threaded.
-   */
-  pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
-
   /* Check library versions */
-  err = check_lib_versions();
-  if (err)
-    return svn_cmdline_handle_exit_error(err, pool, "svnraisetreeconflict: ");
+  SVN_ERR(check_lib_versions());
 
 #if defined(WIN32) || defined(__CYGWIN__)
   /* Set the working copy administrative directory name. */
   if (getenv("SVN_ASP_DOT_NET_HACK"))
     {
-      err = svn_wc_set_adm_dir("_svn", pool);
-      if (err)
-        return svn_cmdline_handle_exit_error(err, pool, "svnraisetreeconflict: ");
+      SVN_ERR(svn_wc_set_adm_dir("_svn", pool));
     }
 #endif
 
-  err = svn_cmdline__getopt_init(&os, argc, argv, pool);
-  if (err)
-    return svn_cmdline_handle_exit_error(err, pool, "svnraisetreeconflict: ");
+  SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
 
   os->interleave = 1;
   while (1)
@@ -366,19 +336,24 @@ main(int argc, const char *argv[])
       if (APR_STATUS_IS_EOF(status))
         break;
       if (status != APR_SUCCESS)
-        usage(pool);  /* this will exit() */
+        {
+          usage(pool);
+          *exit_code = EXIT_FAILURE;
+          return SVN_NO_ERROR;
+        }
 
       switch (opt)
         {
         case 'h':
           help(options, pool);
-          break;
+          return SVN_NO_ERROR;
         case OPT_VERSION:
-          SVNRAISETC_INT_ERR(version(pool));
-          exit(0);
-          break;
+          SVN_ERR(version(pool));
+          return SVN_NO_ERROR;
         default:
-          usage(pool);  /* this will exit() */
+          usage(pool);
+          *exit_code = EXIT_FAILURE;
+          return SVN_NO_ERROR;
         }
     }
 
@@ -388,23 +363,53 @@ main(int argc, const char *argv[])
     {
       const char *s;
 
-      SVNRAISETC_INT_ERR(svn_utf_cstring_to_utf8(&s, os->argv[os->ind++],
-                                                 pool));
+      SVN_ERR(svn_utf_cstring_to_utf8(&s, os->argv[os->ind++], pool));
       APR_ARRAY_PUSH(remaining_argv, const char *) = s;
     }
 
   if (remaining_argv->nelts < 1)
-    usage(pool);  /* this will exit() */
+    {
+      usage(pool);
+      *exit_code = EXIT_FAILURE;
+      return SVN_NO_ERROR;
+    }
 
   /* Do the main task */
-  SVNRAISETC_INT_ERR(raise_tree_conflict(remaining_argv->nelts,
-                                         (const char **)remaining_argv->elts,
-                                         pool));
+  SVN_ERR(raise_tree_conflict(remaining_argv->nelts,
+                              (const char **)remaining_argv->elts,
+                              pool));
 
-  svn_pool_destroy(pool);
+  return SVN_NO_ERROR;
+}
+
+int
+main(int argc, const char *argv[])
+{
+  apr_pool_t *pool;
+  int exit_code = EXIT_SUCCESS;
+  svn_error_t *err;
 
-  /* Flush stdout to make sure that the user will see any printing errors. */
-  SVNRAISETC_INT_ERR(svn_cmdline_fflush(stdout));
+  /* Initialize the app. */
+  if (svn_cmdline_init("svnraisetreeconflict", stderr) != EXIT_SUCCESS)
+    return EXIT_FAILURE;
 
-  return EXIT_SUCCESS;
+  /* Create our top-level pool.  Use a separate mutexless allocator,
+   * given this application is single threaded.
+   */
+  pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
+
+  err = sub_main(&exit_code, argc, argv, pool);
+
+  /* Flush stdout and report if it fails. It would be flushed on exit anyway
+     but this makes sure that output is not silently lost if it fails. */
+  err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
+
+  if (err)
+    {
+      exit_code = EXIT_FAILURE;
+      svn_cmdline_handle_exit_error(err, NULL, "svnraisetreeconflict: ");
+    }
+
+  svn_pool_destroy(pool);
+  return exit_code;
 }

Modified: subversion/branches/log-addressing/tools/dev/unix-build/Makefile.svn
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/dev/unix-build/Makefile.svn?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/dev/unix-build/Makefile.svn (original)
+++ subversion/branches/log-addressing/tools/dev/unix-build/Makefile.svn Wed Nov 27 08:19:45 2013
@@ -70,7 +70,7 @@ APR_VER		= 1.4.6
 APR_ICONV_VER	= 1.2.1
 GNU_ICONV_VER	= 1.14
 APR_UTIL_VER	= 1.4.1
-HTTPD_VER	= 2.2.25
+HTTPD_VER	= 2.2.26
 NEON_VER	= 0.29.6
 SERF_VER	= 1.3.2
 SERF_OLD_VER	= 0.3.1
@@ -249,7 +249,7 @@ bdb-reset:
 		rm -f $(BDB_OBJDIR)/$(f);)
 
 bdb-clean:
-	-(cd $(BDB_SRCDIR)/build_unix/ && make clean)
+	-(cd $(BDB_SRCDIR)/build_unix/ && env MAKEFLAGS= make clean)
 
 # fetch distfile for bdb
 $(DISTDIR)/$(BDB_DIST):
@@ -272,12 +272,12 @@ $(BDB_OBJDIR)/.configured: $(BDB_OBJDIR)
 
 # compile bdb
 $(BDB_OBJDIR)/.compiled: $(BDB_OBJDIR)/.configured
-	(cd $(BDB_SRCDIR)/build_unix && make)
+	(cd $(BDB_SRCDIR)/build_unix && env MAKEFLAGS= make)
 	touch $@
 
 # install bdb
 $(BDB_OBJDIR)/.installed: $(BDB_OBJDIR)/.compiled
-	(cd $(BDB_SRCDIR)/build_unix && make install)
+	(cd $(BDB_SRCDIR)/build_unix && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -293,7 +293,7 @@ apr-reset:
 		rm -f $(APR_OBJDIR)/$(f);)
 
 apr-clean:
-	-(cd $(APR_OBJDIR) && make clean)
+	-(cd $(APR_OBJDIR) && env MAKEFLAGS= make clean)
 
 # retrieve apr if not present yet
 $(APR_OBJDIR)/.retrieved:
@@ -314,7 +314,7 @@ POOL_DEBUG_FLAG=--enable-pool-debug=all
 endif
 
 # configure apr
-$(APR_OBJDIR)/.configured: $(APR_OBJDIR)/.retrieved
+$(APR_OBJDIR)/.configured: $(APR_OBJDIR)/.retrieved $(BDB_OBJDIR)/.installed
 	cd $(APR_SRCDIR) && ./buildconf
 	cd $(APR_OBJDIR) \
 		&& env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" GREP="`which grep`" \
@@ -327,12 +327,12 @@ $(APR_OBJDIR)/.configured: $(APR_OBJDIR)
 
 # compile apr
 $(APR_OBJDIR)/.compiled: $(APR_OBJDIR)/.configured
-	(cd $(APR_OBJDIR) && make)
+	(cd $(APR_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install apr
 $(APR_OBJDIR)/.installed: $(APR_OBJDIR)/.compiled
-	(cd $(APR_OBJDIR) && make install)
+	(cd $(APR_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -348,7 +348,7 @@ apr-iconv-reset:
 		rm -f $(APR_ICONV_OBJDIR)/$(f);)
 
 apr-iconv-clean:
-	-(cd $(APR_ICONV_OBJDIR) && make clean)
+	-(cd $(APR_ICONV_OBJDIR) && env MAKEFLAGS= make clean)
 
 # fetch distfile for apr-iconv
 $(DISTDIR)/$(APR_ICONV_DIST):
@@ -361,7 +361,8 @@ $(APR_ICONV_OBJDIR)/.retrieved: $(DISTDI
 	touch $@
 
 # configure apr-iconv
-$(APR_ICONV_OBJDIR)/.configured: $(APR_ICONV_OBJDIR)/.retrieved
+$(APR_ICONV_OBJDIR)/.configured: $(APR_ICONV_OBJDIR)/.retrieved \
+	$(APR_OBJDIR)/.installed
 	cd $(APR_ICONV_OBJDIR) \
 		&& env CFLAGS="-g $(PROFILE_CFLAGS)" GREP="`which grep`" \
 		$(APR_ICONV_SRCDIR)/configure \
@@ -372,12 +373,12 @@ $(APR_ICONV_OBJDIR)/.configured: $(APR_I
 # compile apr-iconv
 $(APR_ICONV_OBJDIR)/.compiled: $(APR_ICONV_OBJDIR)/.configured
 	(cd $(APR_ICONV_OBJDIR) \
-		&& make CPPFLAGS="-D_OSD_POSIX" CFLAGS="-g -O0 $(PROFILE_CFLAGS)")
+		&& env MAKEFLAGS= make CPPFLAGS="-D_OSD_POSIX" CFLAGS="-g -O0 $(PROFILE_CFLAGS)")
 	touch $@
 
 # install apr-iconv
 $(APR_ICONV_OBJDIR)/.installed: $(APR_ICONV_OBJDIR)/.compiled
-	(cd $(APR_ICONV_OBJDIR) && make install)
+	(cd $(APR_ICONV_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -393,7 +394,7 @@ gnu-iconv-reset:
 		rm -f $(GNU_ICONV_OBJDIR)/$(f);)
 
 gnu-iconv-clean:
-	-(cd $(GNU_ICONV_OBJDIR) && make clean)
+	-(cd $(GNU_ICONV_OBJDIR) && env MAKEFLAGS= make clean)
 	rm -f $(GNU_ICONV_OBJDIR)/lib_encodings.def.diff
 	rm -f $(GNU_ICONV_OBJDIR)/lib_aliases.gperf.diff
 
@@ -453,12 +454,12 @@ $(GNU_ICONV_OBJDIR)/.configured: $(GNU_I
 
 # compile gnu-iconv
 $(GNU_ICONV_OBJDIR)/.compiled: $(GNU_ICONV_OBJDIR)/.configured
-	(cd $(GNU_ICONV_OBJDIR) && make)
+	(cd $(GNU_ICONV_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install gnu-iconv
 $(GNU_ICONV_OBJDIR)/.installed: $(GNU_ICONV_OBJDIR)/.compiled
-	(cd $(GNU_ICONV_OBJDIR) && make install)
+	(cd $(GNU_ICONV_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -490,7 +491,7 @@ apr-util-reset:
 		rm -f $(APR_UTIL_OBJDIR)/$(f);)
 
 apr-util-clean:
-	-(cd $(APR_UTIL_OBJDIR) && make clean)
+	-(cd $(APR_UTIL_OBJDIR) && env MAKEFLAGS= make clean)
 
 
 # retrieve apr-util if not present yet
@@ -504,12 +505,15 @@ $(APR_UTIL_OBJDIR)/.retrieved:
 
 ifeq ($(USE_APR_ICONV),yes)
 ICONV_FLAG=--with-iconv=$(PREFIX)/apr
+ICONV_OBJDIR=$(APR_ICONV_OBJDIR)
 else
 ICONV_FLAG=--with-iconv=$(PREFIX)/iconv
+ICONV_OBJDIR=$(GNU_ICONV_OBJDIR)
 endif
 
 # configure apr-util
-$(APR_UTIL_OBJDIR)/.configured: $(APR_UTIL_OBJDIR)/.retrieved
+$(APR_UTIL_OBJDIR)/.configured: $(APR_UTIL_OBJDIR)/.retrieved \
+	$(APR_OBJDIR)/.installed $(ICONV_OBJDIR)/.installed
 	cd $(APR_UTIL_SRCDIR) && ./buildconf --with-apr=$(APR_SRCDIR)
 	cd $(APR_UTIL_OBJDIR) \
 		&& env LD_LIBRARY_PATH=$(PREFIX)/bdb/lib \
@@ -525,12 +529,12 @@ $(APR_UTIL_OBJDIR)/.configured: $(APR_UT
 
 # compile apr-util
 $(APR_UTIL_OBJDIR)/.compiled: $(APR_UTIL_OBJDIR)/.configured
-	(cd $(APR_UTIL_OBJDIR) && make)
+	(cd $(APR_UTIL_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install apr-util
 $(APR_UTIL_OBJDIR)/.installed: $(APR_UTIL_OBJDIR)/.compiled
-	(cd $(APR_UTIL_OBJDIR) && make install)
+	(cd $(APR_UTIL_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -547,40 +551,21 @@ httpd-reset:
 		rm -f $(HTTPD_OBJDIR)/$(f);)
 
 httpd-clean:
-	-(cd $(HTTPD_OBJDIR) && make clean)
-	rm -f $(HTTPD_OBJDIR)/no_ssl_v2.diff
+	-(cd $(HTTPD_OBJDIR) && env MAKEFLAGS= make clean)
 
 # fetch distfile for httpd
 $(DISTDIR)/$(HTTPD_DIST):
 	cd $(DISTDIR) && $(FETCH_CMD) $(HTTPD_URL)
 
-$(HTTPD_OBJDIR)/no_ssl_v2.diff:
-	mkdir -p $(dir $@)
-	echo > $@.tmp '--- modules/ssl/ssl_engine_io.c.orig	Sat Jul 13 16:49:52 2013'
-	echo >> $@.tmp '+++ modules/ssl/ssl_engine_io.c	Sat Jul 13 16:50:10 2013'
-	echo >> $@.tmp '@@ -1079,7 +1079,9 @@'
-	echo >> $@.tmp '          * IPv4 and IPv6 addresses are not permitted".)'
-	echo >> $@.tmp '          */'
-	echo >> $@.tmp '         if (hostname_note &&'
-	echo >> $@.tmp '+#ifndef OPENSSL_NO_SSL2'
-	echo >> $@.tmp '             sc->proxy->protocol != SSL_PROTOCOL_SSLV2 &&'
-	echo >> $@.tmp '+#endif'
-	echo >> $@.tmp '             sc->proxy->protocol != SSL_PROTOCOL_SSLV3 &&'
-	echo >> $@.tmp '             apr_ipsubnet_create(&ip, hostname_note, NULL,'
-	echo >> $@.tmp '                                 c->pool) != APR_SUCCESS) {'
-	mv -f $@.tmp $@
-
 # retrieve httpd
-$(HTTPD_OBJDIR)/.retrieved: $(DISTDIR)/$(HTTPD_DIST) \
-				$(HTTPD_OBJDIR)/no_ssl_v2.diff
+$(HTTPD_OBJDIR)/.retrieved: $(DISTDIR)/$(HTTPD_DIST)
 	[ -d $(HTTPD_OBJDIR) ] || mkdir -p $(HTTPD_OBJDIR)
 	tar -C $(SRCDIR) -jxf $(DISTDIR)/$(HTTPD_DIST)
-	cd $(SRCDIR)/httpd-$(HTTPD_VER) && \
-		patch -p0 < $(HTTPD_OBJDIR)/no_ssl_v2.diff
 	touch $@
 
 # configure httpd
-$(HTTPD_OBJDIR)/.configured: $(HTTPD_OBJDIR)/.retrieved
+$(HTTPD_OBJDIR)/.configured: $(HTTPD_OBJDIR)/.retrieved \
+	$(APR_UTIL_OBJDIR)/.installed
 	cd $(HTTPD_OBJDIR) \
 		&& env CFLAGS="-g $(PROFILE_CFLAGS)" GREP="`which grep`" \
 		$(HTTPD_SRCDIR)/configure \
@@ -595,12 +580,12 @@ $(HTTPD_OBJDIR)/.configured: $(HTTPD_OBJ
 
 # compile httpd
 $(HTTPD_OBJDIR)/.compiled: $(HTTPD_OBJDIR)/.configured
-	(cd $(HTTPD_OBJDIR) && make)
+	(cd $(HTTPD_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install httpd
 $(HTTPD_OBJDIR)/.installed: $(HTTPD_OBJDIR)/.compiled
-	(cd $(HTTPD_OBJDIR) && make install)
+	(cd $(HTTPD_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 # create a httpd.conf for mod_dav_svn
@@ -638,7 +623,7 @@ neon-reset:
 		rm -f $(NEON_OBJDIR)/$(f);)
 
 neon-clean:
-	-(cd $(NEON_OBJDIR) && make clean)
+	-(cd $(NEON_OBJDIR) && env MAKEFLAGS= make clean)
 
 # fetch distfile for neon
 $(DISTDIR)/$(NEON_DIST):
@@ -685,12 +670,12 @@ $(NEON_OBJDIR)/.configured: $(NEON_OBJDI
 
 # compile neon
 $(NEON_OBJDIR)/.compiled: $(NEON_OBJDIR)/.configured
-	(cd $(NEON_OBJDIR) && make)
+	(cd $(NEON_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install neon
 $(NEON_OBJDIR)/.installed: $(NEON_OBJDIR)/.compiled
-	(cd $(NEON_OBJDIR) && make install)
+	(cd $(NEON_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 
@@ -731,7 +716,8 @@ $(SERF_OBJDIR)/.retrieved:
 	touch $@
 
 # compile serf (serf won't compile outside its source tree)
-$(SERF_OBJDIR)/.compiled: $(SERF_OBJDIR)/.retrieved
+$(SERF_OBJDIR)/.compiled: $(SERF_OBJDIR)/.retrieved \
+	$(APR_UTIL_OBJDIR)/.installed
 	cd $(SERF_SRCDIR) && \
 		scons DEBUG=1 CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
 			APR=$(PREFIX)/apr \
@@ -773,7 +759,8 @@ $(SERF_OLD_OBJDIR)/.retrieved:
 	touch $@
 
 # compile serf (serf won't compile outside its source tree)
-$(SERF_OLD_OBJDIR)/.compiled: $(SERF_OLD_OBJDIR)/.retrieved
+$(SERF_OLD_OBJDIR)/.compiled: $(SERF_OLD_OBJDIR)/.retrieved \
+	$(APR_UTIL_OBJDIR)/.installed
 	cd $(SERF_OLD_SRCDIR) && \
 		env CFLAGS="-O0 -g $(PROFILE_CFLAGS)" \
 			./serfmake --with-apr=$(PREFIX)/apr \
@@ -804,7 +791,7 @@ sqlite-reset:
 		rm -f $(SQLITE_OBJDIR)/$(f);)
 
 sqlite-clean:
-	-cd $(SQLITE_OBJDIR) && make clean
+	-cd $(SQLITE_OBJDIR) && env MAKEFLAGS= make clean
 
 # fetch distfile for sqlite
 $(DISTDIR)/$(SQLITE_DIST):
@@ -833,12 +820,12 @@ $(SQLITE_OBJDIR)/.configured: $(SQLITE_O
 
 # compile sqlite
 $(SQLITE_OBJDIR)/.compiled: $(SQLITE_OBJDIR)/.configured
-	(cd $(SQLITE_OBJDIR) && make)
+	(cd $(SQLITE_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install sqlite
 $(SQLITE_OBJDIR)/.installed: $(SQLITE_OBJDIR)/.compiled
-	(cd $(SQLITE_OBJDIR) && make install)
+	(cd $(SQLITE_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -854,7 +841,7 @@ cyrus-sasl-reset:
 		rm -f $(CYRUS_SASL_OBJDIR)/$(f);)
 
 cyrus-sasl-clean:
-	-(cd $(CYRUS_SASL_OBJDIR) && make distclean)
+	-(cd $(CYRUS_SASL_OBJDIR) && env MAKEFLAGS= make distclean)
 
 # fetch distfile for cyrus-sasl
 $(DISTDIR)/$(CYRUS_SASL_DIST):
@@ -889,7 +876,8 @@ endif
 	touch $@
 
 # configure cyrus-sasl
-$(CYRUS_SASL_OBJDIR)/.configured: $(CYRUS_SASL_OBJDIR)/.retrieved
+$(CYRUS_SASL_OBJDIR)/.configured: $(CYRUS_SASL_OBJDIR)/.retrieved \
+	$(BDB_OBJDIR)/.installed $(SQLITE_OBJDIR)/.installed
 	cd $(CYRUS_SASL_OBJDIR) \
 		&& env CFLAGS="-g $(PROFILE_CFLAGS)" \
 		CPPFLAGS="-I/usr/include/kerberosV" \
@@ -907,12 +895,12 @@ $(CYRUS_SASL_OBJDIR)/.configured: $(CYRU
 
 # compile cyrus-sasl
 $(CYRUS_SASL_OBJDIR)/.compiled: $(CYRUS_SASL_OBJDIR)/.configured
-	(cd $(CYRUS_SASL_OBJDIR) && make)
+	(cd $(CYRUS_SASL_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install cyrus-sasl
 $(CYRUS_SASL_OBJDIR)/.installed: $(CYRUS_SASL_OBJDIR)/.compiled
-	(cd $(CYRUS_SASL_OBJDIR) && make install)
+	(cd $(CYRUS_SASL_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -928,7 +916,7 @@ libmagic-reset:
 		rm -f $(LIBMAGIC_OBJDIR)/$(f);)
 
 libmagic-clean:
-	-(cd $(LIBMAGIC_OBJDIR) && make distclean)
+	-(cd $(LIBMAGIC_OBJDIR) && env MAKEFLAGS= make distclean)
 
 # fetch distfile for libmagic
 $(DISTDIR)/$(LIBMAGIC_DIST):
@@ -951,12 +939,12 @@ $(LIBMAGIC_OBJDIR)/.configured: $(LIBMAG
 
 # compile libmagic
 $(LIBMAGIC_OBJDIR)/.compiled: $(LIBMAGIC_OBJDIR)/.configured
-	(cd $(LIBMAGIC_OBJDIR) && make)
+	(cd $(LIBMAGIC_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install libmagic
 $(LIBMAGIC_OBJDIR)/.installed: $(LIBMAGIC_OBJDIR)/.compiled
-	(cd $(LIBMAGIC_OBJDIR) && make install)
+	(cd $(LIBMAGIC_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -972,7 +960,7 @@ ruby-reset:
 		rm -f $(RUBY_OBJDIR)/$(f);)
 
 ruby-clean:
-	-(cd $(RUBY_OBJDIR) && make distclean)
+	-(cd $(RUBY_OBJDIR) && env MAKEFLAGS= make distclean)
 
 # fetch distfile for ruby
 $(DISTDIR)/$(RUBY_DIST):
@@ -1003,12 +991,12 @@ $(RUBY_OBJDIR)/.configured: $(RUBY_OBJDI
 
 # compile ruby
 $(RUBY_OBJDIR)/.compiled: $(RUBY_OBJDIR)/.configured
-	(cd $(RUBY_OBJDIR) && make)
+	(cd $(RUBY_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install ruby
 $(RUBY_OBJDIR)/.installed: $(RUBY_OBJDIR)/.compiled
-	(cd $(RUBY_OBJDIR) && make install)
+	(cd $(RUBY_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 #######################################################################
@@ -1023,7 +1011,7 @@ bz2-reset:
 		rm -f $(BZ2_OBJDIR)/$(f);)
 
 bz2-clean:
-	-(cd $(BZ2_SRCDIR) && make distclean)
+	-(cd $(BZ2_SRCDIR) && env MAKEFLAGS= make distclean)
 
 # fetch distfile for bz2
 $(DISTDIR)/$(BZ2_DIST):
@@ -1037,12 +1025,12 @@ $(BZ2_OBJDIR)/.retrieved: $(DISTDIR)/$(B
 
 # compile bz2
 $(BZ2_OBJDIR)/.compiled: $(BZ2_OBJDIR)/.retrieved
-	(cd $(BZ2_SRCDIR) && make CFLAGS="-g $(PROFILE_CFLAGS) -fPIC")
+	(cd $(BZ2_SRCDIR) && env MAKEFLAGS= make CFLAGS="-g $(PROFILE_CFLAGS) -fPIC")
 	touch $@
 
 # install bz2
 $(BZ2_OBJDIR)/.installed: $(BZ2_OBJDIR)/.compiled
-	(cd $(BZ2_SRCDIR) && make install PREFIX=$(PREFIX)/bz2)
+	(cd $(BZ2_SRCDIR) && env MAKEFLAGS= make install PREFIX=$(PREFIX)/bz2)
 	touch $@
 
 
@@ -1059,7 +1047,7 @@ python-reset:
 		rm -f $(PYTHON_OBJDIR)/$(f);)
 
 python-clean:
-	-(cd $(PYTHON_OBJDIR) && make distclean)
+	-(cd $(PYTHON_OBJDIR) && env MAKEFLAGS= make distclean)
 
 # fetch distfile for python
 $(DISTDIR)/$(PYTHON_DIST):
@@ -1096,7 +1084,8 @@ $(PYTHON_OBJDIR)/.retrieved: $(DISTDIR)/
 ifdef PROFILE
 PYTHON_PROFILING=--enable-profiling
 endif
-$(PYTHON_OBJDIR)/.configured: $(PYTHON_OBJDIR)/.retrieved
+$(PYTHON_OBJDIR)/.configured: $(PYTHON_OBJDIR)/.retrieved \
+	$(BZ2_OBJDIR)/.installed
 	cd $(PYTHON_OBJDIR) \
 		&& env CFLAGS="-g $(PROFILE_CFLAGS)" GREP="`which grep`" \
 		CPPFLAGS="-I$(PREFIX)/bz2/include" \
@@ -1111,12 +1100,12 @@ $(PYTHON_OBJDIR)/.configured: $(PYTHON_O
 
 # compile python
 $(PYTHON_OBJDIR)/.compiled: $(PYTHON_OBJDIR)/.configured
-	(cd $(PYTHON_OBJDIR) && make)
+	(cd $(PYTHON_OBJDIR) && env MAKEFLAGS= make)
 	touch $@
 
 # install python
 $(PYTHON_OBJDIR)/.installed: $(PYTHON_OBJDIR)/.compiled
-	(cd $(PYTHON_OBJDIR) && make install)
+	(cd $(PYTHON_OBJDIR) && env MAKEFLAGS= make install)
 	touch $@
 
 
@@ -1151,7 +1140,7 @@ svn-reset: svn-bindings-reset
 		rm -f $(SVN_OBJDIR)/$(f);)
 
 svn-clean:
-	-(cd $(svn_builddir) && make distclean)
+	-(cd $(svn_builddir) && env MAKEFLAGS= make distclean)
 
 # retrieve svn if not present yet
 $(SVN_OBJDIR)/.retrieved:
@@ -1227,8 +1216,13 @@ SVN_WITH_HTTPD=--with-apxs="$(PREFIX)/ht
 SVN_WITH_SASL=--with-sasl="$(PREFIX)/cyrus-sasl"
 endif
 
-# configure svn
-$(SVN_OBJDIR)/.configured: $(SVN_OBJDIR)/.retrieved $(DISTDIR)/$(JUNIT_DIST)
+$(SVN_OBJDIR)/.configured: $(SVN_OBJDIR)/.retrieved $(DISTDIR)/$(JUNIT_DIST) \
+	$(APR_OBJDIR)/.installed $(APR_UTIL_OBJDIR)/.installed \
+	$(BDB_OBJDIR)/.installed $(SQLITE_OBJDIR)/.installed \
+	$(HTTPD_OBJDIR)/.installed $(CYRUS_SASL_OBJDIR)/.installed \
+	$(LIBMAGIC_OBJDIR)/.installed $(NEON_OBJDIR)/.installed \
+	$(SERF_OBJDIR)/.installed $(SERF_OLD_OBJDIR)/.installed \
+	$(RUBY_OBJDIR)/.installed $(PYTHON_OBJDIR)/.installed
 	cd $(SVN_SRCDIR) && ./autogen.sh
 	cd $(svn_builddir) && \
 		env LDFLAGS="-L$(PREFIX)/neon/lib -L$(PREFIX)/apr/lib $(SERF_LDFLAG)" \
@@ -1258,13 +1252,13 @@ $(SVN_OBJDIR)/.configured: $(SVN_OBJDIR)
 # compile svn
 $(SVN_OBJDIR)/.compiled: $(SVN_OBJDIR)/.configured
 	cd $(svn_builddir) \
-		&& make EXTRA_CFLAGS="$(PROFILE_CFLAGS) $(W_NO_SYSTEM_HEADERS)"
+		&& env MAKEFLAGS= make EXTRA_CFLAGS="$(PROFILE_CFLAGS) $(W_NO_SYSTEM_HEADERS)"
 	touch $@
 
 # install svn
 $(SVN_OBJDIR)/.installed: $(SVN_OBJDIR)/.compiled
 	cd $(svn_builddir) \
-		&& make install
+		&& env MAKEFLAGS= make install
 	touch $@
 
 # SWIG 1.x and 2.x are not compatible. If SWIG 2.x is used to generated .swg
@@ -1274,44 +1268,44 @@ $(SVN_OBJDIR)/.installed: $(SVN_OBJDIR)/
 # by the same version of SWIG.
 $(SVN_OBJDIR)/.pre-generated-swig-cleaned:
 	-cd $(svn_builddir) \
-		&& make clean-swig
+		&& env MAKEFLAGS= make clean-swig
 	touch $@
 
 $(SVN_OBJDIR)/.bindings-compiled: $(SVN_OBJDIR)/.installed $(SVN_OBJDIR)/.pre-generated-swig-cleaned
 	cd $(svn_builddir) \
 		&& env LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
-			make swig-py
+			env MAKEFLAGS= make swig-py
 	cd $(svn_builddir) && \
 		env PATH=$(PREFIX)/ruby/bin:$$PATH \
-		LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) make swig-rb
+		LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) env MAKEFLAGS= make swig-rb
 	if [ $(ENABLE_PERL_BINDINGS) = yes ]; then \
 		cd $(svn_builddir) \
 			&& env LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
-				make swig-pl; \
+				env MAKEFLAGS= make swig-pl; \
 	fi
 	if [ $(ENABLE_JAVA_BINDINGS) = yes ]; then \
 		cd $(svn_builddir) \
-			&& make javahl; \
+			&& env MAKEFLAGS= make javahl; \
 	fi
 	touch $@
 
 $(SVN_OBJDIR)/.bindings-installed: $(SVN_OBJDIR)/.bindings-compiled
 	cd $(svn_builddir) \
 	  && env LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
-		make install-swig-py
+		env MAKEFLAGS= make install-swig-py
 	cd $(svn_builddir) && \
 		env PATH=$(PREFIX)/ruby/bin:$$PATH \
-		LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) make install-swig-rb
+		LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) env MAKEFLAGS= make install-swig-rb
 	if [ $(ENABLE_PERL_BINDINGS) = yes ]; then \
 		cd $(svn_builddir) \
-	    && make install-swig-pl-lib; \
+	    && env MAKEFLAGS= make install-swig-pl-lib; \
 	  cd subversion/bindings/swig/perl/native \
 		  && perl Makefile.PL PREFIX="$(SVN_PREFIX)" \
-		  && make install; \
+		  && env MAKEFLAGS= make install; \
 	fi
 	if [ $(ENABLE_JAVA_BINDINGS) = yes ]; then \
 		cd $(svn_builddir) \
-			&& make install-javahl; \
+			&& env MAKEFLAGS= make install-javahl; \
 	fi
 	touch $@
 
@@ -1449,7 +1443,7 @@ define do_check
     echo "Begin test: $(subst svn-check-,,$@) x $$fs"; \
     test -d "$(RAMDISK)/tmp" && export TMPDIR="$(RAMDISK)/tmp"; \
     env LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) $(LIB_PTHREAD_HACK) \
-        make check PARALLEL=$(PARALLEL) CLEANUP=$(CLEANUP) \
+        env MAKEFLAGS= make check PARALLEL=$(PARALLEL) CLEANUP=$(CLEANUP) \
 	  EXCLUSIVE_WC_LOCKS=$(EXCLUSIVE_WC_LOCKS) $1 FS_TYPE=$$fs; \
     for log in tests.log fails.log; do \
         test -f $$log && mv -f $$log $$log.$@-$$fs; \
@@ -1506,14 +1500,14 @@ svn-check-swig-pl:
 		(cd $(svn_builddir) && \
 			env LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
 			$(LIB_PTHREAD_HACK) \
-			make check-swig-pl 2>&1) | \
+			env MAKEFLAGS= make check-swig-pl 2>&1) | \
 				tee $(svn_builddir)/tests.log.bindings.pl; \
 	fi
 
 svn-check-swig-py:
 	-(cd $(svn_builddir) && \
 		env LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
-		make check-swig-py 2>&1) | \
+		env MAKEFLAGS= make check-swig-py 2>&1) | \
 			tee $(svn_builddir)/tests.log.bindings.py
 
 # We add the svn prefix to PATH here because the ruby tests
@@ -1524,14 +1518,14 @@ svn-check-swig-rb:
 		LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
 		PATH=$(SVN_PREFIX)/bin:$$PATH \
 		$(LIB_PTHREAD_HACK) \
-			make check-swig-rb 2>&1) | \
+			env MAKEFLAGS= make check-swig-rb 2>&1) | \
 			tee $(svn_builddir)/tests.log.bindings.rb
 
 svn-check-javahl:
 	-if [ $(ENABLE_JAVA_BINDINGS) = yes ]; then \
 		(cd $(svn_builddir) && \
 			env LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) \
-			make $(JAVAHL_CHECK_TARGET) 2>&1) | \
+			env MAKEFLAGS= make $(JAVAHL_CHECK_TARGET) 2>&1) | \
 				tee $(svn_builddir)/tests.log.bindings.javahl; \
 	fi
 

Modified: subversion/branches/log-addressing/tools/dist/backport.pl
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/dist/backport.pl?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/dist/backport.pl (original)
+++ subversion/branches/log-addressing/tools/dist/backport.pl Wed Nov 27 08:19:45 2013
@@ -326,7 +326,8 @@ EOF
 
 sub sanitize_branch {
   local $_ = shift;
-  s#.*/##;
+  my $branches_re = quotemeta $BRANCHES;
+  s#.*$branches_re/##;
   s/^\s*//;
   s/\s*$//;
   return $_;

Modified: subversion/branches/log-addressing/tools/dist/release.py
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/dist/release.py?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/dist/release.py (original)
+++ subversion/branches/log-addressing/tools/dist/release.py Wed Nov 27 08:19:45 2013
@@ -87,7 +87,12 @@ tool_versions = {
   'trunk' : {
             'autoconf' : '2.69',
             'libtool'  : '2.4.2',
-            'swig'     : '2.0.9',
+            'swig'     : '2.0.11',
+  },
+  '1.9' : {
+            'autoconf' : '2.69',
+            'libtool'  : '2.4.2',
+            'swig'     : '2.0.11'
   },
   '1.8' : {
             'autoconf' : '2.69',

Modified: subversion/branches/log-addressing/tools/examples/svnlook.py
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/examples/svnlook.py?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/examples/svnlook.py (original)
+++ subversion/branches/log-addressing/tools/examples/svnlook.py Wed Nov 27 08:19:45 2013
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# svnlook.py : a Python-based replacement for svnlook
+# svnlook.py : alternative svnlook in Python with library API
 #
 ######################################################################
 #    Licensed to the Apache Software Foundation (ASF) under one
@@ -21,6 +21,34 @@
 #    under the License.
 ######################################################################
 #
+# $HeadURL$
+# $LastChangedDate$
+# $LastChangedRevision$
+
+"""
+svnlook.py can also be used as a Python module::
+
+  >>> import svnlook
+  >>> svnlook = svnlook.SVNLook("/testrepo")
+  >>> svnlook.get_author()
+  'randomjoe'
+
+
+Accessible API::
+
+[x] author
+[x] changed
+[x] date
+[ ] diff
+[x] dirs-changed
+[ ] ids
+[x] info
+[x] log
+[ ] tree
+---
+[ ] generator API to avoid passing lists
+"""
+
 
 import sys
 import time
@@ -28,86 +56,155 @@ import os
 
 from svn import core, fs, delta, repos
 
-class SVNLook:
-  def __init__(self, path, cmd, rev, txn):
+class SVNLook(object):
+  def __init__(self, path, rev=None, txn=None, cmd=None):
+    """
+    path  - path to repository
+    rev   - revision number
+    txn   - name of transaction (usually the one about to be committed)
+    cmd   - if set, specifies cmd_* method to execute
+
+    txn takes precedence over rev; if both are None, inspect the head revision
+    """
     path = core.svn_path_canonicalize(path)
     repos_ptr = repos.open(path)
     self.fs_ptr = repos.fs(repos_ptr)
 
+    # if set, txn takes precendence
     if txn:
       self.txn_ptr = fs.open_txn(self.fs_ptr, txn)
     else:
       self.txn_ptr = None
       if rev is None:
         rev = fs.youngest_rev(self.fs_ptr)
+      else:
+        rev = int(rev)
     self.rev = rev
 
-    getattr(self, 'cmd_' + cmd)()
+    if cmd != None:
+      getattr(self, 'cmd_' + cmd)()
 
   def cmd_default(self):
     self.cmd_info()
     self.cmd_tree()
 
   def cmd_author(self):
-    # get the author property, or empty string if the property is not present
-    author = self._get_property(core.SVN_PROP_REVISION_AUTHOR) or ''
-    print(author)
+    print(self.get_author() or '')
 
   def cmd_changed(self):
-    self._print_tree(ChangedEditor, pass_root=1)
+    for status, path in self.get_changed():
+      print("%-3s %s" % (status, path))
 
   def cmd_date(self):
-    if self.txn_ptr:
+    # duplicate original svnlook format, which is
+    # 2010-02-08 21:53:15 +0200 (Mon, 08 Feb 2010)
+    secs = self.get_date(unixtime=True)
+    if secs is None:
       print("")
     else:
-      date = self._get_property(core.SVN_PROP_REVISION_DATE)
-      if date:
-        aprtime = core.svn_time_from_cstring(date)
-        # ### convert to a time_t; this requires intimate knowledge of
-        # ### the apr_time_t type
-        secs = aprtime / 1000000  # aprtime is microseconds; make seconds
-
-        # assume secs in local TZ, convert to tuple, and format
-        ### we don't really know the TZ, do we?
-        print(time.strftime('%Y-%m-%d %H:%M', time.localtime(secs)))
-      else:
-        print("")
+      # convert to tuple, detect time zone and format
+      stamp = time.localtime(secs)
+      isdst = stamp.tm_isdst
+      utcoffset = -(time.altzone if (time.daylight and isdst) else time.timezone) // 60
+
+      suffix = "%+03d%02d" % (utcoffset // 60, abs(utcoffset) % 60)
+      outstr = time.strftime('%Y-%m-%d %H:%M:%S ', stamp) + suffix
+      outstr += time.strftime(' (%a, %d %b %Y)', stamp)
+      print(outstr)
+
 
   def cmd_diff(self):
     self._print_tree(DiffEditor, pass_root=1)
 
   def cmd_dirs_changed(self):
-    self._print_tree(DirsChangedEditor)
+    for dir in self.get_changed_dirs():
+      print(dir)
 
   def cmd_ids(self):
     self._print_tree(Editor, base_rev=0, pass_root=1)
 
   def cmd_info(self):
+    """print the author, data, log_size, and log message"""
     self.cmd_author()
     self.cmd_date()
-    self.cmd_log(1)
-
-  def cmd_log(self, print_size=0):
-    # get the log property, or empty string if the property is not present
-    log = self._get_property(core.SVN_PROP_REVISION_LOG) or ''
-    if print_size:
-      print(len(log))
+    log = self.get_log() or ''
+    print(len(log))
     print(log)
 
+  def cmd_log(self):
+    print(self.get_log() or '')
+
   def cmd_tree(self):
     self._print_tree(Editor, base_rev=0)
 
+
+  # --- API getters
+  def get_author(self):
+    """return string with the author name or None"""
+    return self._get_property(core.SVN_PROP_REVISION_AUTHOR)
+
+  def get_changed(self):
+    """return list of tuples (status, path)"""
+    ret = []
+    def list_callback(status, path):
+      ret.append( (status, path) )
+    self._walk_tree(ChangedEditor, pass_root=1, callback=list_callback)
+    return ret
+
+  def get_date(self, unixtime=False):
+    """return commit timestamp in RFC 3339 format (2010-02-08T20:37:25.195000Z)
+       if unixtime is True, return unix timestamp
+       return None for a txn, or if date property is not set
+    """
+    if self.txn_ptr:
+      return None
+
+    date = self._get_property(core.SVN_PROP_REVISION_DATE)
+    if not unixtime or date == None:
+      return date
+
+    # convert to unix time
+    aprtime = core.svn_time_from_cstring(date)
+    # ### convert to a time_t; this requires intimate knowledge of
+    # ### the apr_time_t type
+    secs = aprtime / 1000000  # aprtime is microseconds; make seconds
+    return secs
+
+  def get_changed_dirs(self):
+    """return list of changed dirs
+       dir names end with trailing forward slash even on windows
+    """
+    dirlist = []
+    def list_callback(item):
+      dirlist.append(item)
+    self._walk_tree(DirsChangedEditor, callback=list_callback)
+    return dirlist
+
+  def get_log(self):
+    """return log message string or None if not present"""
+    return self._get_property(core.SVN_PROP_REVISION_LOG)
+
+
+  # --- Internal helpers
   def _get_property(self, name):
     if self.txn_ptr:
       return fs.txn_prop(self.txn_ptr, name)
     return fs.revision_prop(self.fs_ptr, self.rev, name)
 
   def _print_tree(self, e_factory, base_rev=None, pass_root=0):
+    def print_callback(msg):
+       print(msg)
+    self._walk_tree(e_factory, base_rev, pass_root, callback=print_callback)
+
+  # svn fs, delta, repos calls needs review according to DeltaEditor documentation
+  def _walk_tree(self, e_factory, base_rev=None, pass_root=0, callback=None):
     if base_rev is None:
       # a specific base rev was not provided. use the transaction base,
       # or the previous revision
       if self.txn_ptr:
         base_rev = fs.txn_base_revision(self.txn_ptr)
+      elif self.rev == 0:
+        base_rev = 0
       else:
         base_rev = self.rev - 1
 
@@ -120,10 +217,13 @@ class SVNLook:
     # the base of the comparison
     base_root = fs.revision_root(self.fs_ptr, base_rev)
 
+    if callback == None:
+      callback = lambda msg: None
+
     if pass_root:
-      editor = e_factory(root, base_root)
+      editor = e_factory(root, base_root, callback)
     else:
-      editor = e_factory()
+      editor = e_factory(callback=callback)
 
     # construct the editor for printing these things out
     e_ptr, e_baton = delta.make_editor(editor)
@@ -135,8 +235,17 @@ class SVNLook:
 		    e_ptr, e_baton, authz_cb, 0, 1, 0, 0)
 
 
+# ---------------------------------------------------------
+# Delta Editors. For documentation see:
+# http://subversion.apache.org/docs/community-guide/#docs
+
+# this one doesn't process delete_entry, change_dir_prop, apply_text_delta,
+# change_file_prop, close_file, close_edit, abort_edit
+# ?set_target_revision
+# need review
 class Editor(delta.Editor):
-  def __init__(self, root=None, base_root=None):
+  def __init__(self, root=None, base_root=None, callback=None):
+    """callback argument is unused for this editor"""
     self.root = root
     # base_root ignored
 
@@ -172,7 +281,14 @@ class Editor(delta.Editor):
       return ' <%s>' % fs.unparse_id(id)
     return ''
 
+# doesn't process close_directory, apply_text_delta,
+# change_file_prop, close_file, close_edit, abort_edit
+# ?set_target_revision
 class DirsChangedEditor(delta.Editor):
+  """print names of changed dirs, callback(dir) is a printer function"""
+  def __init__(self, callback):
+    self.callback = callback
+
   def open_root(self, base_revision, dir_pool):
     return [ 1, '' ]
 
@@ -201,13 +317,15 @@ class DirsChangedEditor(delta.Editor):
   def _dir_changed(self, baton):
     if baton[0]:
       # the directory hasn't been printed yet. do it.
-      print(baton[1] + '/')
+      self.callback(baton[1] + '/')
       baton[0] = 0
 
 class ChangedEditor(delta.Editor):
-  def __init__(self, root, base_root):
+  def __init__(self, root, base_root, callback):
+    """callback(status, path) is a printer function"""
     self.root = root
     self.base_root = base_root
+    self.callback = callback
 
   def open_root(self, base_revision, dir_pool):
     return [ 1, '' ]
@@ -215,13 +333,13 @@ class ChangedEditor(delta.Editor):
   def delete_entry(self, path, revision, parent_baton, pool):
     ### need more logic to detect 'replace'
     if fs.is_dir(self.base_root, '/' + path):
-      print('D   ' + path + '/')
+      self.callback('D', path + '/')
     else:
-      print('D   ' + path)
+      self.callback('D', path)
 
   def add_directory(self, path, parent_baton,
                     copyfrom_path, copyfrom_revision, dir_pool):
-    print('A   ' + path + '/')
+    self.callback('A', path + '/')
     return [ 0, path ]
 
   def open_directory(self, path, parent_baton, base_revision, dir_pool):
@@ -230,12 +348,12 @@ class ChangedEditor(delta.Editor):
   def change_dir_prop(self, dir_baton, name, value, pool):
     if dir_baton[0]:
       # the directory hasn't been printed yet. do it.
-      print('_U  ' + dir_baton[1] + '/')
+      self.callback('_U', dir_baton[1] + '/')
       dir_baton[0] = 0
 
   def add_file(self, path, parent_baton,
                copyfrom_path, copyfrom_revision, file_pool):
-    print('A   ' + path)
+    self.callback('A', path)
     return [ '_', ' ', None ]
 
   def open_file(self, path, parent_baton, base_revision, file_pool):
@@ -257,11 +375,12 @@ class ChangedEditor(delta.Editor):
       status = text_mod + prop_mod
       # was there some kind of change?
       if status != '_ ':
-        print(status + '  ' + path)
+        self.callback(status.rstrip(), path)
 
 
 class DiffEditor(delta.Editor):
-  def __init__(self, root, base_root):
+  def __init__(self, root, base_root, callback=None):
+    """callback argument is unused for this editor"""
     self.root = root
     self.base_root = base_root
     self.target_revision = 0
@@ -435,7 +554,7 @@ def main():
   if not hasattr(SVNLook, 'cmd_' + cmd):
     usage(1)
 
-  SVNLook(sys.argv[1], cmd, rev, txn)
+  SVNLook(sys.argv[1], rev, txn, cmd)
 
 if __name__ == '__main__':
   main()

Propchange: subversion/branches/log-addressing/tools/examples/svnlook.py
------------------------------------------------------------------------------
    svn:keywords = URL Date Revision

Modified: subversion/branches/log-addressing/tools/server-side/mod_dontdothat/mod_dontdothat.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/server-side/mod_dontdothat/mod_dontdothat.c?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/server-side/mod_dontdothat/mod_dontdothat.c (original)
+++ subversion/branches/log-addressing/tools/server-side/mod_dontdothat/mod_dontdothat.c Wed Nov 27 08:19:45 2013
@@ -30,12 +30,15 @@
 #include <util_filter.h>
 #include <ap_config.h>
 #include <apr_strings.h>
+#include <apr_uri.h>
 
 #include <expat.h>
 
 #include "mod_dav_svn.h"
 #include "svn_string.h"
 #include "svn_config.h"
+#include "svn_path.h"
+#include "private/svn_fspath.h"
 
 module AP_MODULE_DECLARE_DATA dontdothat_module;
 
@@ -161,26 +164,71 @@ matches(const char *wc, const char *p)
     }
 }
 
+/* duplicate of dav_svn__log_err() from mod_dav_svn/util.c */
+static void
+log_dav_err(request_rec *r,
+            dav_error *err,
+            int level)
+{
+    dav_error *errscan;
+
+    /* Log the errors */
+    /* ### should have a directive to log the first or all */
+    for (errscan = err; errscan != NULL; errscan = errscan->prev) {
+        apr_status_t status;
+
+        if (errscan->desc == NULL)
+            continue;
+
+#if AP_MODULE_MAGIC_AT_LEAST(20091119,0)
+        status = errscan->aprerr;
+#else
+        status = errscan->save_errno;
+#endif
+
+        ap_log_rerror(APLOG_MARK, level, status, r,
+                      "%s  [%d, #%d]",
+                      errscan->desc, errscan->status, errscan->error_id);
+    }
+}
+
 static svn_boolean_t
 is_this_legal(dontdothat_filter_ctx *ctx, const char *uri)
 {
   const char *relative_path;
   const char *cleaned_uri;
   const char *repos_name;
+  const char *uri_path;
   int trailing_slash;
   dav_error *derr;
 
-  /* Ok, so we need to skip past the scheme, host, etc. */
-  uri = ap_strstr_c(uri, "://");
-  if (uri)
-    uri = ap_strchr_c(uri + 3, '/');
+  /* uri can be an absolute uri or just a path, we only want the path to match
+   * against */
+  if (uri && svn_path_is_url(uri))
+    {
+      apr_uri_t parsed_uri;
+      apr_status_t rv = apr_uri_parse(ctx->r->pool, uri, &parsed_uri);
+      if (APR_SUCCESS != rv)
+        {
+          /* Error parsing the URI, log and reject request. */
+          ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, ctx->r,
+                        "mod_dontdothat: blocked request after failing "
+                        "to parse uri: '%s'", uri);
+          return FALSE;
+        }
+      uri_path = parsed_uri.path;
+    }
+  else
+    {
+      uri_path = uri;
+    }
 
-  if (uri)
+  if (uri_path)
     {
       const char *repos_path;
 
       derr = dav_svn_split_uri(ctx->r,
-                               uri,
+                               uri_path,
                                ctx->cfg->base_path,
                                &cleaned_uri,
                                &trailing_slash,
@@ -194,7 +242,7 @@ is_this_legal(dontdothat_filter_ctx *ctx
           if (! repos_path)
             repos_path = "";
 
-          repos_path = apr_psprintf(ctx->r->pool, "/%s", repos_path);
+          repos_path = svn_fspath__canonicalize(repos_path, ctx->r->pool);
 
           /* First check the special cases that are always legal... */
           for (idx = 0; idx < ctx->allow_recursive_ops->nelts; ++idx)
@@ -228,6 +276,19 @@ is_this_legal(dontdothat_filter_ctx *ctx
                 }
             }
         }
+      else
+        {
+          log_dav_err(ctx->r, derr, APLOG_ERR);
+          return FALSE;
+        }
+
+    }
+  else
+    {
+      ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r,
+                    "mod_dontdothat: empty uri passed to is_this_legal(), "
+                    "module bug?");
+      return FALSE;
     }
 
   return TRUE;

Modified: subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.c?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.c (original)
+++ subversion/branches/log-addressing/tools/server-side/svn-rep-sharing-stats.c Wed Nov 27 08:19:45 2013
@@ -79,7 +79,6 @@ help(const apr_getopt_option_t *options,
       ++options;
     }
   svn_error_clear(svn_cmdline_fprintf(stdout, pool, "\n"));
-  exit(0);
 }
 
 
@@ -424,14 +423,17 @@ static svn_error_t *process(const char *
   return SVN_NO_ERROR;
 }
 
-int
-main(int argc, const char *argv[])
+/*
+ * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
+ * either return an error to be displayed, or set *EXIT_CODE to non-zero and
+ * return SVN_NO_ERROR.
+ */
+static svn_error_t *
+sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
 {
   const char *repos_path;
-  apr_pool_t *pool;
   svn_boolean_t prop = FALSE, data = FALSE;
   svn_boolean_t quiet = FALSE;
-  svn_error_t *err;
   apr_getopt_t *os;
   const apr_getopt_option_t options[] =
     {
@@ -445,25 +447,12 @@ main(int argc, const char *argv[])
       {0,             0,  0,  0}
     };
 
-  /* Initialize the app. */
-  if (svn_cmdline_init("svn-rep-sharing-stats", stderr) != EXIT_SUCCESS)
-    return EXIT_FAILURE;
-
-  /* Create our top-level pool.  Use a separate mutexless allocator,
-   * given this application is single threaded.
-   */
-  pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
-
   /* Check library versions */
-  err = check_lib_versions();
-  if (err)
-    return svn_cmdline_handle_exit_error(err, pool, "svn-rep-sharing-stats: ");
+  SVN_ERR(check_lib_versions());
 
-  err = svn_cmdline__getopt_init(&os, argc, argv, pool);
-  if (err)
-    return svn_cmdline_handle_exit_error(err, pool, "svn-rep-sharing-stats: ");
+  SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
 
-  SVN_INT_ERR(check_experimental());
+  SVN_ERR(check_experimental());
 
   os->interleave = 1;
   while (1)
@@ -476,7 +465,8 @@ main(int argc, const char *argv[])
       if (status != APR_SUCCESS)
         {
           usage(pool);
-          return EXIT_FAILURE;
+          *exit_code = EXIT_FAILURE;
+          return SVN_NO_ERROR;
         }
       switch (opt)
         {
@@ -496,14 +486,14 @@ main(int argc, const char *argv[])
           break;
         case 'h':
           help(options, pool);
-          break;
+          return SVN_NO_ERROR;
         case OPT_VERSION:
-          SVN_INT_ERR(version(pool));
-          exit(0);
-          break;
+          SVN_ERR(version(pool));
+          return SVN_NO_ERROR;
         default:
           usage(pool);
-          return EXIT_FAILURE;
+          *exit_code = EXIT_FAILURE;
+          return SVN_NO_ERROR;
         }
     }
 
@@ -513,23 +503,51 @@ main(int argc, const char *argv[])
   if (os->ind + 1 != argc || (!data && !prop))
     {
       usage(pool);
-      return EXIT_FAILURE;
+      *exit_code = EXIT_FAILURE;
+      return SVN_NO_ERROR;
     }
 
   /* Grab REPOS_PATH from argv. */
-  SVN_INT_ERR(svn_utf_cstring_to_utf8(&repos_path, os->argv[os->ind], pool));
+  SVN_ERR(svn_utf_cstring_to_utf8(&repos_path, os->argv[os->ind], pool));
   repos_path = svn_dirent_internal_style(repos_path, pool);
 
   set_up_cancellation();
 
   /* Do something. */
-  SVN_INT_ERR(process(repos_path, prop, data, quiet, pool));
+  SVN_ERR(process(repos_path, prop, data, quiet, pool));
 
   /* We're done. */
+  return SVN_NO_ERROR;
+}
 
-  svn_pool_destroy(pool);
-  /* Flush stdout to make sure that the user will see any printing errors. */
-  SVN_INT_ERR(svn_cmdline_fflush(stdout));
+int
+main(int argc, const char *argv[])
+{
+  apr_pool_t *pool;
+  int exit_code = EXIT_SUCCESS;
+  svn_error_t *err;
+
+  /* Initialize the app. */
+  if (svn_cmdline_init("svn-rep-sharing-stats", stderr) != EXIT_SUCCESS)
+    return EXIT_FAILURE;
+
+  /* Create our top-level pool.  Use a separate mutexless allocator,
+   * given this application is single threaded.
+   */
+  pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
+
+  err = sub_main(&exit_code, argc, argv, pool);
+
+  /* Flush stdout and report if it fails. It would be flushed on exit anyway
+     but this makes sure that output is not silently lost if it fails. */
+  err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
 
-  return EXIT_SUCCESS;
+  if (err)
+    {
+      exit_code = EXIT_FAILURE;
+      svn_cmdline_handle_exit_error(err, NULL, "svn-rep-sharing-stats: ");
+    }
+
+  svn_pool_destroy(pool);
+  return exit_code;
 }

Modified: subversion/branches/log-addressing/tools/server-side/svnauthz.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/tools/server-side/svnauthz.c?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/tools/server-side/svnauthz.c (original)
+++ subversion/branches/log-addressing/tools/server-side/svnauthz.c Wed Nov 27 08:19:45 2013
@@ -382,42 +382,6 @@ subcommand_accessof(apr_getopt_t *os, vo
 #undef EXIT_FAILURE
 #define EXIT_FAILURE 2
 
-/* Similar to svn_cmdline_handle_exit_error but with an exit_code argument
-   so we can comply with our contract and exit with 2 for internal failures.
-   Also is missing the pool argument since we don't need it given
-   main/sub_main. */
-static int
-handle_exit_error(svn_error_t *err, const char *prefix, int exit_code)
-{
-  /* Issue #3014:
-   * Don't print anything on broken pipes. The pipe was likely
-   * closed by the process at the other end. We expect that
-   * process to perform error reporting as necessary.
-   *
-   * ### This assumes that there is only one error in a chain for
-   * ### SVN_ERR_IO_PIPE_WRITE_ERROR. See svn_cmdline_fputs(). */
-  if (err->apr_err != SVN_ERR_IO_PIPE_WRITE_ERROR)
-    svn_handle_error2(err, stderr, FALSE, prefix);
-  svn_error_clear(err);
-  return exit_code;
-}
-
-/* Report and clear the error ERR, and return EXIT_FAILURE. */
-#define EXIT_ERROR(err, exit_code)                               \
-  handle_exit_error(err, "svnauthz: ", exit_code)
-
-/* A redefinition of the public SVN_INT_ERR macro, that suppresses the
- * error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR, amd with the
- * program name 'svnauthz' instead of 'svn'. */
-#undef SVN_INT_ERR
-#define SVN_INT_ERR(expr)                                        \
-  do {                                                           \
-    svn_error_t *svn_err__temp = (expr);                         \
-    if (svn_err__temp)                                           \
-      return EXIT_ERROR(svn_err__temp, EXIT_FAILURE);            \
-  } while (0)
-
-
 /* Return TRUE if the UI of 'svnauthz-validate' (svn 1.7 and earlier)
    should be emulated, given argv[0]. */
 static svn_boolean_t
@@ -485,8 +449,13 @@ canonicalize_access_file(const char **ca
   return SVN_NO_ERROR;
 }
 
-static int
-sub_main(int argc, const char *argv[], apr_pool_t *pool)
+/*
+ * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
+ * either return an error to be displayed, or set *EXIT_CODE to non-zero and
+ * return SVN_NO_ERROR.
+ */
+static svn_error_t *
+sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
 {
   svn_error_t *err;
 
@@ -497,7 +466,7 @@ sub_main(int argc, const char *argv[], a
   int i;
 
   /* Initialize the FS library. */
-  SVN_INT_ERR(svn_fs_initialize(pool));
+  SVN_ERR(svn_fs_initialize(pool));
 
   received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
 
@@ -506,7 +475,7 @@ sub_main(int argc, const char *argv[], a
   opt_state.txn = opt_state.repos_path = opt_state.groups_file = NULL;
 
   /* Parse options. */
-  SVN_INT_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
+  SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
   os->interleave = 1;
 
   if (!use_compat_mode(argv[0], pool))
@@ -521,8 +490,9 @@ sub_main(int argc, const char *argv[], a
             break;
           if (status != APR_SUCCESS)
             {
-              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
-              return EXIT_FAILURE;
+              SVN_ERR(subcommand_help(NULL, NULL, pool));
+              *exit_code = EXIT_FAILURE;
+              return SVN_NO_ERROR;
             }
 
           /* Stash the option code in an array before parsing it. */
@@ -535,7 +505,7 @@ sub_main(int argc, const char *argv[], a
               opt_state.help = TRUE;
               break;
             case 't':
-              SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.txn, arg, pool));
+              SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.txn, arg, pool));
               break;
             case 'R':
               opt_state.recursive = TRUE;
@@ -544,28 +514,29 @@ sub_main(int argc, const char *argv[], a
               opt_state.version = TRUE;
               break;
             case svnauthz__username:
-              SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.username, arg, pool));
+              SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.username, arg, pool));
               break;
             case svnauthz__path:
-              SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.fspath, arg, pool));
+              SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.fspath, arg, pool));
               opt_state.fspath = svn_fspath__canonicalize(opt_state.fspath,
                                                           pool);
               break;
             case svnauthz__repos:
-              SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.repos_name, arg, pool));
+              SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.repos_name, arg, pool));
               break;
             case svnauthz__is:
-              SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.is, arg, pool));
+              SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.is, arg, pool));
               break;
             case svnauthz__groups_file:
-              SVN_INT_ERR(
+              SVN_ERR(
                   svn_utf_cstring_to_utf8(&opt_state.groups_file,
                                           arg, pool));
               break;
             default:
                 {
-                  SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
-                  return EXIT_FAILURE;
+                  SVN_ERR(subcommand_help(NULL, NULL, pool));
+                  *exit_code = EXIT_FAILURE;
+                  return SVN_NO_ERROR;
                 }
             }
         }
@@ -603,8 +574,9 @@ sub_main(int argc, const char *argv[], a
             {
               svn_error_clear(svn_cmdline_fprintf(stderr, pool,
                                         ("subcommand argument required\n")));
-              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
-              return EXIT_FAILURE;
+              SVN_ERR(subcommand_help(NULL, NULL, pool));
+              *exit_code = EXIT_FAILURE;
+              return SVN_NO_ERROR;
             }
         }
       else
@@ -616,14 +588,15 @@ sub_main(int argc, const char *argv[], a
               const char *first_arg_utf8;
 
               os->ind++;
-              SVN_INT_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
+              SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8,
                                                   first_arg, pool));
               svn_error_clear(
                 svn_cmdline_fprintf(stderr, pool,
                                     ("Unknown subcommand: '%s'\n"),
                                     first_arg_utf8));
-              SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
-              return EXIT_FAILURE;
+              SVN_ERR(subcommand_help(NULL, NULL, pool));
+              *exit_code = EXIT_FAILURE;
+              return SVN_NO_ERROR;
             }
         }
     }
@@ -637,13 +610,12 @@ sub_main(int argc, const char *argv[], a
         {
           if (os->ind +2 != argc)
             {
-              err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                     ("Repository and authz file arguments "
-                                      "required"));
-              return EXIT_ERROR(err, EXIT_FAILURE);
+              return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                      ("Repository and authz file arguments "
+                                       "required"));
             }
 
-          SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.repos_path, os->argv[os->ind],
+          SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.repos_path, os->argv[os->ind],
                                               pool));
           os->ind++;
 
@@ -653,24 +625,23 @@ sub_main(int argc, const char *argv[], a
       /* Exactly 1 non-option argument */
       if (os->ind + 1 != argc)
         {
-          err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                 ("Authz file argument required"));
-          return EXIT_ERROR(err, EXIT_FAILURE);
+          return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                  ("Authz file argument required"));
         }
 
       /* Grab AUTHZ_FILE from argv. */
-      SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.authz_file, os->argv[os->ind],
+      SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.authz_file, os->argv[os->ind],
                                           pool));
 
       /* Canonicalize opt_state.authz_file appropriately. */
-      SVN_INT_ERR(canonicalize_access_file(&opt_state.authz_file,
+      SVN_ERR(canonicalize_access_file(&opt_state.authz_file,
                                            opt_state.authz_file,
                                            opt_state.txn != NULL, pool));
 
       /* Same for opt_state.groups_file if it is present. */
       if (opt_state.groups_file)
         {
-          SVN_INT_ERR(canonicalize_access_file(&opt_state.groups_file,
+          SVN_ERR(canonicalize_access_file(&opt_state.groups_file,
                                                opt_state.groups_file,
                                                opt_state.txn != NULL, pool));
         }
@@ -696,13 +667,14 @@ sub_main(int argc, const char *argv[], a
                                           pool);
           svn_opt_format_option(&optstr, badopt, FALSE, pool);
           if (subcommand->name[0] == '-')
-            SVN_INT_ERR(subcommand_help(NULL, NULL, pool));
+            SVN_ERR(subcommand_help(NULL, NULL, pool));
           else
             svn_error_clear(svn_cmdline_fprintf(stderr, pool,
                             ("Subcommand '%s' doesn't accept option '%s'\n"
                              "Type 'svnauthz help %s' for usage.\n"),
                             subcommand->name, optstr, subcommand->name));
-          return EXIT_FAILURE;
+          *exit_code = EXIT_FAILURE;
+          return SVN_NO_ERROR;
         }
     }
 
@@ -724,7 +696,8 @@ sub_main(int argc, const char *argv[], a
         {
           /* Follow our contract that says we exit with 1 if the file does not
              validate. */
-          return EXIT_ERROR(err, 1);
+          *exit_code = 1;
+          return err;
         }
       else if (err->apr_err == SVN_ERR_AUTHZ_UNREADABLE
                || err->apr_err == SVN_ERR_AUTHZ_UNWRITABLE
@@ -732,31 +705,22 @@ sub_main(int argc, const char *argv[], a
         {
           /* Follow our contract that says we exit with 3 if --is does not
            * match. */
-          return EXIT_ERROR(err, 3);
+          *exit_code = 3;
+          return err;
         }
 
-
-      return EXIT_ERROR(err, EXIT_FAILURE);
-    }
-  else
-    {
-      /* Ensure that everything is written to stdout, so the user will
-         see any print errors. */
-      err = svn_cmdline_fflush(stdout);
-      if (err)
-        {
-          return EXIT_ERROR(err, EXIT_FAILURE);
-        }
-      return EXIT_SUCCESS;
+      return err;
     }
 
+  return SVN_NO_ERROR;
 }
 
 int
 main(int argc, const char *argv[])
 {
   apr_pool_t *pool;
-  int exit_code;
+  int exit_code = EXIT_SUCCESS;
+  svn_error_t *err;
 
   /* Initialize the app.  Send all error messages to 'stderr'.  */
   if (svn_cmdline_init(argv[0], stderr) != EXIT_SUCCESS)
@@ -764,7 +728,18 @@ main(int argc, const char *argv[])
 
   pool = svn_pool_create(NULL);
 
-  exit_code = sub_main(argc, argv, pool);
+  err = sub_main(&exit_code, argc, argv, pool);
+
+  /* Flush stdout and report if it fails. It would be flushed on exit anyway
+     but this makes sure that output is not silently lost if it fails. */
+  err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
+
+  if (err)
+    {
+      if (exit_code == 0)
+        exit_code = EXIT_FAILURE;
+      svn_cmdline_handle_exit_error(err, NULL, "svnauthz: ");
+    }
 
   svn_pool_destroy(pool);
   return exit_code;

Modified: subversion/branches/log-addressing/win-tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/win-tests.py?rev=1545958&r1=1545957&r2=1545958&view=diff
==============================================================================
--- subversion/branches/log-addressing/win-tests.py (original)
+++ subversion/branches/log-addressing/win-tests.py Wed Nov 27 08:19:45 2013
@@ -336,6 +336,10 @@ def locate_libs():
       if os.path.exists(src):
         copy_changed_file(src, to_dir=abs_builddir, cleanup=False)
 
+    for name in lib.extra_bin:
+      src = os.path.join(dir, name)
+      copy_changed_file(src, to_dir=abs_builddir)
+
 
   # Copy the Subversion library DLLs
   for i in gen_obj.graph.get_all_sources(gen_base.DT_INSTALL):
@@ -476,15 +480,9 @@ class Httpd:
     self._create_mime_types_file()
     self._create_dontdothat_file()
 
-    # Determine version.
-    if os.path.exists(os.path.join(self.httpd_dir,
-                                   'modules', 'mod_access_compat.so')):
-      self.httpd_ver = 2.3
-    elif os.path.exists(os.path.join(self.httpd_dir,
-                                     'modules', 'mod_auth_basic.so')):
-      self.httpd_ver = 2.2
-    else:
-      self.httpd_ver = 2.0
+    # Obtain version.
+    version_vals = gen_obj._libraries['httpd'].version.split('.')
+    self.httpd_ver = float('%s.%s' % (version_vals[0], version_vals[1]))
 
     # Create httpd config file
     fp = open(self.httpd_config, 'w')
@@ -773,42 +771,59 @@ if not test_javahl and not test_swig:
     os.chdir(old_cwd)
 elif test_javahl:
   failed = False
-  args = (
-          'java.exe',
-          '-Dtest.rootdir=' + os.path.join(abs_builddir, 'javahl'),
-          '-Dtest.srcdir=' + os.path.join(abs_srcdir,
-                                          'subversion/bindings/javahl'),
-          '-Dtest.rooturl=',
-          '-Dtest.fstype=' + fs_type ,
-          '-Dtest.tests=',
-
-          '-Djava.library.path='
-                    + os.path.join(abs_objdir,
-                                   'subversion/bindings/javahl/native'),
-          '-classpath',
-          os.path.join(abs_srcdir, 'subversion/bindings/javahl/classes') +';' +
-            gen_obj.junit_path
-         )
-
-  sys.stderr.flush()
-  print('Running org.apache.subversion tests:')
-  sys.stdout.flush()
-
-  r = subprocess.call(args + tuple(['org.apache.subversion.javahl.RunTests']))
-  sys.stdout.flush()
-  sys.stderr.flush()
-  if (r != 0):
-    print('[Test runner reported failure]')
-    failed = True
 
-  print('Running org.tigris.subversion tests:')
-  sys.stdout.flush()
-  r = subprocess.call(args + tuple(['org.tigris.subversion.javahl.RunTests']))
-  sys.stdout.flush()
-  sys.stderr.flush()
-  if (r != 0):
-    print('[Test runner reported failure]')
-    failed = True
+  java_exe = None
+
+  for path in os.environ["PATH"].split(os.pathsep):
+    if os.path.isfile(os.path.join(path, 'java.exe')):
+      java_exe = os.path.join(path, 'java.exe')
+      break
+
+  if not java_exe and 'java_sdk' in gen_obj._libraries:
+    jdk = gen_obj._libraries['java_sdk']
+
+    if os.path.isfile(os.path.join(jdk.lib_dir, '../bin/java.exe')):
+      java_exe = os.path.join(jdk.lib_dir, '../bin/java.exe')
+
+  if not java_exe:
+    print('Java not found. Skipping Java tests')
+  else:
+    args = (
+            os.path.abspath(java_exe),
+            '-Dtest.rootdir=' + os.path.join(abs_builddir, 'javahl'),
+            '-Dtest.srcdir=' + os.path.join(abs_srcdir,
+                                            'subversion/bindings/javahl'),
+            '-Dtest.rooturl=',
+            '-Dtest.fstype=' + fs_type ,
+            '-Dtest.tests=',
+  
+            '-Djava.library.path='
+                      + os.path.join(abs_objdir,
+                                     'subversion/bindings/javahl/native'),
+            '-classpath',
+            os.path.join(abs_srcdir, 'subversion/bindings/javahl/classes') +';' +
+              gen_obj.junit_path
+           )
+
+    sys.stderr.flush()
+    print('Running org.apache.subversion tests:')
+    sys.stdout.flush()
+
+    r = subprocess.call(args + tuple(['org.apache.subversion.javahl.RunTests']))
+    sys.stdout.flush()
+    sys.stderr.flush()
+    if (r != 0):
+      print('[Test runner reported failure]')
+      failed = True
+
+    print('Running org.tigris.subversion tests:')
+    sys.stdout.flush()
+    r = subprocess.call(args + tuple(['org.tigris.subversion.javahl.RunTests']))
+    sys.stdout.flush()
+    sys.stderr.flush()
+    if (r != 0):
+      print('[Test runner reported failure]')
+      failed = True
 elif test_swig == 'perl':
   failed = False
   swig_dir = os.path.join(abs_builddir, 'swig')