Gentoo Archives: gentoo-commits

From: Joonas Niilola <juippis@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/dstat/files/, sys-apps/dstat/
Date: Thu, 16 Jul 2020 14:39:15
Message-Id: 1594910320.dfe7211eaba93e58b530ec6fd80f3478e4ec3653.juippis@gentoo
1 commit: dfe7211eaba93e58b530ec6fd80f3478e4ec3653
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Fri Jun 19 09:18:02 2020 +0000
4 Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 16 14:38:40 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dfe7211e
7
8 sys-apps/dstat: fix csv output
9
10 Closes: https://bugs.gentoo.org/728736
11 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
12 Closes: https://github.com/gentoo/gentoo/pull/16322
13 Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>
14
15 sys-apps/dstat/dstat-0.7.4-r2.ebuild | 56 +++++++++++++++++++++++++++++++
16 sys-apps/dstat/files/fix-csv-output.patch | 21 ++++++++++++
17 2 files changed, 77 insertions(+)
18
19 diff --git a/sys-apps/dstat/dstat-0.7.4-r2.ebuild b/sys-apps/dstat/dstat-0.7.4-r2.ebuild
20 new file mode 100644
21 index 00000000000..ef9a1a736ea
22 --- /dev/null
23 +++ b/sys-apps/dstat/dstat-0.7.4-r2.ebuild
24 @@ -0,0 +1,56 @@
25 +# Copyright 1999-2020 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +
30 +PYTHON_COMPAT=( python3_{6..9} )
31 +
32 +inherit python-r1
33 +
34 +DESCRIPTION="Versatile replacement for vmstat, iostat and ifstat"
35 +HOMEPAGE="http://dag.wieers.com/home-made/dstat/"
36 +SRC_URI="https://github.com/dagwieers/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
37 +
38 +LICENSE="GPL-2"
39 +SLOT="0"
40 +KEYWORDS="~alpha ~amd64 ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-linux"
41 +IUSE="doc examples"
42 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
43 +
44 +RDEPEND="${PYTHON_DEPS}
45 + dev-python/six[${PYTHON_USEDEP}]"
46 +DEPEND="${RDEPEND}"
47 +
48 +PATCHES=(
49 + "${FILESDIR}/dstat-${PV}-skip-non-sandbox-tests.patch"
50 + "${FILESDIR}/fix-collections-deprecation-warning.patch"
51 + "${FILESDIR}/fix-csv-output.patch"
52 +)
53 +
54 +src_prepare() {
55 +
56 + # bug fix: allow delay to be specified
57 + # backport from: https://github.com/dagwieers/dstat/pull/167/files
58 + sed -i -e 's; / op\.delay; // op.delay;' "dstat" || die
59 +
60 + default
61 +}
62 +
63 +src_install() {
64 + python_foreach_impl python_doscript dstat
65 +
66 + insinto /usr/share/dstat
67 + newins dstat dstat.py
68 + doins plugins/dstat_*.py
69 +
70 + doman docs/dstat.1
71 +
72 + einstalldocs
73 +
74 + if use examples; then
75 + dodoc examples/{mstat,read}.py
76 + fi
77 + if use doc; then
78 + dodoc docs/*.html
79 + fi
80 +}
81
82 diff --git a/sys-apps/dstat/files/fix-csv-output.patch b/sys-apps/dstat/files/fix-csv-output.patch
83 new file mode 100644
84 index 00000000000..e44125b0e46
85 --- /dev/null
86 +++ b/sys-apps/dstat/files/fix-csv-output.patch
87 @@ -0,0 +1,21 @@
88 +https://serverfault.com/questions/996996/dstat-fails-to-start-trying-to-load-python3s-csv
89 +
90 +diff --git a/dstat b/dstat
91 +index 9359965..1682fb5 100755
92 +--- a/dstat
93 ++++ b/dstat
94 +@@ -541,12 +541,12 @@ class dstat:
95 +
96 + line = ''
97 + for i, name in enumerate(self.vars):
98 +- if isinstance(self.val[name], types.ListType) or isinstance(self.val[name], types.TupleType):
99 ++ if isinstance(self.val[name], (tuple, list)):
100 + for j, val in enumerate(self.val[name]):
101 + line = line + printcsv(val)
102 + if j + 1 != len(self.val[name]):
103 + line = line + char['sep']
104 +- elif isinstance(self.val[name], types.StringType):
105 ++ elif isinstance(self.val[name], str):
106 + line = line + self.val[name]
107 + else:
108 + line = line + printcsv(self.val[name])