summaryrefslogtreecommitdiff
path: root/harmony/parted/tests-python3.patch
diff options
context:
space:
mode:
Diffstat (limited to 'harmony/parted/tests-python3.patch')
-rw-r--r--harmony/parted/tests-python3.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/harmony/parted/tests-python3.patch b/harmony/parted/tests-python3.patch
new file mode 100644
index 000000000..8811b7237
--- /dev/null
+++ b/harmony/parted/tests-python3.patch
@@ -0,0 +1,68 @@
+--- parted-3.2/tests/gpt-header-move.old 2014-06-15 18:27:30.000000000 +0000
++++ parted-3.2/tests/gpt-header-move 2017-08-19 20:47:02.443283140 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+
+ # open img file, subtract 33 from altlba address, and move the last 33 sectors
+ # back by 33 sectors
+@@ -11,12 +11,12 @@
+ file.seek(512)
+ gptheader = file.read(512)
+ altlba = unpack_from('<q', gptheader,offset=32)[0]
+-gptheader = array.array('c',gptheader)
++gptheader = array.array('B',gptheader)
+ pack_into('<Q', gptheader, 32, altlba-33)
+ #zero header crc
+ pack_into('<L', gptheader, 16, 0)
+ #compute new crc
+-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
++newcrc = ((crc32(memoryview(gptheader[0:92]))) & 0xFFFFFFFF)
+ pack_into('<L', gptheader, 16, newcrc)
+ file.seek(512)
+ file.write(gptheader)
+@@ -25,7 +25,7 @@
+ file.seek(512*(altlba-32))
+ backup = file.read(512*32)
+ altlba -= 33
+-gptheader = array.array('c',gptheader)
++gptheader = array.array('B',gptheader)
+ #update mylba
+ pack_into('<Q', gptheader, 24, altlba)
+ #update table lba
+@@ -33,7 +33,7 @@
+ #zero header crc
+ pack_into('<L', gptheader, 16, 0)
+ #compute new crc
+-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
++newcrc = ((crc32(memoryview(gptheader[0:92]))) & 0xFFFFFFFF)
+ pack_into('<L', gptheader, 16, newcrc)
+ file.seek(512*(altlba-32))
+ file.write(backup)
+@@ -38,4 +38,4 @@
+ file.seek(512*(altlba-32))
+ file.write(backup)
+ file.write(gptheader)
+-file.write("\0" * (512 * 33))
++file.write(b"\0" * (512 * 33))
+--- parted-3.2/tests/msdos-overlap.old 2014-06-15 18:27:30.000000000 +0000
++++ parted-3.2/tests/msdos-overlap 2017-08-19 20:48:16.279847771 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ """
+ Write an overlapping partition to a msdos disk
+
+@@ -14,10 +14,10 @@
+ OFFSET = 0x1b8
+
+ if len(sys.argv) < 2:
+- print "%s: <image or device>"
++ print("%s: <image or device>")
+ sys.exit(1)
+
+-data = "".join(chr(c) for c in BAD_ENTRY)
++data = bytearray(BAD_ENTRY)
+ with open(sys.argv[1], "rb+") as f:
+ f.seek(OFFSET, 0)
+ f.write(data)