pkgsrc-WIP-changes archive

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

Fix building with Boost >= 1.74



Module Name:	pkgsrc-wip
Committed By:	Edgar Fuß <ef%math.uni-bonn.de@localhost>
Pushed By:	ef
Date:		Thu Jan 14 20:12:47 2021 +0100
Changeset:	65777e8aebe3c857bc9a9a8787053016d817eb90

Modified Files:
	icinga2/distinfo
Added Files:
	icinga2/patches/patch-CMakeLists.txt
	icinga2/patches/patch-lib_base_string.cpp
	icinga2/patches/patch-lib_base_string.hpp
	icinga2/patches/patch-lib_base_utility.cpp
	icinga2/patches/patch-lib_perfdata_elasticsearchwriter.cpp
	icinga2/patches/patch-lib_perfdata_influxdbwriter.cpp
	icinga2/patches/patch-lib_remote_configfileshandler.cpp
	icinga2/patches/patch-lib_remote_httpserverconnection.cpp
	icinga2/patches/patch-lib_remote_httputility.cpp
	icinga2/patches/patch-lib_remote_infohandler.cpp

Log Message:
Fix building with Boost >= 1.74

Upstream Issue 8185
Upstream Pull Requests 8184, 8191, 8575
Upstream commits c30bae2994f1e5f33f6da51eb96d423e9bf0f75c, 34942a35112438a91ef25ffa5f0c6c18f1999303, 339b37a985b5f67ce5f0d2e02211d2c5b98a5d45, eab07a7318f9e42157bc21d86585340d762759e7

Commits split into pkgsrc patches, two adopted for differing context.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=65777e8aebe3c857bc9a9a8787053016d817eb90

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 icinga2/distinfo                                   | 10 ++++
 icinga2/patches/patch-CMakeLists.txt               | 18 ++++++++
 icinga2/patches/patch-lib_base_string.cpp          | 27 +++++++++++
 icinga2/patches/patch-lib_base_string.hpp          | 24 ++++++++++
 icinga2/patches/patch-lib_base_utility.cpp         | 20 ++++++++
 .../patch-lib_perfdata_elasticsearchwriter.cpp     | 17 +++++++
 .../patches/patch-lib_perfdata_influxdbwriter.cpp  | 17 +++++++
 .../patch-lib_remote_configfileshandler.cpp        | 17 +++++++
 .../patch-lib_remote_httpserverconnection.cpp      | 53 ++++++++++++++++++++++
 icinga2/patches/patch-lib_remote_httputility.cpp   | 17 +++++++
 icinga2/patches/patch-lib_remote_infohandler.cpp   | 17 +++++++
 11 files changed, 237 insertions(+)

diffs:
diff --git a/icinga2/distinfo b/icinga2/distinfo
index 666fadc8b5..279c935dad 100644
--- a/icinga2/distinfo
+++ b/icinga2/distinfo
@@ -4,4 +4,14 @@ SHA1 (icinga2-2.12.3.tar.gz) = 2cbcb9e1dd85613c8452235bdacd0eac347b0f69
 RMD160 (icinga2-2.12.3.tar.gz) = 21d907c8441503fcfda975756ccc76fb2a04f5b4
 SHA512 (icinga2-2.12.3.tar.gz) = 28b87e03a8ffeb7a1d19ddf9555151b826f7bf1fd33b0139c2fc8abe7c89d66d96089d5b32d0aaccc3876040514b2bfbde9970416d5ec4ea3b023b17c0fb1799
 Size (icinga2-2.12.3.tar.gz) = 7534454 bytes
+SHA1 (patch-CMakeLists.txt) = ef1bf5f3c7a787e2e1aba0ca241c605de21737c6
+SHA1 (patch-lib_base_string.cpp) = 8af8d9e7270664d9386f2dc2b0a3cc664f800610
+SHA1 (patch-lib_base_string.hpp) = f6c978a9fc1df45977ae02e35b59ff447630590b
+SHA1 (patch-lib_base_utility.cpp) = 85abaca2e84a0053247084b7f5f6baf70f50141c
+SHA1 (patch-lib_perfdata_elasticsearchwriter.cpp) = 8a98e1dfd0c273adebf842d6083c5f192c91bf0c
+SHA1 (patch-lib_perfdata_influxdbwriter.cpp) = 47df0dc5949e3812beb4d0d5168bc126f15d953c
+SHA1 (patch-lib_remote_configfileshandler.cpp) = 0b8ae9509a99df500502f163201bf0d1aeb8282d
+SHA1 (patch-lib_remote_httpserverconnection.cpp) = ce67da2feba7e262045478e933c4800d62d5591b
+SHA1 (patch-lib_remote_httputility.cpp) = 1da86b1be9566b977c7da03e17e206957f1bc0d7
+SHA1 (patch-lib_remote_infohandler.cpp) = 8f0767ced2be04953cfd6132a865de31da92e89e
 SHA1 (patch-third-party_cmake_FindMySQL.cmake) = a33567c30db47c4fab379f1b7c358174dd85fdd3
diff --git a/icinga2/patches/patch-CMakeLists.txt b/icinga2/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..d1aa15e5d8
--- /dev/null
+++ b/icinga2/patches/patch-CMakeLists.txt
@@ -0,0 +1,18 @@
+$NetBSD: patch-CMakeListe.txt $
+
+Define BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
+
+Upstream Issue #8185, Pull Request #8192, commit 34942a35112438a91ef25ffa5f0c6c18f1999303
+
+--- CMakeLists.txt.orig
++++ CMakeLists.txt
+@@ -172,6 +172,9 @@ add_definitions(-DBOOST_COROUTINES_NO_DEPRECATION_WARNING)
+ 
+ add_definitions(-DBOOST_FILESYSTEM_NO_DEPRECATED)
+ 
++# Required for Boost v1.74+
++add_definitions(-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT)
++
+ link_directories(${Boost_LIBRARY_DIRS})
+ include_directories(${Boost_INCLUDE_DIRS})
+ 
diff --git a/icinga2/patches/patch-lib_base_string.cpp b/icinga2/patches/patch-lib_base_string.cpp
new file mode 100644
index 0000000000..081754d865
--- /dev/null
+++ b/icinga2/patches/patch-lib_base_string.cpp
@@ -0,0 +1,27 @@
+$NetBSD: patch-lib_base_string.cpp $
+
+Support Boost 1.74 when setting HTTP headers
+
+Upstream Issue #8185, Pull Request #8575, commit eab07a7318f9e42157bc21d86585340d762759e7
+
+--- lib/base/string.cpp.orig
++++ lib/base/string.cpp
+@@ -127,6 +127,18 @@ String::operator const std::string&() const
+ 	return m_Data;
+ }
+ 
++/**
++ * Conversion function to boost::string_view.
++ *
++ * This allows using String as the value for HTTP headers in boost::beast::http::basic_fields::set.
++ *
++ * @return A boost::string_view representing this string.
++ */
++String::operator boost::string_view() const
++{
++	return boost::string_view(m_Data);
++}
++
+ const char *String::CStr() const
+ {
+ 	return m_Data.c_str();
diff --git a/icinga2/patches/patch-lib_base_string.hpp b/icinga2/patches/patch-lib_base_string.hpp
new file mode 100644
index 0000000000..8fe2cc55d0
--- /dev/null
+++ b/icinga2/patches/patch-lib_base_string.hpp
@@ -0,0 +1,24 @@
+$NetBSD: patch-lib_base_string.hpp $
+
+Support Boost 1.74 when setting HTTP headers
+
+Upstream Issue #8185, Pull Request #8575, commit eab07a7318f9e42157bc21d86585340d762759e7
+
+--- lib/base/string.hpp.orig
++++ lib/base/string.hpp
+@@ -6,6 +6,7 @@
+ #include "base/i2-base.hpp"
+ #include "base/object.hpp"
+ #include <boost/range/iterator.hpp>
++#include <boost/utility/string_view.hpp>
+ #include <string>
+ #include <iosfwd>
+ 
+@@ -71,6 +72,7 @@ public:
+ 	bool operator<(const String& rhs) const;
+ 
+ 	operator const std::string&() const;
++	operator boost::string_view() const;
+ 
+ 	const char *CStr() const;
+ 
diff --git a/icinga2/patches/patch-lib_base_utility.cpp b/icinga2/patches/patch-lib_base_utility.cpp
new file mode 100644
index 0000000000..d5917587a4
--- /dev/null
+++ b/icinga2/patches/patch-lib_base_utility.cpp
@@ -0,0 +1,20 @@
+$NetBSD: patch-lib_base_utility.cpp $
+
+Fix 'fs::copy_option' has not been declared with boost 1.74.0
+
+Upstream Issue #8185, Pull Request #8184, commit c30bae2994f1e5f33f6da51eb96d423e9bf0f75c
+
+--- lib/base/utility.cpp.orig
++++ lib/base/utility.cpp
+@@ -725,7 +725,11 @@ void Utility::CopyFile(const String& source, const String& target)
+ {
+ 	namespace fs = boost::filesystem;
+ 
++#if BOOST_VERSION >= 107400
++	fs::copy_file(fs::path(source.Begin(), source.End()), fs::path(target.Begin(), target.End()), fs::copy_options::overwrite_existing);
++#else /* BOOST_VERSION */
+ 	fs::copy_file(fs::path(source.Begin(), source.End()), fs::path(target.Begin(), target.End()), fs::copy_option::overwrite_if_exists);
++#endif /* BOOST_VERSION */
+ }
+ 
+ /*
diff --git a/icinga2/patches/patch-lib_perfdata_elasticsearchwriter.cpp b/icinga2/patches/patch-lib_perfdata_elasticsearchwriter.cpp
new file mode 100644
index 0000000000..45021c5122
--- /dev/null
+++ b/icinga2/patches/patch-lib_perfdata_elasticsearchwriter.cpp
@@ -0,0 +1,17 @@
+$NetBSD: patch-lib_perfdata_elasticsearchwriter.cpp $
+
+Support Boost 1.74 when setting HTTP headers
+
+Upstream Issue #8185, Pull Request #8575, commit 339b37a985b5f67ce5f0d2e02211d2c5b98a5d45
+
+--- lib/perfdata/elasticsearchwriter.cpp.orig
++++ lib/perfdata/elasticsearchwriter.cpp
+@@ -494,7 +494,7 @@ void ElasticsearchWriter::SendRequest(const String& body)
+ 		request.set(http::field::authorization, "Basic " + Base64::Encode(username + ":" + password));
+ 
+ 	request.body() = body;
+-	request.set(http::field::content_length, request.body().size());
++	request.content_length(request.body().size());
+ 
+ 	/* Don't log the request body to debug log, this is already done above. */
+ 	Log(LogDebug, "ElasticsearchWriter")
diff --git a/icinga2/patches/patch-lib_perfdata_influxdbwriter.cpp b/icinga2/patches/patch-lib_perfdata_influxdbwriter.cpp
new file mode 100644
index 0000000000..f6f4085e11
--- /dev/null
+++ b/icinga2/patches/patch-lib_perfdata_influxdbwriter.cpp
@@ -0,0 +1,17 @@
+$NetBSD: patch-lib_perfdata_influxdbwriter.cpp $
+
+Support Boost 1.74 when setting HTTP headers
+
+Upstream Issue #8185, Pull Request #8575, commit 339b37a985b5f67ce5f0d2e02211d2c5b98a5d45
+
+--- lib/perfdata/influxdbwriter.cpp.orig	2020-08-03 15:43:47.000000000 +0200
++++ lib/perfdata/influxdbwriter.cpp	2021-01-14 19:25:50.874644996 +0100
+@@ -505,7 +505,7 @@
+ 	request.set(http::field::host, url->GetHost() + ":" + url->GetPort());
+ 
+ 	request.body() = body;
+-	request.set(http::field::content_length, request.body().size());
++	request.content_length(request.body().size());
+ 
+ 	try {
+ 		if (stream.first) {
diff --git a/icinga2/patches/patch-lib_remote_configfileshandler.cpp b/icinga2/patches/patch-lib_remote_configfileshandler.cpp
new file mode 100644
index 0000000000..54cebf0393
--- /dev/null
+++ b/icinga2/patches/patch-lib_remote_configfileshandler.cpp
@@ -0,0 +1,17 @@
+$NetBSD: patch-lib_remote_configfileshandler.cpp $
+
+Support Boost 1.74 when setting HTTP headers
+
+Upstream Issue #8185, Pull Request #8575, commit 339b37a985b5f67ce5f0d2e02211d2c5b98a5d45
+
+--- lib/remote/configfileshandler.cpp.orig
++++ lib/remote/configfileshandler.cpp
+@@ -84,7 +84,7 @@ bool ConfigFilesHandler::HandleRequest(
+ 		response.result(http::status::ok);
+ 		response.set(http::field::content_type, "application/octet-stream");
+ 		response.body() = content;
+-		response.set(http::field::content_length, response.body().size());
++		response.content_length(response.body().size());
+ 	} catch (const std::exception& ex) {
+ 		HttpUtility::SendJsonError(response, params, 500, "Could not read file.",
+ 			DiagnosticInformation(ex));
diff --git a/icinga2/patches/patch-lib_remote_httpserverconnection.cpp b/icinga2/patches/patch-lib_remote_httpserverconnection.cpp
new file mode 100644
index 0000000000..9b388c947a
--- /dev/null
+++ b/icinga2/patches/patch-lib_remote_httpserverconnection.cpp
@@ -0,0 +1,53 @@
+$NetBSD: patch-lib_remote_httpserverconnection.cpp $
+
+Support Boost 1.74 when setting HTTP headers
+
+Upstream Issue #8185, Pull Request #8575, commit 339b37a985b5f67ce5f0d2e02211d2c5b98a5d45
+
+--- lib/remote/httpserverconnection.cpp.orig	2020-08-03 15:43:47.000000000 +0200
++++ lib/remote/httpserverconnection.cpp	2021-01-14 19:30:36.695215485 +0100
+@@ -186,7 +186,7 @@
+ 		} else {
+ 			response.set(http::field::content_type, "text/html");
+ 			response.body() = String("<h1>Bad Request</h1><p><pre>") + errorMsg + "</pre></p>";
+-			response.set(http::field::content_length, response.body().size());
++			response.content_length(response.body().size());
+ 		}
+ 
+ 		response.set(http::field::connection, "close");
+@@ -259,7 +259,7 @@
+ 					response.set(http::field::access_control_allow_methods, "GET, POST, PUT, DELETE");
+ 					response.set(http::field::access_control_allow_headers, "Authorization, X-HTTP-Method-Override");
+ 					response.body() = "Preflight OK";
+-					response.set(http::field::content_length, response.body().size());
++					response.content_length(response.body().size());
+ 					response.set(http::field::connection, "close");
+ 
+ 					boost::system::error_code ec;
+@@ -290,7 +290,7 @@
+ 		response.result(http::status::bad_request);
+ 		response.set(http::field::content_type, "text/html");
+ 		response.body() = "<h1>Accept header is missing or not set to 'application/json'.</h1>";
+-		response.set(http::field::content_length, response.body().size());
++		response.content_length(response.body().size());
+ 		response.set(http::field::connection, "close");
+ 
+ 		boost::system::error_code ec;
+@@ -331,7 +331,7 @@
+ 		} else {
+ 			response.set(http::field::content_type, "text/html");
+ 			response.body() = "<h1>Unauthorized. Please check your user credentials.</h1>";
+-			response.set(http::field::content_length, response.body().size());
++			response.content_length(response.body().size());
+ 		}
+ 
+ 		boost::system::error_code ec;
+@@ -423,7 +423,7 @@
+ 		} else {
+ 			response.set(http::field::content_type, "text/html");
+ 			response.body() = String("<h1>Bad Request</h1><p><pre>") + ec.message() + "</pre></p>";
+-			response.set(http::field::content_length, response.body().size());
++			response.content_length(response.body().size());
+ 		}
+ 
+ 		response.set(http::field::connection, "close");
diff --git a/icinga2/patches/patch-lib_remote_httputility.cpp b/icinga2/patches/patch-lib_remote_httputility.cpp
new file mode 100644
index 0000000000..19d9a8b3fc
--- /dev/null
+++ b/icinga2/patches/patch-lib_remote_httputility.cpp
@@ -0,0 +1,17 @@
+$NetBSD: patch-lib_remote_httputility.cpp $
+
+Support Boost 1.74 when setting HTTP headers
+
+Upstream Issue #8185, Pull Request #8575, commit 339b37a985b5f67ce5f0d2e02211d2c5b98a5d45
+
+--- lib/remote/httputility.cpp.orig
++++ lib/remote/httputility.cpp
+@@ -58,7 +58,7 @@ void HttpUtility::SendJsonBody(boost::beast::http::response<boost::beast::http::
+ 
+ 	response.set(http::field::content_type, "application/json");
+ 	response.body() = JsonEncode(val, params && GetLastParameter(params, "pretty"));
+-	response.set(http::field::content_length, response.body().size());
++	response.content_length(response.body().size());
+ }
+ 
+ void HttpUtility::SendJsonError(boost::beast::http::response<boost::beast::http::string_body>& response,
diff --git a/icinga2/patches/patch-lib_remote_infohandler.cpp b/icinga2/patches/patch-lib_remote_infohandler.cpp
new file mode 100644
index 0000000000..68a5ba5ca9
--- /dev/null
+++ b/icinga2/patches/patch-lib_remote_infohandler.cpp
@@ -0,0 +1,17 @@
+$NetBSD: patch-lib_remote_infohandler.cpp $
+
+Support Boost 1.74 when setting HTTP headers
+
+Upstream Issue #8185, Pull Request #8575, commit 339b37a985b5f67ce5f0d2e02211d2c5b98a5d45
+
+--- lib/remote/infohandler.cpp.orig
++++ lib/remote/infohandler.cpp
+@@ -92,7 +92,7 @@ bool InfoHandler::HandleRequest(
+ 
+ 		body += R"(<p>More information about API requests is available in the <a href="https://icinga.com/docs/icinga2/latest/"; target="_blank">documentation</a>.</p></html>)";
+ 		response.body() = body;
+-		response.set(http::field::content_length, response.body().size());
++		response.content_length(response.body().size());
+ 	}
+ 
+ 	return true;


Home | Main Index | Thread Index | Old Index