git: f0191973eadf - main - Mk/Scripts: Fix potential error creating .metadir/+DESC

From: Bryan Drewery <bdrewery_at_FreeBSD.org>
Date: Wed, 14 Dec 2022 05:12:49 UTC
The branch main has been updated by bdrewery:

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

commit f0191973eadf9d52e3c32d5f430fa4f2d083fde6
Author:     Bryan Drewery <bdrewery@FreeBSD.org>
AuthorDate: 2022-12-14 05:05:30 +0000
Commit:     Bryan Drewery <bdrewery@FreeBSD.org>
CommitDate: 2022-12-14 05:11:01 +0000

    Mk/Scripts: Fix potential error creating .metadir/+DESC
    
    In some builds it could be possible that pkg-descr is not writable.
    We could either install -m 0644 the file over or just let sh create
    it.
    
    This change also opens the destination file only once now.
    
    Fixes: ddd0e820c
---
 Mk/Scripts/create-manifest.sh | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/Mk/Scripts/create-manifest.sh b/Mk/Scripts/create-manifest.sh
index 2f68f0e9d436..c6d0ef559195 100644
--- a/Mk/Scripts/create-manifest.sh
+++ b/Mk/Scripts/create-manifest.sh
@@ -86,13 +86,15 @@ if [ -n "${dp_PKG_NOTES}" ]; then
 fi
 
 # Copy the pkg-descr file
-cp ${dp_DESCR} ${dp_METADIR}/+DESC
-if [ -n "${dp_WWW}" ] && ! grep -q '^WWW: ' ${dp_DESCR}; then
-	echo >> ${dp_METADIR}/+DESC
-	for www in ${dp_WWW}; do
-		echo "WWW: ${www}" >> ${dp_METADIR}/+DESC
-	done
-fi
+{
+	cat ${dp_DESCR}
+	if [ -n "${dp_WWW}" ] && ! grep -q '^WWW: ' ${dp_DESCR}; then
+			echo
+			for www in ${dp_WWW}; do
+				echo "WWW: ${www}"
+			done
+	fi
+} > ${dp_METADIR}/+DESC
 
 # Concatenate all the scripts
 output_files=