git: 873d4f6f9905 - main - Mk/Scripts: Fix ports depends-list.sh

From: Luca Pizzamiglio <pizzamig_at_FreeBSD.org>
Date: Tue, 13 Jun 2023 20:13:34 UTC
The branch main has been updated by pizzamig:

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

commit 873d4f6f9905bae3fe580e86aaebbbe994adba97
Author:     Andrew "RhodiumToad" Gierth <andrew@tao11.riddles.org.uk>
AuthorDate: 2023-06-13 20:09:59 +0000
Commit:     Luca Pizzamiglio <pizzamig@FreeBSD.org>
CommitDate: 2023-06-13 20:09:59 +0000

    Mk/Scripts: Fix ports depends-list.sh
    
    depends-list.sh fails in two ways: one is a simple quoting bug which
    causes empty FLAVOR variables to be propagated; the other is that
    de-duplication is being done without regard for flavors.
    
    The upshot of these is that where a port depends on a specific flavor
    (first bug) or on multiple flavors (second bug, usually caused by build
    dependencies) of another port, the constructed dependency list is
    incomplete, and so -recursive targets do not do all the required work.
    (This is especially annoying for fetch-recursive.)
    
    Reviewed by: portmgr@FreeBSD.org
    PR:             269982
    Differential Revision: https://reviews.freebsd.org/D40491
---
 Mk/Scripts/depends-list.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Mk/Scripts/depends-list.sh b/Mk/Scripts/depends-list.sh
index 6c3e03c33288..ab724b58ab1e 100644
--- a/Mk/Scripts/depends-list.sh
+++ b/Mk/Scripts/depends-list.sh
@@ -76,7 +76,7 @@ check_dep() {
 				;;
 			esac
 			if [ -f ${d}/Makefile ]; then
-				if [ -n $f ]; then
+				if [ -n "$f" ]; then
 					export FLAVOR=$f
 				fi
 				break
@@ -91,9 +91,9 @@ check_dep() {
 		fi
 
 		case " ${checked} " in
-			*\ ${d}\ *) continue ;; # Already checked
+			*\ ${port_display}\ *) continue ;; # Already checked
 		esac
-		checked="${checked} ${d}"
+		checked="${checked} ${port_display}"
 		# Check if the dependency actually exists or skip otherwise.
 		if [ ! -d "${d}" ]; then
 			echo "${dp_PKGNAME}: \"${port_display}\" non-existent -- dependency list incomplete" >&2