svn commit: r1930988 - in subversion/trunk: . subversion subversion/libsvn_subr

[email protected]
Newsgroups gmane.comp.version-control.subversion.svn
Message-ID <176712275860.1018780.3879421219391056575@svn02-us-east.apache.org>
Author: rinrab
Date: Tue Dec 30 19:25:58 2025
New Revision: 1930988

Log:
Use separate definitions for each checksum backend enabled.

Now, svn_private_config.h must define one of SVN_CHECKSUM_BACKEND_APR,
SVN_CHECKSUM_BACKEND_OPENSSL, or any other SVN_CHECKSUM_BACKEND_FOO. This will
simplify checks in each implementation and will allow adding more than two of
them.

* CMakeLists.txt
  (options): Drop SVN_CHECKSUM_USE_OPENSSL option, replacing it with a string
   cache variable SVN_CHECKSUM_BACKEND to let user select implementation.
  (SVN_CHECKSUM_BACKEND): Cycle through every possible option to setup proper
   implementation.

* configure.ac
  (Checksum backend): Always define SVN_CHECKSUM_BACKEND_APR. We will implement
   it at some point.

* subversion/libsvn_subr/checksum_apr.c
  (): Compile only if SVN_CHECKSUM_BACKEND_APR is defined.

* subversion/libsvn_subr/checksum_openssl.c
  (): Compile only if SVN_CHECKSUM_BACKEND_OPENSSL is defined.

* subversion/svn_private_config.hw
  (SVN_CHECKSUM_BACKEND_APR): Define to 1.

Note: you might need to reconfigure project

Modified:
   subversion/trunk/CMakeLists.txt
   subversion/trunk/configure.ac
   subversion/trunk/subversion/libsvn_subr/checksum_apr.c
   subversion/trunk/subversion/libsvn_subr/checksum_openssl.c
   subversion/trunk/subversion/svn_private_config.hw

Modified: subversion/trunk/CMakeLists.txt
==============================================================================
--- subversion/trunk/CMakeLists.txt	Tue Dec 30 17:23:05 2025	(r1930987)
+++ subversion/trunk/CMakeLists.txt	Tue Dec 30 19:25:58 2025	(r1930988)
@@ -111,7 +111,8 @@ cmake_dependent_option(SVN_BUILD_SHARED_
 option(SVN_DEBUG "Enables specific features for developer builds" OFF)
 cmake_dependent_option(SVN_USE_WIN32_CRASHHANDLER "Enables WIN32 crash handler." ON "WIN32" OFF)
 option(SVN_USE_DSO "Defined if svn should try to load DSOs" OFF)
-option(SVN_CHECKSUM_USE_OPENSSL "Defined if svn should use OpenSSL to compute checksums." OFF)
+set(SVN_CHECKSUM_BACKEND "apr" CACHE STRING "Checksum backend to use (possible values are 'apr', 'openssl')" )
+set_property(CACHE SVN_CHECKSUM_BACKEND PROPERTY STRINGS "apr" "openssl")
 set(SVN_SOVERSION "0" CACHE STRING "Subversion library ABI version")
 mark_as_advanced(SVN_SOVERSION)
 
@@ -384,15 +385,24 @@ if (SVN_ENABLE_RA_SERF)
   endif()
 endif()
 
-if (SVN_CHECKSUM_USE_OPENSSL)
+if (SVN_CHECKSUM_BACKEND STREQUAL "apr")
+  add_library(external-openssl INTERFACE)
+  add_private_config_definition(
+    "Defined if svn should use APR to compute checksums."
+    "SVN_CHECKSUM_BACKEND_APR" "1"
+  )
+elseif (SVN_CHECKSUM_BACKEND STREQUAL "openssl")
   find_package(OpenSSL REQUIRED)
   add_library(external-openssl ALIAS OpenSSL::Crypto)
   add_private_config_definition(
     "Defined if svn should use OpenSSL to compute checksums."
-    "SVN_CHECKSUM_USE_OPENSSL" "1"
+    "SVN_CHECKSUM_BACKEND_OPENSSL" "1"
   )
 else()
-  add_library(external-openssl INTERFACE)
+  message(SEND_ERROR
+    "Invalid value of SVN_CHECKSUM_BACKEND: '${SVN_CHECKSUM_BACKEND}'. "
+    "Possible options are 'apr' or 'openssl'."
+  )
 endif()
 
 ### Python

Modified: subversion/trunk/configure.ac
==============================================================================
--- subversion/trunk/configure.ac	Tue Dec 30 17:23:05 2025	(r1930987)
+++ subversion/trunk/configure.ac	Tue Dec 30 19:25:58 2025	(r1930988)
@@ -234,6 +234,10 @@ if test "$svn_lib_serf" = "yes"; then
             [Defined if support for Serf is enabled])
 fi
 
+dnl Checksum backend
+AC_DEFINE([SVN_CHECKSUM_BACKEND_APR], 1,
+          [Defined if svn should use APR to compute checksums])
+
 dnl Search for apr_memcache (only affects fs_fs)
 SVN_LIB_APR_MEMCACHE
 

Modified: subversion/trunk/subversion/libsvn_subr/checksum_apr.c
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/checksum_apr.c	Tue Dec 30 17:23:05 2025	(r1930987)
+++ subversion/trunk/subversion/libsvn_subr/checksum_apr.c	Tue Dec 30 19:25:58 2025	(r1930988)
@@ -22,7 +22,7 @@
  */
 
 #include "svn_private_config.h"
-#ifndef SVN_CHECKSUM_USE_OPENSSL
+#ifdef SVN_CHECKSUM_BACKEND_APR
 
 #define APR_WANT_BYTEFUNC
 
@@ -134,5 +134,5 @@ svn_checksum__sha1_ctx_final(unsigned ch
   return SVN_NO_ERROR;
 }
 
-#endif /* SVN_CHECKSUM_USE_OPENSSL */
+#endif /* SVN_CHECKSUM_BACKEND_APR */
 

Modified: subversion/trunk/subversion/libsvn_subr/checksum_openssl.c
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/checksum_openssl.c	Tue Dec 30 17:23:05 2025	(r1930987)
+++ subversion/trunk/subversion/libsvn_subr/checksum_openssl.c	Tue Dec 30 19:25:58 2025	(r1930988)
@@ -22,7 +22,7 @@
  */
 
 #include "svn_private_config.h"
-#ifdef SVN_CHECKSUM_USE_OPENSSL
+#ifdef SVN_CHECKSUM_BACKEND_OPENSSL
 
 #define APR_WANT_BYTEFUNC
 
@@ -159,5 +159,5 @@ svn_checksum__sha1_ctx_final(unsigned ch
   return SVN_NO_ERROR;
 }
 
-#endif /* SVN_CHECKSUM_USE_OPENSSL */
+#endif /* SVN_CHECKSUM_BACKEND_OPENSSL */
 

Modified: subversion/trunk/subversion/svn_private_config.hw
==============================================================================
--- subversion/trunk/subversion/svn_private_config.hw	Tue Dec 30 17:23:05 2025	(r1930987)
+++ subversion/trunk/subversion/svn_private_config.hw	Tue Dec 30 19:25:58 2025	(r1930988)
@@ -73,6 +73,9 @@
 /* Defined to be the path to the installed binaries */
 #define SVN_BINDIR "/usr/local/bin"
 
+/* Defined if svn should use APR to compute checksums */
+#define SVN_CHECKSUM_BACKEND_APR 1
+
 
 
 /* The default FS back-end type */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.