Modified: subversion/branches/fsfs-improvements/subversion/svnauth/svnauth.c URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/svnauth/svnauth.c?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/subversion/svnauth/svnauth.c (original) +++ subversion/branches/fsfs-improvements/subversion/svnauth/svnauth.c Thu Jul 11 16:00:50 2013 @@ -27,10 +27,17 @@ #include <apr_getopt.h> #include <apr_tables.h> +#include "svn_private_config.h" + +#ifdef SVN_HAVE_SERF +#include <serf.h> +#endif + #include "svn_pools.h" #include "svn_error.h" #include "svn_opt.h" #include "svn_dirent_uri.h" +#include "svn_hash.h" #include "svn_utf.h" #include "svn_cmdline.h" #include "svn_config.h" @@ -38,8 +45,7 @@ #include "svn_sorts.h" #include "private/svn_cmdline_private.h" - -#include "svn_private_config.h" +#include "private/svn_token.h" /* Baton for passing option/argument state to a subcommand function. */ struct svnauth_opt_state @@ -47,12 +53,14 @@ struct svnauth_opt_state const char *config_dir; /* --config-dir */ svn_boolean_t version; /* --version */ svn_boolean_t help; /* --help */ + svn_boolean_t show_passwords; /* --show-passwords */ }; -typedef enum svn_cl__longopt_t { +typedef enum svnauth__longopt_t { opt_config_dir = SVN_OPT_FIRST_LONGOPT_ID, + opt_show_passwords, opt_version -} svn_cl__longopt_t; +} svnauth__longopt_t; /** Subcommands. **/ static svn_opt_subcommand_t @@ -72,7 +80,7 @@ static const svn_opt_subcommand_desc2_t {"list", subcommand_list, {0}, N_ ("usage: svnauth list\n\n" "List cached authentication credentials.\n"), - {0} }, + {opt_config_dir, opt_show_passwords} }, {NULL} }; @@ -88,8 +96,9 @@ static const apr_getopt_option_t options {"config-dir", opt_config_dir, 1, N_("use auth cache in config directory ARG")}, - {"version", opt_version, 0, - N_("show program version information")}, + {"show-passwords", opt_show_passwords, 0, N_("show cached passwords")}, + + {"version", opt_version, 0, N_("show program version information")}, {NULL} }; @@ -122,10 +131,10 @@ subcommand_help(apr_getopt_t *os, void * */ #if (defined(WIN32) && !defined(__MINGW32__)) footer = apr_psprintf(pool, _("%s Wincrypt cache in %s\n"), - footer, config_path); + footer, svn_dirent_local_style(config_path, pool)); #elif !defined(SVN_DISABLE_PLAINTEXT_PASSWORD_STORAGE) footer = apr_psprintf(pool, _("%s Plaintext cache in %s\n"), - footer, config_path); + footer, svn_dirent_local_style(config_path, pool)); #endif #ifdef SVN_HAVE_GNOME_KEYRING footer = apr_pstrcat(pool, footer, " Gnome Keyring\n", NULL); @@ -150,38 +159,344 @@ subcommand_help(apr_getopt_t *os, void * return SVN_NO_ERROR; } +/* The separator between credentials . */ +#define SEP_STRING \ + "------------------------------------------------------------------------\n" + +#ifdef SVN_HAVE_SERF +/* Because APR hash order is unstable we use a token map of keys + * to ensure values are always presented in the same order. */ +typedef enum svnauth__cert_info_keys { + svnauth__cert_key_cn, + svnauth__cert_key_e, + svnauth__cert_key_ou, + svnauth__cert_key_o, + svnauth__cert_key_l, + svnauth__cert_key_st, + svnauth__cert_key_c, + svnauth__cert_key_sha1, + svnauth__cert_key_not_before, + svnauth__cert_key_not_after, +} svnauth__cert_info_keys; + +svn_token_map_t cert_info_key_map[] = { + { "CN", svnauth__cert_key_cn }, + { "E", svnauth__cert_key_e }, + { "OU", svnauth__cert_key_ou }, + { "O", svnauth__cert_key_o }, + { "L", svnauth__cert_key_l }, + { "ST", svnauth__cert_key_st }, + { "C", svnauth__cert_key_c }, + { "sha1", svnauth__cert_key_sha1 }, + { "notBefore", svnauth__cert_key_not_before }, + { "notAfter", svnauth__cert_key_not_after } +}; + +/* Show information stored in CERT_INFO. + * Assume all hash table keys occur in the above key map. */ +static svn_error_t * +show_cert_info(apr_hash_t *cert_info, + apr_pool_t *scratch_pool) +{ + int i; + + for (i = 0; i < sizeof(cert_info_key_map) / sizeof(svn_token_map_t); i++) + { + const char *key = cert_info_key_map[i].str; + const char *value = svn_hash_gets(cert_info, key); + + if (value) + { + int token; + + token = svn_token__from_word(cert_info_key_map, key); + switch (token) + { + case svnauth__cert_key_cn: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" Common Name: %s\n"), value)); + break; + case svnauth__cert_key_e: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" Email Address: %s\n"), value)); + break; + case svnauth__cert_key_ou: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" Organizational Unit: %s\n"), + value)); + break; + case svnauth__cert_key_l: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" Locality: %s\n"), value)); + break; + case svnauth__cert_key_st: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" State or Province: %s\n"), + value)); + break; + case svnauth__cert_key_c: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" Country: %s\n"), value)); + break; + case svnauth__cert_key_sha1: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" SHA1 Fingerprint: %s\n"), + value)); + break; + case svnauth__cert_key_not_before: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" Valid as of: %s\n"), value)); + break; + case svnauth__cert_key_not_after: + SVN_ERR(svn_cmdline_printf(scratch_pool, + _(" Valid until: %s\n"), value)); + break; + case SVN_TOKEN_UNKNOWN: + default: + break; + } + } + } + + return SVN_NO_ERROR; +} + +#define MAX_CERT_LINE_LEN 78 + +/* Break ASCII_CERT into lines of at most MAX_CERT_LINE_LEN characters. + * Otherwise, OpenSSL won't parse it due to the way it is invoked by serf. */ +static const char * +split_ascii_cert(const char *ascii_cert, + apr_pool_t *result_pool) +{ + apr_array_header_t *lines; + int i; + apr_size_t cert_len, nlines; + const char *p; + svn_stringbuf_t *line; + + p = ascii_cert; + cert_len = strlen(ascii_cert); + nlines = cert_len / MAX_CERT_LINE_LEN; + lines = apr_array_make(result_pool, 22, sizeof(const char *)); + for (i = 0; i < nlines; i++) + { + line = svn_stringbuf_create_ensure(MAX_CERT_LINE_LEN, result_pool); + svn_stringbuf_appendbytes(line, p, MAX_CERT_LINE_LEN); + p += MAX_CERT_LINE_LEN; + APR_ARRAY_PUSH(lines, const char *) = line->data; + } + if (*p) + { + line = svn_stringbuf_create_ensure(MAX_CERT_LINE_LEN, result_pool); + while (*p) + svn_stringbuf_appendbyte(line, *p++); + APR_ARRAY_PUSH(lines, const char *) = line->data; + } + + return svn_cstring_join(lines, "\n", result_pool); +} +#endif /* SVN_HAVE_SERF */ + +/* ### from libsvn_subr/ssl_server_trust_providers.c */ +#define AUTHN_ASCII_CERT_KEY "ascii_cert" +#define AUTHN_FAILURES_KEY "failures" + +/* Display the base64-encoded DER certificate ASCII_CERT. */ +static svn_error_t * +show_ascii_cert(const char *ascii_cert, + apr_pool_t *scratch_pool) +{ +#ifdef SVN_HAVE_SERF + apr_file_t *pem_file; + const char *pem_path; + const char *pem; + apr_size_t pem_len; + apr_size_t written; + apr_status_t status; + serf_ssl_certificate_t *cert; + apr_hash_t *cert_info; + + SVN_ERR(svn_io_open_unique_file3(&pem_file, &pem_path, NULL, + svn_io_file_del_on_pool_cleanup, + scratch_pool, scratch_pool)); + pem = apr_psprintf(scratch_pool, "%s%s%s", + "-----BEGIN CERTIFICATE-----\n", + split_ascii_cert(ascii_cert, scratch_pool), + "-----END CERTIFICATE-----\n"); + pem_len = strlen(pem); + SVN_ERR(svn_io_file_write_full(pem_file, pem, pem_len, &written, + scratch_pool)); + if (written != pem_len) + { + SVN_ERR(svn_cmdline_printf(scratch_pool, + _("Base64-encoded certificate: %s\n"), + ascii_cert)); + return SVN_NO_ERROR; + } + SVN_ERR(svn_io_file_flush_to_disk(pem_file, scratch_pool)); + + status = serf_ssl_load_cert_file(&cert, pem_path, scratch_pool); + if (status) + { + svn_error_t *err; + + err = svn_error_wrap_apr(status, _("serf error: %s"), + serf_error_string(status)); + svn_handle_warning2(stderr, err, "svnauth: "); + svn_error_clear(err); + + SVN_ERR(svn_cmdline_printf(scratch_pool, + _("Base64-encoded certificate: %s\n"), + ascii_cert)); + return SVN_NO_ERROR; + } + + cert_info = serf_ssl_cert_issuer(cert, scratch_pool); + if (cert_info && apr_hash_count(cert_info) > 0) + { + SVN_ERR(svn_cmdline_printf(scratch_pool, _("Certificate issuer:\n"))); + SVN_ERR(show_cert_info(cert_info, scratch_pool)); + } + + cert_info = serf_ssl_cert_subject(cert, scratch_pool); + if (cert_info && apr_hash_count(cert_info) > 0) + { + SVN_ERR(svn_cmdline_printf(scratch_pool, _("Certificate subject:\n"))); + SVN_ERR(show_cert_info(cert_info, scratch_pool)); + } + + cert_info = serf_ssl_cert_certificate(cert, scratch_pool); + if (cert_info && apr_hash_count(cert_info) > 0) + { + SVN_ERR(svn_cmdline_printf(scratch_pool, _("Certificate validity:\n"))); + SVN_ERR(show_cert_info(cert_info, scratch_pool)); + } +#else + SVN_ERR(svn_cmdline_printf(scratch_pool, + _("Base64-encoded certificate: %s\n"), + ascii_cert)); +#endif /* SVN_HAVE_SERF */ + + return SVN_NO_ERROR; +} + +static svn_error_t * +show_cert_failures(const char *failure_string, + apr_pool_t *scratch_pool) +{ + unsigned int failures; + + SVN_ERR(svn_cstring_atoui(&failures, failure_string)); + + if (0 == (failures & (SVN_AUTH_SSL_NOTYETVALID | SVN_AUTH_SSL_EXPIRED | + SVN_AUTH_SSL_CNMISMATCH | SVN_AUTH_SSL_UNKNOWNCA | + SVN_AUTH_SSL_OTHER))) + return SVN_NO_ERROR; + + SVN_ERR(svn_cmdline_printf( + scratch_pool, _("Automatic certificate validity check failed " + "because:\n"))); + + if (failures & SVN_AUTH_SSL_NOTYETVALID) + SVN_ERR(svn_cmdline_printf( + scratch_pool, _(" The certificate is not yet valid.\n"))); + + if (failures & SVN_AUTH_SSL_EXPIRED) + SVN_ERR(svn_cmdline_printf( + scratch_pool, _(" The certificate has expired.\n"))); + + if (failures & SVN_AUTH_SSL_CNMISMATCH) + SVN_ERR(svn_cmdline_printf( + scratch_pool, _(" The certificate's Common Name (hostname) " + "does not match the remote hostname.\n"))); + + if (failures & SVN_AUTH_SSL_UNKNOWNCA) + SVN_ERR(svn_cmdline_printf( + scratch_pool, _(" The certificate issuer is unknown.\n"))); + + if (failures & SVN_AUTH_SSL_OTHER) + SVN_ERR(svn_cmdline_printf( + scratch_pool, _(" Unknown verification failure.\n"))); + + return SVN_NO_ERROR; +} + +/* ### from libsvn_subr/simple_providers.c */ +#define AUTHN_USERNAME_KEY "username" +#define AUTHN_PASSWORD_KEY "password" +#define AUTHN_PASSTYPE_KEY "passtype" + +/* ### from libsvn_subr/ssl_client_cert_pw_providers.c */ +#define AUTHN_PASSPHRASE_KEY "passphrase" + /* This implements `svn_config_auth_walk_func_t` */ static svn_error_t * list_credentials(svn_boolean_t *delete_cred, - void *cleanup_baton, + void *baton, const char *cred_kind, const char *realmstring, apr_hash_t *hash, apr_pool_t *scratch_pool) { + struct svnauth_opt_state *opt_state = baton; apr_array_header_t *sorted_hash_items; int i; + apr_pool_t *iterpool; *delete_cred = FALSE; + SVN_ERR(svn_cmdline_printf(scratch_pool, SEP_STRING)); SVN_ERR(svn_cmdline_printf(scratch_pool, _("Credential kind: %s\n"), cred_kind)); SVN_ERR(svn_cmdline_printf(scratch_pool, - _("Authentication realm: %s\n"), realmstring)); + _("Authentication realm: %s\n"), realmstring)); sorted_hash_items = svn_sort__hash(hash, svn_sort_compare_items_lexically, scratch_pool); + iterpool = svn_pool_create(scratch_pool); for (i = 0; i < sorted_hash_items->nelts; i++) { svn_sort__item_t item; const char *key; svn_string_t *value; + svn_pool_clear(iterpool); item = APR_ARRAY_IDX(sorted_hash_items, i, svn_sort__item_t); key = item.key; value = item.value; - SVN_ERR(svn_cmdline_printf(scratch_pool, "%s: %s\n", key, value->data)); + if (strcmp(value->data, realmstring) == 0) + continue; /* realm string was already shown above */ + else if (strcmp(key, AUTHN_PASSWORD_KEY) == 0) + { + if (opt_state->show_passwords) + SVN_ERR(svn_cmdline_printf(iterpool, + _("Password: %s\n"), value->data)); + else + SVN_ERR(svn_cmdline_printf(iterpool, _("Password: [not shown]\n"))); + } + else if (strcmp(key, AUTHN_PASSPHRASE_KEY) == 0) + { + if (opt_state->show_passwords) + SVN_ERR(svn_cmdline_printf(iterpool, + _("Passphrase: %s\n"), value->data)); + else + SVN_ERR(svn_cmdline_printf(iterpool, + _("Passphrase: [not shown]\n"))); + } + else if (strcmp(key, AUTHN_PASSTYPE_KEY) == 0) + SVN_ERR(svn_cmdline_printf(iterpool, _("Password cache: %s\n"), + value->data)); + else if (strcmp(key, AUTHN_USERNAME_KEY) == 0) + SVN_ERR(svn_cmdline_printf(iterpool, _("Username: %s\n"), value->data)); + else if (strcmp(key, AUTHN_ASCII_CERT_KEY) == 0) + SVN_ERR(show_ascii_cert(value->data, iterpool)); + else if (strcmp(key, AUTHN_FAILURES_KEY) == 0) + SVN_ERR(show_cert_failures(value->data, iterpool)); + else + SVN_ERR(svn_cmdline_printf(iterpool, "%s: %s\n", key, value->data)); } + svn_pool_destroy(iterpool); SVN_ERR(svn_cmdline_printf(scratch_pool, "\n")); return SVN_NO_ERROR; @@ -199,7 +514,7 @@ subcommand_list(apr_getopt_t *os, void * opt_state->config_dir, NULL, pool)); - SVN_ERR(svn_config_walk_auth_data(config_path, list_credentials, NULL, + SVN_ERR(svn_config_walk_auth_data(config_path, list_credentials, opt_state, pool)); return SVN_NO_ERROR; } @@ -265,6 +580,9 @@ sub_main(int argc, const char *argv[], a SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool)); opt_state.config_dir = svn_dirent_internal_style(utf8_opt_arg, pool); break; + case opt_show_passwords: + opt_state.show_passwords = TRUE; + break; case opt_version: opt_state.version = TRUE; break;
Modified: subversion/branches/fsfs-improvements/subversion/tests/cmdline/svntest/actions.py URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/cmdline/svntest/actions.py?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/subversion/tests/cmdline/svntest/actions.py (original) +++ subversion/branches/fsfs-improvements/subversion/tests/cmdline/svntest/actions.py Thu Jul 11 16:00:50 2013 @@ -1916,11 +1916,11 @@ def get_virginal_state(wc_dir, rev): return state # Cheap administrative directory locking -def lock_admin_dir(wc_dir, recursive=False): +def lock_admin_dir(wc_dir, recursive=False, work_queue=False): "Lock a SVN administrative directory" db, root_path, relpath = wc.open_wc_db(wc_dir) - svntest.main.run_wc_lock_tester(recursive, wc_dir) + svntest.main.run_wc_lock_tester(recursive, wc_dir, work_queue) def set_incomplete(wc_dir, revision): "Make wc_dir incomplete at revision" Modified: subversion/branches/fsfs-improvements/subversion/tests/cmdline/svntest/main.py URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/cmdline/svntest/main.py?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/subversion/tests/cmdline/svntest/main.py (original) +++ subversion/branches/fsfs-improvements/subversion/tests/cmdline/svntest/main.py Thu Jul 11 16:00:50 2013 @@ -800,9 +800,11 @@ def run_atomic_ra_revprop_change(url, re url, revision, propname, skel, want_error and 1 or 0, default_config_dir) -def run_wc_lock_tester(recursive, path): +def run_wc_lock_tester(recursive, path, work_queue=False): "Run the wc-lock obtainer tool, returning its exit code, stdout and stderr" - if recursive: + if work_queue: + option = "-w" + elif recursive: option = "-r" else: option = "-1" @@ -1444,9 +1446,9 @@ class TestSpawningThread(threading.Threa args.append('--ssl-cert=' + options.ssl_cert) if options.http_proxy: args.append('--http-proxy=' + options.http_proxy) - if options.http_proxy-username: + if options.http_proxy_username: args.append('--http-proxy-username=' + options.http_proxy_username) - if options.http_proxy-password: + if options.http_proxy_password: args.append('--http-proxy-password=' + options.http_proxy_password) if options.exclusive_wc_locks: args.append('--exclusive-wc-locks') Modified: subversion/branches/fsfs-improvements/subversion/tests/cmdline/wc_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/cmdline/wc_tests.py?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/subversion/tests/cmdline/wc_tests.py (original) +++ subversion/branches/fsfs-improvements/subversion/tests/cmdline/wc_tests.py Thu Jul 11 16:00:50 2013 @@ -339,6 +339,24 @@ def cleanup_dir_external(sbox): [], "cleanup", '--include-externals', sbox.ospath("")) +@Issue(4390) +def checkout_within_locked_wc(sbox): + """checkout within a locked working copy""" + + sbox.build(read_only = True) + + # lock working copy and create outstanding work queue items + svntest.actions.lock_admin_dir(sbox.ospath(""), True, True) + expected_output = [ + "A %s\n" % sbox.ospath("nested-wc/alpha"), + "A %s\n" % sbox.ospath("nested-wc/beta"), + "Checked out revision 1.\n" + ] + svntest.actions.run_and_verify_svn(None, UnorderedOutput(expected_output), + [], "checkout", sbox.repo_url + '/A/B/E', + sbox.ospath("nested-wc")) + + ######################################################################## # Run the tests @@ -361,6 +379,7 @@ test_list = [ None, cleanup_unversioned_items, cleanup_unversioned_items_in_locked_wc, cleanup_dir_external, + checkout_within_locked_wc, ] if __name__ == '__main__': Modified: subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/wc-lock-tester.c URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/wc-lock-tester.c?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/wc-lock-tester.c (original) +++ subversion/branches/fsfs-improvements/subversion/tests/libsvn_wc/wc-lock-tester.c Thu Jul 11 16:00:50 2013 @@ -35,16 +35,19 @@ #include "private/svn_wc_private.h" #include "../../libsvn_wc/wc.h" #include "../../libsvn_wc/wc_db.h" +#include "../../libsvn_wc/workqueue.h" #include "svn_private_config.h" #define USAGE_MSG \ - "Usage: %s [-r|-1] DIRNAME\n" \ + "Usage: %s [-1|-r|-w] DIRNAME\n" \ "\n" \ - "Locks one directory (-1), or a tree recursively (-r)\n" + "Locks one directory (-1), or a tree recursively (-r), or locks\n" \ + "recursively and creates an outstanding work queue item (-w)\n" static svn_error_t * obtain_lock(const char *path, svn_boolean_t recursive, + svn_boolean_t populate_work_queue, apr_pool_t *scratch_pool) { const char *local_abspath; @@ -52,9 +55,7 @@ obtain_lock(const char *path, svn_boolea SVN_ERR(svn_path_cstring_to_utf8(&path, path, scratch_pool)); SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, scratch_pool)); - - SVN_ERR(svn_wc_context_create(&wc_ctx, NULL, scratch_pool, - scratch_pool)); + SVN_ERR(svn_wc_context_create(&wc_ctx, NULL, scratch_pool, scratch_pool)); if (recursive) { @@ -68,6 +69,19 @@ obtain_lock(const char *path, svn_boolea scratch_pool)); } + if (populate_work_queue) + { + svn_skel_t *work_item; + + /* Add an arbitrary work item to the work queue for DB, but don't + * run the work queue. */ + SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item, wc_ctx->db, + local_abspath, scratch_pool, + scratch_pool)); + SVN_ERR(svn_wc__db_wq_add(wc_ctx->db, local_abspath, work_item, + scratch_pool)); + } + SVN_ERR(svn_cmdline_printf(scratch_pool, "Lock on '%s' obtained, and we " "are not going to release it.\n", svn_dirent_local_style(local_abspath, @@ -83,9 +97,11 @@ main(int argc, const char *argv[]) int exit_code = EXIT_SUCCESS; svn_error_t *err; svn_boolean_t recursive; + svn_boolean_t populate_work_queue; if (argc != 3 - || (strcmp(argv[1], "-1") && apr_strnatcmp(argv[1], "-r"))) + || (strcmp(argv[1], "-1") && apr_strnatcmp(argv[1], "-r") && + apr_strnatcmp(argv[1], "-w"))) { fprintf(stderr, USAGE_MSG, argv[0]); exit(EXIT_FAILURE); @@ -100,9 +116,10 @@ main(int argc, const char *argv[]) /* set up the global pool */ pool = svn_pool_create(NULL); - recursive = (strcmp(argv[1], "-1") != 0); + populate_work_queue = (strcmp(argv[1], "-w") == 0); + recursive = ((strcmp(argv[1], "-1") != 0) || populate_work_queue); - err = obtain_lock(argv[2], recursive, pool); + err = obtain_lock(argv[2], recursive, populate_work_queue, pool); if (err) { Modified: subversion/branches/fsfs-improvements/tools/dev/build-svn-deps-win.pl URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/tools/dev/build-svn-deps-win.pl?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/tools/dev/build-svn-deps-win.pl (original) +++ subversion/branches/fsfs-improvements/tools/dev/build-svn-deps-win.pl Thu Jul 11 16:00:50 2013 @@ -51,7 +51,6 @@ # Usage/help output from the usual flags/on error input. # Make SQLITE_VER friendly since we're using no dots right now. # Work out the fixes to the projects' sources and contribute them back. -# Allow selection of Release/Debug builds. # Allow selection of Arch (x86 and x64) # ZLib support for OpenSSL (have to patch openssl) # Use CMake zlib build instead. @@ -135,7 +134,8 @@ our $SRCDIR; # directory where we store # Some other options our $VS_VER; our $NEON; -our $SVN_VER = '1.8.x'; +our $SVN_VER = '1.9.x'; +our $DEBUG = 0; # Utility function to remove dots from a string sub remove_dots { @@ -351,6 +351,7 @@ sub clean_structure { rmtree($INCDIR); rmtree($LIBDIR); rmtree("$INSTDIR\\serf"); + rmtree("$INSTDIR\\neon"); rmtree("$INSTDIR\\sqlite-amalgamation"); # Dirs created indirectly by the install targets @@ -422,7 +423,7 @@ sub download_dependencies { download_file($PCRE_URL, "$SRCDIR\\pcre.zip", \$PCRE_FILE); download_file($SQLITE_URL, "$SRCDIR\\sqlite-amalgamation.zip", \$SQLITE_FILE); download_file($SERF_URL, "$SRCDIR\\serf.zip", \$SERF_FILE); - download_file($NEON_URL, "$SRCDIR\\neon.tar.gz", \$NEON_FILE) if defined($NEON); + download_file($NEON_URL, "$SRCDIR\\neon.tar.gz", \$NEON_FILE) if $NEON; } ############## @@ -488,7 +489,7 @@ sub extract_dependencies { extract_file($SERF_FILE, $INSTDIR, "$INSTDIR\\serf-$SERF_VER", "$INSTDIR\\serf"); extract_file($NEON_FILE, $INSTDIR, - "$INSTDIR\\neon-$NEON_VER", "$INSTDIR\\neon") if defined($NEON); + "$INSTDIR\\neon-$NEON_VER", "$INSTDIR\\neon") if $NEON; } ######### @@ -499,7 +500,7 @@ sub build_pcre { chdir_or_die("$SRCLIB\\pcre"); my $pcre_generator = 'NMake Makefiles'; # Have to use RelWithDebInfo since httpd looks for the pdb files - my $pcre_build_type = '-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo'; + my $pcre_build_type = '-DCMAKE_BUILD_TYPE:STRING=' . ($DEBUG ? 'Debug' : 'RelWithDebInfo'); my $pcre_shared_libs = '-DBUILD_SHARED_LIBS:BOOL=ON'; my $pcre_install_prefix = "-DCMAKE_INSTALL_PREFIX:PATH=$INSTDIR"; my $cmake_cmd = qq("$CMAKE" -G "$pcre_generator" "$pcre_build_type" "$pcre_shared_libs" "$pcre_install_prefix" .); @@ -514,7 +515,7 @@ sub build_pcre { # build generates, it it doesn't match that then Subversion will fail to build. sub build_zlib { chdir_or_die("$SRCLIB\\zlib"); - $ENV{CC_OPTS} = '/MD /02 /Zi'; + $ENV{CC_OPTS} = $DEBUG ? '/MDd /Gm /ZI /Od /GZ /D_DEBUG' : '/MD /02 /Zi'; $ENV{COMMON_CC_OPTS} = '/nologo /W3 /DWIN32 /D_WINDOWS'; system_or_die("Failure building zilb", qq("$NMAKE" /nologo -f win32\\Makefile.msc STATICLIB=zlibstat.lib all)); @@ -543,8 +544,9 @@ sub build_openssl { # The apache build docs suggest no-rc5 no-idea enable-mdc2 on top of what # is used below, the primary driver behind that is patents, but I believe # the rc5 and idea patents have expired. + my $platform = $DEBUG ? 'debug-VC-WIN32' : 'VC-WIN32'; system_or_die("Failure configuring openssl", - qq("$PERL" Configure no-asm "--prefix=$INSTDIR" VC-WIN32)); + qq("$PERL" Configure no-asm "--prefix=$INSTDIR" $platform)); system_or_die("Failure building openssl (bat)", 'ms\do_ms.bat'); system_or_die("Failure building openssl (nmake)", qq("$NMAKE" /f ms\\ntdll.mak)); system_or_die("Failure testing openssl", qq("$NMAKE" /f ms\\ntdll.mak test)); @@ -601,6 +603,9 @@ sub httpd_fix_makefile { modify_file_in_place($file, sub { s/\.vcproj/.vcxproj/i; + # below fixes that installd breaks when trying to install pcre because + # dll is named pcred.dll when a Debug build. + s/^(\s*copy srclib\\pcre\\pcre\.\$\(src_dll\)\s+"\$\(inst_dll\)"\s+<\s*\.y\s*)$/!IF EXISTS("srclib\\pcre\\pcre\.\$(src_dll)")\n$1!ENDIF\n!IF EXISTS("srclib\\pcre\\pcred\.\$(src_dll)")\n\tcopy srclib\\pcre\\pcred.\$(src_dll)\t\t\t"\$(inst_dll)" <.y\n!ENDIF\n/; }); } @@ -650,8 +655,9 @@ sub get_output_file { # Find the name of the bdb library we've installed in our LIBDIR. sub find_bdb_lib { my $result; + my $debug = $DEBUG ? 'd' : ''; find(sub { - if (not defined($result) and /^libdb\d+\.lib$/) { + if (not defined($result) and /^libdb\d+$debug\.lib$/) { $result = $_; } }, $LIBDIR); @@ -688,12 +694,25 @@ sub httpd_enable_bdb { insert_dependency_in_proj('support\htdbm.vcxproj', $bdb_lib, '.bdb'); } +# Apply the same fix as found in r1486937 on httpd 2.4.x branch. +sub httpd_fix_debug { + my ($httpd_major, $httpd_minor, $httpd_patch) = $HTTPD_VER =~ /^(\d+)\.(\d+)\.(.+)$/; + return unless ($httpd_major <= 2 && $httpd_minor <= 4 && $httpd_patch < 5); + + modify_file_in_place('libhttpd.dsp', sub { + s/^(!MESSAGE "libhttpd - Win32 Debug" \(based on "Win32 \(x86\) Dynamic-Link Library"\))$/$1\n!MESSAGE "libhttpd - Win32 Lexical" (based on "Win32 (x86) Dynamic-Link Library")/; + s/^(# Begin Group "headers")$/# Name "libhttpd - Win32 Lexical"\n$1/; + }, '.lexical'); +} + sub build_httpd { chdir_or_die($HTTPD); my $vs_2012 = $VS_VER eq '2012'; my $vs_2010 = $VS_VER eq '2010'; + httpd_fix_debug(); + # I don't think cvtdsp.pl is necessary with Visual Studio 2012 # but it shouldn't hurt anything either. Including it allows # for the possibility that this may work for older Visual Studio @@ -763,8 +782,9 @@ sub build_httpd { # configurations inside the project since we get them from the environment. # Once all that is done the BuildBin project should be buildable for you to # diagnose the problem. + my $target = $DEBUG ? "installd" : "installr"; system_or_die("Failed building/installing httpd/apr/apu/api", - qq("$NMAKE" /f Makefile.win installr "DBM_LIST=db" "INSTDIR=$INSTDIR")); + qq("$NMAKE" /f Makefile.win $target "DBM_LIST=db" "INSTDIR=$INSTDIR")); chdir_or_die($TOPDIR); } @@ -776,13 +796,15 @@ sub build_bdb { my $sln = 'build_windows\Berkeley_DB_vs2010.sln'; upgrade_solution($sln); + my $platform = $DEBUG ? 'Debug|Win32' : 'Release|Win32'; + # Build the db Project first since the full solution fails due to a broken # dependency with the current version of BDB if we don't. system_or_die("Failed building DBD (Project db)", - qq("$DEVENV" "$sln" /Build "Release|Win32" /Project db)); + qq("$DEVENV" "$sln" /Build "$platform" /Project db)); system_or_die("Failed building DBD", - qq("$DEVENV" "$sln" /Build "Release|Win32")); + qq("$DEVENV" "$sln" /Build "$platform")); # BDB doesn't seem to have it's own install routines so we'll do it ourselves copy_or_die('build_windows\db.h', $INCDIR); @@ -792,16 +814,31 @@ sub build_bdb { } elsif (/\.lib$/) { copy_or_die($_, $LIBDIR); } - }, 'build_windows\Win32\Release'); + }, 'build_windows\\Win32\\' . ($DEBUG ? 'Debug' : 'Release')); chdir_or_die($TOPDIR); } +# Right now this doesn't actually build serf but just patches it so that it +# can build against a debug build of OpenSSL. +sub build_serf { + chdir_or_die("$TOPDIR\\serf"); + + modify_file_in_place('serf.mak', sub { + s/^(INTDIR = Release)$/$1\nOPENSSL_OUT_SUFFIX =/; + s/^(INTDIR = Debug)$/$1\nOPENSSL_OUT_SUFFIX = .dbg/; + s/(\$\(OPENSSL_SRC\)\\out32(?:dll)?)/$1\$(OPENSSL_OUT_SUFFIX)/g; + }, '.debug'); + + chdir_or_die($TOPDIR); +} + sub build_dependencies { build_bdb(); build_zlib(); build_pcre(); build_openssl(); + build_serf(); build_httpd(); } Modified: subversion/branches/fsfs-improvements/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c (original) +++ subversion/branches/fsfs-improvements/tools/dev/svnraisetreeconflict/svnraisetreeconflict.c Thu Jul 11 16:00:50 2013 @@ -187,7 +187,7 @@ raise_tree_conflict(int argc, const char { int i = 0; svn_wc_conflict_version_t *left, *right; - svn_wc_conflict_description2_t *c; + svn_wc_conflict_description3_t *c; svn_wc_context_t *wc_ctx; /* Conflict description parameters */ @@ -223,7 +223,7 @@ raise_tree_conflict(int argc, const char peg_rev1, kind1, pool); right = svn_wc_conflict_version_create2(repos_url2, NULL, path_in_repos2, peg_rev2, kind2, pool); - c = svn_wc_conflict_description_create_tree2(wc_abspath, kind, + c = svn_wc_conflict_description_create_tree3(wc_abspath, kind, operation, left, right, pool); c->action = (svn_wc_conflict_action_t)action; c->reason = (svn_wc_conflict_reason_t)reason; Modified: subversion/branches/fsfs-improvements/tools/dist/backport.pl URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/tools/dist/backport.pl?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/tools/dist/backport.pl (original) +++ subversion/branches/fsfs-improvements/tools/dist/backport.pl Thu Jul 11 16:00:50 2013 @@ -20,20 +20,34 @@ use feature qw/switch say/; # specific language governing permissions and limitations # under the License. +use Digest (); use Term::ReadKey qw/ReadMode ReadKey/; use File::Copy qw/copy move/; use File::Temp qw/tempfile/; use POSIX qw/ctermid/; +############### Start of reading values from environment ############### + +# Programs we use. my $SVN = $ENV{SVN} || 'svn'; # passed unquoted to sh +my $SHELL = $ENV{SHELL} // '/bin/sh'; my $VIM = 'vim'; -my $STATUS = './STATUS'; -my $BRANCHES = '^/subversion/branches'; -my %ERRORS = (); +my $EDITOR = $ENV{SVN_EDITOR} // $ENV{VISUAL} // $ENV{EDITOR} // 'ed'; +my $PAGER = $ENV{PAGER} // 'less -F' // 'cat'; +# Mode flags. +# svn-role: YES=1 MAY_COMMIT=1 +# conflicts-bot: YES=1 MAY_COMMIT=0 +# interactive: YES=0 MAY_COMMIT=0 (default) my $YES = ($ENV{YES} // 0) ? 1 : 0; # batch mode: eliminate prompts, add sleeps -my $MAY_COMMIT = qw[false true][0]; -my $DEBUG = qw[false true][0]; # 'set -x', etc +my $MAY_COMMIT = 'false'; +$MAY_COMMIT = 'true' if ($ENV{MAY_COMMIT} // "false") =~ /^(1|yes|true)$/i; + +# Other knobs. +my $VERBOSE = 0; +my $DEBUG = (exists $ENV{DEBUG}) ? 'true' : 'false'; # 'set -x', etc + +# Username for entering votes. my ($AVAILID) = $ENV{AVAILID} // do { my $SVN_A_O_REALM = 'd3c8a345b14f6a1b42251aef8027ab57'; open USERNAME, '<', "$ENV{HOME}/.subversion/auth/svn.simple/$SVN_A_O_REALM"; @@ -44,22 +58,29 @@ my ($AVAILID) = $ENV{AVAILID} // do { $_ } // warn "Username for commits (of votes/merges) not found"; -my $EDITOR = $ENV{SVN_EDITOR} // $ENV{VISUAL} // $ENV{EDITOR} // 'ed'; -my $VERBOSE = 0; -$DEBUG = 'true' if exists $ENV{DEBUG}; -$MAY_COMMIT = 'true' if ($ENV{MAY_COMMIT} // "false") =~ /^(1|yes|true)$/i; -# derived values +############## End of reading values from the environment ############## + +# Constants. +my $STATUS = './STATUS'; +my $STATEFILE = './.backports1'; +my $BRANCHES = '^/subversion/branches'; + +# Globals. +my %ERRORS = (); +my $MERGED_SOMETHING = 0; my $SVNq; + +# Derived values. my $SVNvsn = do { my ($major, $minor, $patch) = `$SVN --version -q` =~ /^(\d+)\.(\d+)\.(\d+)/; 1e6*$major + 1e3*$minor + $patch; }; - $SVN .= " --non-interactive" if $YES or not defined ctermid; $SVNq = "$SVN -q "; $SVNq =~ s/-q// if $DEBUG eq 'true'; + sub usage { my $basename = $0; $basename =~ s#.*/##; @@ -73,6 +94,7 @@ At a prompt, you have the following opti y: Run a merge. It will not be committed. WARNING: This will run 'update' and 'revert -R ./'. +l: Show logs for the entries being nominated. q: Quit the "for each nomination" loop. ±1: Enter a +1 or -1 vote You will be prompted to commit your vote at the end. @@ -83,7 +105,10 @@ a: Move the entry to the "Approved cha to enter a third +1 vote, type "a" "+" "1". e: Edit the entry in $EDITOR. You will be prompted to commit your edits at the end. -N: Move to the next entry. +N: Move to the next entry. Cache the entry in '$STATEFILE' and do not + prompt for it again (even across runs) until it is changed. + : Move to the next entry, without adding the current one to the cache. + (That's a space character, ASCII 0x20.) After running a merge, you have the following options: @@ -103,13 +128,17 @@ The 'svn' binary defined by the environm EOF } +sub digest_string { + Digest->new("MD5")->add(@_)->hexdigest +} + sub prompt { - print "$_[0] "; shift; + print $_[0]; shift; my %args = @_; my $getchar = sub { ReadMode 'cbreak'; my $answer = (ReadKey 0); - ReadMode 'cbreak'; + ReadMode 'normal'; print $answer; return $answer; }; @@ -117,14 +146,16 @@ sub prompt { die "$0: called prompt() in non-interactive mode!" if $YES; my $answer = $getchar->(); $answer .= $getchar->() if exists $args{extra} and $answer =~ $args{extra}; - say ""; + say "" unless $args{dontprint}; return $args{verbose} ? $answer : ($answer =~ /^y/i) ? 1 : 0; } + sub merge { my %entry = @_; + $MERGED_SOMETHING++; my ($logmsg_fh, $logmsg_filename) = tempfile(); my ($mergeargs, $pattern); @@ -234,8 +265,9 @@ sub sanitize_branch { # TODO: may need to parse other headers too? sub parse_entry { - my $lines = shift; + my $raw = shift; my @lines = @_; + my $depends; my (@revisions, @logsummary, $branch, @votes); # @lines = @_; @@ -264,6 +296,10 @@ sub parse_entry { unshift @votes, pop until $_[-1] =~ /^\s*Votes:/ or not defined $_[-1]; pop; + # depends + # TODO: parse the value of this. + $depends = grep /^Depends:/, @_; + # branch while (@_) { shift and next unless $_[0] =~ s/^\s*Branch(es)?:\s*//; @@ -283,10 +319,12 @@ sub parse_entry { logsummary => [@logsummary], branch => $branch, header => $header, + depends => $depends, id => $id, votes => [@votes], entry => [@lines], - raw => $lines, + raw => $raw, + digest => digest_string($raw), ); } @@ -296,77 +334,132 @@ sub edit_string { die "$0: called edit_string() in non-interactive mode!" if $YES; my $string = shift; my $name = shift; + my %args = @_; + my $trailing_eol = $args{trailing_eol}; my ($fh, $fn) = tempfile; print $fh $string; $fh->flush or die $!; system("$EDITOR -- $fn") == 0 or warn "\$EDITOR failed editing $name: $! ($?); " ."edit results ($fn) ignored."; - return `cat $fn`; + my $rv = `cat $fn`; + $rv =~ s/\n*\z// and $rv .= ("\n" x $trailing_eol) if defined $trailing_eol; + $rv; } sub vote { - my ($approved, $votes) = @_; + my ($state, $approved, $votes) = @_; + # TODO: use votesarray instead of votescheck + my (%approvedcheck, %votescheck); my $raw_approved = ""; - my @votes; + my @votesarray; return unless %$approved or %$votes; + my $had_empty_line; + $. = 0; open STATUS, "<", $STATUS; open VOTES, ">", "$STATUS.$$.tmp"; while (<STATUS>) { - unless (exists $votes->{$.}) { - (exists $approved->{$.}) ? ($raw_approved .= $_) : (print VOTES); + $had_empty_line = /\n\n\z/; + my $key = digest_string $_; + + $approvedcheck{$key}++ if exists $approved->{$key}; + $votescheck{$key}++ if exists $votes->{$key}; + + unless (exists $votes->{$key} or exists $approved->{$key}) { + print VOTES; + next; + } + + unless (exists $votes->{$key}) { + push @votesarray, { + entry => $approved->{$key}, + approval => 1, + digest => $key, + }; + $raw_approved .= $_; next; } - my ($vote, $entry) = @{$votes->{$.}}; - push @{$votes->{$.}}, 1; - push @votes, [$vote, $entry]; + # We have a vote, and potentially an approval. + + my ($vote, $entry) = @{$votes->{$key}}; + push @votesarray, { + entry => $entry, + vote => $vote, + approval => (exists $approved->{$key}), + digest => $key, + }; if ($vote eq 'edit') { local $_ = $entry->{raw}; - (exists $approved->{$.}) ? ($raw_approved .= $_) : (print VOTES); + $votesarray[-1]->{digest} = digest_string $_; + (exists $approved->{$key}) ? ($raw_approved .= $_) : (print VOTES); next; } s/^(\s*\Q$vote\E:.*)/"$1, $AVAILID"/me or s/(.*\w.*?\n)/"$1 $vote: $AVAILID\n"/se; - $_ = edit_string $_, $entry->{header} if $vote ne '+1'; - (exists $approved->{$.}) ? ($raw_approved .= $_) : (print VOTES); + $_ = edit_string $_, $entry->{header}, trailing_eol => 2 + if $vote ne '+1'; + $votesarray[-1]->{digest} = digest_string $_; + (exists $approved->{$key}) ? ($raw_approved .= $_) : (print VOTES); } close STATUS; + print VOTES "\n" if $raw_approved and !$had_empty_line; print VOTES $raw_approved; close VOTES; - die "Some vote chunks weren't found: " - if grep scalar(@$_) != 3, values %$votes; + warn "Some vote chunks weren't found: ", + join ',', + map $votes->{$_}->[1]->{id}, + grep { !$votescheck{$_} } keys %$votes + if scalar(keys %$votes) != scalar(keys %votescheck); + warn "Some approval chunks weren't found: ", + join ',', + map $approved->{$_}->{id}, + grep { !$approvedcheck{$_} } keys %$approved + if scalar(keys %$approved) != scalar(keys %approvedcheck); + prompt "Press the 'any' key to continue...\n", dontprint => 1 + if scalar(keys %$approved) != scalar(keys %approvedcheck) + or scalar(keys %$votes) != scalar(keys %votescheck); move "$STATUS.$$.tmp", $STATUS; my $logmsg = do { - my %allkeys = map { $_ => 1 } keys(%$votes), keys(%$approved); my @sentences = map { - exists $votes->{$_} + my $words_vote = ", approving" x $_->{approval}; + my $words_edit = " and approve" x $_->{approval}; + exists $_->{vote} ? ( - ( $votes->{$_}->[0] eq 'edit' - ? "Edit the $votes->{$_}->[1]->{id} entry" - : "Vote $votes->{$_}->[0] on the $votes->{$_}->[1]->{header}" + ( $_->{vote} eq 'edit' + ? "Edit$words_edit the $_->{entry}->{id} entry" + : "Vote $_->{vote} on the $_->{entry}->{header}$words_vote" ) - . (exists $approved->{$_} ? ", approving" : "") . "." ) : # exists only in $approved - "Approve the $approved->{$_}->{header}." - } keys %allkeys; + "Approve the $_->{entry}->{header}." + } @votesarray; (@sentences == 1) ? $sentences[0] : "* STATUS:\n" . join "", map " $_\n", @sentences; }; - system $SVN, qw/diff --/, $STATUS; - say "Voting '$_->[0]' on $_->[1]->{header}." for @votes; - # say $logmsg; - system $SVN, qw/commit -m/, $logmsg, qw/--/, $STATUS - if prompt "Commit these votes? "; + system "$SVN diff -- $STATUS"; + printf "[[[\n%s%s]]]\n", $logmsg, ("\n" x ($logmsg !~ /\n\z/)); + if (prompt "Commit these votes? ") { + my ($logmsg_fh, $logmsg_filename) = tempfile(); + print $logmsg_fh $logmsg; + close $logmsg_fh; + warn("Tempfile name '$logmsg_filename' not shell-safe; " + ."refraining from commit.\n") and return + unless $logmsg_filename =~ /^([A-Z0-9._-]|\x2f)+$/i; + system("$SVN commit -F $logmsg_filename -- $STATUS") == 0 + or warn("Committing the votes failed($?): $!") and return; + unlink $logmsg_filename; + + $state->{$_->{digest}}++ for @votesarray; + } } sub revert { @@ -381,7 +474,7 @@ sub maybe_revert { # This is both a SIGINT handler, and the tail end of main() in normal runs. # @_ is 'INT' in the former case and () in the latter. delete $SIG{INT} unless @_; - revert if !$YES and prompt 'Revert? '; + revert if !$YES and $MERGED_SOMETHING and prompt 'Revert? '; (@_ ? exit : return); } @@ -396,19 +489,45 @@ sub warning_summary { } } +sub read_state { + # die "$0: called read_state() in non-interactive mode!" if $YES; + + open my $fh, '<', $STATEFILE or do { + return {} if $!{ENOENT}; + die "Can't read statefile: $!"; + }; + + my %rv; + while (<$fh>) { + chomp; + $rv{$_}++; + } + return \%rv; +} + +sub write_state { + my $state = shift; + open STATE, '>', $STATEFILE or warn("Can't write state: $!"), return; + say STATE for keys %$state; + close STATE; +} + sub exit_stage_left { + my $state = shift; maybe_revert; warning_summary if $YES; - vote @_; + vote $state, @_; + write_state $state; exit scalar keys %ERRORS; } sub handle_entry { my $in_approved = shift; - my $votes = shift; my $approved = shift; - my $lines = shift; - my %entry = parse_entry $lines, @_; + my $votes = shift; + my $state = shift; + my $raw = shift; + my %entry = parse_entry $raw, @_; my @vetoes = grep { /^ -1:/ } @{$entry{votes}}; if ($YES) { @@ -421,16 +540,27 @@ sub handle_entry { # Scan-for-conflicts mode merge %entry; - my $output; - if (($output = `$SVN status`) =~ /^(C|.C|...C)/m) { - $ERRORS{$entry{id}} //= "Conflicts merging the $entry{header}!"; + my $output = `$SVN status`; + my (@conflicts) = ($output =~ m#^(?:C|.C|...C).*/(.*)#mg); + if (@conflicts and !$entry{depends}) { + $ERRORS{$entry{id}} //= "Conflicts merging the $entry{header}: " + . (join ', ', @conflicts); say STDERR "Conflicts merging the $entry{header}!"; say STDERR ""; say STDERR $output; + } elsif (!@conflicts and $entry{depends}) { + warn "No conflicts merging the $entry{header}, but conflicts were " + ."expected ('Depends:' header set)\n"; + } elsif (@conflicts) { + say "Conflicts found merging $entry{id}, as expected."; } revert; } } + } elsif ($state->{$entry{digest}}) { + print "\n\n"; + say "Skipping the $entry{header} (remove $STATEFILE to reset):"; + say $entry{logsummary}->[0], ('[...]' x (0 < $#{$entry{logsummary}})); } else { # This loop is just a hack because 'goto' panics. The goto should be where # the "next PROMPT;" is; there's a "last;" at the end of the loop body. @@ -446,18 +576,21 @@ sub handle_entry { say ""; say "Vetoes found!" if @vetoes; - given (prompt 'Go ahead? [y,±1,±0,q,e,a,N]', + # See above for why the while(1). + QUESTION: while (1) { + my $key = $entry{digest}; + given (prompt 'Run a merge? [y,l,±1,±0,q,e,a, ,N] ', verbose => 1, extra => qr/[+-]/) { when (/^y/i) { merge %entry; while (1) { - given (prompt "Shall I open a subshell? [ydN]", verbose => 1) { + given (prompt "Shall I open a subshell? [ydN] ", verbose => 1) { when (/^y/i) { - system($ENV{SHELL} // "/bin/sh") == 0 + system($SHELL) == 0 or warn "Creating an interactive subshell failed ($?): $!" } when (/^d/) { - system($SVN, 'diff') == 0 + system("$SVN diff | $PAGER") == 0 or warn "diff failed ($?): $!"; next; } @@ -467,24 +600,51 @@ sub handle_entry { } # NOTREACHED } + when (/^l/i) { + if ($entry{branch}) { + system "$SVN log --stop-on-copy -v -r 0:HEAD -- " + ."$BRANCHES/$entry{branch} " + ."| $PAGER"; + } elsif (@{$entry{revisions}}) { + system "$SVN log ".(join ' ', map { "-r$_" } @{$entry{revisions}}) + ." -- ^/subversion | $PAGER"; + } else { + die "Assertion failed: entry has neither branch nor revisions:\n", + '[[[', (join ';;', %entry), ']]]'; + } + next PROMPT; + } when (/^q/i) { - exit_stage_left $approved, $votes; + exit_stage_left $state, $approved, $votes; } when (/^a/i) { - $approved->{$.} = \%entry; + $approved->{$key} = \%entry; next PROMPT; } when (/^([+-][01])\s*$/i) { - $votes->{$.} = [$1, \%entry]; + $votes->{$key} = [$1, \%entry]; say "Your '$1' vote has been recorded." if $VERBOSE; } when (/^e/i) { - $entry{raw} = edit_string $entry{raw}, $entry{header}; - $votes->{$.} = ['edit', \%entry]; # marker for the 2nd pass + my $original = $entry{raw}; + $entry{raw} = edit_string $entry{raw}, $entry{header}, + trailing_eol => 2; + $votes->{$key} = ['edit', \%entry] # marker for the 2nd pass + if $original ne $entry{raw}; + } + when (/^N/i) { + $state->{$entry{digest}}++; + } + when (/^\x20/) { + last PROMPT; # Fall off the end of the given/when block. + } + default { + say "Please use one of the options in brackets (q to quit)!"; + next QUESTION; } } - last; - } + last; } # QUESTION + last; } # PROMPT } # TODO: merge() changes ./STATUS, which we're reading below, but @@ -493,23 +653,33 @@ sub handle_entry { 1; } + sub main { my %approved; my %votes; + my $state = read_state; usage, exit 0 if @ARGV; open STATUS, "<", $STATUS or (usage, exit 1); # Because we use the ':normal' command in Vim... - die "A vim with the +ex_extra feature is required" - if `${VIM} --version` !~ /[+]ex_extra/; + die "A vim with the +ex_extra feature is required for \$MAY_COMMIT mode" + if $MAY_COMMIT eq 'true' and `${VIM} --version` !~ /[+]ex_extra/; # ### TODO: need to run 'revert' here # ### TODO: both here and in merge(), unlink files that previous merges added # When running from cron, there shouldn't be local mods. (For interactive # usage, we preserve local mods to STATUS.) - die "Local mods to STATUS file $STATUS" if $YES and `$SVN status -q $STATUS`; + system("$SVN info $STATUS >/dev/null") == 0 + or die "$0: svn error; point \$SVN to an appropriate binary"; + + if (`$SVN status -q $STATUS`) { + die "Local mods to STATUS file $STATUS" if $YES; + warn "Local mods to STATUS file $STATUS"; + system "$SVN diff -- $STATUS"; + prompt "Press the 'any' key to continue...\n", dontprint => 1; + } # Skip most of the file $/ = ""; # paragraph mode @@ -542,15 +712,15 @@ sub main { when (/^ \*/) { warn "Too many bullets in $lines[0]" and next if grep /^ \*/, @lines[1..$#lines]; - handle_entry $in_approved, \%approved, \%votes, $lines, @lines; + handle_entry $in_approved, \%approved, \%votes, $state, $lines, @lines; } default { - warn "Unknown entry '$lines[0]' at line $.\n"; + warn "Unknown entry '$lines[0]'"; } } } - exit_stage_left \%approved, \%votes; + exit_stage_left $state, \%approved, \%votes; } &main Propchange: subversion/branches/fsfs-improvements/tools/dist/make-deps-tarball.sh ------------------------------------------------------------------------------ Merged /subversion/trunk/tools/dist/make-deps-tarball.sh:r1499981-1502252 Modified: subversion/branches/fsfs-improvements/win-tests.py URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/win-tests.py?rev=1502256&r1=1502255&r2=1502256&view=diff ============================================================================== --- subversion/branches/fsfs-improvements/win-tests.py (original) +++ subversion/branches/fsfs-improvements/win-tests.py Thu Jul 11 16:00:50 2013 @@ -331,16 +331,16 @@ def locate_libs(): else: suffix = "" - if cp.has_option('options', '--with-static-apr'): + if not cp.has_option('options', '--with-static-apr'): dlls.append(os.path.join(gen_obj.apr_path, objdir, 'libapr%s.dll' % (suffix))) dlls.append(os.path.join(gen_obj.apr_util_path, objdir, 'libaprutil%s.dll' % (suffix))) - if gen_obj.libintl_path is not None: + if gen_obj.libintl_path: dlls.append(os.path.join(gen_obj.libintl_path, 'bin', 'intl3_svn.dll')) - if gen_obj.bdb_lib is not None: + if gen_obj.bdb_path: partial_path = os.path.join(gen_obj.bdb_path, 'bin', gen_obj.bdb_lib) if objdir == 'Debug': dlls.append(partial_path + 'd.dll')
