summaryrefslogtreecommitdiffstats
path: root/recipes-extended
diff options
context:
space:
mode:
authorChristopher Clark <christopher.w.clark@gmail.com>2020-02-25 16:15:59 -0800
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-02-27 16:59:23 -0500
commitf4eec68635bc516ce99c804bdc876f74dd4523fc (patch)
tree149b04d3a85851703a72346b9b9247e5ce025b3c /recipes-extended
parent593df044c6a18ac3594215f5b93ecbc3ceab9f44 (diff)
downloadmeta-virtualization-f4eec68635bc516ce99c804bdc876f74dd4523fc.tar.gz
xen, xen-tools: update recipes for python3
Adds patches for packaged scripts to enable deployment with python3 where they have been ported to python 3 upstream. setuptools3 inherits distutils3 which modifies ${B}, so cd ${S} is needed in the do_configure, do_compile and do_install steps. Remove python 2 dependency from the Xen recipes by adding a new separate recipe, xen-python2, for packaging the remaining optional scripts which are yet to be ported to python 3. Package naming in the separate recipe is chosen to support transition back into the xen-tools recipe if the scripts are ported later. Use RSUGGESTS to support inclusion of the xen-python2 scripts in images that include python 2. Drop the remus package python dependency since the script was removed in 2014: commit 5b66f84e37a45038f9e5dae7a5768a5525d1e6ba Add python3 RDEPENDS needed to run xenmon. Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-extended')
-rw-r--r--recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch7
-rw-r--r--recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch140
-rw-r--r--recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch40
-rw-r--r--recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch529
-rw-r--r--recipes-extended/xen/files/xen-tools-pygrub-py3.patch233
-rw-r--r--recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch136
-rw-r--r--recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch140
-rw-r--r--recipes-extended/xen/xen-hypervisor.inc4
-rw-r--r--recipes-extended/xen/xen-python2.bb68
-rw-r--r--recipes-extended/xen/xen-tools.inc57
-rw-r--r--recipes-extended/xen/xen-tools_git.bb6
-rw-r--r--recipes-extended/xen/xen.inc11
12 files changed, 1344 insertions, 27 deletions
diff --git a/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch b/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch
index 6504d86e..96e907d5 100644
--- a/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch
+++ b/recipes-extended/xen/files/0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch
@@ -13,11 +13,14 @@ Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
13Forward-ported to Xen 4.12.0 13Forward-ported to Xen 4.12.0
14Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> 14Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
15 15
16Modified to support pygrub installation with python 3
17Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
18
16diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile 19diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
17index 3063c49..513314b 100644 20index 3063c49..513314b 100644
18--- a/tools/pygrub/Makefile 21--- a/tools/pygrub/Makefile
19+++ b/tools/pygrub/Makefile 22+++ b/tools/pygrub/Makefile
20@@ -10,14 +10,15 @@ INSTALL_LOG = build/installed_files.txt 23@@ -10,14 +10,17 @@ INSTALL_LOG = build/installed_files.txt
21 all: build 24 all: build
22 .PHONY: build 25 .PHONY: build
23 build: 26 build:
@@ -32,6 +35,8 @@ index 3063c49..513314b 100644
32- --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force 35- --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
33+ --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force \ 36+ --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force \
34+ $(DISTUTILS_INSTALL_ARGS) 37+ $(DISTUTILS_INSTALL_ARGS)
38+ rm -f $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
39+ $(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
35 set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \ 40 set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
36 "`readlink -f $(DESTDIR)/$(bindir)`" != \ 41 "`readlink -f $(DESTDIR)/$(bindir)`" != \
37 "`readlink -f $(LIBEXEC_BIN)`" ]; then \ 42 "`readlink -f $(LIBEXEC_BIN)`" ]; then \
diff --git a/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch b/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch
new file mode 100644
index 00000000..23997865
--- /dev/null
+++ b/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch
@@ -0,0 +1,140 @@
1From 660d2dd863802ef464c90b32f187cb65861f8185 Mon Sep 17 00:00:00 2001
2From: Wei Liu <wei.liu2@citrix.com>
3Date: Thu, 7 Mar 2019 12:33:38 +0000
4Subject: [PATCH] libxl: make python scripts work with python 2.6 and up
5
6Go through transformations suggested by 2to3 and pick the necessary
7ones.
8
9Signed-off-by: Wei Liu <wei.liu2@citrix.com>
10Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
11---
12 tools/libxl/gentest.py | 4 +++-
13 tools/libxl/gentypes.py | 12 +++++++-----
14 tools/libxl/idl.py | 15 ++++++++-------
15 3 files changed, 18 insertions(+), 13 deletions(-)
16
17diff --git a/tools/libxl/gentest.py b/tools/libxl/gentest.py
18index 989959fc68..1cc7eebc82 100644
19--- a/tools/libxl/gentest.py
20+++ b/tools/libxl/gentest.py
21@@ -1,5 +1,7 @@
22 #!/usr/bin/python
23
24+from __future__ import print_function
25+
26 import os
27 import sys
28 import re
29@@ -86,7 +88,7 @@ def gen_rand_init(ty, v, indent = " ", parent = None):
30
31 if __name__ == '__main__':
32 if len(sys.argv) < 3:
33- print >>sys.stderr, "Usage: gentest.py <idl> <implementation>"
34+ print("Usage: gentest.py <idl> <implementation>", file=sys.stderr)
35 sys.exit(1)
36
37 random.seed(os.getenv('LIBXL_TESTIDL_SEED'))
38diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py
39index 88e5c5f30e..6417c9dd8c 100644
40--- a/tools/libxl/gentypes.py
41+++ b/tools/libxl/gentypes.py
42@@ -1,5 +1,7 @@
43 #!/usr/bin/python
44
45+from __future__ import print_function
46+
47 import sys
48 import re
49
50@@ -576,14 +578,14 @@ def libxl_C_enum_from_string(ty, str, e, indent = " "):
51
52 if __name__ == '__main__':
53 if len(sys.argv) != 6:
54- print >>sys.stderr, "Usage: gentypes.py <idl> <header> <header-private> <header-json> <implementation>"
55+ print("Usage: gentypes.py <idl> <header> <header-private> <header-json> <implementation>", file=sys.stderr)
56 sys.exit(1)
57
58 (_, idlname, header, header_private, header_json, impl) = sys.argv
59
60 (builtins,types) = idl.parse(idlname)
61
62- print "outputting libxl type definitions to %s" % header
63+ print("outputting libxl type definitions to %s" % header)
64
65 f = open(header, "w")
66
67@@ -633,7 +635,7 @@ if __name__ == '__main__':
68 f.write("""#endif /* %s */\n""" % (header_define))
69 f.close()
70
71- print "outputting libxl JSON definitions to %s" % header_json
72+ print("outputting libxl JSON definitions to %s" % header_json)
73
74 f = open(header_json, "w")
75
76@@ -657,7 +659,7 @@ if __name__ == '__main__':
77 f.write("""#endif /* %s */\n""" % header_json_define)
78 f.close()
79
80- print "outputting libxl type internal definitions to %s" % header_private
81+ print("outputting libxl type internal definitions to %s" % header_private)
82
83 f = open(header_private, "w")
84
85@@ -683,7 +685,7 @@ if __name__ == '__main__':
86 f.write("""#endif /* %s */\n""" % header_json_define)
87 f.close()
88
89- print "outputting libxl type implementations to %s" % impl
90+ print("outputting libxl type implementations to %s" % impl)
91
92 f = open(impl, "w")
93 f.write("""
94diff --git a/tools/libxl/idl.py b/tools/libxl/idl.py
95index 2a7f3c44fe..d7367503b4 100644
96--- a/tools/libxl/idl.py
97+++ b/tools/libxl/idl.py
98@@ -1,3 +1,5 @@
99+from __future__ import print_function
100+
101 import sys
102
103 PASS_BY_VALUE = 1
104@@ -11,7 +13,7 @@ DIR_BOTH = 3
105 _default_namespace = ""
106 def namespace(s):
107 if type(s) != str:
108- raise TypeError, "Require a string for the default namespace."
109+ raise TypeError("Require a string for the default namespace.")
110 global _default_namespace
111 _default_namespace = s
112
113@@ -346,7 +348,7 @@ class OrderedDict(dict):
114 return [(x,self[x]) for x in self.__ordered]
115
116 def parse(f):
117- print >>sys.stderr, "Parsing %s" % f
118+ print("Parsing %s" % f, file=sys.stderr)
119
120 globs = {}
121 locs = OrderedDict()
122@@ -362,11 +364,10 @@ def parse(f):
123 globs[n] = t
124
125 try:
126- execfile(f, globs, locs)
127- except SyntaxError,e:
128- raise SyntaxError, \
129- "Errors were found at line %d while processing %s:\n\t%s"\
130- %(e.lineno,f,e.text)
131+ exec(compile(open(f).read(), f, 'exec'), globs, locs)
132+ except SyntaxError as e:
133+ raise SyntaxError("Errors were found at line %d while processing %s:\n\t%s"
134+ % (e.lineno, f, e.text))
135
136 types = [t for t in locs.ordered_values() if isinstance(t,Type)]
137
138--
1392.17.1
140
diff --git a/recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch b/recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch
new file mode 100644
index 00000000..d913be20
--- /dev/null
+++ b/recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch
@@ -0,0 +1,40 @@
1From b9e1368af14ded6aee3bdf64e8329628b16291ff Mon Sep 17 00:00:00 2001
2From: Wei Liu <wei.liu2@citrix.com>
3Date: Mon, 11 Mar 2019 12:55:29 +0000
4Subject: [PATCH] pygrub: change tabs into spaces
5
6Not sure why Python 2 never complained, but Python 3 does.
7
8Change tabs to spaces.
9
10Signed-off-by: Wei Liu <wei.liu2@citrix.com>
11Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
12---
13 tools/pygrub/src/pygrub | 4 ++--
14 1 file changed, 2 insertions(+), 2 deletions(-)
15
16diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
17index 52a8965ad9..1189b1ca48 100755
18--- a/tools/pygrub/src/pygrub
19+++ b/tools/pygrub/src/pygrub
20@@ -858,7 +858,7 @@ if __name__ == "__main__":
21 output_directory = a
22
23 if debug:
24- logging.basicConfig(level=logging.DEBUG)
25+ logging.basicConfig(level=logging.DEBUG)
26
27
28 try:
29@@ -917,7 +917,7 @@ if __name__ == "__main__":
30 # IOErrors raised by fsimage.open
31 # RuntimeErrors raised by run_grub if no menu.lst present
32 if debug:
33- traceback.print_exc()
34+ traceback.print_exc()
35 fs = None
36 continue
37
38--
392.17.1
40
diff --git a/recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch b/recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch
new file mode 100644
index 00000000..f4cbb670
--- /dev/null
+++ b/recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch
@@ -0,0 +1,529 @@
1From 0aabd89dcfee9ee2a6caaa2ec7a475daf5cada53 Mon Sep 17 00:00:00 2001
2From: Wei Liu <wei.liu2@citrix.com>
3Date: Thu, 7 Mar 2019 12:45:47 +0000
4Subject: [PATCH] pygrub: make python scripts work with 2.6 and up
5
6Run 2to3 and pick the sensible suggestions.
7
8Import print_function and absolute_import so 2.6 can work.
9
10There has never been a curses.wrapper module according to 2.x and 3.x
11doc, only a function, so "import curses.wrapper" is not correct. It
12happened to work because 2.x implemented a (undocumented) module.
13
14We only need to import curses to make curses.wrapper available to
15pygrub.
16
17Signed-off-by: Wei Liu <wei.liu2@citrix.com>
18Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
19---
20 tools/pygrub/src/ExtLinuxConf.py | 19 +++++----
21 tools/pygrub/src/GrubConf.py | 39 ++++++++++--------
22 tools/pygrub/src/LiloConf.py | 19 +++++----
23 tools/pygrub/src/pygrub | 71 ++++++++++++++++----------------
24 4 files changed, 78 insertions(+), 70 deletions(-)
25
26diff --git a/tools/pygrub/src/ExtLinuxConf.py b/tools/pygrub/src/ExtLinuxConf.py
27index d1789bf020..9fd635b9cf 100644
28--- a/tools/pygrub/src/ExtLinuxConf.py
29+++ b/tools/pygrub/src/ExtLinuxConf.py
30@@ -10,9 +10,11 @@
31 # along with this program; If not, see <http://www.gnu.org/licenses/>.
32 #
33
34+from __future__ import print_function, absolute_import
35+
36 import sys, re, os
37 import logging
38-import GrubConf
39+from . import GrubConf
40
41 class ExtLinuxImage(object):
42 def __init__(self, lines, path):
43@@ -32,7 +34,8 @@ class ExtLinuxImage(object):
44 self.lines = []
45 self.path = path
46 self.root = ""
47- map(self.set_from_line, lines)
48+ for line in lines:
49+ self.set_from_line(line)
50
51 def set_from_line(self, line, replace = None):
52 (com, arg) = GrubConf.grub_exact_split(line, 2)
53@@ -67,7 +70,7 @@ class ExtLinuxImage(object):
54 setattr(self, "initrd", a.replace("initrd=", ""))
55 arg = arg.replace(a, "")
56
57- if com is not None and self.commands.has_key(com):
58+ if com is not None and com in self.commands:
59 if self.commands[com] is not None:
60 setattr(self, self.commands[com], re.sub('^"(.+)"$', r"\1", arg.strip()))
61 else:
62@@ -136,7 +139,7 @@ class ExtLinuxConfigFile(object):
63 def parse(self, buf = None):
64 if buf is None:
65 if self.filename is None:
66- raise ValueError, "No config file defined to parse!"
67+ raise ValueError("No config file defined to parse!")
68
69 f = open(self.filename, 'r')
70 lines = f.readlines()
71@@ -167,7 +170,7 @@ class ExtLinuxConfigFile(object):
72
73 (com, arg) = GrubConf.grub_exact_split(l, 2)
74 com = com.lower()
75- if self.commands.has_key(com):
76+ if com in self.commands:
77 if self.commands[com] is not None:
78 setattr(self, self.commands[com], arg.strip())
79 else:
80@@ -207,8 +210,8 @@ class ExtLinuxConfigFile(object):
81
82 if __name__ == "__main__":
83 if len(sys.argv) < 2:
84- raise RuntimeError, "Need a configuration file to read"
85+ raise RuntimeError("Need a configuration file to read")
86 g = ExtLinuxConfigFile(sys.argv[1])
87 for i in g.images:
88- print i
89- print g.default
90+ print(i)
91+ print(g.default)
92diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
93index dc810d55cb..f8d3799dc0 100644
94--- a/tools/pygrub/src/GrubConf.py
95+++ b/tools/pygrub/src/GrubConf.py
96@@ -12,6 +12,8 @@
97 # along with this program; If not, see <http://www.gnu.org/licenses/>.
98 #
99
100+from __future__ import print_function, absolute_import
101+
102 import os, sys
103 import logging
104 import re
105@@ -44,7 +46,7 @@ def get_path(s):
106 return (None, s)
107 idx = s.find(')')
108 if idx == -1:
109- raise ValueError, "Unable to find matching ')'"
110+ raise ValueError("Unable to find matching ')'")
111 d = s[:idx]
112 return (GrubDiskPart(d), s[idx + 1:])
113
114@@ -100,7 +102,8 @@ class _GrubImage(object):
115 " initrd: %s\n" %(self.title, self.root, self.kernel,
116 self.args, self.initrd))
117 def _parse(self, lines):
118- map(self.set_from_line, lines)
119+ for line in lines:
120+ self.set_from_line(line)
121
122 def reset(self, lines):
123 self._root = self._initrd = self._kernel = self._args = None
124@@ -141,7 +144,7 @@ class GrubImage(_GrubImage):
125 def set_from_line(self, line, replace = None):
126 (com, arg) = grub_exact_split(line, 2)
127
128- if self.commands.has_key(com):
129+ if com in self.commands:
130 if self.commands[com] is not None:
131 setattr(self, self.commands[com], arg.strip())
132 else:
133@@ -177,7 +180,7 @@ class _GrubConfigFile(object):
134 self.parse()
135
136 def parse(self, buf = None):
137- raise RuntimeError, "unimplemented parse function"
138+ raise RuntimeError("unimplemented parse function")
139
140 def hasPasswordAccess(self):
141 return self.passwordAccess
142@@ -201,7 +204,7 @@ class _GrubConfigFile(object):
143 import crypt
144 if crypt.crypt(password, pwd[1]) == pwd[1]:
145 return True
146- except Exception, e:
147+ except Exception as e:
148 self.passExc = "Can't verify password: %s" % str(e)
149 return False
150
151@@ -213,7 +216,7 @@ class _GrubConfigFile(object):
152
153 def set(self, line):
154 (com, arg) = grub_exact_split(line, 2)
155- if self.commands.has_key(com):
156+ if com in self.commands:
157 if self.commands[com] is not None:
158 setattr(self, self.commands[com], arg.strip())
159 else:
160@@ -233,7 +236,7 @@ class _GrubConfigFile(object):
161 self._default = val
162
163 if self._default < 0:
164- raise ValueError, "default must be positive number"
165+ raise ValueError("default must be positive number")
166 default = property(_get_default, _set_default)
167
168 def set_splash(self, val):
169@@ -265,7 +268,7 @@ class GrubConfigFile(_GrubConfigFile):
170 def parse(self, buf = None):
171 if buf is None:
172 if self.filename is None:
173- raise ValueError, "No config file defined to parse!"
174+ raise ValueError("No config file defined to parse!")
175
176 f = open(self.filename, 'r')
177 lines = f.readlines()
178@@ -296,7 +299,7 @@ class GrubConfigFile(_GrubConfigFile):
179 continue
180
181 (com, arg) = grub_exact_split(l, 2)
182- if self.commands.has_key(com):
183+ if com in self.commands:
184 if self.commands[com] is not None:
185 setattr(self, self.commands[com], arg.strip())
186 else:
187@@ -328,7 +331,7 @@ class Grub2Image(_GrubImage):
188 if com == "set":
189 (com,arg) = grub2_handle_set(arg)
190
191- if self.commands.has_key(com):
192+ if com in self.commands:
193 if self.commands[com] is not None:
194 setattr(self, self.commands[com], arg.strip())
195 else:
196@@ -364,7 +367,7 @@ class Grub2ConfigFile(_GrubConfigFile):
197 def parse(self, buf = None):
198 if buf is None:
199 if self.filename is None:
200- raise ValueError, "No config file defined to parse!"
201+ raise ValueError("No config file defined to parse!")
202
203 f = open(self.filename, 'r')
204 lines = f.readlines()
205@@ -398,7 +401,7 @@ class Grub2ConfigFile(_GrubConfigFile):
206 title_match = re.match('^menuentry ["\'](.*?)["\'] (.*){', l)
207 if title_match:
208 if img is not None:
209- raise RuntimeError, "syntax error: cannot nest menuentry (%d %s)" % (len(img),img)
210+ raise RuntimeError("syntax error: cannot nest menuentry (%d %s)" % (len(img),img))
211 img = []
212 title = title_match.group(1)
213 continue
214@@ -413,7 +416,7 @@ class Grub2ConfigFile(_GrubConfigFile):
215 menu_level -= 1
216 continue
217 else:
218- raise RuntimeError, "syntax error: closing brace without menuentry"
219+ raise RuntimeError("syntax error: closing brace without menuentry")
220
221 self.add_image(Grub2Image(title, img))
222 img = None
223@@ -428,7 +431,7 @@ class Grub2ConfigFile(_GrubConfigFile):
224 if com == "set":
225 (com,arg) = grub2_handle_set(arg)
226
227- if self.commands.has_key(com):
228+ if com in self.commands:
229 if self.commands[com] is not None:
230 arg_strip = arg.strip()
231 if arg_strip == "${saved_entry}" or arg_strip == "${next_entry}":
232@@ -443,7 +446,7 @@ class Grub2ConfigFile(_GrubConfigFile):
233 logging.warning("Unknown directive %s" %(com,))
234
235 if img is not None:
236- raise RuntimeError, "syntax error: end of file with open menuentry(%d %s)" % (len(img),img)
237+ raise RuntimeError("syntax error: end of file with open menuentry(%d %s)" % (len(img),img))
238
239 if self.hasPassword():
240 self.setPasswordAccess(False)
241@@ -462,12 +465,12 @@ class Grub2ConfigFile(_GrubConfigFile):
242
243 if __name__ == "__main__":
244 if len(sys.argv) < 3:
245- raise RuntimeError, "Need a grub version (\"grub\" or \"grub2\") and a grub.conf or grub.cfg to read"
246+ raise RuntimeError('Need a grub version ("grub" or "grub2") and a grub.conf or grub.cfg to read')
247 if sys.argv[1] == "grub":
248 g = GrubConfigFile(sys.argv[2])
249 elif sys.argv[1] == "grub2":
250 g = Grub2ConfigFile(sys.argv[2])
251 else:
252- raise RuntimeError, "Unknown config type %s" % sys.argv[1]
253+ raise RuntimeError("Unknown config type %s" % sys.argv[1])
254 for i in g.images:
255- print i #, i.title, i.root, i.kernel, i.args, i.initrd
256+ print(i) #, i.title, i.root, i.kernel, i.args, i.initrd
257diff --git a/tools/pygrub/src/LiloConf.py b/tools/pygrub/src/LiloConf.py
258index 2cb649f115..e3bfcb5244 100644
259--- a/tools/pygrub/src/LiloConf.py
260+++ b/tools/pygrub/src/LiloConf.py
261@@ -2,9 +2,11 @@
262 #LiloConf.py
263 #
264
265+from __future__ import print_function, absolute_import
266+
267 import sys, re, os
268 import logging
269-import GrubConf
270+from . import GrubConf
271
272 class LiloImage(object):
273 def __init__(self, lines, path):
274@@ -24,12 +26,13 @@ class LiloImage(object):
275 self.lines = []
276 self.path = path
277 self.root = ""
278- map(self.set_from_line, lines)
279+ for line in lines:
280+ self.set_from_line(line)
281
282 def set_from_line(self, line, replace = None):
283 (com, arg) = GrubConf.grub_exact_split(line, 2)
284
285- if self.commands.has_key(com):
286+ if com in self.commands:
287 if self.commands[com] is not None:
288 setattr(self, self.commands[com], re.sub('^"(.+)"$', r"\1", arg.strip()))
289 else:
290@@ -97,7 +100,7 @@ class LiloConfigFile(object):
291 def parse(self, buf = None):
292 if buf is None:
293 if self.filename is None:
294- raise ValueError, "No config file defined to parse!"
295+ raise ValueError("No config file defined to parse!")
296
297 f = open(self.filename, 'r')
298 lines = f.readlines()
299@@ -127,7 +130,7 @@ class LiloConfigFile(object):
300 continue
301
302 (com, arg) = GrubConf.grub_exact_split(l, 2)
303- if self.commands.has_key(com):
304+ if com in self.commands:
305 if self.commands[com] is not None:
306 setattr(self, self.commands[com], arg.strip())
307 else:
308@@ -170,8 +173,8 @@ class LiloConfigFile(object):
309
310 if __name__ == "__main__":
311 if len(sys.argv) < 2:
312- raise RuntimeError, "Need a lilo.conf to read"
313+ raise RuntimeError("Need a lilo.conf to read")
314 g = LiloConfigFile(sys.argv[1])
315 for i in g.images:
316- print i #, i.title, i.root, i.kernel, i.args, i.initrd
317- print g.default
318+ print(i) #, i.title, i.root, i.kernel, i.args, i.initrd
319+ print(g.default)
320diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
321index 1189b1ca48..dbdce315c6 100755
322--- a/tools/pygrub/src/pygrub
323+++ b/tools/pygrub/src/pygrub
324@@ -12,13 +12,15 @@
325 # along with this program; If not, see <http://www.gnu.org/licenses/>.
326 #
327
328+from __future__ import print_function
329+
330 import os, sys, string, struct, tempfile, re, traceback, stat, errno
331 import copy
332 import logging
333 import platform
334 import xen.lowlevel.xc
335
336-import curses, _curses, curses.wrapper, curses.textpad, curses.ascii
337+import curses, _curses, curses.textpad, curses.ascii
338 import getopt
339
340 import xenfsimage
341@@ -77,7 +79,7 @@ def get_solaris_slice(file, offset):
342 buf = os.read(fd, 512)
343 os.close(fd)
344 if struct.unpack("<H", buf[508:510])[0] != DKL_MAGIC:
345- raise RuntimeError, "Invalid disklabel magic"
346+ raise RuntimeError("Invalid disklabel magic")
347
348 nslices = struct.unpack("<H", buf[30:32])[0]
349
350@@ -88,7 +90,7 @@ def get_solaris_slice(file, offset):
351 if slicetag == V_ROOT:
352 return slicesect * SECTOR_SIZE
353
354- raise RuntimeError, "No root slice found"
355+ raise RuntimeError("No root slice found")
356
357 def get_fs_offset_gpt(file):
358 fd = os.open(file, os.O_RDONLY)
359@@ -423,20 +425,17 @@ class Grub:
360 we're being given a raw config file rather than a disk image."""
361
362 if not os.access(fn, os.R_OK):
363- raise RuntimeError, "Unable to access %s" %(fn,)
364+ raise RuntimeError("Unable to access %s" %(fn,))
365
366- cfg_list = map(lambda x: (x,grub.GrubConf.Grub2ConfigFile),
367- ["/boot/grub/grub.cfg", "/grub/grub.cfg",
368- "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]) + \
369- map(lambda x: (x,grub.ExtLinuxConf.ExtLinuxConfigFile),
370- ["/boot/isolinux/isolinux.cfg",
371+ cfg_list = [(x,grub.GrubConf.Grub2ConfigFile) for x in ["/boot/grub/grub.cfg", "/grub/grub.cfg",
372+ "/boot/grub2/grub.cfg", "/grub2/grub.cfg"]] + \
373+ [(x,grub.ExtLinuxConf.ExtLinuxConfigFile) for x in ["/boot/isolinux/isolinux.cfg",
374 "/boot/extlinux/extlinux.conf",
375 "/boot/extlinux.conf",
376 "/extlinux/extlinux.conf",
377- "/extlinux.conf"]) + \
378- map(lambda x: (x,grub.GrubConf.GrubConfigFile),
379- ["/boot/grub/menu.lst", "/boot/grub/grub.conf",
380- "/grub/menu.lst", "/grub/grub.conf"])
381+ "/extlinux.conf"]] + \
382+ [(x,grub.GrubConf.GrubConfigFile) for x in ["/boot/grub/menu.lst", "/boot/grub/grub.conf",
383+ "/grub/menu.lst", "/grub/grub.conf"]]
384
385 if not fs:
386 # set the config file and parse it
387@@ -448,12 +447,12 @@ class Grub:
388
389 for f,parser in cfg_list:
390 if fs.file_exists(f):
391- print >>sys.stderr, "Using %s to parse %s" % (parser,f)
392+ print("Using %s to parse %s" % (parser,f), file=sys.stderr)
393 self.cf = parser()
394 self.cf.filename = f
395 break
396 if self.__dict__.get('cf', None) is None:
397- raise RuntimeError, "couldn't find bootloader config file in the image provided."
398+ raise RuntimeError("couldn't find bootloader config file in the image provided.")
399 f = fs.open_file(self.cf.filename)
400 # limit read size to avoid pathological cases
401 buf = f.read(FS_READ_MAX)
402@@ -628,11 +627,11 @@ def run_grub(file, entry, fs, cfg_args):
403 if list_entries:
404 for i in range(len(g.cf.images)):
405 img = g.cf.images[i]
406- print "title: %s" % img.title
407- print " root: %s" % img.root
408- print " kernel: %s" % img.kernel[1]
409- print " args: %s" % img.args
410- print " initrd: %s" % img.initrd[1]
411+ print("title: %s" % img.title)
412+ print(" root: %s" % img.root)
413+ print(" kernel: %s" % img.kernel[1])
414+ print(" args: %s" % img.args)
415+ print(" initrd: %s" % img.initrd[1])
416
417 if interactive and not list_entries:
418 curses.wrapper(run_main)
419@@ -646,7 +645,7 @@ def run_grub(file, entry, fs, cfg_args):
420 sel = idx
421
422 if sel == -1:
423- print "No kernel image selected!"
424+ print("No kernel image selected!")
425 sys.exit(1)
426
427 try:
428@@ -731,7 +730,7 @@ def format_sxp(kernel, ramdisk, args):
429 def format_simple(kernel, ramdisk, args, sep):
430 for check in (kernel, ramdisk, args):
431 if check is not None and sep in check:
432- raise RuntimeError, "simple format cannot represent delimiter-containing value"
433+ raise RuntimeError("simple format cannot represent delimiter-containing value")
434 s = ("kernel %s" % kernel) + sep
435 if ramdisk:
436 s += ("ramdisk %s" % ramdisk) + sep
437@@ -744,7 +743,7 @@ if __name__ == "__main__":
438 sel = None
439
440 def usage():
441- print >> sys.stderr, "Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],)
442+ print("Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],), file=sys.stderr)
443
444 def copy_from_image(fs, file_to_read, file_type, output_directory,
445 not_really):
446@@ -755,8 +754,8 @@ if __name__ == "__main__":
447 sys.exit("The requested %s file does not exist" % file_type)
448 try:
449 datafile = fs.open_file(file_to_read)
450- except Exception, e:
451- print >>sys.stderr, e
452+ except Exception as e:
453+ print(e, file=sys.stderr)
454 sys.exit("Error opening %s in guest" % file_to_read)
455 (tfd, ret) = tempfile.mkstemp(prefix="boot_"+file_type+".",
456 dir=output_directory)
457@@ -769,8 +768,8 @@ if __name__ == "__main__":
458 return ret
459 try:
460 os.write(tfd, data)
461- except Exception, e:
462- print >>sys.stderr, e
463+ except Exception as e:
464+ print(e, file=sys.stderr)
465 os.close(tfd)
466 os.unlink(ret)
467 del datafile
468@@ -834,7 +833,7 @@ if __name__ == "__main__":
469 try:
470 part_offs = [ int(a) ]
471 except ValueError:
472- print "offset value must be an integer"
473+ print("offset value must be an integer")
474 usage()
475 sys.exit(1)
476 elif o in ("--entry",):
477@@ -847,13 +846,13 @@ if __name__ == "__main__":
478 debug = True
479 elif o in ("--output-format",):
480 if a not in ["sxp", "simple", "simple0"]:
481- print "unknown output format %s" % a
482+ print("unknown output format %s" % a)
483 usage()
484 sys.exit(1)
485 output_format = a
486 elif o in ("--output-directory",):
487 if not os.path.isdir(a):
488- print "%s is not an existing directory" % a
489+ print("%s is not an existing directory" % a)
490 sys.exit(1)
491 output_directory = a
492
493@@ -862,8 +861,8 @@ if __name__ == "__main__":
494
495
496 try:
497- os.makedirs(output_directory, 0700)
498- except OSError,e:
499+ os.makedirs(output_directory, 0o700)
500+ except OSError as e:
501 if (e.errno == errno.EEXIST) and os.path.isdir(output_directory):
502 pass
503 else:
504@@ -877,10 +876,10 @@ if __name__ == "__main__":
505 # debug
506 if isconfig:
507 chosencfg = run_grub(file, entry, fs, incfg["args"])
508- print " kernel: %s" % chosencfg["kernel"]
509+ print(" kernel: %s" % chosencfg["kernel"])
510 if chosencfg["ramdisk"]:
511- print " initrd: %s" % chosencfg["ramdisk"]
512- print " args: %s" % chosencfg["args"]
513+ print(" initrd: %s" % chosencfg["ramdisk"])
514+ print(" args: %s" % chosencfg["args"])
515 sys.exit(0)
516
517 # if boot filesystem is set then pass to fsimage.open
518@@ -926,7 +925,7 @@ if __name__ == "__main__":
519
520 # Did looping through partitions find us a kernel?
521 if fs is None:
522- raise RuntimeError, "Unable to find partition containing kernel"
523+ raise RuntimeError("Unable to find partition containing kernel")
524
525 bootcfg["kernel"] = copy_from_image(fs, chosencfg["kernel"], "kernel",
526 output_directory, not_really)
527--
5282.17.1
529
diff --git a/recipes-extended/xen/files/xen-tools-pygrub-py3.patch b/recipes-extended/xen/files/xen-tools-pygrub-py3.patch
new file mode 100644
index 00000000..e486646f
--- /dev/null
+++ b/recipes-extended/xen/files/xen-tools-pygrub-py3.patch
@@ -0,0 +1,233 @@
1From 83a204e6951c6358f995da3b60dd61224e9d41ac Mon Sep 17 00:00:00 2001
2From: Wei Liu <wei.liu2@citrix.com>
3Date: Tue, 5 Mar 2019 14:13:17 +0000
4Subject: [PATCH] pygrub/fsimage: make it work with python 3
5
6With the help of two porting guides and cpython source code:
7
81. Use PyBytes to replace PyString counterparts.
92. Use PyVarObject_HEAD_INIT.
103. Remove usage of Py_FindMethod.
114. Use new module initialisation routine.
12
13For #3, Py_FindMethod was removed, yet an alternative wasn't
14documented. The code is the result of reverse-engineering cpython
15commit 6116d4a1d1
16
17https://docs.python.org/3/howto/cporting.html
18http://python3porting.com/cextensions.html
19
20Signed-off-by: Wei Liu <wei.liu2@citrix.com>
21Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
22---
23 tools/pygrub/src/fsimage/fsimage.c | 123 ++++++++++++++++-------------
24 1 file changed, 69 insertions(+), 54 deletions(-)
25
26diff --git a/tools/pygrub/src/fsimage/fsimage.c b/tools/pygrub/src/fsimage/fsimage.c
27index 780207791c..2ebbbe35df 100644
28--- a/tools/pygrub/src/fsimage/fsimage.c
29+++ b/tools/pygrub/src/fsimage/fsimage.c
30@@ -26,12 +26,6 @@
31 #include <xenfsimage.h>
32 #include <stdlib.h>
33
34-#if (PYTHON_API_VERSION >= 1011)
35-#define PY_PAD 0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L,0L
36-#else
37-#define PY_PAD 0L,0L,0L,0L
38-#endif
39-
40 typedef struct fsimage_fs {
41 PyObject_HEAD
42 fsi_t *fs;
43@@ -59,12 +53,24 @@ fsimage_file_read(fsimage_file_t *file, PyObject *args, PyObject *kwargs)
44
45 bufsize = size ? size : 4096;
46
47- if ((buffer = PyString_FromStringAndSize(NULL, bufsize)) == NULL)
48+ buffer =
49+#if PY_MAJOR_VERSION < 3
50+ PyString_FromStringAndSize(NULL, bufsize);
51+#else
52+ PyBytes_FromStringAndSize(NULL, bufsize);
53+#endif
54+
55+ if (buffer == NULL)
56 return (NULL);
57
58 while (1) {
59 int err;
60- void *buf = PyString_AS_STRING(buffer) + bytesread;
61+ void *buf =
62+#if PY_MAJOR_VERSION < 3
63+ PyString_AS_STRING(buffer) + bytesread;
64+#else
65+ PyBytes_AS_STRING(buffer) + bytesread;
66+#endif
67
68 err = fsi_pread_file(file->file, buf, bufsize,
69 bytesread + offset);
70@@ -84,12 +90,20 @@ fsimage_file_read(fsimage_file_t *file, PyObject *args, PyObject *kwargs)
71 if (bufsize == 0)
72 break;
73 } else {
74+#if PY_MAJOR_VERSION < 3
75 if (_PyString_Resize(&buffer, bytesread + bufsize) < 0)
76+#else
77+ if (_PyBytes_Resize(&buffer, bytesread + bufsize) < 0)
78+#endif
79 return (NULL);
80 }
81 }
82
83+#if PY_MAJOR_VERSION < 3
84 _PyString_Resize(&buffer, bytesread);
85+#else
86+ _PyBytes_Resize(&buffer, bytesread);
87+#endif
88 return (buffer);
89 }
90
91@@ -106,11 +120,13 @@ static struct PyMethodDef fsimage_file_methods[] = {
92 { NULL, NULL, 0, NULL }
93 };
94
95+#if PY_MAJOR_VERSION < 3
96 static PyObject *
97 fsimage_file_getattr(fsimage_file_t *file, char *name)
98 {
99 return (Py_FindMethod(fsimage_file_methods, (PyObject *)file, name));
100 }
101+#endif
102
103 static void
104 fsimage_file_dealloc(fsimage_file_t *file)
105@@ -123,29 +139,18 @@ fsimage_file_dealloc(fsimage_file_t *file)
106
107 static char fsimage_file_type__doc__[] = "Filesystem image file";
108 PyTypeObject fsimage_file_type = {
109- PyObject_HEAD_INIT(&PyType_Type)
110- 0, /* ob_size */
111- "xenfsimage.file", /* tp_name */
112- sizeof(fsimage_file_t), /* tp_size */
113- 0, /* tp_itemsize */
114- (destructor) fsimage_file_dealloc, /* tp_dealloc */
115- 0, /* tp_print */
116- (getattrfunc) fsimage_file_getattr, /* tp_getattr */
117- 0, /* tp_setattr */
118- 0, /* tp_compare */
119- 0, /* tp_repr */
120- 0, /* tp_as_number */
121- 0, /* tp_as_sequence */
122- 0, /* tp_as_mapping */
123- 0, /* tp_hash */
124- 0, /* tp_call */
125- 0, /* tp_str */
126- 0, /* tp_getattro */
127- 0, /* tp_setattro */
128- 0, /* tp_as_buffer */
129- Py_TPFLAGS_DEFAULT, /* tp_flags */
130- fsimage_file_type__doc__,
131- PY_PAD
132+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
133+ .tp_name = "xenfsimage.file",
134+ .tp_basicsize = sizeof(fsimage_file_t),
135+ .tp_dealloc = (destructor) fsimage_file_dealloc,
136+#if PY_MAJOR_VERSION < 3
137+ .tp_getattr = (getattrfunc) fsimage_file_getattr,
138+#endif
139+ .tp_flags = Py_TPFLAGS_DEFAULT,
140+ .tp_doc = fsimage_file_type__doc__,
141+#if PY_MAJOR_VERSION >= 3
142+ .tp_methods = fsimage_file_methods,
143+#endif
144 };
145
146 static PyObject *
147@@ -208,11 +213,13 @@ static struct PyMethodDef fsimage_fs_methods[] = {
148 { NULL, NULL, 0, NULL }
149 };
150
151+#if PY_MAJOR_VERSION < 3
152 static PyObject *
153 fsimage_fs_getattr(fsimage_fs_t *fs, char *name)
154 {
155 return (Py_FindMethod(fsimage_fs_methods, (PyObject *)fs, name));
156 }
157+#endif
158
159 static void
160 fsimage_fs_dealloc (fsimage_fs_t *fs)
161@@ -225,29 +232,18 @@ fsimage_fs_dealloc (fsimage_fs_t *fs)
162 PyDoc_STRVAR(fsimage_fs_type__doc__, "Filesystem image");
163
164 PyTypeObject fsimage_fs_type = {
165- PyObject_HEAD_INIT(&PyType_Type)
166- 0, /* ob_size */
167- "xenfsimage.fs", /* tp_name */
168- sizeof(fsimage_fs_t), /* tp_size */
169- 0, /* tp_itemsize */
170- (destructor) fsimage_fs_dealloc, /* tp_dealloc */
171- 0, /* tp_print */
172- (getattrfunc) fsimage_fs_getattr, /* tp_getattr */
173- 0, /* tp_setattr */
174- 0, /* tp_compare */
175- 0, /* tp_repr */
176- 0, /* tp_as_number */
177- 0, /* tp_as_sequence */
178- 0, /* tp_as_mapping */
179- 0, /* tp_hash */
180- 0, /* tp_call */
181- 0, /* tp_str */
182- 0, /* tp_getattro */
183- 0, /* tp_setattro */
184- 0, /* tp_as_buffer */
185- Py_TPFLAGS_DEFAULT, /* tp_flags */
186- fsimage_fs_type__doc__,
187- PY_PAD
188+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
189+ .tp_name = "xenfsimage.fs",
190+ .tp_basicsize = sizeof(fsimage_fs_t),
191+ .tp_dealloc = (destructor) fsimage_fs_dealloc,
192+#if PY_MAJOR_VERSION < 3
193+ .tp_getattr = (getattrfunc) fsimage_fs_getattr,
194+#endif
195+ .tp_flags = Py_TPFLAGS_DEFAULT,
196+ .tp_doc = fsimage_fs_type__doc__,
197+#if PY_MAJOR_VERSION >= 3
198+ .tp_methods = fsimage_fs_methods,
199+#endif
200 };
201
202 static PyObject *
203@@ -309,8 +305,27 @@ static struct PyMethodDef fsimage_module_methods[] = {
204 { NULL, NULL, 0, NULL }
205 };
206
207+#if PY_MAJOR_VERSION >= 3
208+static struct PyModuleDef fsimage_module_def = {
209+ PyModuleDef_HEAD_INIT,
210+ .m_name = "xenfsimage",
211+ .m_size = -1,
212+ .m_methods = fsimage_module_methods,
213+};
214+#endif
215+
216 PyMODINIT_FUNC
217+#if PY_MAJOR_VERSION >= 3
218+PyInit_xenfsimage(void)
219+#else
220 initxenfsimage(void)
221+#endif
222 {
223+#if PY_MAJOR_VERSION < 3
224 Py_InitModule("xenfsimage", fsimage_module_methods);
225+#else
226+ if (PyType_Ready(&fsimage_fs_type) < 0 || PyType_Ready(&fsimage_file_type) < 0)
227+ return NULL;
228+ return PyModule_Create(&fsimage_module_def);
229+#endif
230 }
231--
2322.17.1
233
diff --git a/recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch b/recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch
new file mode 100644
index 00000000..b32c5d06
--- /dev/null
+++ b/recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch
@@ -0,0 +1,136 @@
1From 88d703a361d34d75f81fc6d30b31d0abc8aa17eb Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
3 <marmarek@invisiblethingslab.com>
4Date: Fri, 9 Aug 2019 03:01:36 +0100
5Subject: [PATCH] python: fix -Wsign-compare warnings
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10Specifically:
11xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_create’:
12xen/lowlevel/xc/xc.c:147:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
13 147 | for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
14 | ^
15xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_sethandle’:
16xen/lowlevel/xc/xc.c:312:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
17 312 | for ( i = 0; i < sizeof(xen_domain_handle_t); i++ )
18 | ^
19xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_getinfo’:
20xen/lowlevel/xc/xc.c:391:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
21 391 | for ( j = 0; j < sizeof(xen_domain_handle_t); j++ )
22 | ^
23xen/lowlevel/xc/xc.c: In function ‘pyxc_get_device_group’:
24xen/lowlevel/xc/xc.c:677:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Werror=sign-compare]
25 677 | for ( i = 0; i < num_sdevs; i++ )
26 | ^
27xen/lowlevel/xc/xc.c: In function ‘pyxc_physinfo’:
28xen/lowlevel/xc/xc.c:988:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
29 988 | for ( i = 0; i < sizeof(pinfo.hw_cap)/4; i++ )
30 | ^
31xen/lowlevel/xc/xc.c:994:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
32 994 | for ( i = 0; i < ARRAY_SIZE(virtcaps_bits); i++ )
33 | ^
34xen/lowlevel/xc/xc.c:998:24: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
35 998 | for ( i = 0; i < ARRAY_SIZE(virtcaps_bits); i++ )
36 | ^
37xen/lowlevel/xs/xs.c: In function ‘xspy_ls’:
38xen/lowlevel/xs/xs.c:191:23: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare]
39 191 | for (i = 0; i < xsval_n; i++)
40 | ^
41xen/lowlevel/xs/xs.c: In function ‘xspy_get_permissions’:
42xen/lowlevel/xs/xs.c:297:23: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare]
43 297 | for (i = 0; i < perms_n; i++) {
44 | ^
45cc1: all warnings being treated as errors
46
47Use size_t for loop iterators where it's compared with sizeof() or
48similar construct.
49
50Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
51Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
52
53Modified to apply to Xen 4.12.2 by Christopher Clark
54Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
55---
56 tools/python/xen/lowlevel/xc/xc.c | 13 ++++++++-----
57 tools/python/xen/lowlevel/xs/xs.c | 4 ++--
58 2 files changed, 10 insertions(+), 7 deletions(-)
59
60diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
61index 522cbe3b9c..188bfa34da 100644
62--- a/tools/python/xen/lowlevel/xc/xc.c
63+++ b/tools/python/xen/lowlevel/xc/xc.c
64@@ -117,7 +117,8 @@ static PyObject *pyxc_domain_create(XcObject *self,
65 PyObject *kwds)
66 {
67 uint32_t dom = 0, target = 0;
68- int ret, i;
69+ int ret;
70+ size_t i;
71 PyObject *pyhandle = NULL;
72 struct xen_domctl_createdomain config = {
73 .handle = {
74@@ -295,7 +296,7 @@ static PyObject *pyxc_vcpu_setaffinity(XcObject *self,
75
76 static PyObject *pyxc_domain_sethandle(XcObject *self, PyObject *args)
77 {
78- int i;
79+ size_t i;
80 uint32_t dom;
81 PyObject *pyhandle;
82 xen_domain_handle_t handle;
83@@ -336,7 +337,8 @@ static PyObject *pyxc_domain_getinfo(XcObject *self,
84 PyObject *list, *info_dict, *pyhandle;
85
86 uint32_t first_dom = 0;
87- int max_doms = 1024, nr_doms, i, j;
88+ int max_doms = 1024, nr_doms, i;
89+ size_t j;
90 xc_dominfo_t *info;
91
92 static char *kwd_list[] = { "first_dom", "max_doms", NULL };
93@@ -631,7 +633,8 @@ static PyObject *pyxc_get_device_group(XcObject *self,
94 {
95 uint32_t sbdf;
96 uint32_t max_sdevs, num_sdevs;
97- int domid, seg, bus, dev, func, rc, i;
98+ int domid, seg, bus, dev, func, rc;
99+ size_t i;
100 PyObject *Pystr;
101 char *group_str;
102 char dev_str[9];
103@@ -971,7 +974,7 @@ static PyObject *pyxc_physinfo(XcObject *self)
104 {
105 xc_physinfo_t pinfo;
106 char cpu_cap[128], virt_caps[128], *p;
107- int i;
108+ size_t i;
109 const char *virtcap_names[] = { "hvm", "hvm_directio" };
110
111 if ( xc_physinfo(self->xc_handle, &pinfo) != 0 )
112diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c
113index 9a0acfc25c..ea50f86bc3 100644
114--- a/tools/python/xen/lowlevel/xs/xs.c
115+++ b/tools/python/xen/lowlevel/xs/xs.c
116@@ -186,7 +186,7 @@ static PyObject *xspy_ls(XsHandle *self, PyObject *args)
117 Py_END_ALLOW_THREADS
118
119 if (xsval) {
120- int i;
121+ size_t i;
122 PyObject *val = PyList_New(xsval_n);
123 for (i = 0; i < xsval_n; i++)
124 #if PY_MAJOR_VERSION >= 3
125@@ -276,7 +276,7 @@ static PyObject *xspy_get_permissions(XsHandle *self, PyObject *args)
126 struct xs_handle *xh = xshandle(self);
127 struct xs_permissions *perms;
128 unsigned int perms_n = 0;
129- int i;
130+ size_t i;
131
132 xs_transaction_t th;
133 char *thstr;
134--
1352.17.1
136
diff --git a/recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch b/recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch
new file mode 100644
index 00000000..455072ba
--- /dev/null
+++ b/recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch
@@ -0,0 +1,140 @@
1From a9047a722ba5de38e7c1d762ffcfb74c36725fe2 Mon Sep 17 00:00:00 2001
2From: Andrew Cooper <andrew.cooper3@citrix.com>
3Date: Mon, 11 Mar 2019 19:18:40 +0000
4Subject: [PATCH] tools/xen-foreign: Update python scripts to be Py3 compatible
5
6The issues are:
7 * dict.has_key() was completely removed in Py3
8 * dict.keys() is an iterable rather than list in Py3, so .sort() doesn't work.
9 * list.sort(cmp=) was deprecated in Py2.4 and removed in Py3.
10
11The has_key() issue is trivially fixed by switching to using the in keyword.
12The sorting issue could be trivially fixed, but take the opportunity to
13improve the code.
14
15The reason for the sorting is to ensure that "unsigned long" gets replaced
16before "long", and the only reason sorting is necessary is because
17inttypes[arch] is needlessly a dictionary. Update inttypes[arch] to be a list
18of tuples rather than a dictionary, and process them in list order.
19
20Reported-by: George Dunlap <george.dunlap@eu.citrix.com>
21Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
22Acked-by: Wei Liu <wei.liu2@citrix.com>
23---
24 tools/include/xen-foreign/mkchecker.py | 2 +-
25 tools/include/xen-foreign/mkheader.py | 58 +++++++++++++-------------
26 2 files changed, 29 insertions(+), 31 deletions(-)
27
28diff --git a/tools/include/xen-foreign/mkchecker.py b/tools/include/xen-foreign/mkchecker.py
29index fdad869a91..199b0eebbc 100644
30--- a/tools/include/xen-foreign/mkchecker.py
31+++ b/tools/include/xen-foreign/mkchecker.py
32@@ -37,7 +37,7 @@ for struct in structs:
33 f.write('\tprintf("%%-25s |", "%s");\n' % struct);
34 for a in archs:
35 s = struct + "_" + a;
36- if compat_arches.has_key(a):
37+ if a in compat_arches:
38 compat = compat_arches[a]
39 c = struct + "_" + compat;
40 else:
41diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py
42index 97e0c7a984..fb268f0dce 100644
43--- a/tools/include/xen-foreign/mkheader.py
44+++ b/tools/include/xen-foreign/mkheader.py
45@@ -17,13 +17,13 @@ header = {};
46 footer = {};
47
48 #arm
49-inttypes["arm32"] = {
50- "unsigned long" : "__danger_unsigned_long_on_arm32",
51- "long" : "__danger_long_on_arm32",
52- "xen_pfn_t" : "uint64_t",
53- "xen_ulong_t" : "uint64_t",
54- "uint64_t" : "__align8__ uint64_t",
55-};
56+inttypes["arm32"] = [
57+ ("unsigned long", "__danger_unsigned_long_on_arm32"),
58+ ("long", "__danger_long_on_arm32"),
59+ ("xen_pfn_t", "uint64_t"),
60+ ("xen_ulong_t", "uint64_t"),
61+ ("uint64_t", "__align8__ uint64_t"),
62+]
63 header["arm32"] = """
64 #define __arm___ARM32 1
65 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
66@@ -38,13 +38,13 @@ footer["arm32"] = """
67 #undef __DECL_REG
68 """
69
70-inttypes["arm64"] = {
71- "unsigned long" : "__danger_unsigned_long_on_arm64",
72- "long" : "__danger_long_on_arm64",
73- "xen_pfn_t" : "uint64_t",
74- "xen_ulong_t" : "uint64_t",
75- "uint64_t" : "__align8__ uint64_t",
76-};
77+inttypes["arm64"] = [
78+ ("unsigned long", "__danger_unsigned_long_on_arm64"),
79+ ("long", "__danger_long_on_arm64"),
80+ ("xen_pfn_t", "uint64_t"),
81+ ("xen_ulong_t", "uint64_t"),
82+ ("uint64_t", "__align8__ uint64_t"),
83+]
84 header["arm64"] = """
85 #define __aarch64___ARM64 1
86 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
87@@ -60,12 +60,12 @@ footer["arm64"] = """
88 """
89
90 # x86_32
91-inttypes["x86_32"] = {
92- "unsigned long" : "uint32_t",
93- "long" : "uint32_t",
94- "xen_pfn_t" : "uint32_t",
95- "xen_ulong_t" : "uint32_t",
96-};
97+inttypes["x86_32"] = [
98+ ("unsigned long", "uint32_t"),
99+ ("long", "uint32_t"),
100+ ("xen_pfn_t", "uint32_t"),
101+ ("xen_ulong_t", "uint32_t"),
102+]
103 header["x86_32"] = """
104 #define __DECL_REG_LO8(which) uint32_t e ## which ## x
105 #define __DECL_REG_LO16(name) uint32_t e ## name
106@@ -79,12 +79,12 @@ footer["x86_32"] = """
107 """;
108
109 # x86_64
110-inttypes["x86_64"] = {
111- "unsigned long" : "__align8__ uint64_t",
112- "long" : "__align8__ uint64_t",
113- "xen_pfn_t" : "__align8__ uint64_t",
114- "xen_ulong_t" : "__align8__ uint64_t",
115-};
116+inttypes["x86_64"] = [
117+ ("unsigned long", "__align8__ uint64_t"),
118+ ("long", "__align8__ uint64_t"),
119+ ("xen_pfn_t", "__align8__ uint64_t"),
120+ ("xen_ulong_t", "__align8__ uint64_t"),
121+]
122 header["x86_64"] = """
123 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
124 # define __DECL_REG(name) union { uint64_t r ## name, e ## name; }
125@@ -205,10 +205,8 @@ for struct in structs:
126 output = re.sub("\\b(%s)_t\\b" % struct, "\\1_%s_t" % arch, output);
127
128 # replace: integer types
129-integers = inttypes[arch].keys();
130-integers.sort(lambda a, b: cmp(len(b),len(a)));
131-for type in integers:
132- output = re.sub("\\b%s\\b" % type, inttypes[arch][type], output);
133+for old, new in inttypes[arch]:
134+ output = re.sub("\\b%s\\b" % old, new, output)
135
136 # print results
137 f = open(outfile, "w");
138--
1392.17.1
140
diff --git a/recipes-extended/xen/xen-hypervisor.inc b/recipes-extended/xen/xen-hypervisor.inc
index c0df1580..79fafd27 100644
--- a/recipes-extended/xen/xen-hypervisor.inc
+++ b/recipes-extended/xen/xen-hypervisor.inc
@@ -6,7 +6,7 @@ DESCRIPTION = "The Xen hypervisor"
6# this allows for varying the target architecture or toolchain used 6# this allows for varying the target architecture or toolchain used
7# to build the different components. eg. 32-bit tools and a 64-bit hypervisor. 7# to build the different components. eg. 32-bit tools and a 64-bit hypervisor.
8 8
9inherit deploy 9inherit deploy python3native
10 10
11PACKAGES = " \ 11PACKAGES = " \
12 ${PN} \ 12 ${PN} \
@@ -34,7 +34,7 @@ do_configure() {
34} 34}
35 35
36do_compile() { 36do_compile() {
37 oe_runmake xen 37 oe_runmake xen PYTHON="${PYTHON}"
38} 38}
39 39
40do_install() { 40do_install() {
diff --git a/recipes-extended/xen/xen-python2.bb b/recipes-extended/xen/xen-python2.bb
new file mode 100644
index 00000000..08d8e92a
--- /dev/null
+++ b/recipes-extended/xen/xen-python2.bb
@@ -0,0 +1,68 @@
1SUMMARY = "Xen hypervisor tools written in python 2"
2DESCRIPTION = "Unported utility scripts for the Xen hypervisor"
3HOMEPAGE = "http://xen.org"
4LICENSE = "GPLv2"
5SECTION = "console/tools"
6
7SRCREV ?= "a5fcafbfbee55261853fba07149c1c795f2baf58"
8
9XEN_REL ?= "4.12"
10XEN_BRANCH ?= "stable-4.12"
11
12SRC_URI = "git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH}"
13
14LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095"
15
16PV = "${XEN_REL}+git${SRCPV}"
17
18S = "${WORKDIR}/git"
19
20# Packages in this recipe do not use ${PN} to allow for simpler
21# movement of the package back into the xen-tools recipe if/when
22# the scripts are ported to python 3.
23
24RDEPENDS_xen-tools-xencov-split ="python"
25RDEPENDS_xen-tools-xencons = "python"
26RDEPENDS_xen-tools-xenpvnetboot = "python"
27RDEPENDS_xen-tools-xentrace-format = "python"
28
29RRECOMMENDS_xen-tools-xencov-trace = "xen-tools-xencov"
30RRECOMMENDS_xen-tools-xentrace-format = "xen-tools-xentrace"
31
32PACKAGES = " \
33 xen-tools-xencons \
34 xen-tools-xencov-split \
35 xen-tools-xenpvnetboot \
36 xen-tools-xentrace-format \
37 "
38
39FILES_xen-tools-xencons = " \
40 ${bindir}/xencons \
41 "
42
43FILES_xen-tools-xencov-split = " \
44 ${bindir}/xencov_split \
45 "
46
47FILES_xen-tools-xenpvnetboot = " \
48 ${libdir}/xen/bin/xenpvnetboot \
49 "
50
51FILES_xen-tools-xentrace-format = " \
52 ${bindir}/xentrace_format \
53 "
54
55do_configure[noexec] = "1"
56do_compile[noexec] = "1"
57
58do_install() {
59 install -d ${D}${bindir}
60 install -m 0755 ${S}/tools/xentrace/xentrace_format \
61 ${D}${bindir}/xentrace_format
62 install -m 0755 ${S}/tools/misc/xencons ${D}${bindir}/xencons
63 install -m 0755 ${S}/tools/misc/xencov_split ${D}${bindir}/xencov_split
64
65 install -d ${D}${libdir}/xen/bin
66 install -m 0755 ${S}/tools/misc/xenpvnetboot \
67 ${D}${libdir}/xen/bin/xenpvnetboot
68}
diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc
index e166c74b..a6f12090 100644
--- a/recipes-extended/xen/xen-tools.inc
+++ b/recipes-extended/xen/xen-tools.inc
@@ -1,7 +1,7 @@
1SUMMARY = "Xen hypervisor tools" 1SUMMARY = "Xen hypervisor tools"
2DESCRIPTION = "Tools and utility software for the Xen hypervisor" 2DESCRIPTION = "Tools and utility software for the Xen hypervisor"
3 3
4inherit setuptools update-rc.d systemd deploy 4inherit setuptools3 update-rc.d systemd deploy
5require xen-blktap.inc 5require xen-blktap.inc
6 6
7RDEPENDS_${PN} = "\ 7RDEPENDS_${PN} = "\
@@ -47,21 +47,25 @@ RDEPENDS_${PN}-fsimage = " \
47 47
48RDEPENDS_${PN}-misc = " \ 48RDEPENDS_${PN}-misc = " \
49 perl \ 49 perl \
50 python \ 50 python3 \
51 ${PN}-xencov \
52 "
53
54RSUGGESTS_${PN}-misc = " \
55 ${PN}-xencons \
56 ${PN}-xenpvnetboot \
51 " 57 "
52 58
53RDEPENDS_${PN}-python = " \ 59RDEPENDS_${PN}-python = " \
54 python \ 60 python3 \
55 " 61 "
56 62
57RDEPENDS_${PN}-pygrub = " \ 63RDEPENDS_${PN}-pygrub = " \
64 python3 \
58 ${PN}-python \ 65 ${PN}-python \
59 " 66 "
60 67
61RDEPENDS_${PN}-remus = " \ 68RDEPENDS_${PN}-remus = "bash"
62 bash \
63 python \
64 "
65 69
66RDEPENDS_${PN}-scripts-block = "\ 70RDEPENDS_${PN}-scripts-block = "\
67 bash \ 71 bash \
@@ -78,6 +82,8 @@ RDEPENDS_${PN}-scripts-network = "\
78 ${PN}-volatiles \ 82 ${PN}-volatiles \
79 " 83 "
80 84
85RSUGGESTS_${PN}-xencov = "${PN}-xencov-split"
86
81RDEPENDS_${PN}-xencommons = "\ 87RDEPENDS_${PN}-xencommons = "\
82 bash \ 88 bash \
83 ${PN}-console \ 89 ${PN}-console \
@@ -97,7 +103,11 @@ RDEPENDS_${PN}-xendomains = "\
97 103
98RDEPENDS_${PN}-xl = "libgcc" 104RDEPENDS_${PN}-xl = "libgcc"
99 105
100RDEPENDS_${PN}-xentrace = "python" 106RDEPENDS_${PN}-xenmon = " \
107 python3 \
108 "
109
110RSUGGESTS_${PN}-xentrace = "${PN}-xentrace-format"
101 111
102RDEPENDS_${PN}-xen-watchdog = "bash" 112RDEPENDS_${PN}-xen-watchdog = "bash"
103 113
@@ -160,6 +170,7 @@ PACKAGES = " \
160 ${PN}-volatiles \ 170 ${PN}-volatiles \
161 ${PN}-xcutils \ 171 ${PN}-xcutils \
162 ${PN}-xencommons \ 172 ${PN}-xencommons \
173 ${PN}-xencov \
163 ${PN}-xend \ 174 ${PN}-xend \
164 ${PN}-xend-examples \ 175 ${PN}-xend-examples \
165 ${PN}-xendomains \ 176 ${PN}-xendomains \
@@ -188,8 +199,8 @@ RPROVIDES_${PN}-xenstored = "virtual/xenstored"
188 199
189FILES_${PN}-dbg += "\ 200FILES_${PN}-dbg += "\
190 ${libdir}/xen/bin/.debug \ 201 ${libdir}/xen/bin/.debug \
191 ${libdir}/python2.7/site-packages/.debug \ 202 ${libdir}/${PYTHON_DIR}/site-packages/.debug \
192 ${libdir}/python2.7/site-packages/xen/lowlevel/.debug \ 203 ${libdir}/${PYTHON_DIR}/site-packages/xen/lowlevel/.debug \
193 ${libdir}/fs/xfs/.debug \ 204 ${libdir}/fs/xfs/.debug \
194 ${libdir}/fs/ufs/.debug \ 205 ${libdir}/fs/ufs/.debug \
195 ${libdir}/fs/ext2fs-lib/.debug \ 206 ${libdir}/fs/ext2fs-lib/.debug \
@@ -202,8 +213,8 @@ FILES_${PN}-dbg += "\
202 ${libdir}exec/.debug \ 213 ${libdir}exec/.debug \
203 ${libdir}/xen/libexec/.debug \ 214 ${libdir}/xen/libexec/.debug \
204 ${bindir}/.debug \ 215 ${bindir}/.debug \
205 ${libdir}/python2.7/dist-packages/.debug \ 216 ${libdir}/${PYTHON_DIR}/dist-packages/.debug \
206 ${libdir}/python2.7/dist-packages/xen/lowlevel/.debug \ 217 ${libdir}/${PYTHON_DIR}/dist-packages/xen/lowlevel/.debug \
207 " 218 "
208 219
209FILES_${PN}-dev = "\ 220FILES_${PN}-dev = "\
@@ -404,15 +415,11 @@ FILES_${PN}-livepatch += " \
404 " 415 "
405 416
406FILES_${PN}-misc = "\ 417FILES_${PN}-misc = "\
407 ${bindir}/xencons \
408 ${bindir}/xencov_split \
409 ${bindir}/xen-detect \ 418 ${bindir}/xen-detect \
410 ${libdir}/xen/bin/xenpvnetboot \
411 ${libdir}/xen/bin/depriv-fd-checker \ 419 ${libdir}/xen/bin/depriv-fd-checker \
412 ${sbindir}/gtracestat \ 420 ${sbindir}/gtracestat \
413 ${sbindir}/gtraceview \ 421 ${sbindir}/gtraceview \
414 ${sbindir}/xen-bugtool \ 422 ${sbindir}/xen-bugtool \
415 ${sbindir}/xencov \
416 ${sbindir}/xenperf \ 423 ${sbindir}/xenperf \
417 ${sbindir}/xenpm \ 424 ${sbindir}/xenpm \
418 ${sbindir}/xsview \ 425 ${sbindir}/xsview \
@@ -436,11 +443,10 @@ FILES_${PN}-pygrub = "\
436 " 443 "
437 444
438FILES_${PN}-python = "\ 445FILES_${PN}-python = "\
439 ${libdir}/python2.7 \ 446 ${libdir}/${PYTHON_DIR} \
440 " 447 "
441 448
442FILES_${PN}-remus = "\ 449FILES_${PN}-remus = "\
443 ${bindir}/remus \
444 ${sysconfdir}/xen/scripts/remus-netbuf-setup \ 450 ${sysconfdir}/xen/scripts/remus-netbuf-setup \
445 " 451 "
446 452
@@ -500,6 +506,10 @@ FILES_${PN}-xcutils = "\
500 ${libdir}/xen/bin/xc_save \ 506 ${libdir}/xen/bin/xc_save \
501 " 507 "
502 508
509FILES_${PN}-xencov = "\
510 ${sbindir}/xencov \
511 "
512
503FILES_${PN}-xend-examples = "\ 513FILES_${PN}-xend-examples = "\
504 ${sysconfdir}/xen/xend-config.sxp \ 514 ${sysconfdir}/xen/xend-config.sxp \
505 ${sysconfdir}/xen/xend-pci-permissive.sxp \ 515 ${sysconfdir}/xen/xend-pci-permissive.sxp \
@@ -539,7 +549,6 @@ FILES_${PN}-xenstored = "\
539 549
540FILES_${PN}-xentrace = "\ 550FILES_${PN}-xentrace = "\
541 ${bindir}/xentrace \ 551 ${bindir}/xentrace \
542 ${bindir}/xentrace_format \
543 ${bindir}/xentrace_setsize \ 552 ${bindir}/xentrace_setsize \
544 ${libdir}/xen/bin/xenctx \ 553 ${libdir}/xen/bin/xenctx \
545 ${bindir}/xenalyze \ 554 ${bindir}/xenalyze \
@@ -665,12 +674,20 @@ do_stubs() {
665addtask stubs after do_configure before do_compile 674addtask stubs after do_configure before do_compile
666 675
667do_compile() { 676do_compile() {
668 oe_runmake tools 677 cd ${S}
678 oe_runmake tools PYTHON="${PYTHON}"
669} 679}
670 680
671do_install() { 681do_install() {
682 cd ${S}
672 oe_runmake DESTDIR="${D}" install-tools 683 oe_runmake DESTDIR="${D}" install-tools
673 684
685 # Remove unported python 2 scripts -- see the separate xen-python2 recipe
686 rm -f ${D}${bindir}/xentrace_format \
687 ${D}${bindir}/xencons \
688 ${D}${bindir}/xencov_split \
689 ${D}${libdir}/xen/bin/xenpvnetboot
690
674 # remove installed volatiles 691 # remove installed volatiles
675 rm -rf ${D}${base_prefix}/run \ 692 rm -rf ${D}${base_prefix}/run \
676 ${D}${localstatedir}/run \ 693 ${D}${localstatedir}/run \
diff --git a/recipes-extended/xen/xen-tools_git.bb b/recipes-extended/xen/xen-tools_git.bb
index 7042c535..00060df7 100644
--- a/recipes-extended/xen/xen-tools_git.bb
+++ b/recipes-extended/xen/xen-tools_git.bb
@@ -6,6 +6,12 @@ XEN_BRANCH ?= "stable-${XEN_REL}"
6SRC_URI = " \ 6SRC_URI = " \
7 git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \ 7 git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH} \
8 file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \ 8 file://0001-python-pygrub-pass-DISTUTILS-xen.4.12.patch \
9 file://xen-tools-update-python-scripts-to-py3.patch \
10 file://xen-tools-libxl-gentypes-py3.patch \
11 file://xen-tools-python-fix-Wsign-compare-warnings.patch \
12 file://xen-tools-pygrub-change-tabs-into-spaces.patch \
13 file://xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch \
14 file://xen-tools-pygrub-py3.patch \
9 " 15 "
10 16
11LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095" 17LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095"
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index b2af8aa7..0bfe72da 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -43,7 +43,7 @@ DEPENDS = " \
43 pciutils \ 43 pciutils \
44 pixman \ 44 pixman \
45 procps \ 45 procps \
46 python \ 46 python3 \
47 libaio \ 47 libaio \
48 lzo \ 48 lzo \
49 util-linux \ 49 util-linux \
@@ -77,8 +77,8 @@ libexecdir = "${libdir}"
77export XEN_OS = "Linux" 77export XEN_OS = "Linux"
78 78
79# this is used for the header (#!${bindir}/python) of the install python scripts 79# this is used for the header (#!${bindir}/python) of the install python scripts
80export PYTHONPATH="${bindir}/python" 80export PYTHONPATH="${bindir}/env python3"
81export ac_cv_path_PYTHONPATH="${bindir}/python" 81export ac_cv_path_PYTHONPATH="${bindir}/env python3"
82export DISTUTILS_BUILD_ARGS 82export DISTUTILS_BUILD_ARGS
83export DISTUTILS_INSTALL_ARGS 83export DISTUTILS_INSTALL_ARGS
84 84
@@ -207,6 +207,7 @@ EXTRA_OEMAKE += "XEN_CONFIG_EXPERT=y"
207EXTRA_OEMAKE += "debug=n" 207EXTRA_OEMAKE += "debug=n"
208 208
209do_configure_common() { 209do_configure_common() {
210 cd ${S}
210 211
211 #./configure --enable-xsmpolicy does not set XSM_ENABLE must be done manually 212 #./configure --enable-xsmpolicy does not set XSM_ENABLE must be done manually
212 if [ "${XSM_ENABLED}" = "1" ]; then 213 if [ "${XSM_ENABLED}" = "1" ]; then
@@ -222,7 +223,9 @@ do_configure_common() {
222 223
223 # do configure 224 # do configure
224 oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \ 225 oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \
225 EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" 226 EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" \
227 PYTHON="${PYTHON}"
228
226 if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then 229 if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then
227 cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h 230 cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h
228 fi 231 fi