From 1ae08f499ba11b22e88a2716a3a75e2597814af3 Mon Sep 17 00:00:00 2001 From: "Edinaldo P. Silva" Date: Sat, 30 May 2020 02:37:48 +0100 Subject: network/speedometer: Updated for version 2.8. Signed-off-by: Dave Woodfall Signed-off-by: Willy Sudiarto Raharjo --- network/speedometer/changelog | 153 ++++++++++++++++++++++++ network/speedometer/speedometer.1.pod | 147 +++++++++++++++++++++++ network/speedometer/speedometer.SlackBuild | 22 ++-- network/speedometer/speedometer.info | 2 +- network/speedometer/update-to-python3.patch | 174 ++++++++++++++++++++++++++++ 5 files changed, 489 insertions(+), 9 deletions(-) create mode 100644 network/speedometer/changelog create mode 100644 network/speedometer/speedometer.1.pod create mode 100644 network/speedometer/update-to-python3.patch (limited to 'network') diff --git a/network/speedometer/changelog b/network/speedometer/changelog new file mode 100644 index 0000000000..3ab3448f88 --- /dev/null +++ b/network/speedometer/changelog @@ -0,0 +1,153 @@ +speedometer (2.8-3) unstable; urgency=medium + + * New maintainer. (Closes: #920070) + * Switch to Python 3, consequently: + - debian/control: updated dependencies to python3. + - debian/patches/update-to-python3.patch: added to provide + python3 support. (Closes: #943229) + * Using new DH level format. Consequently: + - debian/compat: removed. + - debian/control: Changed from 'debhelper' to 'debhelper-compat' in + Build-Depends field and bumped level to 12. + * debian/control: + - Added the field Rules-Requires-Root: no + - Standards-Version: bumped to 4.4.1 (no changes needed) + - Switch VCS URLs to salsa.debian.org + * debian/copyright: + - Added safe uri (https) to Format. + - Updated years and rights. + * debian/rules: + - Added pybuild support. + - Updated to reduced format. + * debian/salsa-ci.yml: added to provide CI tests for Salsa. + * debian/upstream/metadata: created. + * debian/upstream.changelog: removed, upstream no longer uses hg repo. + * debian/watch: + - migrated to version 4. + - updated to new repository in Github an using new variables. + + + -- Giovani Augusto Ferreira Tue, 17 Dec 2019 10:43:07 -0300 + +speedometer (2.8-2) unstable; urgency=medium + + * debian/compat + - Updae to 9. + * debian/control + - (Build-Depends): Update to debhelper 9. + - (Homepage): Move field. + - (Standards-Version): Update to 3.9.8. + - (Vcs-*): Update to anonscm.debian.org. + * debian/copyright + - Update URLs. + * debian/pod2man.mk + - Make build reproducible (Closes: 782221). + Patch thanks to Reiner Herrmann . + + -- Jari Aalto Wed, 19 Oct 2016 18:25:25 +0300 + +speedometer (2.8-1) unstable; urgency=low + + [Jari Aalto] + * New upstream release + - Linear scale (Closes: #415397). + * debian/copyright + - (Format): Update URL. + * debian/rules + - (get-changelog): Add more commentary. + * debian/upstream.changelog + - Update. + + [tony mancill] + * Add python-setuptools to Build-Depends + + -- Jari Aalto Fri, 09 Dec 2011 14:30:46 +0200 + +speedometer (2.7-1) unstable; urgency=low + + * New upstream release + - Fix Python 2.5.4 DeprecationWarning: The popen2 module is deprecated + (Closes: #583573). + * debian/compat + - Update to 8. + * debian/control + - (Build-Depends): Update to debhelper 8. + - (Standards-Version): Update to 3.9.2. + * debian/copyright + - Update to DEP5. + - (Files: *): Correct license to LGPL 2.1. + * debian/*.mk + - Minor updates. + * debian/speedometer.1.pod + - (top level): Proper starting comment. + - (DESCRIPTION): Improve documentation to note that + traffic must be generated (Closes: #583576). + - (EXAMPLES): Adjust indentation. + - (SEE ALSO): Add more programs. + - (AUTHORS): Adjust wording. + * debian/rules + - (PKGDIR): New. + - (get-changelog): New. + - Cleanup rules handled by dh(1). + + -- Jari Aalto Thu, 21 Apr 2011 19:34:18 +0300 + +speedometer (2.6-3) unstable; urgency=low + + * debian/control + - (Depends): Update to python-urwid (>= 0.9.9.1), because (0.9.9) is + not compatible (Closes: #569070). Update to debhelper 7.1 due to + oveerrides in debian/rules + - (Standards-Version): update to 3.8.4. + * debian/rules: + - (binary-indep): Remove unused commands. + - (install): remove target. + - (override_dh_auto_install): New target. + - (.PHONY): cleanup targets. + + -- Jari Aalto Mon, 22 Feb 2010 16:18:59 +0200 + +speedometer (2.6-2) unstable; urgency=low + + * Move to packaging format: 3.0 (quilt). + * debian/clean + - Move content from 'rules' for dh(1) to use. + * debian/compat + - Update to 7. + * debian/control + - (Build-Depends): update to debhelper 7. + - (Description): convert examples to bullets. + - (Depends): add ${misc:Depends} for debhelper, + add version to dependency python-urwid (>= 0.9.1). + - (Standards-Version): update to 3.8.3 + * debian/copyright + - (GPL): Use FSF URL (FSF recommendation). + * debian/rules + - Remove rules obsoleted by dh(1). + * debian/source/format + - New file. + * debian/speedometer.1 + - Delete file generated from *.pod source (see debian/rules::man). + * debian/speedometer.manpages + - Move content from 'rules' for dh(1) to use. + + -- Jari Aalto Sat, 19 Dec 2009 13:52:03 +0200 + +speedometer (2.6-1) unstable; urgency=low + + * New upstream version. (Closes: #473420). + * debian/changelog + - Adjust indentation and layout. + - Change time to ISO 8601 notation. + * debian/control + - (Vcs-*): New fields. + - (Homepage): move to separate field. + - (Standards-Version): Update to 3.8.0. + + -- Jari Aalto Sat, 18 Oct 2008 01:07:47 +0300 + +speedometer (2.4-1) unstable; urgency=low + + * Initial release (Closes: #404671) + + -- Jari Aalto Sat, 13 Jan 2007 20:34:25 +0200 diff --git a/network/speedometer/speedometer.1.pod b/network/speedometer/speedometer.1.pod new file mode 100644 index 0000000000..7e228f8fae --- /dev/null +++ b/network/speedometer/speedometer.1.pod @@ -0,0 +1,147 @@ +# Copyright +# +# Copyright (C) 2007-2010 Jari Aalto +# +# License +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Description +# +# To learn what TOP LEVEL sections to use in manual pages, +# see POSIX/Susv standard and "Utility Description Defaults" at +# http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap01.html#tag_01_11 +# +# This is manual page in Perl POD format. Read more at +# http://perldoc.perl.org/perlpod.html or run command: +# +# perldoc perlpod | less +# +# To check the syntax: +# +# podchecker *.pod +# +# Create manual page with command: +# +# pod2man PAGE.N.pod > PAGE.N + +=pod + +=head1 NAME + +speedometer - measure and display the rate of data across a network connection + +=head1 SYNOPSIS + + speedometer [options] tap [[-c] tap] ... + +=head1 DESCRIPTION + +Monitor network traffic or speed/progress of a file transfer. At least +one tap option (B<-f>, B<-rx>, B<-tx>) must be entered. Option B<-c> +starts a new column, otherwise taps are piled vertically. + +Note: before you use the program, satrt generating traffic by +transferring files in/out e.g. with scp(1) in the network you're +measuring. + +=head1 OPTIONS + +=over 4 + +=item B<-b> + +Use old blocky display instead of smoothed display even when UTF-8 +encoding is detected. + +=item B<-f filename [size]> + +Display download speed with progress bar. This option must be used if +directly following another file tap without an expected size +specified. + +=item B<-i interval> + +Interval in seconds. Examples: 5 or 0.25". Default is 1. + +=item B<-p> + +Use plain-text display (one tap only). + +=item B<-rx iface> + +Display bytes received on network interface. + +=item B<-tx iface> + +Display bytes transmitted on network interface. + +=item B<-z> + +Report zero size on files that don't exist instead of waiting for them +to be created + +=back + +EXAMPLES + +How long it will take for my 38MB transfer to finish? + + speedometer favorite_episode.rm $(( 38 * 1024 * 1024 )) + +How quickly is another transfer going? + + speedometer dl/big.avi + +How fast is this LAN? + + host-a$ cat /dev/zero | nc -l -p 12345 + host-b$ nc host-a 12345 > /dev/null + host-b$ speedometer -rx eth0 + +How fast is the upstream on this ADSL line? + + speedometer -tx ppp0 + +How fast can I write data to my filesystem? (with at least 1GB free) + + dd bs=1000000 count=1000 if=/dev/zero of=bigfile & + speedometer bigfile + +=head1 ENVIRONMENT + +None. + +=head1 FILES + +None. + +=head1 SEE ALSO + +htop(1) +iotop(1) +scp(1) +top(1) +vmstat(1) + +=head1 AUTHORS + +Program was written by Ian Ward + +This manual page was written by Jari Aalto . +Released under license GNU GPL version 2 or (at your option) any later +version. For more information about license, visit +. + +=cut diff --git a/network/speedometer/speedometer.SlackBuild b/network/speedometer/speedometer.SlackBuild index 32b374ea93..9fb3e89275 100644 --- a/network/speedometer/speedometer.SlackBuild +++ b/network/speedometer/speedometer.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for speedometer -# Copyright 2015 Edinaldo P. Silva, Rio de Janeiro, Brazil +# Copyright 2015-2020 Edinaldo P. Silva, Rio de Janeiro, Brazil # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -24,12 +24,12 @@ PRGNAM=speedometer VERSION=${VERSION:-2.8} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then case "$( uname -m )" in - i?86) ARCH=i486 ;; + i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac @@ -40,8 +40,8 @@ TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} -if [ "$ARCH" = "i486" ]; then - SLKCFLAGS="-O2 -march=i486 -mtune=i686" +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" @@ -69,15 +69,21 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -python setup.py install --root=$PKG +patch -Np1 < $CWD/update-to-python3.patch +python3 setup.py install --root=$PKG --optimize=1 find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true -DOCS="CHANGELOG" +# make manpage. +mkdir -p $PKG/usr/man/man1/ +pod2man $CWD/speedometer.1.pod > $PKG/usr/man/man1/speedometer.1 + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $(find $PKG/usr/man -type l); do ln -s $(readlink $i).gz $i.gz; rm $i; done mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION +install -Dm644 $CWD/changelog $PKG/usr/doc/$PRGNAM-$VERSION/CHANGELOG cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/network/speedometer/speedometer.info b/network/speedometer/speedometer.info index f99c0b453c..0bcb7a15fd 100644 --- a/network/speedometer/speedometer.info +++ b/network/speedometer/speedometer.info @@ -5,6 +5,6 @@ DOWNLOAD="http://excess.org/speedometer/speedometer-2.8.tar.gz" MD5SUM="aa52b9253117523202d6ec8c110344ef" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="" +REQUIRES="psutil python3-six python3-urwid" MAINTAINER="Edinaldo P. Silva" EMAIL="edps.mundognu@gmail.com" diff --git a/network/speedometer/update-to-python3.patch b/network/speedometer/update-to-python3.patch new file mode 100644 index 0000000000..dfce959f3b --- /dev/null +++ b/network/speedometer/update-to-python3.patch @@ -0,0 +1,174 @@ +Description: Update upstream source to Python 3. + Based on fixes at https://github.com/kenduest/speedometer/ +Author: Giovani Augusto Ferreira +Last-Update: 2019-12-08 + +Index: speedometer/speedometer.py +=================================================================== +--- speedometer.orig/speedometer.py ++++ speedometer/speedometer.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + + # speedometer.py + # Copyright (C) 2001-2011 Ian Ward +@@ -21,6 +21,8 @@ import os + import string + import math + import re ++import psutil ++import six + + __usage__ = """Usage: speedometer [options] tap [[-c] tap]... + Monitor network traffic or speed/progress of a file transfer. At least one +@@ -76,6 +78,10 @@ units_per_second = 'bytes' + chart_minimum = 2**5 + chart_maximum = 2**32 + ++if six.PY3: ++ def long(*args,**kwargs): ++ return int(*args,**kwargs) ++ + graph_scale = None + def update_scale(): + """ +@@ -400,7 +406,8 @@ class SpeedGraph: + self.log = [] + self.bar = [] + +- def get_data(self, (maxcol,maxrow)): ++ def get_data(self, max_col_row): ++ maxcol, maxrow = max_col_row + bar = self.bar[-maxcol:] + if len(bar) < maxcol: + bar = [[0]]*(maxcol-len(bar)) + bar +@@ -409,8 +416,8 @@ class SpeedGraph: + def selectable(self): + return False + +- def render(self, (maxcol, maxrow), focus=False): +- ++ def render(self, max_col_row, focus=False): ++ maxcol, maxrow = max_col_row + left = max(0, len(self.log)-maxcol) + pad = maxcol-(len(self.log)-left) + +@@ -445,8 +452,8 @@ class SpeedGraph: + for i in range(left+max(0, ldist-pad),len(l)-rdist+1): + li = l[i] + if li == 0: continue +- if i and l[i-1]>=li: continue +- if l[i+1]>li: continue ++ if i and l[i-1] != None and l[i-1]>=li: continue ++ if li is None or l[i+1]>li: continue + highs.append((li, -i)) + + highs.sort() +@@ -471,7 +478,7 @@ class SpeedGraph: + + + def speed_scale(s): +- if s <= 0: return 0 ++ if s is None or s <= 0: return 0 + if logarithmic_scale: + s = math.log(s, 2) + s = min(graph_range(), max(0, s-graph_min())) +@@ -498,7 +505,7 @@ def readable_speed(speed): + if speed == None or speed < 0: speed = 0 + + units = "B/s ", "KiB/s", "MiB/s", "GiB/s", "TiB/s" +- step = 1L ++ step = long(1) + + for u in units: + +@@ -511,7 +518,7 @@ def readable_speed(speed): + if speed/step < 1024: + return "%4d " %(speed/step) + u + +- step = step * 1024L ++ step = step * long(1024) + + return "%4d " % (speed/(step/1024)) + units[-1] + +@@ -524,7 +531,7 @@ def readable_speed_bits(speed): + + speed = speed * 8 + units = "b/s ", "Kib/s", "Mib/s", "Gib/s", "Tib/s" +- step = 1L ++ step = long(1) + + for u in units: + +@@ -537,7 +544,7 @@ def readable_speed_bits(speed): + if speed/step < 1024: + return "%4d " %(speed/step) + u + +- step = step * 1024L ++ step = step * long(1024) + + return "%4d " % (speed/(step/1024)) + units[-1] + +@@ -607,18 +614,12 @@ def network_feed(device,rxtx): + r = re.compile(r"^\s*" + re.escape(device) + r":(.*)$", re.MULTILINE) + + def networkfn(devre=r,rxtx=rxtx): +- f = open('/proc/net/dev') +- dev_lines = f.read() +- f.close() +- match = devre.search(dev_lines) +- if not match: +- return None +- +- parts = match.group(1).split() + if rxtx == 'RX': +- return long(parts[0]) ++ val=psutil.net_io_counters(pernic=True)[device].bytes_recv + else: +- return long(parts[8]) ++ val=psutil.net_io_counters(pernic=True)[device].bytes_sent ++ ++ return long(val) + + return networkfn + +@@ -728,7 +729,7 @@ def time_as_units(seconds): + # (multiplicative factor, suffix) + units = (1,"s"), (60,"m"), (60,"h"), (24,"d"), (7,"w"), (52,"y") + +- scale = 1L ++ scale = long(1) + topunit = -1 + # find the top unit to use + for mul, suf in units: +@@ -757,7 +758,7 @@ def readable_time(seconds, columns=None) + for value, suf in time_as_units(seconds): + new_out = out + if out: new_out = new_out + ' ' +- new_out = new_out + `value` + suf ++ new_out = new_out + value + suf + if columns and len(new_out) > columns: break + out = new_out + +@@ -1091,6 +1092,6 @@ def wait_all(cols): + if __name__ == "__main__": + try: + console() +- except KeyboardInterrupt, err: ++ except KeyboardInterrupt as err: + pass + +Index: speedometer/setup.py +=================================================================== +--- speedometer.orig/setup.py ++++ speedometer/setup.py +@@ -35,7 +35,7 @@ setup_d = { + 'scripts': ['speedometer.py'], + 'entry_points': { + 'console_scripts': ['speedometer = speedometer:console'],}, +- 'install_requires': ['urwid >= 0.9.9.1'], ++ 'install_requires': ['urwid >= 0.9.9.1', 'psutil', 'six'], + 'license':"LGPL", + 'keywords':"network bandwidth monitor system speed download file progress console", + 'platforms':"Linux", -- cgit v1.2.3