summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-kernel/blktrace/blktrace/make-btt-scripts-python3-ready.patch197
-rw-r--r--meta/recipes-kernel/blktrace/blktrace_git.bb1
2 files changed, 198 insertions, 0 deletions
diff --git a/meta/recipes-kernel/blktrace/blktrace/make-btt-scripts-python3-ready.patch b/meta/recipes-kernel/blktrace/blktrace/make-btt-scripts-python3-ready.patch
new file mode 100644
index 0000000000..3b0c1c692c
--- /dev/null
+++ b/meta/recipes-kernel/blktrace/blktrace/make-btt-scripts-python3-ready.patch
@@ -0,0 +1,197 @@
1From 70d5ca2d5f3d6b97c11c641b7e0c5836983219a0 Mon Sep 17 00:00:00 2001
2From: Eric Sandeen <sandeen@redhat.com>
3Date: Wed, 28 Mar 2018 15:26:36 -0500
4Subject: [oe-core][PATCH 1/1] make btt scripts python3-ready
5
6Many distributions are moving to python3 by default. Here's
7an attempt to make the python scripts in blktrace python3-ready.
8
9Most of this was done with automated tools. I hand fixed some
10space-vs tab issues, and cast an array index to integer. It
11passes rudimentary testing when run under python2.7 as well
12as python3.
13
14This doesn't do anything with the shebangs, it leaves them both
15invoking whatever "env python" coughs up on the system.
16
17Signed-off-by: Eric Sandeen <sandeen@redhat.com>
18Signed-off-by: Jens Axboe <axboe@kernel.dk>
19
20Unchanged except to modify shebangs to use python3 since
21oe-core does not support python2 anymore.
22
23Upstream-Status: Backport [git://git.kernel.dk/blktrace.git commit 70d5ca2d5...]
24
25Signed-off-by: Joe Slater <joe.slater@windriver.com>
26
27---
28 btt/bno_plot.py | 28 +++++++++++++++-------------
29 btt/btt_plot.py | 22 +++++++++++++---------
30 2 files changed, 28 insertions(+), 22 deletions(-)
31
32--- git.orig/btt/bno_plot.py
33+++ git/btt/bno_plot.py
34@@ -1,4 +1,4 @@
35-#! /usr/bin/env python
36+#! /usr/bin/env python3
37 #
38 # btt blkno plotting interface
39 #
40@@ -38,6 +38,8 @@ automatically push the keys under the gr
41 To exit the plotter, enter 'quit' or ^D at the 'gnuplot> ' prompt.
42 """
43
44+from __future__ import absolute_import
45+from __future__ import print_function
46 import getopt, glob, os, sys, tempfile
47
48 verbose = 0
49@@ -60,14 +62,14 @@ def parse_args(in_args):
50
51 try:
52 (opts, args) = getopt.getopt(in_args, s_opts, l_opts)
53- except getopt.error, msg:
54- print >>sys.stderr, msg
55- print >>sys.stderr, __doc__
56+ except getopt.error as msg:
57+ print(msg, file=sys.stderr)
58+ print(__doc__, file=sys.stderr)
59 sys.exit(1)
60
61 for (o, a) in opts:
62 if o in ('-h', '--help'):
63- print __doc__
64+ print(__doc__)
65 sys.exit(0)
66 elif o in ('-v', '--verbose'):
67 verbose += 1
68@@ -84,10 +86,10 @@ if __name__ == '__main__':
69 (bnos, keys_below) = parse_args(sys.argv[1:])
70
71 if verbose:
72- print 'Using files:',
73- for bno in bnos: print bno,
74- if keys_below: print '\nKeys are to be placed below graph'
75- else: print ''
76+ print('Using files:', end=' ')
77+ for bno in bnos: print(bno, end=' ')
78+ if keys_below: print('\nKeys are to be placed below graph')
79+ else: print('')
80
81 tmpdir = tempfile.mktemp()
82 os.mkdir(tmpdir)
83@@ -99,7 +101,7 @@ if __name__ == '__main__':
84 fo = open(t, 'w')
85 for line in open(f, 'r'):
86 fld = line.split(None)
87- print >>fo, fld[0], fld[1], int(fld[2])-int(fld[1])
88+ print(fld[0], fld[1], int(fld[2])-int(fld[1]), file=fo)
89 fo.close()
90
91 t = t[t.rfind('/')+1:]
92@@ -107,16 +109,16 @@ if __name__ == '__main__':
93 else: plot_cmd = "%s,'%s'" % (plot_cmd, t)
94
95 fo = open('%s/plot.cmds' % tmpdir, 'w')
96- print >>fo, cmds
97- if len(bnos) > 10 or keys_below: print >>fo, 'set key below'
98- print >>fo, plot_cmd
99+ print(cmds, file=fo)
100+ if len(bnos) > 10 or keys_below: print('set key below', file=fo)
101+ print(plot_cmd, file=fo)
102 fo.close()
103
104 pid = os.fork()
105 if pid == 0:
106 cmd = 'gnuplot %s/plot.cmds -' % tmpdir
107
108- if verbose: print 'Executing %s' % cmd
109+ if verbose: print('Executing %s' % cmd)
110
111 os.chdir(tmpdir)
112 os.system(cmd)
113--- git.orig/btt/btt_plot.py
114+++ git/btt/btt_plot.py
115@@ -1,4 +1,4 @@
116-#! /usr/bin/env python
117+#! /usr/bin/env python3
118 #
119 # btt_plot.py: Generate matplotlib plots for BTT generate data files
120 #
121@@ -55,6 +55,10 @@ Arguments:
122 but the -o (--output) and -T (--title) options will be ignored.
123 """
124
125+from __future__ import absolute_import
126+from __future__ import print_function
127+import six
128+from six.moves import range
129 __author__ = 'Alan D. Brunelle <alan.brunelle@hp.com>'
130
131 #------------------------------------------------------------------------------
132@@ -82,7 +86,7 @@ get_base = lambda file: file[file.find(
133 def fatal(msg):
134 """Generate fatal error message and exit"""
135
136- print >>sys.stderr, 'FATAL: %s' % msg
137+ print('FATAL: %s' % msg, file=sys.stderr)
138 sys.exit(1)
139
140 #------------------------------------------------------------------------------
141@@ -163,7 +167,7 @@ def get_data(files):
142 if not os.path.exists(file):
143 fatal('%s not found' % file)
144 elif verbose:
145- print 'Processing %s' % file
146+ print('Processing %s' % file)
147
148 xs = []
149 ys = []
150@@ -214,8 +218,8 @@ def parse_args(args):
151
152 try:
153 (opts, args) = getopt.getopt(args[1:], s_opts, l_opts)
154- except getopt.error, msg:
155- print >>sys.stderr, msg
156+ except getopt.error as msg:
157+ print(msg, file=sys.stderr)
158 fatal(__doc__)
159
160 for (o, a) in opts:
161@@ -293,15 +297,15 @@ def generate_output(type, db):
162 def color(idx, style):
163 """Returns a color/symbol type based upon the index passed."""
164
165- colors = [ 'b', 'g', 'r', 'c', 'm', 'y', 'k' ]
166+ colors = [ 'b', 'g', 'r', 'c', 'm', 'y', 'k' ]
167 l_styles = [ '-', ':', '--', '-.' ]
168 m_styles = [ 'o', '+', '.', ',', 's', 'v', 'x', '<', '>' ]
169
170 color = colors[idx % len(colors)]
171 if style == 'line':
172- style = l_styles[(idx / len(l_styles)) % len(l_styles)]
173+ style = l_styles[int((idx / len(l_styles)) % len(l_styles))]
174 elif style == 'marker':
175- style = m_styles[(idx / len(m_styles)) % len(m_styles)]
176+ style = m_styles[int((idx / len(m_styles)) % len(m_styles))]
177
178 return '%s%s' % (color, style)
179
180@@ -314,7 +318,7 @@ def generate_output(type, db):
181 ofile = '%s.png' % type
182
183 if verbose:
184- print 'Generating plot into %s' % ofile
185+ print('Generating plot into %s' % ofile)
186
187 fig = plt.figure(figsize=plot_size)
188 ax = fig.add_subplot(111)
189@@ -329,7 +333,7 @@ def generate_output(type, db):
190 legends = None
191
192 keys = []
193- for file in db.iterkeys():
194+ for file in six.iterkeys(db):
195 if not file in ['min_x', 'max_x', 'min_y', 'max_y']:
196 keys.append(file)
197
diff --git a/meta/recipes-kernel/blktrace/blktrace_git.bb b/meta/recipes-kernel/blktrace/blktrace_git.bb
index 2605ff9167..6903053b5b 100644
--- a/meta/recipes-kernel/blktrace/blktrace_git.bb
+++ b/meta/recipes-kernel/blktrace/blktrace_git.bb
@@ -12,6 +12,7 @@ PV = "1.2.0+git${SRCPV}"
12SRC_URI = "git://git.kernel.dk/blktrace.git \ 12SRC_URI = "git://git.kernel.dk/blktrace.git \
13 file://ldflags.patch \ 13 file://ldflags.patch \
14 file://CVE-2018-10689.patch \ 14 file://CVE-2018-10689.patch \
15 file://make-btt-scripts-python3-ready.patch \
15" 16"
16 17
17S = "${WORKDIR}/git" 18S = "${WORKDIR}/git"