From 5552a510b4d94ec29a918eacd9b29dccda9a1d27 Mon Sep 17 00:00:00 2001 From: prspkt Date: Mon, 24 Jun 2019 20:28:13 +0300 Subject: testing/tsung: add python3 support --- testing/tsung/APKBUILD | 12 ++-- testing/tsung/support-python3.patch | 120 ++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 testing/tsung/support-python3.patch (limited to 'testing/tsung') diff --git a/testing/tsung/APKBUILD b/testing/tsung/APKBUILD index 24c1769575..1a7194fcd4 100644 --- a/testing/tsung/APKBUILD +++ b/testing/tsung/APKBUILD @@ -3,7 +3,7 @@ pkgname=tsung pkgver=1.7.0 -pkgrel=4 +pkgrel=5 pkgdesc="Tsung is a high-performance benchmark framework for various protocols including HTTP,XMPP,LDAP,etc." url="https://www.process-one.net/en/tsung/" options="!check" # Tests fail on CI @@ -18,8 +18,8 @@ depends="bash erlang-xmerl gnuplot perl-template-toolkit - python2 - py-matplotlib>=1.5.1-r3 + python3 + py3-matplotlib>=1.5.1-r3 " makedepends="erlang-asn1 erlang-dev @@ -30,7 +30,8 @@ makedepends="erlang-asn1 perl " source="$pkgname-$pkgver.tar.gz::https://github.com/processone/$pkgname/archive/v$pkgver.tar.gz - 0005-Do-not-install-manpages-in-main-install.patch" + 0005-Do-not-install-manpages-in-main-install.patch + support-python3.patch" build() { ./configure --prefix=/usr \ @@ -51,4 +52,5 @@ package() { } sha512sums="63ec9b7b2f0a9fafde8182160b55513526009be056c6715ecff8dbeb40ab05f55d264f8f79e22b8987c6019c0b7eed9ac4e0e71792ad4cad67c758e64257c1d5 tsung-1.7.0.tar.gz -ee80c21fe6a66c96b1aa68afd96209516a5a3fe1d51a1ee01a1f465d164c332bbe30f03de1cc20f3d6e0651770fa7e579d64f52d282b64d6ca02d098852f2a93 0005-Do-not-install-manpages-in-main-install.patch" +ee80c21fe6a66c96b1aa68afd96209516a5a3fe1d51a1ee01a1f465d164c332bbe30f03de1cc20f3d6e0651770fa7e579d64f52d282b64d6ca02d098852f2a93 0005-Do-not-install-manpages-in-main-install.patch +b105a692cba4168a364df92e2f2239f2a0bdd2018cedaba822bb3fc4159ed7a5fe20115dbeacdf016c8bc9f18797205372755a1bce9a2db59f989134077aa639 support-python3.patch" diff --git a/testing/tsung/support-python3.patch b/testing/tsung/support-python3.patch new file mode 100644 index 0000000000..fe5a181cd2 --- /dev/null +++ b/testing/tsung/support-python3.patch @@ -0,0 +1,120 @@ +From e37e82aa8778688c5b315c4fe54fa4f67e9a4a82 Mon Sep 17 00:00:00 2001 +From: Didier Fabert +Date: Fri, 31 May 2019 22:52:47 +0200 +Subject: [PATCH] Support python3: print statement has been replaced with a + function + +--- + src/tsung-plotter/tsplot.py.in | 30 +++++++++++++++--------------- + src/tsung-plotter/tsung/tsung.py | 2 +- + 2 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/src/tsung-plotter/tsplot.py.in b/src/tsung-plotter/tsplot.py.in +index f7a180b3..f8eb7295 100644 +--- a/src/tsung-plotter/tsplot.py.in ++++ b/src/tsung-plotter/tsplot.py.in +@@ -1,4 +1,4 @@ +-#! /usr/bin/env python ++#! /usr/bin/env python3 + # -*- Mode: python -*- + # -*- coding: utf-8 -*- + +@@ -204,7 +204,7 @@ def main(conffile, logs, legends, outdir, verbose): + stats = [x.strip().rsplit('.', 1) + for x in config.get(s, 'stats').split(' ')] + except: +- print 'error: unable to read plot "%s" stats' % s ++ print('error: unable to read plot "%s" stats' % s) + continue + + if config.has_option(s, 'styles'): +@@ -235,8 +235,8 @@ def main(conffile, logs, legends, outdir, verbose): + try: + p.__dict__['yfactor'] = map(float,config.get(s, 'yfactor').decode(encoding).split(',')) + except ValueError: +- print 'warning: %s yfactor not a number: %s' \ +- % (p.name, config.get(s, yfactor)) ++ print('warning: %s yfactor not a number: %s' \ ++ % (p.name, config.get(s, yfactor))) + # Text parameters - to decode into specified encoding + for attr in ['title', 'xlabel', 'ylabel', 'plottype', 'yscale']: + if config.has_option(s, attr): +@@ -249,13 +249,13 @@ def main(conffile, logs, legends, outdir, verbose): + try: + p.__dict__[attr] = config.getfloat(s, attr) + except ValueError: +- print 'warning: %s %s not a number: %s' \ +- % (p.name, attr, config.get(s, attr)) ++ print('warning: %s %s not a number: %s' \ ++ % (p.name, attr, config.get(s, attr))) + + outfile = p.plot(stats, dataset) + + if verbose: +- print 'Generated plot %s' % outfile ++ print('Generated plot %s' % outfile) + + if __name__ == "__main__": + from optparse import OptionParser +@@ -280,10 +280,10 @@ if __name__ == "__main__": + config = options.config + + if options.verbose: +- print 'Using %s configuration file' % config ++ print('Using %s configuration file' % config) + + if not os.access(config, os.R_OK): +- print "can't read configuration file: %s" % config ++ print("can't read configuration file: %s" % config) + sys.exit(1) + + # FIXME: error control +@@ -295,7 +295,7 @@ if __name__ == "__main__": + + # args are legend then file, any times wanted by user + if len(args) % 2 != 0: +- print "error: please provide legend and tsung log filename" ++ print("error: please provide legend and tsung log filename") + sys.exit(3) + + count = 0 +@@ -311,21 +311,21 @@ if __name__ == "__main__": + count += 1 + + if options.verbose: +- print 'Using %s stats configuration file' % SYS_STATS_CONF ++ print('Using %s stats configuration file' % SYS_STATS_CONF) + + logs = [] + for logfile in files: + if not os.access(logfile, os.R_OK): +- print "error: unable to read file %s" % logfile ++ print("error: unable to read file %s" % logfile) + + else: + if options.verbose: +- print 'Parsing Tsung log file', logfile ++ print('Parsing Tsung log file', logfile) + logs.append((logfile, TsungLog(SYS_STATS_CONF, logfile))) + + if len(logs) != len(args) / 2: +- print 'error while parsing files (%d != %d)' % (len(logs), +- len(args)/2) ++ print('error while parsing files (%d != %d)' % (len(logs), ++ len(args)/2)) + sys.exit(2) + + main(config, logs, legends, options.outdir, options.verbose) +diff --git a/src/tsung-plotter/tsung/tsung.py b/src/tsung-plotter/tsung/tsung.py +index 72d32976..ffcca8af 100644 +--- a/src/tsung-plotter/tsung/tsung.py ++++ b/src/tsung-plotter/tsung/tsung.py +@@ -204,7 +204,7 @@ def parse(self): + break + + if name not in self.unknown and not is_re: +- print 'WARNING: tsung %s data is not configured' % name ++ print('WARNING: tsung %s data is not configured' % name) + self.unknown.append(name) + + def stat(self, name, stat): -- cgit v1.2.3