Monday, July 26, 2021

Re: termshark: unbreak arm*: replace pty module

On Mon, Jul 26, 2021 at 10:13:16PM +0000, Klemens Nanni wrote:
> The update to 2.2.0 not only broke the build on aarch64 and armv7 due to
> use of the outdated kr/pty module, it also broke termshark's colors
> with our default `TERM=xterm'.
>
> I replaced the go pty module to see if that would fix color issues,
> replacing worked but colors didn't.
>
> The color issue needs more work, "termshark 2.2.x not visible"
> https://github.com/gcla/termshark/issues/114 seems to be the same issue
> on other OSes/platforms.
>
> tl;dr: Use `TERM=vt100' or `TERM=xterm-256color' for a monochrome or
> working colorful TUI, respectively.
>
>
> Regardless of colors, using the new module makes arm* work and I have
> successfully built and used it on my Pinebook Pro, which is nice.
>
> I've added `pre-build' doing exactly what you'd do manually to replace
> and checksum the module upfront prior to building; it's not pretty but
> that's how this go ecosystem works...
>
> Should we go ahead with something like this to unbreak arm*?

New diff after creack/pty cut another release about 40 minutes ago with
abieber's fix for mips64 builds.


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/termshark/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile 23 Mar 2021 22:17:36 -0000 1.7
+++ Makefile 27 Jul 2021 02:17:58 -0000
@@ -1,12 +1,10 @@
# $OpenBSD: Makefile,v 1.7 2021/03/23 22:17:36 sthen Exp $

-BROKEN-aarch64= old kr/pty doesn't support OpenBSD arm arches; needs creack/pty@v1.1.11
-BROKEN-armv7= old kr/pty doesn't support OpenBSD arm arches; needs creack/pty@v1.1.11
-
COMMENT= terminal UI for tshark, inspired by Wireshark

MODGO_MODNAME= github.com/gcla/termshark/v2
MODGO_VERSION= v2.2.0
+REVISION= 0

DISTNAME= termshark-${MODGO_VERSION}

@@ -23,6 +21,7 @@ MODULES= lang/go
RUN_DEPENDS= net/wireshark,-text

MODGO_MODULES= \
+ github.com/creack/pty v1.1.14 \
github.com/!burnt!sushi/toml v0.3.1 \
github.com/adam-hanna/array!operations v0.2.5 \
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc \
@@ -51,7 +50,6 @@ MODGO_MODULES= \
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 \
github.com/konsorten/go-windows-terminal-sequences v1.0.2 \
github.com/kr/pretty v0.1.0 \
- github.com/kr/pty v1.1.4 \
github.com/kr/text v0.1.0 \
github.com/lucasb-eyer/go-colorful v1.0.3 \
github.com/magiconair/properties v1.8.0 \
@@ -88,11 +86,11 @@ MODGO_MODULES= \
gopkg.in/yaml.v2 v2.2.2

MODGO_MODFILES= \
+ github.com/creack/pty v1.1.14 \
github.com/davecgh/go-spew v1.1.0 \
github.com/go-test/deep v1.0.1 \
github.com/hashicorp/golang-lru v0.5.1 \
github.com/konsorten/go-windows-terminal-sequences v1.0.1 \
- github.com/kr/pty v1.1.1 \
github.com/stretchr/objx v0.1.0 \
github.com/stretchr/testify v1.2.2 \
github.com/stretchr/testify v1.3.0 \
@@ -104,6 +102,15 @@ MODGO_MODFILES= \
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a \
golang.org/x/text v0.3.0 \
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
+
+# manually replace old pty module with new one to enable arm64, armv7 and mips64
+# builds until upstream fixes this
+pre-build:
+ ${MODGO_CMD} mod edit -replace \
+ github.com/kr/pty=github.com/creack/pty@v1.1.14 ${WRKSRC}/go.mod
+ sed -i '/github.com\/.*\/pty/d' ${WRKSRC}/go.sum
+ echo 'github.com/creack/pty v1.1.14 h1:55VbUWoBxE1iTAh3B6JztD6xyQ06CvW/31oD6rYwrtY=' >> ${WRKSRC}/go.sum
+ echo 'github.com/creack/pty v1.1.14/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=' >> ${WRKSRC}/go.sum

# *shrug* builds ok with "go get" but ports build picks up something broken
do-build:
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/termshark/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- distinfo 10 Mar 2021 22:08:18 -0000 1.2
+++ distinfo 27 Jul 2021 02:18:04 -0000
@@ -20,6 +20,8 @@ SHA256 (go_modules/github.com/coreos/go-
SHA256 (go_modules/github.com/coreos/go-etcd/@v/v2.0.0+incompatible.zip) = SyJnMoNbkpivZdtdB1AkpZcaoR70tFaJmjgwvM1DWwc=
SHA256 (go_modules/github.com/coreos/go-semver/@v/v0.2.0.mod) = 7lARLbikHJ18hSy4jqSgh/IdaONnqPdq1u4Pt5rGvRw=
SHA256 (go_modules/github.com/coreos/go-semver/@v/v0.2.0.zip) = CtB3vaUUZc6pcRiZV2PZENkcT/5M9DcPlTATrxlSUu0=
+SHA256 (go_modules/github.com/creack/pty/@v/v1.1.14.mod) = BBOkGR3M1sdbDMdMtxrxVkBw8uy/zjq0ujzMnXAf2Cw=
+SHA256 (go_modules/github.com/creack/pty/@v/v1.1.14.zip) = ZtRg1bMCKzdfGy7I+rr2j1UkTFmQ1whgXCx7tXWwOfE=
SHA256 (go_modules/github.com/davecgh/go-spew/@v/v1.1.0.mod) = vLKTkyUSN7eaF7bBm/KRNPQ+j0OMMZiYj81GGhzfBcw=
SHA256 (go_modules/github.com/davecgh/go-spew/@v/v1.1.1.mod) = vLKTkyUSN7eaF7bBm/KRNPQ+j0OMMZiYj81GGhzfBcw=
SHA256 (go_modules/github.com/davecgh/go-spew/@v/v1.1.1.zip) = a0SoQ5UfNxtwEMdU7MPKvv6BXVztHFuUCfstaX6KiQ0=
@@ -58,9 +60,6 @@ SHA256 (go_modules/github.com/konsorten/
SHA256 (go_modules/github.com/konsorten/go-windows-terminal-sequences/@v/v1.0.2.zip) = TQDXG43mC8r0VPj4ZyEOvNBedcCnwnJZBPcaovIPsI4=
SHA256 (go_modules/github.com/kr/pretty/@v/v0.1.0.mod) = 49XUbS9qyUpmalS16GfsFr8ZnZ9LcAgnzXMWB+/dEJo=
SHA256 (go_modules/github.com/kr/pretty/@v/v0.1.0.zip) = BgY9IUV+Btwqukpb0JdxFH7D2KtAsiTyblXFp2CJykM=
-SHA256 (go_modules/github.com/kr/pty/@v/v1.1.1.mod) = baTJxzZERolOXvh34Z+YXNUdZxzm6PTKh4YrRJ9t1/Y=
-SHA256 (go_modules/github.com/kr/pty/@v/v1.1.4.mod) = baTJxzZERolOXvh34Z+YXNUdZxzm6PTKh4YrRJ9t1/Y=
-SHA256 (go_modules/github.com/kr/pty/@v/v1.1.4.zip) = mu/49OcxZwGMnr/V6HK7rozRPc6q8q3dfV7fOJvIX7I=
SHA256 (go_modules/github.com/kr/text/@v/v0.1.0.mod) = L7qVKeXBPd5i83Hvc4O68E1xMlAdrGqgjpEPnsC/hcU=
SHA256 (go_modules/github.com/kr/text/@v/v0.1.0.zip) = k2OkyPHzOHo2AU3lG0d7gxoTmB/FmlZl+dIWCb6p53w=
SHA256 (go_modules/github.com/lucasb-eyer/go-colorful/@v/v1.0.3.mod) = hPnDjpiEqwE8g3yxau4TlQDT1cbMqwJDmIHbLs8o9mA=
@@ -163,6 +162,8 @@ SIZE (go_modules/github.com/coreos/go-et
SIZE (go_modules/github.com/coreos/go-etcd/@v/v2.0.0+incompatible.zip) = 30740
SIZE (go_modules/github.com/coreos/go-semver/@v/v0.2.0.mod) = 35
SIZE (go_modules/github.com/coreos/go-semver/@v/v0.2.0.zip) = 10848
+SIZE (go_modules/github.com/creack/pty/@v/v1.1.14.mod) = 38
+SIZE (go_modules/github.com/creack/pty/@v/v1.1.14.zip) = 23944
SIZE (go_modules/github.com/davecgh/go-spew/@v/v1.1.0.mod) = 34
SIZE (go_modules/github.com/davecgh/go-spew/@v/v1.1.1.mod) = 34
SIZE (go_modules/github.com/davecgh/go-spew/@v/v1.1.1.zip) = 60320
@@ -201,9 +202,6 @@ SIZE (go_modules/github.com/konsorten/go
SIZE (go_modules/github.com/konsorten/go-windows-terminal-sequences/@v/v1.0.2.zip) = 3968
SIZE (go_modules/github.com/kr/pretty/@v/v0.1.0.mod) = 67
SIZE (go_modules/github.com/kr/pretty/@v/v0.1.0.zip) = 11159
-SIZE (go_modules/github.com/kr/pty/@v/v1.1.1.mod) = 25
-SIZE (go_modules/github.com/kr/pty/@v/v1.1.4.mod) = 25
-SIZE (go_modules/github.com/kr/pty/@v/v1.1.4.zip) = 14830
SIZE (go_modules/github.com/kr/text/@v/v0.1.0.mod) = 64
SIZE (go_modules/github.com/kr/text/@v/v0.1.0.zip) = 12591
SIZE (go_modules/github.com/lucasb-eyer/go-colorful/@v/v1.0.3.mod) = 51

No comments:

Post a Comment