git: 8ead0f7997c6 - main - lang/quilc: Fix error handling in shell code; Add comments

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 02 Aug 2022 21:28:10 UTC
The branch main has been updated by yuri:

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

commit 8ead0f7997c60ebfe4817c67a3e61485ca8a7f08
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-08-02 21:26:57 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-08-02 21:28:06 +0000

    lang/quilc: Fix error handling in shell code; Add comments
---
 lang/quilc/Makefile                         |  6 +++---
 lang/quilc/Makefile.deps                    |  5 +++++
 lang/quilc/files/build-log-to-makefile-deps | 16 +++++++++++++++-
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/lang/quilc/Makefile b/lang/quilc/Makefile
index 99d24a4f8476..fccf7742b17a 100644
--- a/lang/quilc/Makefile
+++ b/lang/quilc/Makefile
@@ -41,9 +41,9 @@ MAINTAINER_MODE=	no
 
 .if (${MAINTAINER_MODE} == "yes")
 do-build:
-	# build, download dependencies during build, and collect build log with URLs in it
-	@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${TARGET_ALL} 2>&1 | tee -a ${WRKDIR}/build.log
-	# convert build.log to Makefile.deps
+	# build, download dependencies during build, and save build log with URLs in it
+	@set -e; set -o pipefail; cd ${WRKSRC} && (${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${TARGET_ALL} 2>&1 | tee -a ${WRKDIR}/build.log)
+	# compute Makefile.deps based on URLs in build.log
 	@${FILESDIR}/build-log-to-makefile-deps ${WRKDIR}/build.log > Makefile.deps
 .else
 .  include <Makefile.deps>
diff --git a/lang/quilc/Makefile.deps b/lang/quilc/Makefile.deps
index 06996cb7e5cf..aff523868c9a 100644
--- a/lang/quilc/Makefile.deps
+++ b/lang/quilc/Makefile.deps
@@ -1,3 +1,8 @@
+##
+## (!!!) This is an auto-generated file.
+## (!!!) Please do not modify manually.
+## (!!!) Instead please follow the instructions in Makefile on how to update the port.
+##
 MASTER_SITES_DEPS= \
 http://beta.quicklisp.org/archive/alexa/2018-08-31/:alexa_20180831_git_tgz \
 http://beta.quicklisp.org/archive/alexandria/2022-07-07/:alexandria_20220707_git_tgz \
diff --git a/lang/quilc/files/build-log-to-makefile-deps b/lang/quilc/files/build-log-to-makefile-deps
index dab08c647e37..74acf7e30642 100755
--- a/lang/quilc/files/build-log-to-makefile-deps
+++ b/lang/quilc/files/build-log-to-makefile-deps
@@ -1,9 +1,21 @@
 #!/bin/sh
 
+# parse args
+BUILD_LOG=$1
+
+# error handling
 set -e
+set -o pipefail
 
-BUILD_LOG=$1
+# write the header
+echo "##"
+echo "## (!!!) This is an auto-generated file."
+echo "## (!!!) Please do not modify manually."
+echo "## (!!!) Instead please follow the instructions in Makefile on how to update the port."
+echo "##"
+echo ""
 
+# write MASTER_SITES_DEPS
 echo "MASTER_SITES_DEPS= \\"
 cat ${BUILD_LOG} | \
 	grep -a "^; Fetching #<URL " | \
@@ -19,6 +31,7 @@ cat ${BUILD_LOG} | \
 	sed -E 's|.*|& \\|'
 echo ""
 
+# write DISTFILES_DEPS
 echo "DISTFILES_DEPS= \\"
 cat ${BUILD_LOG} | \
 	grep -a "^; Fetching #<URL " | \
@@ -32,3 +45,4 @@ cat ${BUILD_LOG} | \
 	sed -E 's|^(.+):([^:-\+\.]*)[-\+\.]([^:]*)$|\1:\2_\3|' | \
 	sed -E 's|^(.+):([^:-\+\.]*)[-\+\.]([^:]*)$|\1:\2_\3|' | \
 	sed -E 's|.*|& \\|'
+echo ""