[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] 06/07: fixed anastasis-reducer to return init state
From: |
gnunet |
Subject: |
[taler-anastasis] 06/07: fixed anastasis-reducer to return init state |
Date: |
Sat, 12 Sep 2020 11:01:53 +0200 |
This is an automated email from the git hooks/post-receive script.
dennis-neufeld pushed a commit to branch master
in repository anastasis.
commit 514a95ba9b3109aaa17924e202d107ce8b17bdcc
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Sat Sep 12 10:58:51 2020 +0200
fixed anastasis-reducer to return init state
---
Makefile.am | 4 ++--
configure.ac | 4 +++-
contrib/Makefile.am | 1 -
contrib/pogen.sh | 3 +++
contrib/redux.countries.json | 11 +++++++++
src/cli/anastasis-cli-redux.c | 22 ++++++++++++-----
src/lib/anastasis_api_backup_redux.c | 46 +++++++++++++++++++++++++++++++++++-
7 files changed, 80 insertions(+), 11 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 3227908..6880184 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,9 +8,9 @@ else
endif
else
if ENABLE_DOC
- SUBDIRS = . src doc
+ SUBDIRS = . contrib src doc
else
- SUBDIRS = . src doc
+ SUBDIRS = . contrib src doc
endif
endif
diff --git a/configure.ac b/configure.ac
index 6a8b94d..547b3f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -297,7 +297,9 @@ AC_MSG_RESULT($enable_experimental)
AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])
-AC_CONFIG_FILES([Makefile
+AC_CONFIG_FILES([
+Makefile
+contrib/Makefile
doc/Makefile
src/Makefile
src/util/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 84424af..f8ea7f5 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -7,7 +7,6 @@ pkgdatadir= $(prefix)/share/anastasis/
EXTRA_DIST = \
$(pkgdata_DATA) \
- get_version.sh \
pogen.sh
pkgdata_DATA = \
diff --git a/contrib/pogen.sh b/contrib/pogen.sh
new file mode 100755
index 0000000..89140ea
--- /dev/null
+++ b/contrib/pogen.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+find src -name "*.c" | sort > po/POTFILES.in
+find contrib -name "*.json" | sort >> po/POTFILES.in
diff --git a/contrib/redux.countries.json b/contrib/redux.countries.json
index 1d684e2..57a0262 100644
--- a/contrib/redux.countries.json
+++ b/contrib/redux.countries.json
@@ -22,6 +22,17 @@
"fr": "Allemagne",
"en": "Germany" },
"currency": "EUR"
+ },
+ {
+ "code" : "us",
+ "name" : "United States of America (USA)",
+ "continent" : "North America",
+ "continent_i18n" : { "de" : "Nordamerika" },
+ "name_i18n" : { "de_DE":"Vereinigte Staaten von Amerika (USA)",
+ "de_CH":"Vereinigte Staaten von
Amerika (USA)",
+ "fr": "États-Unis d'Amérique
(USA)",
+ "en": "United States of America
(USA)" },
+ "currency": "USD"
}
]
}
diff --git a/src/cli/anastasis-cli-redux.c b/src/cli/anastasis-cli-redux.c
index ef96094..bd32856 100644
--- a/src/cli/anastasis-cli-redux.c
+++ b/src/cli/anastasis-cli-redux.c
@@ -177,6 +177,15 @@ run (void *cls,
{
path_new_state = (char *) args[0];
new_state = ANASTASIS_backup_start (cfg);
+ if (! new_state)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "At %s:%u failed to get an initial state!\n",
+ __FILE__,
+ __LINE__);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
if (! (0 == json_dump_file (new_state,
path_new_state,
JSON_COMPACT)))
@@ -269,12 +278,13 @@ run (void *cls,
&action_cb,
cls);
- if (r_flag)
- ANASTASIS_recovery_action (prev_state,
- action,
- arguments,
- &action_cb,
- cls);
+
+// if (r_flag)
+// ANASTASIS_recovery_action (prev_state,
+// action,
+// arguments,
+// &action_cb,
+// cls);
}
diff --git a/src/lib/anastasis_api_backup_redux.c
b/src/lib/anastasis_api_backup_redux.c
index 3640568..6acbdfa 100644
--- a/src/lib/anastasis_api_backup_redux.c
+++ b/src/lib/anastasis_api_backup_redux.c
@@ -50,6 +50,43 @@ typedef void
ANASTASIS_ActionCallback cb,
void *cb_cls);
+static int
+redux_countries_init ()
+{
+ char *dn;
+ json_error_t error;
+
+ {
+ char *path;
+
+ path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
+ if (NULL == path)
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_asprintf (&dn,
+ "%s/share/anastasis/redux.countries.json",
+ path);
+ GNUNET_free (path);
+ }
+ redux_countries = json_load_file (dn, JSON_COMPACT, &error);
+ if (NULL == redux_countries)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to parse `%s': %s at %d:%d (%d)\n",
+ dn,
+ error.text,
+ error.line,
+ error.column,
+ error.position);
+ GNUNET_free (dn);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (dn);
+ return GNUNET_OK;
+}
+
/**
* Returns an initial ANASTASIS backup state.
*
@@ -61,8 +98,15 @@ ANASTASIS_backup_start (const struct
GNUNET_CONFIGURATION_Handle *cfg)
json_t *initial_state;
json_t *temp_country;
size_t index;
- json_t *root = json_object_get (redux_countries, "countries");
json_t *continents = json_array ();
+ json_t *root;
+
+ if (GNUNET_SYSERR == redux_countries_init ())
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ root = json_object_get (redux_countries, "countries");
json_array_foreach (root, index, temp_country)
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (3e1fd2b -> a7d37bf), gnunet, 2020/09/12
- [taler-anastasis] 01/07: work on reducer, gnunet, 2020/09/12
- [taler-anastasis] 02/07: options for reducer cli, gnunet, 2020/09/12
- [taler-anastasis] 04/07: work on backup redux, gnunet, 2020/09/12
- [taler-anastasis] 03/07: work on reducer cli, gnunet, 2020/09/12
- [taler-anastasis] 06/07: fixed anastasis-reducer to return init state,
gnunet <=
- [taler-anastasis] 05/07: work on backup redux, gnunet, 2020/09/12
- [taler-anastasis] 07/07: merge, gnunet, 2020/09/12