diff options
| author | Christopher Clark <christopher.w.clark@gmail.com> | 2020-06-29 18:54:47 -0700 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-07-06 16:25:56 -0400 |
| commit | 345505989ce65f2486aa3afdf325cc68c28f1d55 (patch) | |
| tree | cee861990f2534e506d1c4a21729110d75e848d5 | |
| parent | 8af29790eee317c3b1da3acd87b10659eaa914a7 (diff) | |
| download | meta-virtualization-345505989ce65f2486aa3afdf325cc68c28f1d55.tar.gz | |
xen, xen-tools: update revision to Xen 4.13
Pull to the current tip of the stable 4.13 branch and apply an upstream
4.14-release-acked patch to xen-tools for a compiler warning in kdd.
Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
11 files changed, 89 insertions, 1232 deletions
diff --git a/recipes-extended/xen/files/0001-xen-build-temporarily-inhibit-Werror.patch b/recipes-extended/xen/files/0001-xen-build-temporarily-inhibit-Werror.patch index 0f075553..6e43a4ff 100644 --- a/recipes-extended/xen/files/0001-xen-build-temporarily-inhibit-Werror.patch +++ b/recipes-extended/xen/files/0001-xen-build-temporarily-inhibit-Werror.patch | |||
| @@ -4,6 +4,8 @@ Date: Thu, 18 Jun 2020 09:05:22 -0400 | |||
| 4 | Subject: [PATCH] xen/build: temporarily inhibit Werror | 4 | Subject: [PATCH] xen/build: temporarily inhibit Werror |
| 5 | 5 | ||
| 6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | 6 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> |
| 7 | Rebased on Xen 4.13: | ||
| 8 | Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com> | ||
| 7 | --- | 9 | --- |
| 8 | tools/libxl/Makefile | 2 +- | 10 | tools/libxl/Makefile | 2 +- |
| 9 | xen/Rules.mk | 2 +- | 11 | xen/Rules.mk | 2 +- |
| @@ -13,8 +15,8 @@ diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile | |||
| 13 | index 6da342ed61..c67560e269 100644 | 15 | index 6da342ed61..c67560e269 100644 |
| 14 | --- a/tools/libxl/Makefile | 16 | --- a/tools/libxl/Makefile |
| 15 | +++ b/tools/libxl/Makefile | 17 | +++ b/tools/libxl/Makefile |
| 16 | @@ -11,7 +11,7 @@ MINOR = 0 | 18 | @@ -14,7 +14,7 @@ MINOR = 0 |
| 17 | XLUMAJOR = 4.12 | 19 | XLUMAJOR = 4.13 |
| 18 | XLUMINOR = 0 | 20 | XLUMINOR = 0 |
| 19 | 21 | ||
| 20 | -CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \ | 22 | -CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \ |
| @@ -38,3 +40,15 @@ index a151b3f625..a05ceec1e5 100644 | |||
| 38 | -- | 40 | -- |
| 39 | 2.19.1 | 41 | 2.19.1 |
| 40 | 42 | ||
| 43 | diff --git a/tools/debugger/kdd/Makefile b/tools/debugger/kdd/Makefile | ||
| 44 | index 26116949d4..a72ad3b1e0 100644 | ||
| 45 | --- a/tools/debugger/kdd/Makefile | ||
| 46 | +++ b/tools/debugger/kdd/Makefile | ||
| 47 | @@ -1,7 +1,6 @@ | ||
| 48 | XEN_ROOT = $(CURDIR)/../../.. | ||
| 49 | include $(XEN_ROOT)/tools/Rules.mk | ||
| 50 | |||
| 51 | -CFLAGS += -Werror | ||
| 52 | CFLAGS += $(CFLAGS_libxenctrl) | ||
| 53 | CFLAGS += -DXC_WANT_COMPAT_MAP_FOREIGN_API | ||
| 54 | LDLIBS += $(LDLIBS_libxenctrl) | ||
diff --git a/recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch b/recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch new file mode 100644 index 00000000..c1b110df --- /dev/null +++ b/recipes-extended/xen/files/xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | From 3471cafbdda35eacf04670881dd2aee2558b4f08 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Tim Deegan <tim@xen.org> | ||
| 3 | Date: Fri, 26 Jun 2020 10:40:44 +0000 | ||
| 4 | Subject: [PATCH] kdd: stop using [0] arrays to access packet contents | ||
| 5 | |||
| 6 | GCC 10 is unhappy about this, and we already use 64k buffers | ||
| 7 | in the only places where packets are allocated, so move the | ||
| 8 | 64k size into the packet definition. | ||
| 9 | |||
| 10 | Reported-by: Olaf Hering <olaf@aepfle.de> | ||
| 11 | Signed-off-by: Tim Deegan <tim@xen.org> | ||
| 12 | Acked-by: Wei Liu <wl@xen.org> | ||
| 13 | Release-acked-by: Paul Durrant <paul@xen.org> | ||
| 14 | --- | ||
| 15 | tools/debugger/kdd/kdd.c | 4 ++-- | ||
| 16 | tools/debugger/kdd/kdd.h | 3 +-- | ||
| 17 | 2 files changed, 3 insertions(+), 4 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c | ||
| 20 | index 3ebda9b12c..866532f0c7 100644 | ||
| 21 | --- a/tools/debugger/kdd/kdd.c | ||
| 22 | +++ b/tools/debugger/kdd/kdd.c | ||
| 23 | @@ -79,11 +79,11 @@ typedef struct { | ||
| 24 | /* State of the debugger stub */ | ||
| 25 | typedef struct { | ||
| 26 | union { | ||
| 27 | - uint8_t txb[sizeof (kdd_hdr) + 65536]; /* Marshalling area for tx */ | ||
| 28 | + uint8_t txb[sizeof (kdd_hdr)]; /* Marshalling area for tx */ | ||
| 29 | kdd_pkt txp; /* Also readable as a packet structure */ | ||
| 30 | }; | ||
| 31 | union { | ||
| 32 | - uint8_t rxb[sizeof (kdd_hdr) + 65536]; /* Marshalling area for rx */ | ||
| 33 | + uint8_t rxb[sizeof (kdd_hdr)]; /* Marshalling area for rx */ | ||
| 34 | kdd_pkt rxp; /* Also readable as a packet structure */ | ||
| 35 | }; | ||
| 36 | unsigned int cur; /* Offset into rx where we'll put the next byte */ | ||
| 37 | diff --git a/tools/debugger/kdd/kdd.h b/tools/debugger/kdd/kdd.h | ||
| 38 | index bfb00ba5c5..b9a17440df 100644 | ||
| 39 | --- a/tools/debugger/kdd/kdd.h | ||
| 40 | +++ b/tools/debugger/kdd/kdd.h | ||
| 41 | @@ -68,7 +68,6 @@ typedef struct { | ||
| 42 | uint16_t len; /* Payload length, excl. header and trailing byte */ | ||
| 43 | uint32_t id; /* Echoed in responses */ | ||
| 44 | uint32_t sum; /* Unsigned sum of all payload bytes */ | ||
| 45 | - uint8_t payload[0]; | ||
| 46 | } PACKED kdd_hdr; | ||
| 47 | |||
| 48 | #define KDD_PKT_CMD 0x0002 /* Debugger commands (and replies to them) */ | ||
| 49 | @@ -323,7 +322,7 @@ typedef struct { | ||
| 50 | kdd_msg msg; | ||
| 51 | kdd_reg reg; | ||
| 52 | kdd_stc stc; | ||
| 53 | - uint8_t payload[0]; | ||
| 54 | + uint8_t payload[65536]; | ||
| 55 | }; | ||
| 56 | } PACKED kdd_pkt; | ||
| 57 | |||
| 58 | -- | ||
| 59 | 2.17.1 | ||
| 60 | |||
diff --git a/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch b/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch deleted file mode 100644 index 23997865..00000000 --- a/recipes-extended/xen/files/xen-tools-libxl-gentypes-py3.patch +++ /dev/null | |||
| @@ -1,140 +0,0 @@ | |||
| 1 | From 660d2dd863802ef464c90b32f187cb65861f8185 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Wei Liu <wei.liu2@citrix.com> | ||
| 3 | Date: Thu, 7 Mar 2019 12:33:38 +0000 | ||
| 4 | Subject: [PATCH] libxl: make python scripts work with python 2.6 and up | ||
| 5 | |||
| 6 | Go through transformations suggested by 2to3 and pick the necessary | ||
| 7 | ones. | ||
| 8 | |||
| 9 | Signed-off-by: Wei Liu <wei.liu2@citrix.com> | ||
| 10 | Reviewed-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 | |||
| 17 | diff --git a/tools/libxl/gentest.py b/tools/libxl/gentest.py | ||
| 18 | index 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')) | ||
| 38 | diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py | ||
| 39 | index 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(""" | ||
| 94 | diff --git a/tools/libxl/idl.py b/tools/libxl/idl.py | ||
| 95 | index 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 | -- | ||
| 139 | 2.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 deleted file mode 100644 index d913be20..00000000 --- a/recipes-extended/xen/files/xen-tools-pygrub-change-tabs-into-spaces.patch +++ /dev/null | |||
| @@ -1,40 +0,0 @@ | |||
| 1 | From b9e1368af14ded6aee3bdf64e8329628b16291ff Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Wei Liu <wei.liu2@citrix.com> | ||
| 3 | Date: Mon, 11 Mar 2019 12:55:29 +0000 | ||
| 4 | Subject: [PATCH] pygrub: change tabs into spaces | ||
| 5 | |||
| 6 | Not sure why Python 2 never complained, but Python 3 does. | ||
| 7 | |||
| 8 | Change tabs to spaces. | ||
| 9 | |||
| 10 | Signed-off-by: Wei Liu <wei.liu2@citrix.com> | ||
| 11 | Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> | ||
| 12 | --- | ||
| 13 | tools/pygrub/src/pygrub | 4 ++-- | ||
| 14 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub | ||
| 17 | index 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 | -- | ||
| 39 | 2.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 deleted file mode 100644 index f4cbb670..00000000 --- a/recipes-extended/xen/files/xen-tools-pygrub-make-python-scripts-work-with-2.6-and-up.patch +++ /dev/null | |||
| @@ -1,529 +0,0 @@ | |||
| 1 | From 0aabd89dcfee9ee2a6caaa2ec7a475daf5cada53 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Wei Liu <wei.liu2@citrix.com> | ||
| 3 | Date: Thu, 7 Mar 2019 12:45:47 +0000 | ||
| 4 | Subject: [PATCH] pygrub: make python scripts work with 2.6 and up | ||
| 5 | |||
| 6 | Run 2to3 and pick the sensible suggestions. | ||
| 7 | |||
| 8 | Import print_function and absolute_import so 2.6 can work. | ||
| 9 | |||
| 10 | There has never been a curses.wrapper module according to 2.x and 3.x | ||
| 11 | doc, only a function, so "import curses.wrapper" is not correct. It | ||
| 12 | happened to work because 2.x implemented a (undocumented) module. | ||
| 13 | |||
| 14 | We only need to import curses to make curses.wrapper available to | ||
| 15 | pygrub. | ||
| 16 | |||
| 17 | Signed-off-by: Wei Liu <wei.liu2@citrix.com> | ||
| 18 | Reviewed-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 | |||
| 26 | diff --git a/tools/pygrub/src/ExtLinuxConf.py b/tools/pygrub/src/ExtLinuxConf.py | ||
| 27 | index 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) | ||
| 92 | diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py | ||
| 93 | index 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 | ||
| 257 | diff --git a/tools/pygrub/src/LiloConf.py b/tools/pygrub/src/LiloConf.py | ||
| 258 | index 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) | ||
| 320 | diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub | ||
| 321 | index 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 | -- | ||
| 528 | 2.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 deleted file mode 100644 index e486646f..00000000 --- a/recipes-extended/xen/files/xen-tools-pygrub-py3.patch +++ /dev/null | |||
| @@ -1,233 +0,0 @@ | |||
| 1 | From 83a204e6951c6358f995da3b60dd61224e9d41ac Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Wei Liu <wei.liu2@citrix.com> | ||
| 3 | Date: Tue, 5 Mar 2019 14:13:17 +0000 | ||
| 4 | Subject: [PATCH] pygrub/fsimage: make it work with python 3 | ||
| 5 | |||
| 6 | With the help of two porting guides and cpython source code: | ||
| 7 | |||
| 8 | 1. Use PyBytes to replace PyString counterparts. | ||
| 9 | 2. Use PyVarObject_HEAD_INIT. | ||
| 10 | 3. Remove usage of Py_FindMethod. | ||
| 11 | 4. Use new module initialisation routine. | ||
| 12 | |||
| 13 | For #3, Py_FindMethod was removed, yet an alternative wasn't | ||
| 14 | documented. The code is the result of reverse-engineering cpython | ||
| 15 | commit 6116d4a1d1 | ||
| 16 | |||
| 17 | https://docs.python.org/3/howto/cporting.html | ||
| 18 | http://python3porting.com/cextensions.html | ||
| 19 | |||
| 20 | Signed-off-by: Wei Liu <wei.liu2@citrix.com> | ||
| 21 | Reviewed-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 | |||
| 26 | diff --git a/tools/pygrub/src/fsimage/fsimage.c b/tools/pygrub/src/fsimage/fsimage.c | ||
| 27 | index 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 | -- | ||
| 232 | 2.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 deleted file mode 100644 index b32c5d06..00000000 --- a/recipes-extended/xen/files/xen-tools-python-fix-Wsign-compare-warnings.patch +++ /dev/null | |||
| @@ -1,136 +0,0 @@ | |||
| 1 | From 88d703a361d34d75f81fc6d30b31d0abc8aa17eb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= | ||
| 3 | <marmarek@invisiblethingslab.com> | ||
| 4 | Date: Fri, 9 Aug 2019 03:01:36 +0100 | ||
| 5 | Subject: [PATCH] python: fix -Wsign-compare warnings | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 9 | |||
| 10 | Specifically: | ||
| 11 | xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_create’: | ||
| 12 | xen/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 | | ^ | ||
| 15 | xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_sethandle’: | ||
| 16 | xen/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 | | ^ | ||
| 19 | xen/lowlevel/xc/xc.c: In function ‘pyxc_domain_getinfo’: | ||
| 20 | xen/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 | | ^ | ||
| 23 | xen/lowlevel/xc/xc.c: In function ‘pyxc_get_device_group’: | ||
| 24 | xen/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 | | ^ | ||
| 27 | xen/lowlevel/xc/xc.c: In function ‘pyxc_physinfo’: | ||
| 28 | xen/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 | | ^ | ||
| 31 | xen/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 | | ^ | ||
| 34 | xen/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 | | ^ | ||
| 37 | xen/lowlevel/xs/xs.c: In function ‘xspy_ls’: | ||
| 38 | xen/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 | | ^ | ||
| 41 | xen/lowlevel/xs/xs.c: In function ‘xspy_get_permissions’: | ||
| 42 | xen/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 | | ^ | ||
| 45 | cc1: all warnings being treated as errors | ||
| 46 | |||
| 47 | Use size_t for loop iterators where it's compared with sizeof() or | ||
| 48 | similar construct. | ||
| 49 | |||
| 50 | Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> | ||
| 51 | Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> | ||
| 52 | |||
| 53 | Modified to apply to Xen 4.12.2 by Christopher Clark | ||
| 54 | Signed-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 | |||
| 60 | diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c | ||
| 61 | index 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 ) | ||
| 112 | diff --git a/tools/python/xen/lowlevel/xs/xs.c b/tools/python/xen/lowlevel/xs/xs.c | ||
| 113 | index 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 | -- | ||
| 135 | 2.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 deleted file mode 100644 index 455072ba..00000000 --- a/recipes-extended/xen/files/xen-tools-update-python-scripts-to-py3.patch +++ /dev/null | |||
| @@ -1,140 +0,0 @@ | |||
| 1 | From a9047a722ba5de38e7c1d762ffcfb74c36725fe2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrew Cooper <andrew.cooper3@citrix.com> | ||
| 3 | Date: Mon, 11 Mar 2019 19:18:40 +0000 | ||
| 4 | Subject: [PATCH] tools/xen-foreign: Update python scripts to be Py3 compatible | ||
| 5 | |||
| 6 | The 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 | |||
| 11 | The has_key() issue is trivially fixed by switching to using the in keyword. | ||
| 12 | The sorting issue could be trivially fixed, but take the opportunity to | ||
| 13 | improve the code. | ||
| 14 | |||
| 15 | The reason for the sorting is to ensure that "unsigned long" gets replaced | ||
| 16 | before "long", and the only reason sorting is necessary is because | ||
| 17 | inttypes[arch] is needlessly a dictionary. Update inttypes[arch] to be a list | ||
| 18 | of tuples rather than a dictionary, and process them in list order. | ||
| 19 | |||
| 20 | Reported-by: George Dunlap <george.dunlap@eu.citrix.com> | ||
| 21 | Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> | ||
| 22 | Acked-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 | |||
| 28 | diff --git a/tools/include/xen-foreign/mkchecker.py b/tools/include/xen-foreign/mkchecker.py | ||
| 29 | index 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: | ||
| 41 | diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py | ||
| 42 | index 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 | -- | ||
| 139 | 2.17.1 | ||
| 140 | |||
diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc index 154e2244..2feed007 100644 --- a/recipes-extended/xen/xen-tools.inc +++ b/recipes-extended/xen/xen-tools.inc | |||
| @@ -65,6 +65,7 @@ RRECOMMENDS_${PN} = " \ | |||
| 65 | ${PN}-flask \ | 65 | ${PN}-flask \ |
| 66 | ${PN}-hvmloader \ | 66 | ${PN}-hvmloader \ |
| 67 | ${PN}-shim \ | 67 | ${PN}-shim \ |
| 68 | ${PN}-ucode \ | ||
| 68 | ${PN}-xenpaging \ | 69 | ${PN}-xenpaging \ |
| 69 | " | 70 | " |
| 70 | 71 | ||
| @@ -202,6 +203,7 @@ PACKAGES = " \ | |||
| 202 | ${PN}-scripts-network \ | 203 | ${PN}-scripts-network \ |
| 203 | ${PN}-shim \ | 204 | ${PN}-shim \ |
| 204 | ${PN}-staticdev \ | 205 | ${PN}-staticdev \ |
| 206 | ${PN}-ucode \ | ||
| 205 | ${PN}-volatiles \ | 207 | ${PN}-volatiles \ |
| 206 | ${PN}-xcutils \ | 208 | ${PN}-xcutils \ |
| 207 | ${PN}-xencommons \ | 209 | ${PN}-xencommons \ |
| @@ -529,6 +531,10 @@ FILES_${PN}-shim = " \ | |||
| 529 | ${libdir}/xen/boot/xen-shim \ | 531 | ${libdir}/xen/boot/xen-shim \ |
| 530 | " | 532 | " |
| 531 | 533 | ||
| 534 | FILES_${PN}-ucode = "\ | ||
| 535 | ${sbindir}/xen-ucode \ | ||
| 536 | " | ||
| 537 | |||
| 532 | FILES_${PN}-volatiles = "\ | 538 | FILES_${PN}-volatiles = "\ |
| 533 | ${sysconfdir}/default/volatiles/99_xen \ | 539 | ${sysconfdir}/default/volatiles/99_xen \ |
| 534 | ${sysconfdir}/tmpfiles.d/xen.conf \ | 540 | ${sysconfdir}/tmpfiles.d/xen.conf \ |
diff --git a/recipes-extended/xen/xen-tools_git.bb b/recipes-extended/xen/xen-tools_git.bb index de9acc0e..5f41915a 100644 --- a/recipes-extended/xen/xen-tools_git.bb +++ b/recipes-extended/xen/xen-tools_git.bb | |||
| @@ -1,21 +1,16 @@ | |||
| 1 | SRCREV ?= "a5fcafbfbee55261853fba07149c1c795f2baf58" | 1 | SRCREV ?= "9f7e8bac4ca279b3bfccb5f3730fb2e5398c95ab" |
| 2 | 2 | ||
| 3 | XEN_REL ?= "4.12" | 3 | XEN_REL ?= "4.13" |
| 4 | XEN_BRANCH ?= "stable-${XEN_REL}" | 4 | XEN_BRANCH ?= "stable-${XEN_REL}" |
| 5 | 5 | ||
| 6 | SRC_URI = " \ | 6 | SRC_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 \ | ||
| 15 | file://0001-xen-build-temporarily-inhibit-Werror.patch \ | 9 | file://0001-xen-build-temporarily-inhibit-Werror.patch \ |
| 10 | file://xen-tools-kdd-stop-using-0-arrays-to-access-packet-contents.patch \ | ||
| 16 | " | 11 | " |
| 17 | 12 | ||
| 18 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095" | 13 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=4295d895d4b5ce9d070263d52f030e49" |
| 19 | 14 | ||
| 20 | PV = "${XEN_REL}+git${SRCPV}" | 15 | PV = "${XEN_REL}+git${SRCPV}" |
| 21 | 16 | ||
diff --git a/recipes-extended/xen/xen_git.bb b/recipes-extended/xen/xen_git.bb index a7475ac3..142bdcc4 100644 --- a/recipes-extended/xen/xen_git.bb +++ b/recipes-extended/xen/xen_git.bb | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | SRCREV ?= "a5fcafbfbee55261853fba07149c1c795f2baf58" | 1 | SRCREV ?= "9f7e8bac4ca279b3bfccb5f3730fb2e5398c95ab" |
| 2 | 2 | ||
| 3 | XEN_REL ?= "4.12" | 3 | XEN_REL ?= "4.13" |
| 4 | XEN_BRANCH ?= "stable-${XEN_REL}" | 4 | XEN_BRANCH ?= "stable-${XEN_REL}" |
| 5 | 5 | ||
| 6 | SRC_URI = "git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH}" | 6 | SRC_URI = "git://xenbits.xen.org/xen.git;branch=${XEN_BRANCH}" |
| 7 | 7 | ||
| 8 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=bbb4b1bdc2c3b6743da3c39d03249095" | 8 | LIC_FILES_CHKSUM ?= "file://COPYING;md5=4295d895d4b5ce9d070263d52f030e49" |
| 9 | 9 | ||
| 10 | PV = "${XEN_REL}+git${SRCPV}" | 10 | PV = "${XEN_REL}+git${SRCPV}" |
| 11 | 11 | ||
