From: "Patrick McLean" <chutzpah@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/exabgp/files/, net-misc/exabgp/
Date: Thu, 25 Feb 2021 17:31:41 +0000 (UTC) [thread overview]
Message-ID: <1614274281.6e73d50d48c225700837c41b30bcc53594aec5aa.chutzpah@gentoo> (raw)
commit: 6e73d50d48c225700837c41b30bcc53594aec5aa
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Thu Feb 25 17:31:21 2021 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Thu Feb 25 17:31:21 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e73d50d
net-misc/exabgp-4.2.11-r2: Revbump, supervision, misc bugfixes
Copyright: Sony Interactive Entertainment Inc.
Package-Manager: Portage-3.0.15, Repoman-3.0.2
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
net-misc/exabgp/exabgp-4.2.11-r2.ebuild | 59 ++++++++++++++++++++
...p-4.2.11-healthcheck-allow-disable-metric.patch | 22 ++++++++
.../exabgp-4.2.11-healthcheck-fix-log-crash.patch | 13 +++++
.../files/exabgp-4.2.11-less-verbose-logging.patch | 44 +++++++++++++++
net-misc/exabgp/files/exabgp.initd-r1 | 64 ++++++++++++++++++++++
5 files changed, 202 insertions(+)
diff --git a/net-misc/exabgp/exabgp-4.2.11-r2.ebuild b/net-misc/exabgp/exabgp-4.2.11-r2.ebuild
new file mode 100644
index 00000000000..3e7774c0353
--- /dev/null
+++ b/net-misc/exabgp/exabgp-4.2.11-r2.ebuild
@@ -0,0 +1,59 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{7..9} )
+DISTUTILS_USE_SETUPTOOLS=rdepend
+inherit tmpfiles systemd distutils-r1
+
+DESCRIPTION="The BGP swiss army knife of networking"
+HOMEPAGE="https://github.com/Exa-Networks/exabgp"
+SRC_URI="https://github.com/Exa-Networks/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ acct-group/exabgp
+ acct-user/exabgp
+"
+BDEPEND="
+ test? (
+ dev-python/psutil[${PYTHON_USEDEP}]
+ dev-python/nose[${PYTHON_USEDEP}]
+ dev-python/six[${PYTHON_USEDEP}]
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}/exabgp-4.2.7-paths.patch"
+ "${FILESDIR}/exabgp-4.2.10-ip-path.patch"
+ "${FILESDIR}/exabgp-4.2.11-healthcheck-allow-disable-metric.patch"
+ "${FILESDIR}/exabgp-4.2.11-healthcheck-fix-log-crash.patch"
+ "${FILESDIR}/exabgp-4.2.11-less-verbose-logging.patch"
+)
+
+python_test() {
+ ./qa/bin/parsing || die "tests fail with ${EPYTHON}"
+ nosetests -v ./qa/tests/*_test.py || die "tests fail with ${EPYTHON}"
+}
+
+python_install_all() {
+ distutils-r1_python_install_all
+
+ newinitd "${FILESDIR}/${PN}.initd-r1" ${PN}
+ newconfd "${FILESDIR}/${PN}.confd" ${PN}
+
+ newtmpfiles "${FILESDIR}/exabgp.tmpfiles" ${PN}.conf
+ systemd_dounit etc/systemd/*
+
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}/${PN}.logrotate" ${PN}
+
+ keepdir /etc/exabgp
+
+ doman doc/man/*.?
+}
diff --git a/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-allow-disable-metric.patch b/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-allow-disable-metric.patch
new file mode 100644
index 00000000000..768fe80a810
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-allow-disable-metric.patch
@@ -0,0 +1,22 @@
+diff --git a/lib/exabgp/application/healthcheck.py b/lib/exabgp/application/healthcheck.py
+index a4f6b8d1..805cf8af 100644
+--- a/lib/exabgp/application/healthcheck.py
++++ b/lib/exabgp/application/healthcheck.py
+@@ -168,6 +168,7 @@
+ g.add_argument(
+ "--start-ip", metavar='N', type=int, default=0, help="index of the first IP in the list of IP addresses"
+ )
++ g.add_argument("--no-metric", action="store_true", default=False, help="don't send metrics when updating announcements")
+ g.add_argument(
+ "--up-metric", metavar='M', type=int, default=100, help="first IP get the metric M when the service is up"
+ )
+@@ -494,7 +495,8 @@
+ announce = "route {0} next-hop {1}".format(str(ip), options.next_hop or "self")
+
+ if command == "announce":
+- announce = "{0} med {1}".format(announce, metric)
++ if not options.no_metric:
++ announce = "{0} med {1}".format(announce, metric)
+ if options.local_preference >= 0:
+ announce = "{0} local-preference {1}".format(announce, options.local_preference)
+ if options.community or options.disabled_community:
diff --git a/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-fix-log-crash.patch b/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-fix-log-crash.patch
new file mode 100644
index 00000000000..a43e90a724e
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp-4.2.11-healthcheck-fix-log-crash.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/exabgp/logger.py b/lib/exabgp/logger.py
+index 41a1cf28..f87785a2 100644
+--- a/lib/exabgp/logger.py
++++ b/lib/exabgp/logger.py
+@@ -339,7 +339,7 @@ class Logger(object):
+ else:
+ src = source
+
+- log = self._option.get(src, True) and getattr(syslog, 'LOG_%s' % level) <= self.level
++ log = self._option.get(src, True) and getattr(syslog, 'LOG_%s' % level, logging.handlers.SysLogHandler.LOG_DAEMON) <= self.level
+
+ if not log:
+ return
diff --git a/net-misc/exabgp/files/exabgp-4.2.11-less-verbose-logging.patch b/net-misc/exabgp/files/exabgp-4.2.11-less-verbose-logging.patch
new file mode 100644
index 00000000000..fe09a58ed77
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp-4.2.11-less-verbose-logging.patch
@@ -0,0 +1,44 @@
+diff --git a/lib/exabgp/application/healthcheck.py b/lib/exabgp/application/healthcheck.py
+index a4f6b8d1..d8195074 100644
+--- a/lib/exabgp/application/healthcheck.py
++++ b/lib/exabgp/application/healthcheck.py
+@@ -159,7 +159,16 @@ def setup_logging(debug, silent, name, syslog_facility, syslog):
+ enable_syslog = syslog and not debug
+ # To syslog
+ if enable_syslog:
+- facility = getattr(logging.handlers.SysLogHandler, "LOG_{0}".format(syslog_facility.upper()))
++ if isinstance(syslog_facility, int) or syslog_facility.isdigit():
++ for log_facility, value in sorted(logging.handlers.SysLogHandler.facility_names.items(), key=lambda x: x[1]):
++ if value >= int(syslog_facility):
++ facility = log_facility
++ break
++ elif hasattr(logging.handlers.SysLogHandler, "LOG_{0}".format(syslog_facility.upper())):
++ facility = getattr(logging.handlers.SysLogHandler, "LOG_{0}".format(syslog_facility.upper()))
++ else:
++ facility = logging.handlers.SysLogHandler.LOG_DAEMON
++
+ sh = logging.handlers.SysLogHandler(address=str(syslog_address()), facility=facility)
+ if name:
+ healthcheck_name = "healthcheck-{0}".format(name)
+diff --git a/lib/exabgp/reactor/api/command/announce.py b/lib/exabgp/reactor/api/command/announce.py
+index 3c9091d2..e21cbe95 100644
+--- a/lib/exabgp/reactor/api/command/announce.py
++++ b/lib/exabgp/reactor/api/command/announce.py
+@@ -6,6 +6,7 @@ Created by Thomas Mangin on 2017-07-01.
+ Copyright (c) 2009-2017 Exa Networks. All rights reserved.
+ License: 3-clause BSD. (See the COPYRIGHT file)
+ """
++import logging
+
+ from exabgp.reactor.api.command.command import Command
+ from exabgp.reactor.api.command.limit import match_neighbors
+@@ -50,7 +51,8 @@ def announce_route(self, reactor, service, line):
+ change.nlri.action = OUT.ANNOUNCE
+ reactor.configuration.inject_change(peers, change)
+ self.log_message(
+- 'route added to %s : %s' % (', '.join(peers) if peers else 'all peers', change.extensive())
++ 'route added to %s : %s' % (', '.join(peers) if peers else 'all peers', change.extensive()),
++ level=logging.WARNING
+ )
+ yield False
+
diff --git a/net-misc/exabgp/files/exabgp.initd-r1 b/net-misc/exabgp/files/exabgp.initd-r1
new file mode 100644
index 00000000000..ec2f01704b8
--- /dev/null
+++ b/net-misc/exabgp/files/exabgp.initd-r1
@@ -0,0 +1,64 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# default arguments
+: "${EXABGP_ARGS:=--env=/etc/${RC_SVCNAME}/exabgp.env /etc/${RC_SVCNAME}/exabgp.conf}"
+
+command="capsh"
+command_args="
+ --uid=${EXABGP_USER:=exabgp}
+ --gid=${EXABGP_GROUP:=exabgp}
+ --caps='cap_net_admin+epi cap_setuid+ep-i cap_setgid+ep-i'
+ -- -c \"/usr/bin/exabgp ${EXABGP_ARGS}\""
+
+supervisor=supervise-daemon
+
+: "${pidfile:=/run/exabgp/${RC_SVCNAME}-supervisor.pid}"
+: "${output_log:=/var/log/${RC_SVCNAME}/exabgp.log}"
+: "${error_log:=/var/log/${RC_SVCNAME}/exabgp.log}"
+
+extra_started_commands="routes sessions"
+extra_commands="checkconfig"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ checkpath -q -d -m 0755 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ /run/exabgp || return
+
+ checkpath -q -p -m 0600 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ /run/exabgp/${RC_SVCNAME}.{in,out} || return
+
+ checkpath -q -d -m 0755 -o "${EXABGP_USER}:${EXABGP_GROUP}" \
+ "/var/log/${RC_SVCNAME}" || return
+
+ checkconfig || return
+}
+
+stop_pre() {
+ # don't restart if the configuration is bad
+ if [ "${RC_CMD}" = restart ]; then
+ checkconfig || return
+ fi
+}
+
+checkconfig() {
+ ebegin "Checking configuration for ${RC_SVCNAME}"
+ exabgp -t ${EXABGP_ARGS}
+ eend ${?} "Invalid configuration"
+}
+
+sessions() {
+ ebegin "Querying sessions"
+ exabgpcli --env /etc/${RC_SVCNAME}/exabgp.env show neighbor summary
+ eend ${?} "exabgpcli failed"
+}
+
+routes() {
+ ebegin "Querying routes"
+ exabgpcli --env /etc/${RC_SVCNAME}/exabgp.env show adj-rib out
+ eend ${?} "exabgpcli failed"
+}
next reply other threads:[~2021-02-25 17:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-25 17:31 Patrick McLean [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-04-23 23:15 [gentoo-commits] repo/gentoo:master commit in: net-misc/exabgp/files/, net-misc/exabgp/ Patrick McLean
2020-11-04 2:21 Patrick McLean
2020-07-10 3:50 Patrick McLean
2020-05-20 1:16 Patrick McLean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1614274281.6e73d50d48c225700837c41b30bcc53594aec5aa.chutzpah@gentoo \
--to=chutzpah@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox