mirror of
https://github.com/yann64/haikuports.git
synced 2026-03-19 01:46:00 +01:00
udis86: use python3 for the build/tests. (#10122)
Patches for Python 3 compatibility, taken from: https://salsa.debian.org/debian/libudis86/-/tree/master/debian/patches
This commit is contained in:
127
dev-libs/udis86/patches/0001-fixes-for-python3.patch
Normal file
127
dev-libs/udis86/patches/0001-fixes-for-python3.patch
Normal file
@@ -0,0 +1,127 @@
|
||||
From: Robert Haist <rhaist@mailbox.org>
|
||||
Date: Mon, 14 May 2018 22:52:22 +0200
|
||||
Subject: fixes for python3
|
||||
|
||||
---
|
||||
scripts/ud_itab.py | 14 +++++++-------
|
||||
scripts/ud_opcode.py | 14 +++++++-------
|
||||
scripts/ud_optable.py | 10 +++++-----
|
||||
3 files changed, 19 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/scripts/ud_itab.py b/scripts/ud_itab.py
|
||||
index b17fe69..6d71f90 100644
|
||||
--- a/scripts/ud_itab.py
|
||||
+++ b/scripts/ud_itab.py
|
||||
@@ -214,7 +214,7 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
|
||||
e = self.InvalidEntry
|
||||
i = self.InvalidEntryIdx
|
||||
|
||||
- if idx in table[ 'entries' ].keys():
|
||||
+ if idx in list(table[ 'entries' ].keys()):
|
||||
e = table[ 'entries' ][ idx ]
|
||||
|
||||
# leaf node (insn)
|
||||
@@ -265,14 +265,14 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
|
||||
pfx_c = []
|
||||
opr = e[ 'operands' ]
|
||||
for i in range(len(opr)):
|
||||
- if not (opr[i] in self.OperandDict.keys()):
|
||||
- print("error: invalid operand declaration: %s\n" % opr[i])
|
||||
+ if not (opr[i] in list(self.OperandDict.keys())):
|
||||
+ print(("error: invalid operand declaration: %s\n" % opr[i]))
|
||||
opr_c[i] = "O_" + opr[i]
|
||||
opr = "%s %s %s" % (opr_c[0] + ",", opr_c[1] + ",", opr_c[2])
|
||||
|
||||
for p in e['prefixes']:
|
||||
- if not ( p in self.PrefixDict.keys() ):
|
||||
- print("error: invalid prefix specification: %s \n" % pfx)
|
||||
+ if not ( p in list(self.PrefixDict.keys()) ):
|
||||
+ print(("error: invalid prefix specification: %s \n" % pfx))
|
||||
pfx_c.append( self.PrefixDict[p] )
|
||||
if len(e['prefixes']) == 0:
|
||||
pfx_c.append( "P_none" )
|
||||
@@ -301,7 +301,7 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
|
||||
# table type enumeration
|
||||
self.ItabH.write( "/* ud_table_type -- lookup table types (see decode.c) */\n" )
|
||||
self.ItabH.write( "enum ud_table_type {\n " )
|
||||
- enum = [ self.TableInfo[ k ][ 'name' ] for k in self.TableInfo.keys() ]
|
||||
+ enum = [ self.TableInfo[ k ][ 'name' ] for k in list(self.TableInfo.keys()) ]
|
||||
self.ItabH.write( ",\n ".join( enum ) )
|
||||
self.ItabH.write( "\n};\n\n" );
|
||||
|
||||
@@ -336,7 +336,7 @@ class UdItabGenerator( ud_opcode.UdOpcodeTables ):
|
||||
# Macros defining short-names for operands
|
||||
#
|
||||
self.ItabC.write("\n\n/* itab entry operand definitions (for readability) */\n");
|
||||
- operands = self.OperandDict.keys()
|
||||
+ operands = list(self.OperandDict.keys())
|
||||
operands = sorted(operands)
|
||||
for o in operands:
|
||||
self.ItabC.write("#define O_%-7s { %-12s %-8s }\n" %
|
||||
diff --git a/scripts/ud_opcode.py b/scripts/ud_opcode.py
|
||||
index 70cd226..8cc1b3f 100644
|
||||
--- a/scripts/ud_opcode.py
|
||||
+++ b/scripts/ud_opcode.py
|
||||
@@ -130,8 +130,8 @@ class UdOpcodeTables:
|
||||
'/mod' : lambda v: '00' if v == '!11' else '01',
|
||||
# Mode extensions:
|
||||
# (16, 32, 64) => (00, 01, 02)
|
||||
- '/o' : lambda v: "%02x" % (int(v) / 32),
|
||||
- '/a' : lambda v: "%02x" % (int(v) / 32),
|
||||
+ '/o' : lambda v: "%02x" % int(int(v) / 32),
|
||||
+ '/a' : lambda v: "%02x" % int(int(v) / 32),
|
||||
'/m' : lambda v: '00' if v == '!64' else '01',
|
||||
# SSE
|
||||
'/sse' : lambda v: UdOpcodeTables.OpcExtIndex['sse'][v],
|
||||
@@ -226,17 +226,17 @@ class UdOpcodeTables:
|
||||
raise
|
||||
|
||||
def print_table( self, table, pfxs ):
|
||||
- print("%s |" % pfxs)
|
||||
- keys = table[ 'entries' ].keys()
|
||||
+ print(("%s |" % pfxs))
|
||||
+ keys = list(table[ 'entries' ].keys())
|
||||
if ( len( keys ) ):
|
||||
keys.sort()
|
||||
for idx in keys:
|
||||
e = table[ 'entries' ][ idx ]
|
||||
if e[ 'type' ] == 'insn':
|
||||
- print("%s |-<%s>" % ( pfxs, idx )),
|
||||
- print("%s %s" % ( e[ 'mnemonic' ], ' '.join( e[ 'operands'] ) ))
|
||||
+ print(("%s |-<%s>" % ( pfxs, idx )), end=' ')
|
||||
+ print(("%s %s" % ( e[ 'mnemonic' ], ' '.join( e[ 'operands'] ) )))
|
||||
else:
|
||||
- print("%s |-<%s> %s" % ( pfxs, idx, e['type'] ))
|
||||
+ print(("%s |-<%s> %s" % ( pfxs, idx, e['type'] )))
|
||||
self.print_table( e, pfxs + ' |' )
|
||||
|
||||
def print_tree( self ):
|
||||
diff --git a/scripts/ud_optable.py b/scripts/ud_optable.py
|
||||
index e9e0b53..0a51e97 100644
|
||||
--- a/scripts/ud_optable.py
|
||||
+++ b/scripts/ud_optable.py
|
||||
@@ -62,7 +62,7 @@ class UdOptableXmlParser:
|
||||
if not insnNode.localName:
|
||||
continue
|
||||
if insnNode.localName != "instruction":
|
||||
- print("warning: invalid insn node - %s" % insnNode.localName)
|
||||
+ print(("warning: invalid insn node - %s" % insnNode.localName))
|
||||
continue
|
||||
|
||||
mnemonic = insnNode.getElementsByTagName( 'mnemonic' )[ 0 ].firstChild.data
|
||||
@@ -81,11 +81,11 @@ class UdOptableXmlParser:
|
||||
|
||||
|
||||
def printFn( pfx, mnm, opc, opr, ven ):
|
||||
- print('def: ',)
|
||||
+ print(('def: ',))
|
||||
if len( pfx ):
|
||||
- print(' '.join( pfx ),)
|
||||
- print("%s %s %s %s" %
|
||||
- ( mnm, ' '.join( opc ), ' '.join( opr ), ven ))
|
||||
+ print((' '.join( pfx ),))
|
||||
+ print(("%s %s %s %s" %
|
||||
+ ( mnm, ' '.join( opc ), ' '.join( opr ), ven )))
|
||||
|
||||
|
||||
def parse( xml, callback ):
|
||||
54
dev-libs/udis86/patches/0002-Fix-oprgen-python3-compat.patch
Normal file
54
dev-libs/udis86/patches/0002-Fix-oprgen-python3-compat.patch
Normal file
@@ -0,0 +1,54 @@
|
||||
From: Robert Haist <rhaist@mailbox.org>
|
||||
Date: Mon, 14 May 2018 22:58:01 +0200
|
||||
Subject: Fix oprgen python3 compat
|
||||
|
||||
---
|
||||
tests/oprgen.py | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/tests/oprgen.py b/tests/oprgen.py
|
||||
index 9ab7634..f8a038d 100644
|
||||
--- a/tests/oprgen.py
|
||||
+++ b/tests/oprgen.py
|
||||
@@ -103,10 +103,10 @@ class UdTestGenerator( ud_opcode.UdOpcodeTables ):
|
||||
|
||||
def Xmm(self):
|
||||
r = 16 if self.mode == 64 else 8
|
||||
- return "xmm%d" % random.choice(range(r))
|
||||
+ return "xmm%d" % random.choice(list(range(r)))
|
||||
|
||||
def Mmx(self):
|
||||
- return "mm%d" % random.choice(range(8))
|
||||
+ return "mm%d" % random.choice(list(range(8)))
|
||||
|
||||
def Modrm_RM_GPR(self, size, cast=False):
|
||||
return random.choice([self.Gpr(size),
|
||||
@@ -208,8 +208,8 @@ class UdTestGenerator( ud_opcode.UdOpcodeTables ):
|
||||
|
||||
def Opr_R(self):
|
||||
if self.mode == 64:
|
||||
- return self.OprRxq(random.choice(range(8)))
|
||||
- return self.OprRxd(random.choice(range(8)));
|
||||
+ return self.OprRxq(random.choice(list(range(8))))
|
||||
+ return self.OprRxd(random.choice(list(range(8))));
|
||||
|
||||
def Opr_C(self):
|
||||
return "cr3"
|
||||
@@ -686,7 +686,7 @@ class UdTestGenerator( ud_opcode.UdOpcodeTables ):
|
||||
def generate_yasm( self, mode, seed ):
|
||||
opr_combos = {}
|
||||
random.seed( seed )
|
||||
- print "[bits %s]" % mode
|
||||
+ print("[bits %s]" % mode)
|
||||
for insn in self.InsnTable:
|
||||
if insn[ 'mnemonic' ] in self.ExcludeList:
|
||||
continue
|
||||
@@ -728,7 +728,7 @@ class UdTestGenerator( ud_opcode.UdOpcodeTables ):
|
||||
else:
|
||||
operands = None
|
||||
if operands is not None:
|
||||
- print "\t%s %s" % (insn['mnemonic'], operands)
|
||||
+ print("\t%s %s" % (insn['mnemonic'], operands))
|
||||
opr_combos[fusedName]['covered'] = True
|
||||
|
||||
# stats
|
||||
27
dev-libs/udis86/patches/0005-Fix-tests-makefile.patch
Normal file
27
dev-libs/udis86/patches/0005-Fix-tests-makefile.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
From: Robert Haist <rhaist@mailbox.org>
|
||||
Date: Mon, 14 May 2018 23:45:19 +0200
|
||||
Subject: Fix tests makefile
|
||||
|
||||
---
|
||||
tests/Makefile.am | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index f7cc17b..69e4e43 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -75,12 +75,12 @@ oprtest: oprgen.py
|
||||
|
||||
.PHONY: difftest
|
||||
difftest: oprtest $(builddir)/difftest.sh
|
||||
- @sh $(builddir)/difftest.sh
|
||||
+ @bash $(builddir)/difftest.sh
|
||||
|
||||
|
||||
.PHONY: difftest-refup
|
||||
difftest-refup: $(builddir)/difftest.sh
|
||||
- @sh $(builddir)/difftest.sh refup
|
||||
+ @bash $(builddir)/difftest.sh refup
|
||||
|
||||
|
||||
.PHONY: warn_no_yasm
|
||||
@@ -5,11 +5,16 @@ convenient interface for use in the analysis and instrumentation of binary code.
|
||||
HOMEPAGE="http://udis86.sourceforge.net/"
|
||||
COPYRIGHT="2002-2012, Vivek Thampi"
|
||||
LICENSE="BSD (2-clause)"
|
||||
REVISION="2"
|
||||
REVISION="3"
|
||||
SOURCE_URI="https://github.com/vmt/udis86/archive/v$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="43567f7e12168943c5b5ffb3d3f5b7a33cb36328f8938a993458f3ded0ba5779"
|
||||
SOURCE_FILENAME="udis86-$portVersion.tar.gz"
|
||||
PATCHES="udis86-$portVersion.patchset"
|
||||
PATCHES="
|
||||
udis86-$portVersion.patchset
|
||||
0001-fixes-for-python3.patch
|
||||
0002-Fix-oprgen-python3-compat.patch
|
||||
0005-Fix-tests-makefile.patch
|
||||
"
|
||||
|
||||
ARCHITECTURES="all ?x86"
|
||||
|
||||
@@ -29,7 +34,7 @@ BUILD_PREREQUIRES="
|
||||
cmd:gcc
|
||||
cmd:libtoolize
|
||||
cmd:make
|
||||
cmd:python
|
||||
cmd:python3
|
||||
cmd:sh
|
||||
cmd:yasm
|
||||
"
|
||||
@@ -41,7 +46,7 @@ BUILD()
|
||||
{
|
||||
libtoolize --force --copy --install
|
||||
sh autogen.sh
|
||||
runConfigure ./configure
|
||||
runConfigure ./configure --with-python=python3
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user