Michael W Thelen wrote:
> * Edmund Horner <chrysophylax@chrysophylax.cjb.net> [2004-06-14 05:40]:
>> You should hear from me again tomorrow or so.
>
> It's been a little while... Edmund, have you been able to work on this
> patch? If you haven't been able to find time, I'm willing to help out
> if you want it.
>
> -- Mike
(NB. I started sending this first with an incorrect patch attached, so
if there's another copy of this mail without this little "NB" notice,
ignore that one.)
Hi Mike, it sure has been a while! (So much for hearing from me
"tomorrow" ...)
Here's the second version of the patch. I have not implemented anything
in the RA/FS loaders for checking the versions of plugins; I began to,
but it got out of hand and I thought the main version checks should be
finished first. However I have added svn_libname__version() functions
for the plugin libraries. I guess these should eventually be added to
the vtables or something, and checked from the loaders...?
Proposed log message follows.
-- Edmund.
Implement library version functions, and check library versions in
command-line clients. Each library features a "svn_libname_version"
function that returns information on the Subversion version the library
is compiled as. Clients call their own "check_lib_versions" (or a
similarly named) function that uses svn_ver_check_list (from
libsvn_subr/version.c) to call the version functions of a list of
libraries, which ensures there are no version mismatches.
This change is a generalisation of r9697 to other libraries and
clients, and fixes issue 1861.
* subversion/libsvn_delta/version.c (svn_delta_version),
subversion/libsvn_ra_svn/client.c (svn_ra_svn_version):
New files, with functions for returning library versions.
* subversion/libsvn_delta/version.c (svn_delta_version),
subversion/libsvn_diff/util.c (svn_diff_version),
subversion/libsvn_fs/fs-loader.c (svn_fs_version),
subversion/libsvn_fs_base/fs.c (svn_fs_base__version),
subversion/libsvn_fs_fs/fs.c: (svn_fs_fs__version),
subversion/libsvn_ra/ra_loader.c (svn_ra_version),
subversion/libsvn_ra_dav/util.c (svn_ra_dav__version),
subversion/libsvn_ra_local/ra_plugin.c (svn_ra_local__version),
subversion/libsvn_repos/repos.c (svn_repos_version),
subversion/libsvn_wc/util.c (svn_wc_version):
New functions for returning library versions.
* subversion/include/svn_delta.h (svn_delta_version),
subversion/include/svn_diff.h (svn_diff_version),
subversion/include/svn_fs.h (svn_fs_version),
subversion/libsvn_fs_base/fs.h (svn_fs_base__version),
subversion/libsvn_fs_fs/fs.h (svn_fs_fs__version),
subversion/include/svn_ra.h (svn_ra_version),
subversion/libsvn_ra_dav/ra_dav.h (svn_ra_dav__version),
subversion/libsvn_ra_local/ra_local.h (svn_ra_local__version),
subversion/include/svn_ra_svn.h (svn_ra_svn_version),
subversion/include/svn_repos.h (svn_repos_version),
subversion/include/svn_wc.h (svn_wc_version):
New function symbols.
* subversion/svnadmin/main.c,
subversion/svnlook/main.c,
subversion/svndumpfilter/main.c,
subversion/svnserve/main.c,
subversion/svnversion/main.c,
contrib/client-side/svn-push/svn-push.c:
(check_lib_versions): New function that checks the compiled
versions of all svn libraries needed by this client.
(main): Call check_lib_versions() and exit with failure if library
versions are not adequate.
* subversion/clients/cmdline/main.c:
(check_lib_versions): Add remaining library version checks.
Index: subversion/libsvn_fs_base/fs.c
===================================================================
--- subversion/libsvn_fs_base/fs.c (revision 10140)
+++ subversion/libsvn_fs_base/fs.c (working copy)
@@ -1193,7 +1193,15 @@
return newpath;
}
+/* Return the library version number.
+ */
+const svn_version_t *
+svn_fs_base__version (void)
+{
+ SVN_VERSION_BODY;
+}
+
/* Base FS library vtable, used by the FS loader library. */
Index: subversion/libsvn_fs_base/fs.h
===================================================================
--- subversion/libsvn_fs_base/fs.h (revision 10140)
+++ subversion/libsvn_fs_base/fs.h (working copy)
@@ -30,6 +30,13 @@
extern "C" {
#endif /* __cplusplus */
+
+/**
+ * Get libsvn_fs_base version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_fs_base__version (void);
+
/*** The filesystem structure. ***/
Index: subversion/libsvn_ra/ra_loader.c
===================================================================
--- subversion/libsvn_ra/ra_loader.c (revision 10140)
+++ subversion/libsvn_ra/ra_loader.c (working copy)
@@ -280,3 +280,12 @@
return SVN_NO_ERROR;
}
+
+
+/* Return the library version number.
+ */
+const svn_version_t *
+svn_ra_version (void)
+{
+ SVN_VERSION_BODY;
+}
Index: subversion/svnadmin/main.c
===================================================================
--- subversion/svnadmin/main.c (revision 10140)
+++ subversion/svnadmin/main.c (working copy)
@@ -30,6 +30,7 @@
#include "svn_config.h"
#include "svn_repos.h"
#include "svn_fs.h"
+#include "svn_version.h"
#include "svn_private_config.h"
@@ -133,6 +134,24 @@
}
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_repos", svn_repos_version },
+ { "svn_fs", svn_fs_version },
+ { "svn_delta", svn_delta_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
/** Subcommands. **/
@@ -866,6 +885,16 @@
pool = svn_pool_create_ex (NULL, allocator);
apr_allocator_owner_set (allocator, pool);
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
if (argc <= 1)
{
subcommand_help (NULL, NULL, pool);
Index: subversion/include/svn_diff.h
===================================================================
--- subversion/include/svn_diff.h (revision 10140)
+++ subversion/include/svn_diff.h (working copy)
@@ -50,6 +50,7 @@
#include "svn_types.h"
#include "svn_error.h"
#include "svn_io.h"
+#include "svn_version.h"
#ifdef __cplusplus
extern "C" {
@@ -57,6 +58,13 @@
+/**
+ * Get libsvn_diff version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_diff_version (void);
+
+
/* Diffs. */
/** An opaque type that represents a difference between either two or
Index: subversion/include/svn_fs.h
===================================================================
--- subversion/include/svn_fs.h (revision 10140)
+++ subversion/include/svn_fs.h (working copy)
@@ -37,6 +37,13 @@
#endif /* __cplusplus */
+/**
+ * Get libsvn_fs version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_fs_version (void);
+
+
/* Opening and creating filesystems. */
Index: subversion/include/svn_ra_svn.h
===================================================================
--- subversion/include/svn_ra_svn.h (revision 10140)
+++ subversion/include/svn_ra_svn.h (working copy)
@@ -323,6 +323,12 @@
svn_config_t *pwdb, const char **user,
svn_boolean_t *success);
+/**
+ * Get libsvn_ra_svn version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_ra_svn_version (void);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: subversion/include/svn_repos.h
===================================================================
--- subversion/include/svn_repos.h (revision 10140)
+++ subversion/include/svn_repos.h (working copy)
@@ -29,6 +29,7 @@
#include "svn_delta.h"
#include "svn_types.h"
#include "svn_error.h"
+#include "svn_version.h"
#ifdef __cplusplus
@@ -37,6 +38,13 @@
/* ---------------------------------------------------------------*/
+/**
+ * Get libsvn_repos version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_repos_version (void);
+
+
/** Callback type for checking authorization on paths produced by (at
* least) svn_repos_dir_delta().
Index: subversion/include/svn_delta.h
===================================================================
--- subversion/include/svn_delta.h (revision 10140)
+++ subversion/include/svn_delta.h (working copy)
@@ -33,6 +33,7 @@
#include "svn_string.h"
#include "svn_error.h"
#include "svn_io.h"
+#include "svn_version.h"
#ifdef __cplusplus
extern "C" {
@@ -40,6 +41,13 @@
+/**
+ * Get libsvn_delta version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_delta_version (void);
+
+
/** Text deltas.
*
* A text delta represents the difference between two strings of
Index: subversion/include/svn_wc.h
===================================================================
--- subversion/include/svn_wc.h (revision 10140)
+++ subversion/include/svn_wc.h (working copy)
@@ -50,6 +50,13 @@
#endif /* __cplusplus */
+/**
+ * Get libsvn_wc version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_wc_version (void);
+
+
/* Locking/Opening/Closing */
/** Baton for access to a working copy administrative area.
Index: subversion/include/svn_ra.h
===================================================================
--- subversion/include/svn_ra.h (revision 10140)
+++ subversion/include/svn_ra.h (working copy)
@@ -40,6 +40,13 @@
/* Misc. declarations */
+/**
+ * Get libsvn_ra version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_ra_version (void);
+
+
/** This is a function type which allows the RA layer to fetch working
* copy (WC) properties.
*
Index: subversion/libsvn_fs/fs-loader.c
===================================================================
--- subversion/libsvn_fs/fs-loader.c (revision 10140)
+++ subversion/libsvn_fs/fs-loader.c (working copy)
@@ -814,3 +814,11 @@
{
return a->vtable->compare (a, b);
}
+
+/* Return the library version number.
+ */
+const svn_version_t *
+svn_fs_version (void)
+{
+ SVN_VERSION_BODY;
+}
Index: subversion/libsvn_diff/util.c
===================================================================
--- subversion/libsvn_diff/util.c (revision 10140)
+++ subversion/libsvn_diff/util.c (working copy)
@@ -181,3 +181,11 @@
return SVN_NO_ERROR;
}
+
+/* Return the library version number.
+ */
+const svn_version_t *
+svn_diff_version (void)
+{
+ SVN_VERSION_BODY;
+}
Index: subversion/libsvn_wc/util.c
===================================================================
--- subversion/libsvn_wc/util.c (revision 10140)
+++ subversion/libsvn_wc/util.c (working copy)
@@ -102,3 +102,11 @@
return SVN_NO_ERROR;
}
+
+/* Get library version information.
+ */
+const svn_version_t *
+svn_wc_version (void)
+{
+ SVN_VERSION_BODY;
+}
Index: subversion/libsvn_ra_local/ra_plugin.c
===================================================================
--- subversion/libsvn_ra_local/ra_plugin.c (revision 10140)
+++ subversion/libsvn_ra_local/ra_plugin.c (working copy)
@@ -914,3 +914,12 @@
return SVN_NO_ERROR;
}
+
+
+/* Get the library version information.
+ */
+const svn_version_t *
+svn_ra_local__version (void)
+{
+ SVN_VERSION_BODY;
+}
Index: subversion/libsvn_ra_local/ra_local.h
===================================================================
--- subversion/libsvn_ra_local/ra_local.h (revision 10140)
+++ subversion/libsvn_ra_local/ra_local.h (working copy)
@@ -77,6 +77,17 @@
+/** Miscellaneous routines **/
+
+/**
+ * Get libsvn_ra_local version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_ra_local__version (void);
+
+
+
+
/** Private routines **/
Index: subversion/svnlook/main.c
===================================================================
--- subversion/svnlook/main.c (revision 10140)
+++ subversion/svnlook/main.c (working copy)
@@ -255,7 +255,27 @@
return SVN_NO_ERROR;
}
+
+/* Version compatibility check */
static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_repos", svn_repos_version },
+ { "svn_fs", svn_fs_version },
+ { "svn_delta", svn_delta_version },
+ { "svn_diff", svn_diff_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
+static svn_error_t *
get_property (svn_string_t **prop_value /* native */,
svn_boolean_t need_translation,
svnlook_ctxt_t *c,
@@ -1811,6 +1831,16 @@
pool = svn_pool_create_ex (NULL, allocator);
apr_allocator_owner_set (allocator, pool);
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
if (argc <= 1)
{
subcommand_help (NULL, NULL, pool);
Index: subversion/clients/cmdline/main.c
===================================================================
--- subversion/clients/cmdline/main.c (revision 10140)
+++ subversion/clients/cmdline/main.c (working copy)
@@ -692,8 +692,11 @@
{
static const svn_version_checklist_t checklist[] =
{
- { "svn_subr", svn_subr_version },
+ { "svn_subr", svn_subr_version },
{ "svn_client", svn_client_version },
+ { "svn_wc", svn_wc_version },
+ { "svn_ra", svn_ra_version },
+ { "svn_delta", svn_delta_version },
{ NULL, NULL }
};
Index: subversion/svndumpfilter/main.c
===================================================================
--- subversion/svndumpfilter/main.c (revision 10140)
+++ subversion/svndumpfilter/main.c (working copy)
@@ -812,6 +812,24 @@
}
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_repos", svn_repos_version },
+ { "svn_fs", svn_fs_version },
+ { "svn_delta", svn_delta_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
/* qsort-ready comparison function. */
static int compare_paths (const void *a, const void *b)
{
@@ -999,6 +1017,16 @@
pool = svn_pool_create_ex (NULL, allocator);
apr_allocator_owner_set (allocator, pool);
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
if (argc <= 1)
{
subcommand_help (NULL, NULL, pool);
Index: subversion/libsvn_repos/repos.c
===================================================================
--- subversion/libsvn_repos/repos.c (revision 10140)
+++ subversion/libsvn_repos/repos.c (working copy)
@@ -1335,3 +1335,10 @@
return SVN_NO_ERROR;
}
+/* Get library version information.
+ */
+const svn_version_t *
+svn_repos_version (void)
+{
+ SVN_VERSION_BODY;
+}
Index: subversion/libsvn_ra_svn/version.c
===================================================================
--- subversion/libsvn_ra_svn/version.c (revision 0)
+++ subversion/libsvn_ra_svn/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_ra_svn_version (void)
+{
+ SVN_VERSION_BODY;
+}
Property changes on: subversion/libsvn_ra_svn/version.c
___________________________________________________________________
Name: svn:eol-style
+ native
Index: subversion/libsvn_delta/version.c
===================================================================
--- subversion/libsvn_delta/version.c (revision 0)
+++ subversion/libsvn_delta/version.c (revision 0)
@@ -0,0 +1,27 @@
+/*
+ * version.c: library version number
+ *
+ * ====================================================================
+ * Copyright (c) 2000-2004 CollabNet. All rights reserved.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at http://subversion.tigris.org/license-1.html.
+ * If newer versions of this license are posted there, you may use a
+ * newer version instead, at your option.
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals. For exact contribution history, see the revision
+ * history and logs, available at http://subversion.tigris.org/.
+ * ====================================================================
+ */
+
+
+
+#include "svn_version.h"
+
+const svn_version_t *
+svn_delta_version (void)
+{
+ SVN_VERSION_BODY;
+}
Property changes on: subversion/libsvn_delta/version.c
___________________________________________________________________
Name: svn:eol-style
+ native
Index: subversion/libsvn_ra_dav/ra_dav.h
===================================================================
--- subversion/libsvn_ra_dav/ra_dav.h (revision 10140)
+++ subversion/libsvn_ra_dav/ra_dav.h (working copy)
@@ -709,6 +709,13 @@
apr_array_header_t *location_revisions,
apr_pool_t *pool);
+/**
+ * Get libsvn_ra_dav version information.
+ * @since New in 1.1.
+ */
+
+const svn_version_t *svn_ra_dav__version (void);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Index: subversion/libsvn_ra_dav/util.c
===================================================================
--- subversion/libsvn_ra_dav/util.c (revision 10140)
+++ subversion/libsvn_ra_dav/util.c (working copy)
@@ -789,3 +789,12 @@
msg = apr_psprintf(pool, _("%s of '%s'"), method, url);
return svn_ra_dav__convert_error(session, msg, rv, pool);
}
+
+
+/* Return the library version number.
+ */
+const svn_version_t *
+svn_ra_dav__version (void)
+{
+ SVN_VERSION_BODY;
+}
Index: subversion/svnserve/main.c
===================================================================
--- subversion/svnserve/main.c (revision 10140)
+++ subversion/svnserve/main.c (working copy)
@@ -37,6 +37,8 @@
#include "svn_utf.h"
#include "svn_path.h"
#include "svn_opt.h"
+#include "svn_repos.h"
+#include "svn_version.h"
#include "server.h"
@@ -195,6 +197,25 @@
}
#endif
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_repos", svn_repos_version },
+ { "svn_fs", svn_fs_version },
+ { "svn_delta", svn_delta_version },
+ { "svn_ra_svn", svn_ra_svn_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
int main(int argc, const char *const *argv)
{
enum run_mode run_mode = run_mode_none;
@@ -229,6 +250,16 @@
/* Create our top-level pool. */
pool = svn_pool_create(NULL);
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
apr_getopt_init(&os, pool, argc, argv);
params.root = "/";
Index: subversion/svnversion/main.c
===================================================================
--- subversion/svnversion/main.c (revision 10140)
+++ subversion/svnversion/main.c (working copy)
@@ -157,6 +157,23 @@
}
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_client", svn_client_version },
+ { "svn_wc", svn_wc_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
/*
* Why is this not an svn subcommand? I have this vague idea that it could
* be run as part of the build process, with the output embedded in the svn
@@ -200,6 +217,16 @@
pool = svn_pool_create_ex (NULL, allocator);
apr_allocator_owner_set (allocator, pool);
+ /* Check library versions */
+ err = check_lib_versions ();
+ if (err)
+ {
+ svn_handle_error (err, stderr, FALSE);
+ svn_error_clear (err);
+ svn_pool_destroy (pool);
+ return EXIT_FAILURE;
+ }
+
sb.switched = FALSE;
sb.modified = FALSE;
sb.committed = FALSE;
Index: subversion/libsvn_fs_fs/fs.c
===================================================================
--- subversion/libsvn_fs_fs/fs.c (revision 10140)
+++ subversion/libsvn_fs_fs/fs.c (working copy)
@@ -250,6 +250,14 @@
}
+/* Return the library version number.
+ */
+const svn_version_t *
+svn_fs_fs__version (void)
+{
+ SVN_VERSION_BODY;
+}
+
/* Base FS library vtable, used by the FS loader library. */
Index: subversion/libsvn_fs_fs/fs.h
===================================================================
--- subversion/libsvn_fs_fs/fs.h (revision 10140)
+++ subversion/libsvn_fs_fs/fs.h (working copy)
@@ -27,6 +27,12 @@
extern "C" {
#endif /* __cplusplus */
+/**
+ * Get libsvn_fs_fs version information.
+ * @since New in 1.1.
+ */
+const svn_version_t *svn_fs_fs__version (void);
+
/*** The filesystem structure. ***/
Index: contrib/client-side/svn-push/svn-push.c
===================================================================
--- contrib/client-side/svn-push/svn-push.c (revision 10140)
+++ contrib/client-side/svn-push/svn-push.c (working copy)
@@ -144,7 +144,25 @@
return SVN_NO_ERROR;
}
+
+/* Version compatibility check */
+static svn_error_t *
+check_lib_versions (void)
+{
+ static const svn_version_checklist_t checklist[] =
+ {
+ { "svn_subr", svn_subr_version },
+ { "svn_delta", svn_delta_version },
+ { "svn_ra", svn_ra_version },
+ { NULL, NULL }
+ };
+
+ SVN_VERSION_DEFINE (my_version);
+ return svn_ver_check_list (&my_version, checklist);
+}
+
+
int
main (int argc, char *argv[])
{
@@ -159,6 +177,14 @@
return EXIT_FAILURE;
top_pool = svn_pool_create (NULL);
+
+ /* Check library versions */
+ error = check_lib_versions ();
+ if (error)
+ {
+ svn_handle_error (error, stderr, 0);
+ return EXIT_FAILURE;
+ }
#define CMD_LINE_ERROR \
{ \
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jul 5 08:03:50 2004