Index | Thread | Search

From:
Landry Breuil <landry@openbsd.org>
Subject:
Re: boost 1.87.0b1 bulk build test (maintainer action required)
To:
ports@openbsd.org, ajacoutot@openbsd.org
Date:
Thu, 21 Nov 2024 13:07:53 +0100

Download raw body.

Thread
Le Thu, Nov 21, 2024 at 08:40:04AM +0100, Landry Breuil a écrit :
> Le Tue, Nov 19, 2024 at 12:35:28PM +0100, Theo Buehler a écrit :
> > Brad sent me a diff for boost 1.87.0b1 to test (included at the end). As
> > was to be expected, it comes with significant fallout. A lot of the
> > damage from the 1.85 filesystem removals didn't fix itself:
> > 
> > https://marc.info/?l=openbsd-ports&m=171375368020942&w=2
> > 
> > Then there's a few more API removals on top.
> > 
> > Not sure what the best way to proceed would be. Some major linux distros
> > (arch, suse tumbleweed) and pkgsrc ship 1.86, FreeBSD has 1.85. So fixes
> > should be findable even if some upstreams don't seem to include them yet.
> > net/i2pd:
> > 
> > /tmp/pobj/i2pd-2.54.0/i2pd-2.54.0/build/../libi2pd/Timestamp.h:55:17: error: no type named 'io_service' in namespace 'boost::asio'
> >                         boost::asio::io_service m_Service;
> >                         ~~~~~~~~~~~~~^
> > 
> > productivity/gnucash:
> > 
> > /tmp/pobj/gnucash-5.9/gnucash-5.9/libgnucash/app-utils/gnc-quotes.cpp:208:22: error: no type named 'io_service' in namespace 'boost::asio'                                                                boost::asio::io_service svc;
> >         ~~~~~~~~~~~~~^
> 
> for those two, it seems migration from io_service to io_context is
> simple, per https://github.com/chriskohlhoff/asio/issues/615
> 
> nothing found in the upstream git repos/trackers. will try to fix
> gnucash and if the same fix applies easily to i2pd i'll send the patch
> for testing (i use neither)

the attached diff builds against boost 1.87, rechecking that it still
does with 1.84. My c++ is rusty so more eyes welcome, but gnucash
already uses c++17 so the std::filesystem bits should be there.

runtime tests welcome, afaict this code is only used in the config
migration path..

Landry
Index: patches/patch-libgnucash_app-utils_gnc-quotes_cpp
===================================================================
RCS file: patches/patch-libgnucash_app-utils_gnc-quotes_cpp
diff -N patches/patch-libgnucash_app-utils_gnc-quotes_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-libgnucash_app-utils_gnc-quotes_cpp	21 Nov 2024 12:05:07 -0000
@@ -0,0 +1,12 @@
+Index: libgnucash/app-utils/gnc-quotes.cpp
+--- libgnucash/app-utils/gnc-quotes.cpp.orig
++++ libgnucash/app-utils/gnc-quotes.cpp
+@@ -205,7 +205,7 @@ GncFQQuoteSource::run_cmd (const StrVec& args, const s
+     try
+     {
+         std::future<std::vector<char> > out_buf, err_buf;
+-        boost::asio::io_service svc;
++        boost::asio::io_context svc;
+ 
+         auto input_buf = bp::buffer (json_string);
+ 	bp::child process;
Index: patches/patch-libgnucash_core-utils_gnc-filepath-utils_cpp
===================================================================
RCS file: patches/patch-libgnucash_core-utils_gnc-filepath-utils_cpp
diff -N patches/patch-libgnucash_core-utils_gnc-filepath-utils_cpp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-libgnucash_core-utils_gnc-filepath-utils_cpp	21 Nov 2024 12:05:07 -0000
@@ -0,0 +1,94 @@
+unbreak with boost 1.87
+
+use std::filesystem::copy instead of handrolling a copy_recursive() func with
+now-removed boost::filesystem APIs
+
+Index: libgnucash/core-utils/gnc-filepath-utils.cpp
+--- libgnucash/core-utils/gnc-filepath-utils.cpp.orig
++++ libgnucash/core-utils/gnc-filepath-utils.cpp
+@@ -64,6 +64,7 @@
+ #endif
+ 
+ #include "gnc-locale-utils.hpp"
++#include <filesystem>
+ #include <boost/filesystem.hpp>
+ #include <boost/locale.hpp>
+ #include <regex>
+@@ -428,54 +429,7 @@ gnc_validate_directory (const bfs::path &dirname)
+     return true;
+ }
+ 
+-/* Will attempt to copy all files and directories from src to dest
+- * Returns true if successful or false if not */
+-static bool
+-copy_recursive(const bfs::path& src, const bfs::path& dest)
+-{
+-    if (!bfs::exists(src))
+-        return false;
+-
+-    // Don't copy on self
+-    if (src.compare(dest) == 0)
+-        return false;
+-
+-    auto old_str = src.string();
+-    auto old_len = old_str.size();
+-    try
+-    {
+-        /* Note: the for(auto elem : iterator) construct fails
+-         * on travis (g++ 4.8.x, boost 1.54) so I'm using
+-         * a traditional for loop here */
+-        for(auto direntry = bfs::recursive_directory_iterator(src);
+-            direntry != bfs::recursive_directory_iterator(); ++direntry)
+-        {
+ #ifdef G_OS_WIN32
+-            string cur_str = direntry->path().wstring();
+-#else
+-            string cur_str = direntry->path().string();
+-#endif
+-            auto cur_len = cur_str.size();
+-            string rel_str(cur_str, old_len, cur_len - old_len);
+-            bfs::path relpath(rel_str, cvt);
+-            auto newpath = bfs::absolute (relpath.relative_path(), dest);
+-            newpath.imbue(bfs_locale);
+-            bfs::copy(direntry->path(), newpath);
+-        }
+-    }
+-    catch(const bfs::filesystem_error& ex)
+-    {
+-        g_warning("An error occurred while trying to migrate the user configation from\n%s to\n%s"
+-                  "(Error: %s)",
+-                  src.string().c_str(), gnc_userdata_home_str.c_str(),
+-                  ex.what());
+-        return false;
+-    }
+-
+-    return true;
+-}
+-
+-#ifdef G_OS_WIN32
+ /* g_get_user_data_dir defaults to CSIDL_LOCAL_APPDATA, but
+  * the roaming profile makes more sense.
+  * So this function is a copy of glib's internal get_special_folder
+@@ -594,7 +548,21 @@ static std::string migrate_gnc_datahome()
+     migration_msg.imbue(gnc_get_boost_locale());
+ 
+     /* Step 1: copy directory $HOME/.gnucash to $GNC_DATA_HOME */
+-    auto full_copy = copy_recursive (old_dir, gnc_userdata_home);
++    auto full_copy = true;
++    try
++    {
++        std::filesystem::copy (std::filesystem::path(old_dir.string()),
++                               std::filesystem::path(gnc_userdata_home.string()),
++                               std::filesystem::copy_options::recursive);
++    }
++    catch (std::error_code& ec)
++    {
++        g_warning("An error occurred while trying to migrate the user configation from\n%s to\n%s"
++                  "(Error: %s)",
++                  old_dir.string().c_str(), gnc_userdata_home_str.c_str(),
++                  ec.message().c_str());
++        full_copy = false;
++    }
+ 
+     /* Step 2: move user editable config files from GNC_DATA_HOME to GNC_CONFIG_HOME
+                 These files are: