From d908fdef9d03d090b2e1ac3080349e26d207584c Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Mon, 29 Feb 2016 16:13:21 +0100 Subject: [PATCH] sys-process/ctop: initial import of version 0.4.1 --- metadata/categories.conf | 1 + .../sys-process/ctop/ctop-0.4.1.exheres-0 | 20 ++++++++++ .../ctop/files/ctop-0.4.1-blkio.patch | 38 +++++++++++++++++++ .../ctop/files/ctop-0.4.1-rel-paths.patch | 27 +++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 packages/sys-process/ctop/ctop-0.4.1.exheres-0 create mode 100644 packages/sys-process/ctop/files/ctop-0.4.1-blkio.patch create mode 100644 packages/sys-process/ctop/files/ctop-0.4.1-rel-paths.patch diff --git a/metadata/categories.conf b/metadata/categories.conf index 9c2eb09..3bdd942 100644 --- a/metadata/categories.conf +++ b/metadata/categories.conf @@ -28,6 +28,7 @@ net-misc net-www sci-mathematics sys-apps +sys-process voip www-apps www-servers diff --git a/packages/sys-process/ctop/ctop-0.4.1.exheres-0 b/packages/sys-process/ctop/ctop-0.4.1.exheres-0 new file mode 100644 index 0000000..65cdda7 --- /dev/null +++ b/packages/sys-process/ctop/ctop-0.4.1.exheres-0 @@ -0,0 +1,20 @@ +# Copyright 2016 Julian Ospald +# Distributed under the terms of the GNU General Public License v2 + +require setup-py [ import=setuptools multibuild=false ] + +SUMMARY="A lightweight top like monitor for linux CGroups" +HOMEPAGE="https://github.com/yadutaf/ctop https://pypi.python.org/pypi/ctop" +DOWNLOADS="https://github.com/yadutaf/ctop/archive/v${PV}.tar.gz -> ${PNV}.tar.gz" + +LICENCES="MIT" +SLOT="0" +PLATFORMS="~amd64 ~x86" +MYOPTIONS="" + +# upstream backports +DEFAULT_SRC_PREPARE_PATCHES=( + "${FILES}"/${PNV}-rel-paths.patch + "${FILES}"/${PNV}-blkio.patch +) + diff --git a/packages/sys-process/ctop/files/ctop-0.4.1-blkio.patch b/packages/sys-process/ctop/files/ctop-0.4.1-blkio.patch new file mode 100644 index 0000000..d448fe2 --- /dev/null +++ b/packages/sys-process/ctop/files/ctop-0.4.1-blkio.patch @@ -0,0 +1,38 @@ +From 093d4c2b604f6e94d01420c0937d5fe574c49a40 Mon Sep 17 00:00:00 2001 +From: Jean-Tiare Le Bigot +Date: Tue, 19 Jan 2016 08:36:07 +0100 +Subject: [PATCH] workaround broken blkio on some system. Fixes #15 + +--- + cgroup_top.py | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/cgroup_top.py b/cgroup_top.py +index fece4a6..8bbb8f0 100755 +--- a/cgroup_top.py ++++ b/cgroup_top.py +@@ -26,6 +26,7 @@ + import pwd + import time + import pty ++import errno + import subprocess + import multiprocessing + +@@ -346,8 +347,14 @@ def collect(measures): + collect_ensure_common(cur[cgroup.name], cgroup) + + # Collect BlockIO stats +- cur[cgroup.name]['blkio.throttle.io_service_bytes'] = cgroup['blkio.throttle.io_service_bytes'] +- cur[cgroup.name]['blkio.throttle.io_service_bytes.diff'] = {'total':0} ++ try: ++ cur[cgroup.name]['blkio.throttle.io_service_bytes'] = cgroup['blkio.throttle.io_service_bytes'] ++ cur[cgroup.name]['blkio.throttle.io_service_bytes.diff'] = {'total':0} ++ except IOError as e: ++ # Workaround broken systems (see #15) ++ if e.errno == errno.ENOENT: ++ continue ++ raise + + # Collect BlockIO increase on run > 1 + if cgroup.name in prev: diff --git a/packages/sys-process/ctop/files/ctop-0.4.1-rel-paths.patch b/packages/sys-process/ctop/files/ctop-0.4.1-rel-paths.patch new file mode 100644 index 0000000..a095c89 --- /dev/null +++ b/packages/sys-process/ctop/files/ctop-0.4.1-rel-paths.patch @@ -0,0 +1,27 @@ +From 180b94124cc17afa60cd9126fee2e004a26c43f2 Mon Sep 17 00:00:00 2001 +From: Jean-Tiare Le Bigot +Date: Fri, 15 May 2015 22:21:26 +0200 +Subject: [PATCH] fix #7: use relative path to which + +Signed-off-by: Jean-Tiare Le Bigot +--- + CHANGELOG | 1 + + cgroup_top.py | 5 ++++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/cgroup_top.py b/cgroup_top.py +index f073518..6a1ea66 100755 +--- a/cgroup_top.py ++++ b/cgroup_top.py +@@ -41,7 +41,10 @@ + sys.exit(0) + + def cmd_exists(cmd): +- return subprocess.call(["/bin/which", cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 ++ try: ++ return subprocess.call(["which", cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0 ++ except OSError: ++ return False + + HAS_LXC = cmd_exists('lxc-start') + HAS_DOCKER = cmd_exists('docker')