Tuesday, July 27, 2021

Re: termshark: unbreak arm*: replace pty module

On 2021/07/27 02:20, Klemens Nanni wrote:
> 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.

How about this?

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 11:07:55 -0000
@@ -1,12 +1,14 @@
# $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
+# patched to replace kr/pty with kreack/pty; see modules.inc XXX
+WRKDIST= ${WRKSRC}
+# remove pkg/MESSAGE if colours get fixed for TERM=xterm.

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}

@@ -22,93 +24,11 @@ WANTLIB += c pthread
MODULES= lang/go
RUN_DEPENDS= net/wireshark,-text

-MODGO_MODULES= \
- 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 \
- github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf \
- github.com/antchfx/xmlquery v1.0.0 \
- github.com/antchfx/xpath v1.0.0 \
- github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 \
- github.com/blang/semver v3.5.1+incompatible \
- github.com/coreos/etcd v3.3.10+incompatible \
- github.com/coreos/go-etcd v2.0.0+incompatible \
- github.com/coreos/go-semver v0.2.0 \
- github.com/davecgh/go-spew v1.1.1 \
- github.com/fsnotify/fsnotify v1.4.7 \
- github.com/gcla/deep v1.0.2 \
- github.com/gcla/gowid v1.1.1-0.20201029034135-cc3f828591d3 \
- github.com/gcla/tail v1.0.1-0.20190505190527-650e90873359 \
- github.com/gcla/tcell v1.1.2-0.20200927150251-decc2045f510 \
- github.com/gcla/term v0.0.0-20191015020247-31cba2f9f402 \
- github.com/gdamore/encoding v1.0.0 \
- github.com/gdamore/tcell v1.3.1-0.20200115030318-bff4943f9a29 \
- github.com/go-test/deep v1.0.2 \
- github.com/guptarohit/asciigraph v0.4.1 \
- github.com/hashicorp/golang-lru v0.5.3 \
- github.com/hashicorp/hcl v1.0.0 \
- github.com/jessevdk/go-flags v1.4.0 \
- 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 \
- github.com/mattn/go-isatty v0.0.9 \
- github.com/mattn/go-runewidth v0.0.7 \
- github.com/mitchellh/mapstructure v1.1.2 \
- github.com/mreiferson/go-snappystream v0.2.3 \
- github.com/pelletier/go-toml v1.2.0 \
- github.com/pkg/errors v0.8.1 \
- github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 \
- github.com/pmezard/go-difflib v1.0.0 \
- github.com/rakyll/statik v0.1.6 \
- github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 \
- github.com/sirupsen/logrus v1.4.2 \
- github.com/spf13/afero v1.1.2 \
- github.com/spf13/cast v1.3.0 \
- github.com/spf13/jwalterweatherman v1.0.0 \
- github.com/spf13/pflag v1.0.3 \
- github.com/spf13/viper v1.3.2 \
- github.com/stretchr/objx v0.1.1 \
- github.com/stretchr/testify v1.4.0 \
- github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5 \
- github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 \
- github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 \
- golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 \
- golang.org/x/net v0.0.0-20190620200207-3b0461eec859 \
- golang.org/x/sys v0.0.0-20191010194322-b09406accb47 \
- golang.org/x/text v0.3.2 \
- golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e \
- gopkg.in/alecthomas/kingpin.v2 v2.2.6 \
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 \
- gopkg.in/fsnotify/fsnotify.v1 v1.4.7 \
- gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 \
- gopkg.in/yaml.v2 v2.2.2
-
-MODGO_MODFILES= \
- 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 \
- golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 \
- golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a \
- golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a \
- golang.org/x/sys v0.0.0-20190422165155-953cdadca894 \
- golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 \
- 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
-
# *shrug* builds ok with "go get" but ports build picks up something broken
do-build:
-cd ${WRKSRC} && ${MODGO_BUILD_CMD} ${ALL_TARGET}/cmd/...
rm -f ${WRKDIR}/go/pkg/mod/github.com/gcla/term@v0.0.0-20191015020247-31cba2f9f402/termios/pty_openbsd.go
cd ${WRKSRC} && ${MODGO_BUILD_CMD} ${ALL_TARGET}/cmd/...

+.include "modules.inc"
.include <bsd.port.mk>
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 11:07:55 -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
Index: modules.inc
===================================================================
RCS file: modules.inc
diff -N modules.inc
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ modules.inc 27 Jul 2021 11:07:55 -0000
@@ -0,0 +1,85 @@
+# $OpenBSD$
+
+MODGO_MODULES = \
+ 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 \
+ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf \
+ github.com/antchfx/xmlquery v1.0.0 \
+ github.com/antchfx/xpath v1.0.0 \
+ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6 \
+ github.com/blang/semver v3.5.1+incompatible \
+ github.com/coreos/etcd v3.3.10+incompatible \
+ github.com/coreos/go-etcd v2.0.0+incompatible \
+ github.com/coreos/go-semver v0.2.0 \
+ github.com/davecgh/go-spew v1.1.1 \
+ github.com/fsnotify/fsnotify v1.4.7 \
+ github.com/gcla/deep v1.0.2 \
+ github.com/gcla/gowid v1.1.1-0.20201029034135-cc3f828591d3 \
+ github.com/gcla/tail v1.0.1-0.20190505190527-650e90873359 \
+ github.com/gcla/tcell v1.1.2-0.20200927150251-decc2045f510 \
+ github.com/gcla/term v0.0.0-20191015020247-31cba2f9f402 \
+ github.com/gdamore/encoding v1.0.0 \
+ github.com/gdamore/tcell v1.3.1-0.20200115030318-bff4943f9a29 \
+ github.com/go-test/deep v1.0.2 \
+ github.com/guptarohit/asciigraph v0.4.1 \
+ github.com/hashicorp/golang-lru v0.5.3 \
+ github.com/hashicorp/hcl v1.0.0 \
+ github.com/jessevdk/go-flags v1.4.0 \
+ 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/text v0.1.0 \
+ github.com/lucasb-eyer/go-colorful v1.0.3 \
+ github.com/magiconair/properties v1.8.0 \
+ github.com/mattn/go-isatty v0.0.9 \
+ github.com/mattn/go-runewidth v0.0.7 \
+ github.com/mitchellh/mapstructure v1.1.2 \
+ github.com/mreiferson/go-snappystream v0.2.3 \
+ github.com/pelletier/go-toml v1.2.0 \
+ github.com/pkg/errors v0.8.1 \
+ github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 \
+ github.com/pmezard/go-difflib v1.0.0 \
+ github.com/rakyll/statik v0.1.6 \
+ github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 \
+ github.com/sirupsen/logrus v1.4.2 \
+ github.com/spf13/afero v1.1.2 \
+ github.com/spf13/cast v1.3.0 \
+ github.com/spf13/jwalterweatherman v1.0.0 \
+ github.com/spf13/pflag v1.0.3 \
+ github.com/spf13/viper v1.3.2 \
+ github.com/stretchr/objx v0.1.1 \
+ github.com/stretchr/testify v1.4.0 \
+ github.com/tevino/abool v0.0.0-20170917061928-9b9efcf221b5 \
+ github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8 \
+ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 \
+ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 \
+ golang.org/x/net v0.0.0-20190620200207-3b0461eec859 \
+ golang.org/x/sys v0.0.0-20191010194322-b09406accb47 \
+ golang.org/x/text v0.3.2 \
+ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e \
+ gopkg.in/alecthomas/kingpin.v2 v2.2.6 \
+ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 \
+ gopkg.in/fsnotify/fsnotify.v1 v1.4.7 \
+ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 \
+ gopkg.in/yaml.v2 v2.2.2
+
+MODGO_MODFILES = \
+ 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/stretchr/objx v0.1.0 \
+ github.com/stretchr/testify v1.2.2 \
+ github.com/stretchr/testify v1.3.0 \
+ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9 \
+ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a \
+ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a \
+ golang.org/x/sys v0.0.0-20190422165155-953cdadca894 \
+ golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 \
+ 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
+
+# XXX replaced kr/pty with these
+MODGO_MODULES += github.com/creack/pty v1.1.14
Index: patches/patch-go_mod
===================================================================
RCS file: patches/patch-go_mod
diff -N patches/patch-go_mod
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-go_mod 27 Jul 2021 11:07:55 -0000
@@ -0,0 +1,10 @@
+$OpenBSD$
+
+Index: go.mod
+--- go.mod.orig
++++ go.mod
+@@ -37,3 +37,4 @@ require (
+ replace github.com/gdamore/tcell => github.com/gcla/tcell v1.1.2-0.20200927150251-decc2045f510
+
+ replace github.com/pkg/term => github.com/gcla/term v0.0.0-20191015020247-31cba2f9f402
++replace github.com/kr/pty => github.com/creack/pty v1.1.14
Index: patches/patch-go_sum
===================================================================
RCS file: patches/patch-go_sum
diff -N patches/patch-go_sum
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-go_sum 27 Jul 2021 11:07:55 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Index: go.sum
+--- go.sum.orig
++++ go.sum
+@@ -53,9 +53,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.
+ github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+ github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+-github.com/kr/pty v1.1.4 h1:5Myjjh3JY/NaAi4IsUbHADytDyl1VE1Y9PXDlL+P/VQ=
+-github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
++github.com/creack/pty v1.1.14/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
++github.com/creack/pty v1.1.14 h1:55VbUWoBxE1iTAh3B6JztD6xyQ06CvW/31oD6rYwrtY=
+ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+ github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
Index: pkg/MESSAGE
===================================================================
RCS file: pkg/MESSAGE
diff -N pkg/MESSAGE
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ pkg/MESSAGE 27 Jul 2021 11:07:55 -0000
@@ -0,0 +1,2 @@
+termshark's colours are broken with TERM=xterm or TERM=xterm-color;
+as a workaround you can run with TERM=vt100 or TERM=xterm-256color.

No comments:

Post a Comment