git: e5b697968023 - main - sysutils/amazon-ssm-agent: fix build on arm64

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Thu, 06 Apr 2023 21:43:59 UTC
The branch main has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e5b697968023aa97b952beea579ce58b43a4f6c5

commit e5b697968023aa97b952beea579ce58b43a4f6c5
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2023-04-01 00:07:47 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2023-04-06 20:33:19 +0000

    sysutils/amazon-ssm-agent: fix build on arm64
    
    Bump golang.org/x/sys dependency to a version new enough to support
    arm64-freebsd.  Replace github.com/kr/pty dependency with a new
    version, which moved to github.com/creack/pty.
    
    Approved by:    portmgr (build fix blanket)
---
 sysutils/amazon-ssm-agent/Makefile                           | 12 +++++++++---
 sysutils/amazon-ssm-agent/distinfo                           |  6 +++++-
 .../files/patch-agent_session_shell_shell__unix.go           | 11 +++++++++++
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/sysutils/amazon-ssm-agent/Makefile b/sysutils/amazon-ssm-agent/Makefile
index dc2c58537624..00af6236e0af 100644
--- a/sysutils/amazon-ssm-agent/Makefile
+++ b/sysutils/amazon-ssm-agent/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	amazon-ssm-agent
 PORTVERSION=	2.3.1205.0
-PORTREVISION=	13
+PORTREVISION=	14
 CATEGORIES=	sysutils
 
 MAINTAINER=	cperciva@FreeBSD.org
@@ -10,8 +10,6 @@ WWW=		https://github.com/aws/amazon-ssm-agent
 LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN_aarch64=	fails to build: vendor/golang.org/x/sys/unix/cap_freebsd.go:18:23: undefined: CAP_RIGHTS_VERSION_00
-
 RUN_DEPENDS=	${LOCALBASE}/share/certs/ca-root-nss.crt:security/ca_root_nss
 
 USES=		go
@@ -19,6 +17,8 @@ USES=		go
 USE_GITHUB=	yes
 GH_ACCOUNT=	aws
 GH_SUBDIR=	src/github.com/aws/amazon-ssm-agent
+GH_TUPLE=	creack:pty:v1.1.18:pty \
+		golang:sys:v0.6.0:sys
 
 GO_BUILDFLAGS=	-ldflags "-s -w"
 GO_TARGET=	./agent:${PREFIX}/sbin/amazon-ssm-agent \
@@ -37,6 +37,12 @@ PLIST_FILES=	etc/amazon/ssm/amazon-ssm-agent.json.template	\
 
 USE_RC_SUBR=	amazon-ssm-agent
 
+pre-patch:
+	${MKDIR} ${WRKSRC}/vendor/src/github.com/creack
+	${LN} -s ${WRKSRC_pty} ${WRKSRC}/vendor/src/github.com/creack/pty
+	${RM} -r ${WRKSRC}/vendor/src/golang.org/x/sys
+	${LN} -s ${WRKSRC_sys} ${WRKSRC}/vendor/src/golang.org/x/sys
+
 post-patch:
 	${LN} -s ${WRKSRC}/vendor/src/* ${WRKSRC}/vendor/
 
diff --git a/sysutils/amazon-ssm-agent/distinfo b/sysutils/amazon-ssm-agent/distinfo
index 0c818fa6562e..250f703605ed 100644
--- a/sysutils/amazon-ssm-agent/distinfo
+++ b/sysutils/amazon-ssm-agent/distinfo
@@ -1,3 +1,7 @@
-TIMESTAMP = 1589747277
+TIMESTAMP = 1680307376
 SHA256 (aws-amazon-ssm-agent-2.3.1205.0_GH0.tar.gz) = 3a2424c6cd669486581ccf09cd57cbaecd69ef5731a62a50a826eb4b9515face
 SIZE (aws-amazon-ssm-agent-2.3.1205.0_GH0.tar.gz) = 22202960
+SHA256 (creack-pty-v1.1.18_GH0.tar.gz) = 7a1d6775e3f99b98e5d87303e9aeacfd73d810abffc17e42a561d0650adc980e
+SIZE (creack-pty-v1.1.18_GH0.tar.gz) = 10668
+SHA256 (golang-sys-v0.6.0_GH0.tar.gz) = b4f6d17c7a128f76169964b437cb66b3f2dbf9a33361928ec19dfecf7b03fc54
+SIZE (golang-sys-v0.6.0_GH0.tar.gz) = 1434234
diff --git a/sysutils/amazon-ssm-agent/files/patch-agent_session_shell_shell__unix.go b/sysutils/amazon-ssm-agent/files/patch-agent_session_shell_shell__unix.go
new file mode 100644
index 000000000000..7ef13858cc9f
--- /dev/null
+++ b/sysutils/amazon-ssm-agent/files/patch-agent_session_shell_shell__unix.go
@@ -0,0 +1,11 @@
+--- agent/session/shell/shell_unix.go.orig	2023-04-01 00:01:35 UTC
++++ agent/session/shell/shell_unix.go
+@@ -34,7 +34,7 @@ import (
+ 	"github.com/aws/amazon-ssm-agent/agent/log"
+ 	mgsContracts "github.com/aws/amazon-ssm-agent/agent/session/contracts"
+ 	"github.com/aws/amazon-ssm-agent/agent/session/utility"
+-	"github.com/kr/pty"
++	"github.com/creack/pty"
+ )
+ 
+ var ptyFile *os.File