summaryrefslogtreecommitdiff
path: root/system/parted/tests-python3.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-08 02:02:24 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-06-08 02:02:24 -0500
commitfd2bb2f751c13b3c0c002b8e012810902b9da364 (patch)
tree17b2e38c966c9f96cfa568c1f572261a289590e6 /system/parted/tests-python3.patch
parentb0a5136bf3326ba38b360be288d06f9a27f2a4d2 (diff)
downloadpackages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.gz
packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.bz2
packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.tar.xz
packages-fd2bb2f751c13b3c0c002b8e012810902b9da364.zip
harmony -> system
Diffstat (limited to 'system/parted/tests-python3.patch')
-rw-r--r--system/parted/tests-python3.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/system/parted/tests-python3.patch b/system/parted/tests-python3.patch
new file mode 100644
index 000000000..8811b7237
--- /dev/null
+++ b/system/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)