gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-sync] branch master updated (db9150e -> abb9161)


From: gnunet
Subject: [taler-sync] branch master updated (db9150e -> abb9161)
Date: Sun, 10 Nov 2024 17:21:55 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository sync.

    from db9150e  remove dead GNUNET_STRINGS_get_utf8_args(), just a NOP
     new 9c60576  clean up build system
     new abb9161  ensure we do not start if the database version is outdated 
(#9203)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                        | 32 +++++++-----------------------
 src/include/sync_database_lib.h     |  6 +++++-
 src/sync/sync-httpd.c               |  3 ++-
 src/sync/sync-httpd_backup_post.c   |  7 ++++---
 src/syncdb/plugin_syncdb_postgres.c | 39 +++++++++++++++++--------------------
 src/syncdb/sync-dbinit.c            |  3 ++-
 src/syncdb/sync_db_plugin.c         | 22 +++++++++++++++++++--
 src/syncdb/test_sync_db.c           | 16 ++++++++-------
 src/util/os_installation.c          |  5 +++++
 9 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/configure.ac b/configure.ac
index 791f50c..b7a56df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,35 +166,18 @@ PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3],
 ***]])])
 
 # libcurl-gnutls
-LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false])
-AS_IF([test "x$curl" = xtrue],
-      [LDFLAGS="-L$with_libcurl/lib $LDFLAGS"
-       CPPFLAGS="-I$with_libcurl/include $CPPFLAGS"])
-
+AC_CHECK_LIB([curl],
+             [curl_easy_getinfo],
+             [LIBCURL="-lcurl"
+              curl_gnutls=1],
+             [curl_gnutls=0])
+LIBCURL_CHECK_CONFIG([],[7.34.0],[curl=true],[curl=false])
 # Check for curl/curl.h
 AC_CHECK_HEADERS([curl/curl.h],,
   curl=false)
 
 AS_IF([test x$curl = xfalse],
-      [AC_MSG_ERROR([GNU Taler requires libcurl-gnutls  >= 7.34])])
-
-# check for libtalertwistertesting
-twistertesting=0
-AC_MSG_CHECKING([for talertwistertesting])
-AC_ARG_WITH([twister],
-            [AS_HELP_STRING([--with-twister=PFX], [base of 
libtalertwistertesting])],
-            [AC_MSG_RESULT([given as $with_twister])],
-            [AC_MSG_RESULT([not given])
-             with_twister=yes])
-AS_CASE([$with_twister],
-        [yes], [],
-        [no], [AC_MSG_WARN([no twister-testing will be compiled])],
-        [LDFLAGS="-L$with_twister/lib $LDFLAGS"
-         CPPFLAGS="-I$with_twister/include $CPPFLAGS"])
-
-AC_CHECK_HEADERS([taler/taler_twister_testing_lib.h],
- [AC_CHECK_LIB([talertwistertesting], [TALER_TESTING_run_twister], 
twistertesting=1,, [-ltalerexchange -ltalerbank])])
-AM_CONDITIONAL(HAVE_TWISTER, test x$twistertesting = x1)
+      [AC_MSG_ERROR([sync requires libcurl-gnutls  >= 7.34])])
 
 # gcov compilation
 AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
@@ -273,7 +256,6 @@ AM_CONDITIONAL([HAVE_GNUNETPQ], [false])
 AM_CONDITIONAL([HAVE_POSTGRESQL], [false])
 AM_CONDITIONAL([USE_COVERAGE], [false])
 AM_CONDITIONAL([ENABLE_DOC], [true])
-AM_CONDITIONAL([HAVE_TWISTER], [true])
 
 
 # end of 'doc_only'
diff --git a/src/include/sync_database_lib.h b/src/include/sync_database_lib.h
index 3311ce2..3f264b2 100644
--- a/src/include/sync_database_lib.h
+++ b/src/include/sync_database_lib.h
@@ -26,10 +26,14 @@
  * Initialize the plugin.
  *
  * @param cfg configuration to use
+ * @param skip_preflight true if we should skip the usual
+ *   preflight check which assures us that the DB is actually
+ *   operational; only sync-dbinit should use true here.
  * @return NULL on failure
  */
 struct SYNC_DatabasePlugin *
-SYNC_DB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg);
+SYNC_DB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                     bool skip_preflight);
 
 
 /**
diff --git a/src/sync/sync-httpd.c b/src/sync/sync-httpd.c
index fefefaa..34a2114 100644
--- a/src/sync/sync-httpd.c
+++ b/src/sync/sync-httpd.c
@@ -641,7 +641,8 @@ run (void *cls,
   }
 
   if (NULL ==
-      (db = SYNC_DB_plugin_load (config)))
+      (db = SYNC_DB_plugin_load (config,
+                                 false)))
   {
     global_ret = EXIT_NOTCONFIGURED;
     GNUNET_SCHEDULER_shutdown ();
diff --git a/src/sync/sync-httpd_backup_post.c 
b/src/sync/sync-httpd_backup_post.c
index f4bb2da..20d4094 100644
--- a/src/sync/sync-httpd_backup_post.c
+++ b/src/sync/sync-httpd_backup_post.c
@@ -32,7 +32,7 @@
  * we are awaiting payment before giving up?
  */
 #define CHECK_PAYMENT_GENERIC_TIMEOUT GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MINUTES, 30)
+          GNUNET_TIME_UNIT_MINUTES, 30)
 
 
 /**
@@ -236,7 +236,7 @@ make_payment_request (const char *order_id,
   TALER_MHD_add_global_headers (resp);
   {
     char *hdr;
-    char *pfx;
+    const char *pfx;
     char *hn;
     struct GNUNET_Buffer hdr_buf = { 0 };
 
@@ -515,7 +515,8 @@ await_payment (struct BackupContext *bc,
   bc->omgh = TALER_MERCHANT_merchant_order_get (SH_ctx,
                                                 SH_backend_url,
                                                 order_id,
-                                                NULL /* our payments are NOT 
session-bound */,
+                                                NULL /* our payments are NOT 
session-bound */
+                                                ,
                                                 timeout,
                                                 &check_payment_cb,
                                                 bc);
diff --git a/src/syncdb/plugin_syncdb_postgres.c 
b/src/syncdb/plugin_syncdb_postgres.c
index d250c82..580bc3f 100644
--- a/src/syncdb/plugin_syncdb_postgres.c
+++ b/src/syncdb/plugin_syncdb_postgres.c
@@ -237,8 +237,7 @@ prepare_statements (void *cls)
  * @return #GNUNET_OK on success
  */
 static enum GNUNET_GenericReturnValue
-internal_setup (struct PostgresClosure *pg,
-                bool skip_prepare)
+internal_setup (struct PostgresClosure *pg)
 {
   if (NULL == pg->conn)
   {
@@ -267,11 +266,12 @@ internal_setup (struct PostgresClosure *pg,
 #endif
     struct GNUNET_PQ_Context *db_conn;
 
-    db_conn = GNUNET_PQ_connect_with_cfg (pg->cfg,
-                                          "syncdb-postgres",
-                                          NULL,
-                                          es,
-                                          NULL);
+    db_conn = GNUNET_PQ_connect_with_cfg2 (pg->cfg,
+                                           "syncdb-postgres",
+                                           "sync-",
+                                           es,
+                                           NULL,
+                                           GNUNET_PQ_FLAG_CHECK_CURRENT);
     if (NULL == db_conn)
       return GNUNET_SYSERR;
     pg->conn = db_conn;
@@ -280,8 +280,6 @@ internal_setup (struct PostgresClosure *pg,
     GNUNET_PQ_reconnect_if_down (pg->conn);
   if (pg->init)
     return GNUNET_OK;
-  if (skip_prepare)
-    return GNUNET_OK;
   return prepare_statements (pg);
 }
 
@@ -308,8 +306,7 @@ postgres_preflight (void *cls)
   if (! pg->init)
   {
     if (GNUNET_OK !=
-        internal_setup (pg,
-                        false))
+        internal_setup (pg))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                   "Failed to ensure DB is initialized\n");
@@ -631,7 +628,8 @@ payment_by_account_cb (void *cls,
 static enum GNUNET_DB_QueryStatus
 postgres_lookup_pending_payments_by_account (void *cls,
                                              const struct
-                                             SYNC_AccountPublicKeyP 
*account_pub,
+                                             SYNC_AccountPublicKeyP 
*account_pub
+                                             ,
                                              SYNC_DB_PaymentPendingIterator it,
                                              void *it_cls)
 {
@@ -1283,6 +1281,10 @@ postgres_create_tables (void *cls)
  * @return NULL on error, otherwise a `struct TALER_SYNCDB_Plugin`
  */
 void *
+libsync_plugin_db_postgres_init (void *cls);
+
+/* make compiler happy */
+void *
 libsync_plugin_db_postgres_init (void *cls)
 {
   struct GNUNET_CONFIGURATION_Handle *cfg = cls;
@@ -1316,15 +1318,6 @@ libsync_plugin_db_postgres_init (void *cls)
     GNUNET_free (pg);
     return NULL;
   }
-  if (GNUNET_OK !=
-      internal_setup (pg,
-                      true))
-  {
-    GNUNET_free (pg->currency);
-    GNUNET_free (pg->sql_dir);
-    GNUNET_free (pg);
-    return NULL;
-  }
   plugin = GNUNET_new (struct SYNC_DatabasePlugin);
   plugin->cls = pg;
   plugin->create_tables = &postgres_create_tables;
@@ -1350,6 +1343,10 @@ libsync_plugin_db_postgres_init (void *cls)
  * @return NULL (always)
  */
 void *
+libsync_plugin_db_postgres_done (void *cls);
+
+/* make compiler happy */
+void *
 libsync_plugin_db_postgres_done (void *cls)
 {
   struct SYNC_DatabasePlugin *plugin = cls;
diff --git a/src/syncdb/sync-dbinit.c b/src/syncdb/sync-dbinit.c
index d1c9e39..838b636 100644
--- a/src/syncdb/sync-dbinit.c
+++ b/src/syncdb/sync-dbinit.c
@@ -57,7 +57,8 @@ run (void *cls,
   struct SYNC_DatabasePlugin *plugin;
 
   if (NULL ==
-      (plugin = SYNC_DB_plugin_load (cfg)))
+      (plugin = SYNC_DB_plugin_load (cfg,
+                                     true)))
   {
     fprintf (stderr,
              "Failed to initialize database plugin.\n");
diff --git a/src/syncdb/sync_db_plugin.c b/src/syncdb/sync_db_plugin.c
index 6739e4d..9e4a476 100644
--- a/src/syncdb/sync_db_plugin.c
+++ b/src/syncdb/sync_db_plugin.c
@@ -20,12 +20,13 @@
  * @author Sree Harsha Totakura <sreeharsha@totakura.in>
  */
 #include "platform.h"
-#include "sync_database_plugin.h"
+#include "sync_database_lib.h"
 #include <ltdl.h>
 
 
 struct SYNC_DatabasePlugin *
-SYNC_DB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg)
+SYNC_DB_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg,
+                     bool skip_preflight)
 {
   char *plugin_name;
   char *lib_name;
@@ -52,6 +53,15 @@ SYNC_DB_plugin_load (const struct 
GNUNET_CONFIGURATION_Handle *cfg)
     plugin->library_name = lib_name;
   else
     GNUNET_free (lib_name);
+  if ( (! skip_preflight) &&
+       (GNUNET_OK !=
+        plugin->preflight (plugin->cls)) )
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Database not ready. Try running sync-dbinit!\n");
+    SYNC_DB_plugin_unload (plugin);
+    return NULL;
+  }
   return plugin;
 }
 
@@ -80,6 +90,10 @@ static char *old_dlsearchpath;
  * Setup libtool paths.
  */
 void __attribute__ ((constructor))
+plugin_init (void);
+
+/* make compiler happy... */
+void __attribute__ ((constructor))
 plugin_init ()
 {
   int err;
@@ -121,6 +135,10 @@ plugin_init ()
  * Shutdown libtool.
  */
 void __attribute__ ((destructor))
+plugin_fini (void);
+
+/* make compiler happy... */
+void __attribute__ ((destructor))
 plugin_fini ()
 {
   lt_dlsetsearchpath (old_dlsearchpath);
diff --git a/src/syncdb/test_sync_db.c b/src/syncdb/test_sync_db.c
index d01941b..c9c492c 100644
--- a/src/syncdb/test_sync_db.c
+++ b/src/syncdb/test_sync_db.c
@@ -28,14 +28,15 @@
 
 
 #define FAILIF(cond)                            \
-  do {                                          \
-    if (! (cond)) { break;}                       \
-    GNUNET_break (0);                           \
-    goto drop;                                     \
-  } while (0)
+        do {                                          \
+          if (! (cond)) { break;}                       \
+          GNUNET_break (0);                           \
+          goto drop;                                     \
+        } while (0)
 
 #define RND_BLK(ptr)                                                    \
-  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (*ptr))
+        GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, ptr, sizeof (* 
\
+                                                                             
ptr))
 
 /**
  * Global return value for the test.  Initially -1, set to 0 upon
@@ -94,7 +95,8 @@ run (void *cls)
   size_t bs;
   void *b = NULL;
 
-  if (NULL == (plugin = SYNC_DB_plugin_load (cfg)))
+  if (NULL == (plugin = SYNC_DB_plugin_load (cfg,
+                                             true)))
   {
     result = 77;
     return;
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index 85092d1..a05ea46 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -25,6 +25,7 @@
  */
 #include "platform.h"
 #include <gnunet/gnunet_util_lib.h>
+#include "sync_util.h"
 
 
 /**
@@ -62,6 +63,10 @@ SYNC_project_data_default (void)
  * Initialize libsyncutil.
  */
 void __attribute__ ((constructor))
+SYNC_OS_init (void);
+
+/* make compiler happy */
+void __attribute__ ((constructor))
 SYNC_OS_init ()
 {
   GNUNET_OS_init (&sync_pd);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]