diff options
author | Sam James <sam@gentoo.org> | 2023-01-14 19:39:07 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-01-14 19:39:48 +0000 |
commit | 41387bfec00020779525cb7ae2f5549b90514e65 (patch) | |
tree | 088e652615a5861b65b6623400486931bf8da181 | |
parent | media-sound/ncspot: fix optfeature syntax (diff) | |
download | gentoo-41387bfec00020779525cb7ae2f5549b90514e65.tar.gz gentoo-41387bfec00020779525cb7ae2f5549b90514e65.tar.bz2 gentoo-41387bfec00020779525cb7ae2f5549b90514e65.zip |
net-analyzer/icinga2: fix build w/ boost-1.81
Closes: https://bugs.gentoo.org/888063
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | net-analyzer/icinga2/files/icinga2-2.13.6-boost-1.81.patch | 93 | ||||
-rw-r--r-- | net-analyzer/icinga2/icinga2-2.13.6-r1.ebuild | 149 |
2 files changed, 242 insertions, 0 deletions
diff --git a/net-analyzer/icinga2/files/icinga2-2.13.6-boost-1.81.patch b/net-analyzer/icinga2/files/icinga2-2.13.6-boost-1.81.patch new file mode 100644 index 000000000000..426dc5a1daa5 --- /dev/null +++ b/net-analyzer/icinga2/files/icinga2-2.13.6-boost-1.81.patch @@ -0,0 +1,93 @@ +https://bugs.gentoo.org/888063 +https://github.com/Icinga/icinga2/issues/9618 +https://github.com/Icinga/icinga2/pull/9624 + +From 5bcbc96e221bb3aafc370449941bfbd70939915c Mon Sep 17 00:00:00 2001 +From: "Alexander A. Klimov" <alexander.klimov@icinga.com> +Date: Wed, 4 Jan 2023 17:02:19 +0100 +Subject: [PATCH 1/2] Handle boost::beast::http::basic_fields#set() signature + change (v1.81) + +Make String convertible to boost::beast::string_view (always working), +not boost::string_view (broken). +--- a/lib/base/string.cpp ++++ b/lib/base/string.cpp +@@ -128,15 +128,15 @@ String::operator const std::string&() const + } + + /** +- * Conversion function to boost::string_view. ++ * Conversion function to boost::beast::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. ++ * @return A boost::beast::string_view representing this string. + */ +-String::operator boost::string_view() const ++String::operator boost::beast::string_view() const + { +- return boost::string_view(m_Data); ++ return boost::beast::string_view(m_Data); + } + + const char *String::CStr() const +--- a/lib/base/string.hpp ++++ b/lib/base/string.hpp +@@ -5,6 +5,7 @@ + + #include "base/i2-base.hpp" + #include "base/object.hpp" ++#include <boost/beast/core.hpp> + #include <boost/range/iterator.hpp> + #include <boost/utility/string_view.hpp> + #include <functional> +@@ -73,7 +74,7 @@ class String + bool operator<(const String& rhs) const; + + operator const std::string&() const; +- operator boost::string_view() const; ++ operator boost::beast::string_view() const; + + const char *CStr() const; + + +From 99c2d69dc85dfcd044e4a83d4894aa52eedfe09d Mon Sep 17 00:00:00 2001 +From: "Alexander A. Klimov" <alexander.klimov@icinga.com> +Date: Wed, 4 Jan 2023 17:34:49 +0100 +Subject: [PATCH 2/2] Handle boost::beast::http::basic_fields#operator[]() + signature change (v1.81) + +Use always working std::string(x), not broken x.to_string(). +(x is a return value.) +--- a/lib/remote/httphandler.cpp ++++ b/lib/remote/httphandler.cpp +@@ -58,7 +58,7 @@ void HttpHandler::ProcessRequest( + Dictionary::Ptr node = m_UrlTree; + std::vector<HttpHandler::Ptr> handlers; + +- Url::Ptr url = new Url(request.target().to_string()); ++ Url::Ptr url = new Url(std::string(request.target())); + auto& path (url->GetPath()); + + for (std::vector<String>::size_type i = 0; i <= path.size(); i++) { +--- a/lib/remote/httpserverconnection.cpp ++++ b/lib/remote/httpserverconnection.cpp +@@ -246,7 +246,7 @@ bool HandleAccessControl( + if (!allowedOrigins.empty()) { + auto& origin (request[http::field::origin]); + +- if (allowedOrigins.find(origin.to_string()) != allowedOrigins.end()) { ++ if (allowedOrigins.find(std::string(origin)) != allowedOrigins.end()) { + response.set(http::field::access_control_allow_origin, origin); + } + +@@ -536,7 +536,7 @@ void HttpServerConnection::ProcessMessages(boost::asio::yield_context yc) + if (!authenticatedUser) { + CpuBoundWork fetchingAuthenticatedUser (yc); + +- authenticatedUser = ApiUser::GetByAuthHeader(request[http::field::authorization].to_string()); ++ authenticatedUser = ApiUser::GetByAuthHeader(std::string(request[http::field::authorization])); + } + + Log logMsg (LogInformation, "HttpServerConnection"); diff --git a/net-analyzer/icinga2/icinga2-2.13.6-r1.ebuild b/net-analyzer/icinga2/icinga2-2.13.6-r1.ebuild new file mode 100644 index 000000000000..3b4c1eedf0be --- /dev/null +++ b/net-analyzer/icinga2/icinga2-2.13.6-r1.ebuild @@ -0,0 +1,149 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit cmake systemd + +if [[ ${PV} != 9999 ]]; then + SRC_URI="https://github.com/Icinga/icinga2/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm64 ~x86" +else + inherit git-r3 + EGIT_REPO_URI="https://github.com/Icinga/icinga2.git" +fi + +DESCRIPTION="Distributed, general purpose, network monitoring engine" +HOMEPAGE="https://icinga.com/" + +LICENSE="GPL-2" +SLOT="0" +IUSE="console jumbo-build lto mail mariadb minimal +mysql nano-syntax +plugins postgres systemd +vim-syntax" + +# Add accounts to DEPEND because of fowners in src_install +DEPEND=" + dev-libs/openssl:0= + dev-libs/boost:=[context] + console? ( dev-libs/libedit ) + mariadb? ( dev-db/mariadb-connector-c:= ) + mysql? ( dev-db/mysql-connector-c:= ) + postgres? ( dev-db/postgresql:= ) + dev-libs/yajl:= + acct-user/icinga + acct-group/icinga + acct-group/icingacmd" +BDEPEND=" + sys-devel/bison + >=sys-devel/flex-2.5.35" +RDEPEND=" + ${DEPEND} + plugins? ( || ( + net-analyzer/monitoring-plugins + net-analyzer/nagios-plugins + ) ) + mail? ( virtual/mailx ) + acct-group/nagios" + +REQUIRED_USE="!minimal? ( || ( mariadb mysql postgres ) )" + +PATCHES=( + "${FILESDIR}"/${P}-boost-1.81.patch +) + +src_configure() { + local mycmakeargs=( + -DICINGA2_UNITY_BUILD=$(usex jumbo-build) + -DCMAKE_INSTALL_SYSCONFDIR=/etc + -DCMAKE_INSTALL_LOCALSTATEDIR=/var + -DICINGA2_SYSCONFIGFILE=/etc/conf.d/icinga2 + -DICINGA2_PLUGINDIR="/usr/$(get_libdir)/nagios/plugins" + -DICINGA2_USER=icinga + -DICINGA2_GROUP=icingacmd + -DICINGA2_COMMAND_GROUP=icingacmd + -DICINGA2_RUNDIR=/run + -DINSTALL_SYSTEMD_SERVICE_AND_INITSCRIPT=ON + -DUSE_SYSTEMD=$(usex systemd) + -DLOGROTATE_HAS_SU=ON + -DICINGA2_LTO_BUILD=$(usex lto) + ) + # default to off if minimal, allow the flags to be set otherwise + if use minimal; then + mycmakeargs+=( + -DICINGA2_WITH_MYSQL=OFF + -DICINGA2_WITH_PGSQL=OFF + ) + else + mycmakeargs+=( + -DICINGA2_WITH_PGSQL=$(usex postgres) + -DICINGA2_WITH_MYSQL=$(usex mysql yes $(usex mariadb)) + ) + fi + + cmake_src_configure +} + +src_install() { + cmake_src_install + + newinitd "${FILESDIR}"/icinga2.initd-3 icinga2 + + if use mysql || use mariadb; then + docinto schema + newdoc "${WORKDIR}"/icinga2-${PV}/lib/db_ido_mysql/schema/mysql.sql mysql.sql + docinto schema/upgrade + dodoc "${WORKDIR}"/icinga2-${PV}/lib/db_ido_mysql/schema/upgrade/* + fi + if use postgres; then + docinto schema + newdoc "${WORKDIR}"/icinga2-${PV}/lib/db_ido_pgsql/schema/pgsql.sql pgsql.sql + docinto schema/upgrade + dodoc "${WORKDIR}"/icinga2-${PV}/lib/db_ido_pgsql/schema/upgrade/* + fi + + keepdir /etc/icinga2 + keepdir /var/lib/icinga2/api/zones + keepdir /var/lib/icinga2/api/repository + keepdir /var/lib/icinga2/api/log + keepdir /var/spool/icinga2/perfdata + + rm -r "${D}/run" || die "failed to remove /run" + rm -r "${D}/var/cache" || die "failed to remove /var/cache" + + fowners -R icinga:icinga /etc/icinga2 + fperms 0750 /etc/icinga2 + fowners icinga:icinga /var/lib/icinga2 + fowners -R icinga:icingacmd /var/lib/icinga2/api + fowners -R icinga:icingacmd /var/lib/icinga2/certificate-requests + fowners -R icinga:icingacmd /var/lib/icinga2/certs + fowners icinga:icinga /var/spool/icinga2 + fowners icinga:icinga /var/spool/icinga2/perfdata + fowners icinga:icingacmd /var/log/icinga2 + + fperms ug+rwX,o-rwx /etc/icinga2 + fperms ug+rwX,o-rwx /var/lib/icinga2 + fperms ug+rwX,o-rwx /var/spool/icinga2 + fperms ug+rwX,o-rwx /var/log/icinga2 + + if use vim-syntax; then + insinto /usr/share/vim/vimfiles + doins -r "${WORKDIR}"/${P}/tools/syntax/vim/ftdetect + doins -r "${WORKDIR}"/${P}/tools/syntax/vim/syntax + fi + + if use nano-syntax; then + insinto /usr/share/nano + doins "${WORKDIR}"/${P}/tools/syntax/nano/icinga2.nanorc + fi +} + +pkg_postinst() { + if [[ "${PV}" != 9999 ]]; then + local v + for v in ${REPLACING_VERSIONS}; do + if ver_test "${PV}" -gt "${v}"; then + elog "DB IDO schema upgrade may be required." + elog "https://www.icinga.com/docs/icinga2/latest/doc/16-upgrading-icinga-2/" + fi + done + fi +} |