You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2012/08/31 16:57:07 UTC

svn commit: r1379474 - in /subversion/trunk/subversion: include/private/svn_sqlite.h libsvn_subr/opt.c libsvn_subr/sqlite.c libsvn_subr/sysinfo.c libsvn_subr/sysinfo.h

Author: brane
Date: Fri Aug 31 14:57:07 2012
New Revision: 1379474

URL: http://svn.apache.org/viewvc?rev=1379474&view=rev
Log:
With "svn --version --verbose", print compile-time and run-time versions
of APR, APR-Util and SQLite.

* subversion/include/private/svn_sqlite.h
  (svn_sqlite__compiled_version, svn_sqlite__runtime_version): Declare.
* subversion/libsvn_subr/sqlite.c
  (svn_sqlite__compiled_version, svn_sqlite__runtime_version): Implement.
  Expose SQLITE_VERSION and sqlite3_libversion() to the rest of libsvn_subr.

* subversion/libsvn_subr/sysinfo.h (svn_sysinfo__linked_libs): Declare.
* subversion/libsvn_subr/sysinfo.c (svn_sysinfo__linked_libs): Implement.

* subversion/libsvn_subr/opt.c (svn_opt__print_version_info): Use the
  result of svn_sysinfo__linked_libs to print info about dependencies.

Modified:
    subversion/trunk/subversion/include/private/svn_sqlite.h
    subversion/trunk/subversion/libsvn_subr/opt.c
    subversion/trunk/subversion/libsvn_subr/sqlite.c
    subversion/trunk/subversion/libsvn_subr/sysinfo.c
    subversion/trunk/subversion/libsvn_subr/sysinfo.h

Modified: subversion/trunk/subversion/include/private/svn_sqlite.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_sqlite.h?rev=1379474&r1=1379473&r2=1379474&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_sqlite.h (original)
+++ subversion/trunk/subversion/include/private/svn_sqlite.h Fri Aug 31 14:57:07 2012
@@ -37,6 +37,17 @@ extern "C" {
 #endif /* __cplusplus */
 
 
+/* Because the SQLite code can be inlined into libsvn_subre/sqlite.c,
+   we define accessors to its compile-time and run-time version
+   numbers here. */
+
+/* Return the value that SQLITE_VERSION had at compile time. */
+const char *svn_sqlite__compiled_version(void);
+
+/* Return the value of sqlite3_libversion() at run time. */
+const char *svn_sqlite__runtime_version(void);
+
+
 typedef struct svn_sqlite__db_t svn_sqlite__db_t;
 typedef struct svn_sqlite__stmt_t svn_sqlite__stmt_t;
 typedef struct svn_sqlite__context_t svn_sqlite__context_t;

Modified: subversion/trunk/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1379474&r1=1379473&r2=1379474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/opt.c (original)
+++ subversion/trunk/subversion/libsvn_subr/opt.c Fri Aug 31 14:57:07 2012
@@ -1134,6 +1134,7 @@ svn_opt__print_version_info(const char *
     {
       const char *const host = svn_sysinfo__canonical_host(pool);
       const char *const relname = svn_sysinfo__release_name(pool);
+      const char *const slibs = svn_sysinfo__linked_libs(pool);
       const char *const dlibs = svn_sysinfo__loaded_libs(pool);
 
       SVN_ERR(svn_cmdline_fputs(_("System information:\n\n"), stdout, pool));
@@ -1144,6 +1145,13 @@ svn_opt__print_version_info(const char *
       else
         SVN_ERR(svn_cmdline_printf(pool, _("* running on %s\n"), host));
 
+      if (slibs)
+        {
+          SVN_ERR(svn_cmdline_fputs(_("* linked dependencies:\n"),
+                                    stdout, pool));
+          SVN_ERR(svn_cmdline_fputs(slibs, stdout, pool));
+        }
+
       if (dlibs)
         {
           SVN_ERR(svn_cmdline_fputs(_("* loaded shared libraries:\n"),

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=1379474&r1=1379473&r2=1379474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Fri Aug 31 14:57:07 2012
@@ -54,6 +54,20 @@
 #error SQLite is too old -- version 3.7.12 is the minimum required version
 #endif
 
+const char *
+svn_sqlite__compiled_version(void)
+{
+  static const char sqlite_version[] = SQLITE_VERSION;
+  return sqlite_version;
+}
+
+const char *
+svn_sqlite__runtime_version(void)
+{
+  return sqlite3_libversion();
+}
+
+
 INTERNAL_STATEMENTS_SQL_DECLARE_STATEMENTS(internal_statements);
 
 

Modified: subversion/trunk/subversion/libsvn_subr/sysinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sysinfo.c?rev=1379474&r1=1379473&r2=1379474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sysinfo.c Fri Aug 31 14:57:07 2012
@@ -37,11 +37,15 @@
 #include <apr_pools.h>
 #include <apr_file_info.h>
 #include <apr_strings.h>
+#include <apr_version.h>
+#include <apu_version.h>
 
 #include "svn_ctype.h"
 #include "svn_error.h"
 #include "svn_utf.h"
 
+#include "private/svn_sqlite.h"
+
 #include "sysinfo.h"
 #include "svn_private_config.h"
 
@@ -96,6 +100,28 @@ svn_sysinfo__release_name(apr_pool_t *po
 #endif
 }
 
+const char *
+svn_sysinfo__linked_libs(apr_pool_t *pool)
+{
+  const char *apr_ver =
+    apr_psprintf(pool, "APR %s (compiled with %s)",
+                 apr_version_string(), APR_VERSION_STRING);
+  const char *apr_util_ver =
+    apr_psprintf(pool, "APR-Util %s (compiled with %s)",
+                 apu_version_string(), APU_VERSION_STRING);
+  const char *sqlite_ver =
+#ifdef SVN_SQLITE_INLINE
+    apr_psprintf(pool, "SQLite %s (amalgamated)",
+                 svn_sqlite__runtime_version());
+#else
+    apr_psprintf(pool, "SQLite %s (compiled with %s)",
+                 svn_sqlite__runtime_version(),
+                 svn_sqlite__compiled_version());
+#endif
+
+    return apr_psprintf(pool, "  - %s\n  - %s\n  - %s\n",
+                        apr_ver, apr_util_ver, sqlite_ver);
+}
 
 const char *
 svn_sysinfo__loaded_libs(apr_pool_t *pool)

Modified: subversion/trunk/subversion/libsvn_subr/sysinfo.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sysinfo.h?rev=1379474&r1=1379473&r2=1379474&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sysinfo.h (original)
+++ subversion/trunk/subversion/libsvn_subr/sysinfo.h Fri Aug 31 14:57:07 2012
@@ -44,6 +44,13 @@ const char *svn_sysinfo__canonical_host(
  */
 const char *svn_sysinfo__release_name(apr_pool_t *pool);
 
+/* Return a description of the link-time and run-time versions of
+ * dependent libraries.
+ *
+ * All allocations are done in POOL.
+ */
+const char *svn_sysinfo__linked_libs(apr_pool_t *pool);
+
 /* Return a string containing a list of shared libraries loaded by the
  * running process, including their versions where applicable, or NULL
  * if the information is not available.



Re: svn commit: r1379474 - in /subversion/trunk/subversion: include/private/svn_sqlite.h libsvn_subr/opt.c libsvn_subr/sqlite.c libsvn_subr/sysinfo.c libsvn_subr/sysinfo.h

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Branko Čibej wrote on Fri, Aug 31, 2012 at 16:59:57 +0200:
> On 31.08.2012 16:57, brane@apache.org wrote:
> > Author: brane
> > Date: Fri Aug 31 14:57:07 2012
> > New Revision: 1379474
> >
> > URL: http://svn.apache.org/viewvc?rev=1379474&view=rev
> > Log:
> > With "svn --version --verbose", print compile-time and run-time versions
> > of APR, APR-Util and SQLite.
> 
> This change takes care of the hard dependencies that are always linked
> with (or compiled into) libsvn_subr. I'm not sure what to do with serf,
> BDB, etc. that libsvn_subr does not depend on. I feel it would be wrong
> if we linked them in, but can't think of another way to find the
> run-time versions of those libraries.

Makes sense.  How about teaching the higher-level libraries that do link
those external libraries (eg: libsvn_fs_base) to report the version
numbers of the dependencies?

I'm not sure how to get the output all the way to the client, though.
For RA providers and FS providers, the providers support a "my version
string" API and there is a way to enumerate the available providers,
thus yielding output such as:

[[[
* ra_serf : Module for accessing a repository via WebDAV protocol using serf.
  - handles 'http' scheme
  - handles 'https' scheme
]]]

But I'm not sure that this approach generalises to all optional external
dependencies we have.  (Case in point: libsasl as a subsidiary of
libsvn_ra_svn.)

> 
> -- Brane
> 
> -- 
> Certified & Supported Apache Subversion Downloads:
> http://www.wandisco.com/subversion/download
> 

Re: svn commit: r1379474 - in /subversion/trunk/subversion: include/private/svn_sqlite.h libsvn_subr/opt.c libsvn_subr/sqlite.c libsvn_subr/sysinfo.c libsvn_subr/sysinfo.h

Posted by Branko Čibej <br...@wandisco.com>.
On 31.08.2012 16:57, brane@apache.org wrote:
> Author: brane
> Date: Fri Aug 31 14:57:07 2012
> New Revision: 1379474
>
> URL: http://svn.apache.org/viewvc?rev=1379474&view=rev
> Log:
> With "svn --version --verbose", print compile-time and run-time versions
> of APR, APR-Util and SQLite.

This change takes care of the hard dependencies that are always linked
with (or compiled into) libsvn_subr. I'm not sure what to do with serf,
BDB, etc. that libsvn_subr does not depend on. I feel it would be wrong
if we linked them in, but can't think of another way to find the
run-time versions of those libraries.

-- Brane

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download