git: 45530097ae37 - main - Mk/bsd.port.mk: support multiple URLs in WWW

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Wed, 21 Sep 2022 11:24:15 UTC
The branch main has been updated by se:

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

commit 45530097ae3725e7265e8bac2bde48766f3f4f09
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2022-09-21 11:18:28 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2022-09-21 11:23:44 +0000

    Mk/bsd.port.mk: support multiple URLs in WWW
    
    The WWW macro was supposewd to hold only one URL pointing to the most
    useful starting point for a user searching for additional information,
    configuration examples, etc.
    
    Some port maintainers have set the WWW macro to a list of URLs,
    breaking assumptions by scripts and tools in the ports system and of
    external users of the ports system.
    
    This change allows WWW to hold a list of URLs by only considering the
    first list element in places where only a single URL is supported.
    
    This mirrors the previous behavior of only using the first line tagged
    with "WWW: " in the pkg-descr file.
    
    Approved by:    portmgr (tcberner)
    Differential Revision:  https://reviews.freebsd.org/D36558
---
 Mk/Scripts/create-manifest.sh | 6 ++++--
 Mk/bsd.port.mk                | 5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Mk/Scripts/create-manifest.sh b/Mk/Scripts/create-manifest.sh
index 118483cecddf..2f68f0e9d436 100644
--- a/Mk/Scripts/create-manifest.sh
+++ b/Mk/Scripts/create-manifest.sh
@@ -52,7 +52,7 @@ licenselogic: ${dp_LICENSE_COMB:-single}
 EOT
 
 # Then, the optional bits
-[ -z "${dp_WWW}" ] || echo "www: \"${dp_WWW}\""
+[ -z "${dp_WWW}" ] || echo "www: \"${dp_WWW%% *}\""
 [ -z "${dp_LICENSE}" ] || echo "licenses: [ ${dp_LICENSE} ]"
 [ -z "${dp_USERS}" ] || echo "users: [ ${dp_USERS} ]"
 [ -z "${dp_GROUPS}" ] || echo "groups: [ ${dp_GROUPS} ]"
@@ -89,7 +89,9 @@ fi
 cp ${dp_DESCR} ${dp_METADIR}/+DESC
 if [ -n "${dp_WWW}" ] && ! grep -q '^WWW: ' ${dp_DESCR}; then
 	echo >> ${dp_METADIR}/+DESC
-	echo "WWW: ${dp_WWW}" >> ${dp_METADIR}/+DESC
+	for www in ${dp_WWW}; do
+		echo "WWW: ${www}" >> ${dp_METADIR}/+DESC
+	done
 fi
 
 # Concatenate all the scripts
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 2bb318263c83..c582ca50bb32 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -3567,6 +3567,8 @@ create-users-groups:
 .      endif
 .    endif
 
+_WWW=	${WWW:[1]}
+
 .    if !defined(DISABLE_SECURITY_CHECK)
 .      if !target(security-check)
 security-check: ${TMPPLIST}
@@ -4287,7 +4289,7 @@ create-manifest:
 			dp_PORT_OPTIONS='${PORT_OPTIONS}'                     \
 			dp_PREFIX='${PREFIX}'                                 \
 			dp_USERS='${USERS:u:S/$/,/}'                          \
-			dp_WWW='${_WWW}'                                      \
+			dp_WWW='${WWW}'                                       \
 			${PKG_NOTES_ENV}                                      \
 			${SH} ${SCRIPTSDIR}/create-manifest.sh
 
@@ -4351,7 +4353,6 @@ _FETCH_DEPENDS=${FETCH_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C
 _LIB_DEPENDS=${LIB_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
 _BUILD_DEPENDS=${BUILD_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,} ${_LIB_DEPENDS}
 _RUN_DEPENDS=${RUN_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,} ${_LIB_DEPENDS}
-_WWW=${WWW}
 .      if exists(${DESCR})
 _DESCR=${DESCR}
 .      else