From fd9ddff07f670e3348cc9368fffa9ce72f81b742 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sat, 21 Jan 2023 04:22:43 +0100
Subject: [PATCH] community/entr: upgrade to 5.3

The C unit test suite (which has been previously invoked via
`make test`) was removed and replaced by the regression tests
(previously `make regress`). These didn't pass on the builders
before due to lack of a TTY and several bashisms in the test script.
To fix that, run the tests in script(1) and execute the test script
with /bin/bash instead of /bin/sh.
---
 community/entr/APKBUILD                 | 23 +++++++++++++++--------
 community/entr/fix-git-invocation.patch | 15 +++++++++++++++
 2 files changed, 30 insertions(+), 8 deletions(-)
 create mode 100644 community/entr/fix-git-invocation.patch

diff --git a/community/entr/APKBUILD b/community/entr/APKBUILD
index 0b788e162734..e59e5b69d8ef 100644
--- a/community/entr/APKBUILD
+++ b/community/entr/APKBUILD
@@ -1,7 +1,7 @@
 # Contributor: Stuart Cardall <developer@it-offshore.co.uk>
 # Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
 pkgname=entr
-pkgver=5.2
+pkgver=5.3
 pkgrel=0
 pkgdesc="Event Notify Test Runner: Run arbitrary commands when files change"
 url="https://eradman.com/entrproject"
@@ -9,8 +9,17 @@ arch="all"
 license="ISC"
 subpackages="$pkgname-doc"
 makedepends="vim mercurial file util-linux"
-checkdepends="bash tmux"
-source="https://eradman.com/entrproject/code/entr-$pkgver.tar.gz"
+checkdepends="bash tmux util-linux-misc"
+source="https://eradman.com/entrproject/code/entr-$pkgver.tar.gz
+	fix-git-invocation.patch"
+
+prepare() {
+	default_prepare
+
+	# The test script is not compatibile with BusyBox ash
+	# and also uses several GNU extensions (e.g. function syntax).
+	sed -i system_test.sh -e 's|#!/bin/sh|#!/bin/bash|'
+}
 
 build() {
 	./configure
@@ -18,10 +27,7 @@ build() {
 }
 
 check() {
-	make test
-
-	# FIXME: The tmux invocation in the functional tests blocks the builders
-	# make regress
+	SHELL=/bin/sh script --return --quiet -c "make -j1 test" /dev/null
 }
 
 package() {
@@ -29,5 +35,6 @@ package() {
 }
 
 sha512sums="
-b12310b6695f0b3d3d830b651dd182ddf2321aad38f569066cc2e5b17570070e48eb4900725c88c1d31a8ff71099aba78fb7508ad60706265cbdf8f29257eaaa  entr-5.2.tar.gz
+b160cb60de99a743226b472256d937ef6ace54f5350a83420f59ac2706cd0fb042d6f85fcac6c73e76c161c6225b956df8b00156dea9ce55d8b8225e8ca13e7f  entr-5.3.tar.gz
+236f6efa6d02bc95abb8f9194ffe81d50a8f0813fc7fb73f2310022bd2aae90f1922edfbb8c104a9838840d1831c52639d9f62bbcb05081b9b8ee93c3629d5e8  fix-git-invocation.patch
 "
diff --git a/community/entr/fix-git-invocation.patch b/community/entr/fix-git-invocation.patch
new file mode 100644
index 000000000000..264dbad872a7
--- /dev/null
+++ b/community/entr/fix-git-invocation.patch
@@ -0,0 +1,15 @@
+Without a Git configuration git(1) exits with a non-zero exit code
+which, in turn, causes a failure of the entr test suite.
+
+diff -upr entr-5.3.orig/system_test.sh entr-5.3/system_test.sh
+--- entr-5.3.orig/system_test.sh	2023-01-21 10:50:35.430697263 +0100
++++ entr-5.3/system_test.sh	2023-01-21 10:51:10.478073569 +0100
+@@ -250,6 +250,8 @@ try "exec single utility when an entire
+ 		cp /usr/include/*.h $tmp/
+ 		cd $tmp
+ 		git init -q
++		git config user.email "you@example.com"
++		git config user.name "Your Name"
+ 		git add *.h
+ 		git commit -m "initial checkin" -q
+ 		for f in `ls *.h | head`; do
-- 
GitLab