gnucash maint: Multiple changes pushed
Geert Janssens
gjanssens at code.gnucash.org
Thu Jan 23 09:37:36 EST 2020
Updated via https://github.com/Gnucash/gnucash/commit/ad612c48 (commit)
via https://github.com/Gnucash/gnucash/commit/4537c1de (commit)
via https://github.com/Gnucash/gnucash/commit/031d805b (commit)
via https://github.com/Gnucash/gnucash/commit/7cd24956 (commit)
from https://github.com/Gnucash/gnucash/commit/93ff991b (commit)
commit ad612c482bdc760b08b52195a921b92b96565abe
Merge: 4537c1de3 7cd249567
Author: Geert Janssens <geert at kobaltwit.be>
Date: Thu Jan 23 15:34:11 2020 +0100
Merge branch 'maint' of https://github.com/loftx/gnucash into maint
commit 4537c1de365880fe89554289c3e2f43edeff53de
Author: Geert Janssens <geert at kobaltwit.be>
Date: Wed Jan 22 22:40:11 2020 +0100
Bug 794916 - Fails to find environment file at startup when installation prefix is '/opt'
Update on this bug. Before doing the binreloc dance on various
paths check if the calculated dynamic prefix is still the same
as the compile time PREFIX. If so, just stick with the compile
time path names as this means the application wasn't relocated
anyway. Only if the dynamic prefix is different, try to
recalculate the requested paths relative to the dynamic
prefix.
Together with the configure time fix to detect /etc/opt is
outside of the /opt prefix, this eliminates the need for further
special case handling of the sysconfig directory so that
special case handling is removed.
diff --git a/libgnucash/core-utils/binreloc.c b/libgnucash/core-utils/binreloc.c
index 741df778f..589e71c6d 100644
--- a/libgnucash/core-utils/binreloc.c
+++ b/libgnucash/core-utils/binreloc.c
@@ -459,7 +459,10 @@ gnc_gbr_find_prefix (const gchar *default_prefix)
*
* If compiled_dir exists and is an absolute path then we check the dynamic
* prefix and if it's NULL fall back first on the passed-in default and then on
- * compiled_dir; otherwise we pass the compiled PREFIX value as a default to
+ * compiled_dir;
+ * otherwise if the dynamic prefix turns out to be the compile time defined PREFIX
+ * just use that
+ * otherwise we pass the compiled PREFIX value as a default to
* gnc_gbr_find_prefix, remove the PREFIX part (if any) from the compiled_dir
* and append that to the retrieved prefix.
*/
@@ -471,6 +474,9 @@ find_component_directory (const gchar *default_dir, const gchar* compiled_dir)
prefix = gnc_gbr_find_prefix (NULL);
if (prefix == NULL)
return g_strdup (default_dir ? default_dir : compiled_dir);
+ else if (!g_strcmp0 (prefix, PREFIX))
+ return g_strdup (compiled_dir);
+
subdir = gnc_file_path_relative_part(PREFIX, compiled_dir);
if (g_strcmp0 (compiled_dir, subdir) == 0)
{
@@ -544,7 +550,6 @@ gchar *
gnc_gbr_find_lib_dir (const gchar *default_lib_dir)
{
return find_component_directory (default_lib_dir, LIBDIR);
-
}
/** Locate the application's configuration files folder.
@@ -563,62 +568,7 @@ gnc_gbr_find_lib_dir (const gchar *default_lib_dir)
gchar *
gnc_gbr_find_etc_dir (const gchar *default_etc_dir)
{
- gchar *prefix, *dir, *sysconfdir;
-
- prefix = gnc_gbr_find_prefix (NULL);
- if (prefix == NULL)
- {
- /* BinReloc not initialized. */
- if (default_etc_dir != NULL)
- return g_strdup (default_etc_dir);
- else
- return NULL;
- }
-
- if (g_path_is_absolute (SYSCONFDIR))
- {
- sysconfdir = gnc_file_path_relative_part (PREFIX, SYSCONFDIR);
- if (g_strcmp0 (sysconfdir, SYSCONFDIR) == 0)
- {
- g_free (sysconfdir);
- sysconfdir = gnc_file_path_relative_part("/", SYSCONFDIR);
- }
- dir = g_build_filename (prefix, sysconfdir, NULL);
- g_free (sysconfdir);
- }
- else if ((g_strcmp0 (PREFIX, "/opt") == 0) ||
- (g_str_has_prefix (PREFIX, "/opt/")))
- {
- /* If the prefix is "/opt/..." the etc stuff will be installed in
- * "SYSCONFDIR/opt/...", while the rest will be in "/opt/..."
- * If this gets relocated after (make install), there will be another
- * prefix prepended to all of that:
- * "prefix2/opt/..."
- * "prefix2/SYSCONFDIR/opt/..."
- * Note: this most likely won't work on Windows. Don't try a /opt
- * prefix on that platform...
- */
- gchar *std_etc_dir = g_build_filename ("/", SYSCONFDIR, PREFIX, NULL);
-
- gchar *base_prefix_pos = g_strstr_len (prefix, -1, PREFIX);
- if (!base_prefix_pos || base_prefix_pos == prefix)
- dir = g_build_filename ("/", std_etc_dir, NULL);
- else
- {
- gchar *prefix2 = g_strndup (prefix, base_prefix_pos - prefix);
- dir = g_build_filename (prefix2, std_etc_dir, NULL);
- }
- g_free (std_etc_dir);
-
- }
- else
- {
- sysconfdir = gnc_file_path_relative_part(PREFIX, SYSCONFDIR);
- dir = g_build_filename (prefix, sysconfdir, NULL);
- g_free (sysconfdir);
- }
- g_free (prefix);
- return dir;
+ return find_component_directory (default_etc_dir, SYSCONFDIR);
}
commit 031d805bb24b1e8bdbfcfb2aa46b2ebe41e0161d
Author: Geert Janssens <geert at kobaltwit.be>
Date: Wed Jan 22 22:05:20 2020 +0100
Fix binreloc test for all install paths inside prefix
The FHS standard rules for a /opt based prefix sets a sysconfig dir to
/etc/opt/... which is outside of /opt. This was however not detected
properly. It now is.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1e58c77d..110315aef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,7 +74,7 @@ foreach(install_dir ${CMAKE_INSTALL_FULL_BINDIR}
${CMAKE_INSTALL_FULL_SYSCONFDIR} ${CMAKE_INSTALL_FULL_DATAROOTDIR}
${CMAKE_INSTALL_FULL_DATADIR} ${CMAKE_INSTALL_FULL_LIBDIR})
string(FIND ${install_dir} ${CMAKE_INSTALL_PREFIX} in_prefix)
- if(in_prefix EQUAL -1)
+ if(NOT (in_prefix EQUAL 0))
set(ENABLE_BINRELOC OFF)
message(WARNING "${install_dir} is set outside of the intallation prefix ${CMAKE_INSTALL_PREFIX}. That will break relocation so ENABLE_BINRELOC is set to off. With relocation disabled GnuCash will run only in its configured install location. You must set GNC_UNINSTALLED=1 and GNC_BUILDDIR=/path/to/builddir to run from the build directory. GnuCash will not run from a DESTDIR.")
break()
commit 7cd2495674935cdb1626e90e291811454a58c830
Author: loftx <dev at loftx.co.uk>
Date: Mon Jan 20 20:26:53 2020 +0100
Add Invoice.Unpost() to Python Bindings
diff --git a/bindings/python/gnucash_business.py b/bindings/python/gnucash_business.py
index b4583377d..e3aaa51ce 100644
--- a/bindings/python/gnucash_business.py
+++ b/bindings/python/gnucash_business.py
@@ -327,6 +327,7 @@ methods_return_instance_lists(
Invoice, { 'GetEntries': Entry })
Invoice.add_method('gncInvoiceRemoveEntry', 'RemoveEntry')
+Invoice.add_method('gncInvoiceUnpost', 'Unpost')
# Bill
Bill.add_methods_with_prefix('gncBill')
Summary of changes:
CMakeLists.txt | 2 +-
bindings/python/gnucash_business.py | 1 +
libgnucash/core-utils/binreloc.c | 66 +++++--------------------------------
3 files changed, 10 insertions(+), 59 deletions(-)
More information about the gnucash-changes
mailing list