sys-apps/dstat: version bump to 0.7.4
authorPaul Healy <lmiphay@gmail.com>
Tue, 8 Oct 2019 20:21:11 +0000 (21:21 +0100)
committerJoonas Niilola <juippis@gentoo.org>
Mon, 21 Oct 2019 14:08:17 +0000 (17:08 +0300)
Adds support for python 3
Now uses EAPI 7
backport fix from: https://github.com/dagwieers/dstat/pull/167/files
added missing six dep
avoid deprecation warning for importing collections with python 3.7

Closes: https://bugs.gentoo.org/696442

Signed-off-by: Paul Healy <lmiphay@gmail.com>
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
sys-apps/dstat/Manifest
sys-apps/dstat/dstat-0.7.4.ebuild [new file with mode: 0644]
sys-apps/dstat/files/dstat-0.7.4-skip-non-sandbox-tests.patch [new file with mode: 0644]
sys-apps/dstat/files/fix-collections-deprecation-warning.patch [new file with mode: 0644]

index bd2c9a4da6354a8f8b3641cf30d941f156b83961..ad77287898f655dd9b440f997b8c0a6853664d8a 100644 (file)
@@ -1 +1,2 @@
 DIST dstat-0.7.3.tar.gz 135583 BLAKE2B c846a06b6039e49944d43cc36178fed74fd4e0e3a1a4418dbe0e5987763995eb36dff0245cfa7107d446b8ac2ea500e13980f87e97aa8e5b8d566ee188be1639 SHA512 db37cc8bb7afd235ae9088e76c4defaa4d76651b111fbfdcd0980bc96376de20d57964912799a413397a79651730503bdeb8fea5cb97ab4d6d81632f528aefd2
+DIST dstat-0.7.4.tar.gz 139992 BLAKE2B c8226358956687a4f64e248ef539b431b9e394e87986366f9941df2e86f0dac3032261ec2ca9c816d3bc89afabc352bc8bc80f9ad3eaa6118fd16bd7b0f1e68e SHA512 d100223887ebd83d0fd1259436f39419a85df9002556abcfc8e4195aa63be73d85707dcd5c4fb56a979b29131485dce6e97c177fbfca08dc50bd0f92b15cc6f5
diff --git a/sys-apps/dstat/dstat-0.7.4.ebuild b/sys-apps/dstat/dstat-0.7.4.ebuild
new file mode 100644 (file)
index 0000000..66bbf59
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python{2_7,3_{6,7}} )
+
+inherit python-r1
+
+DESCRIPTION="Versatile replacement for vmstat, iostat and ifstat"
+HOMEPAGE="http://dag.wieers.com/home-made/dstat/"
+SRC_URI="https://github.com/dagwieers/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples wifi"
+REQUIRED_USE="wifi? ( ${PYTHON_REQUIRED_USE} )"
+
+RDEPEND="
+       dev-python/six[${PYTHON_USEDEP}]
+       wifi? (
+               ${PYTHON_DEPS}
+               net-wireless/python-wifi
+       )"
+DEPEND=""
+
+PATCHES=( \
+       "${FILESDIR}/dstat-${PV}-skip-non-sandbox-tests.patch" \
+       "${FILESDIR}/fix-collections-deprecation-warning.patch" \
+)
+
+src_prepare() {
+
+       # bug fix: allow delay to be specified
+       # backport from: https://github.com/dagwieers/dstat/pull/167/files
+       sed -i -e 's; / op\.delay; // op.delay;' "dstat" || die
+
+       default
+}
+
+src_install() {
+       default
+
+       if use examples; then
+               dodoc examples/{mstat,read}.py
+       fi
+       if use doc; then
+               dodoc docs/*.html
+       fi
+}
diff --git a/sys-apps/dstat/files/dstat-0.7.4-skip-non-sandbox-tests.patch b/sys-apps/dstat/files/dstat-0.7.4-skip-non-sandbox-tests.patch
new file mode 100644 (file)
index 0000000..38457cd
--- /dev/null
@@ -0,0 +1,18 @@
+diff --git a/Makefile b/Makefile
+index c371f62..42ef84d 100644
+--- a/Makefile
++++ b/Makefile
+@@ -32,10 +32,12 @@ clean:
+       rm -f examples/*.pyc plugins/*.pyc
+       $(MAKE) -C docs clean
++TEST_PLUGINS=--cpufreq --disk-tps --dstat-cpu --dstat-ctxt --dstat-mem --dstat --helloworld --md-status --net-packets --proc-count --snooze --test --top-bio-adv --top-bio --top-childwait --top-cpu-adv --top-cpu --top-cputime-avg --top-cputime --top-int --top-io-adv --top-io --top-latency-avg --top-latency --top-mem --top-oom
++
+ test:
+       ./dstat --version
+       ./dstat -taf 1 5
+-      ./dstat -t --all-plugins 1 5
++      ./dstat -t $(TEST_PLUGINS) 1 5
+ dist: clean
+       $(MAKE) -C docs dist
diff --git a/sys-apps/dstat/files/fix-collections-deprecation-warning.patch b/sys-apps/dstat/files/fix-collections-deprecation-warning.patch
new file mode 100644 (file)
index 0000000..e505c98
--- /dev/null
@@ -0,0 +1,25 @@
+diff --git a/dstat b/dstat
+index 9359965..777242f 100755
+--- a/dstat
++++ b/dstat
+@@ -19,6 +19,11 @@
+ from __future__ import absolute_import, division, generators, print_function
+ __metaclass__ = type
++try:
++    from collections.abc import Sequence
++except ImportError:
++    from collections import Sequence
++
+ import collections
+ import fnmatch
+ import getopt
+@@ -512,7 +517,7 @@ class dstat:
+                 scale = self.scales[i]
+             else:
+                 scale = self.scale
+-            if isinstance(self.val[name], collections.Sequence) and not isinstance(self.val[name], six.string_types):
++            if isinstance(self.val[name], Sequence) and not isinstance(self.val[name], six.string_types):
+                 line = line + cprintlist(self.val[name], ctype, self.width, scale)
+                 sep = theme['frame'] + char['colon']
+                 if i + 1 != len(self.vars):