--- /dev/null
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 python3_{5,6} )
+inherit distutils-r1
+
+DESCRIPTION="A Prometheus metrics exporter for Buildbot"
+HOMEPAGE="https://github.com/claws/buildbot-prometheus"
+SRC_URI="https://github.com/claws/buildbot-prometheus/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+RDEPEND="dev-python/prometheus_client[${PYTHON_USEDEP}]
+ >=dev-util/buildbot-0.9.0[${PYTHON_USEDEP}]"
+DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
+ ${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/buildbot-prometheus-17.7.2-Migrate-duration-calculations-to-buildbot-09.patch"
+)
+
+python_prepare_all() {
+ sed -i -e "/^install_reqs.*$/d" -e "/^from pip.*$/d" -e "s/requires = .*/requires = ['buildbot', 'prometheus_client']/" setup.py || die
+ distutils-r1_python_prepare_all
+}
+
+pkg_postinst() {
+ einfo "This version has been patched to be compatible with the current buildbot releases >=0.9.0"
+ einfo "For older buildbot-0.8* releases, please use dev-python/buildbot-prometheus-17.7.2-r1 version"
+}
--- /dev/null
+From ceddea3f55773e104c628ef6316ce74785d235f3 Mon Sep 17 00:00:00 2001
+From: °R\ 4Ó¨\7f < _â\ 3>
+Date: Tue, 6 Mar 2018 02:30:56 +0000
+Subject: [PATCH] Migrate duration calculations to >=buildbot-0.9
+
+---
+ buildbot_prometheus/prometheus.py | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/buildbot_prometheus/prometheus.py b/buildbot_prometheus/prometheus.py
+index a766f41..ebf41a1 100644
+--- a/buildbot_prometheus/prometheus.py
++++ b/buildbot_prometheus/prometheus.py
+@@ -302,7 +302,7 @@ class Prometheus(service.BuildbotService):
+ build_started = msg['started_at']
+ build_finished = msg['complete_at']
+ build_duration = build_finished - build_started
+- duration_seconds = build_duration.total_seconds()
++ duration_seconds = build_duration
+ self.g_builds_duration.labels(**labels).set(duration_seconds)
+
+ build_status = resolve_results_status(msg['results'])
+@@ -401,7 +401,7 @@ class Prometheus(service.BuildbotService):
+ buildset_started = msg['submitted_at']
+ buildset_finished = msg['complete_at']
+ buildset_duration = buildset_finished - buildset_started
+- duration_seconds = buildset_duration.total_seconds()
++ duration_seconds = buildset_duration
+ self.g_buildsets_duration.labels(**labels).set(duration_seconds)
+
+ bs_success = resolve_results_status(msg['results'])
+@@ -444,7 +444,7 @@ class Prometheus(service.BuildbotService):
+ br_started = msg['submitted_at']
+ br_finished = msg['complete_at']
+ br_duration = br_finished - br_started
+- duration_seconds = br_duration.total_seconds()
++ duration_seconds = br_duration
+ self.g_build_requests_duration.labels(**labels).set(duration_seconds)
+
+ br_success = resolve_results_status(msg['results'])
+@@ -491,7 +491,7 @@ class Prometheus(service.BuildbotService):
+ step_started = msg['started_at']
+ step_finished = msg['complete_at']
+ step_duration = step_finished - step_started
+- duration_seconds = step_duration.total_seconds()
++ duration_seconds = step_duration
+ self.g_steps_duration.labels(**labels).set(duration_seconds)
+
+ step_success = resolve_results_status(msg['results'])
+--
+libgit2 0.24.6
+