Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Dec 2024 21:48:58 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 50291c77306b - stable/13 - depend-cleanup.sh: Generalise lib32 code and avoid duplication
Message-ID:  <202412092148.4B9Lmwp8033219@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=50291c77306be87ee9f85fe557d47b65c8af50ed

commit 50291c77306be87ee9f85fe557d47b65c8af50ed
Author:     Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2023-07-27 04:10:47 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-12-09 21:46:55 +0000

    depend-cleanup.sh: Generalise lib32 code and avoid duplication
    
    By passing through _ALL_libcompats we can avoid hard-coding the list of
    libcompats in depend-cleanup.sh. This cleanup also makes clean_dep
    shorter by using a loop instead of handling each case explicitly (at the
    expense of slightly tweaked logging).
    
    Reviewed by:    brooks, jhb
    Differential Revision:  https://reviews.freebsd.org/D41187
    
    (cherry picked from commit 81805ec30074363e5d7d7add37b3ccf4f1eb396b)
    
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1543
---
 tools/build/depend-cleanup.sh | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/tools/build/depend-cleanup.sh b/tools/build/depend-cleanup.sh
index e88a765357a5..7299ee0ccf6b 100755
--- a/tools/build/depend-cleanup.sh
+++ b/tools/build/depend-cleanup.sh
@@ -72,6 +72,9 @@ if [ -z "${MACHINE_ARCH+set}" ]; then
 	err "MACHINE_ARCH not set"
 fi
 
+# XXX: _ALL_libcompats not MFC'd in Makefile.inc1
+ALL_libcompats=32
+
 run()
 {
 	if [ "$VERBOSE" ]; then
@@ -87,12 +90,15 @@ run()
 # $3 source extension
 clean_dep()
 {
-	if egrep -qw "$2\.$3" "$OBJTOP"/$1/.depend.$2.*o 2>/dev/null; then
-		echo "Removing stale dependencies and objects for $2.$3"
-		run rm -f \
-		    "$OBJTOP"/obj-lib32/$1/.depend.$2.* \
-		    "$OBJTOP"/obj-lib32/$1/$2.*o
-	fi
+	for libcompat in "" $ALL_libcompats; do
+		dirprfx=${libcompat:+obj-lib${libcompat}/}
+		if egrep -qw "$2\.$3" "$OBJTOP"/$dirprfx$1/.depend.$2.*o 2>/dev/null; then
+			echo "Removing stale ${libcompat:+lib${libcompat} }dependencies and objects for $2.$3"
+			run rm -f \
+			    "$OBJTOP"/$dirprfx$1/.depend.$2.* \
+			    "$OBJTOP"/$dirprfx$1/$2.*o
+		fi
+	done
 }
 
 # Date      Rev      Description
@@ -106,7 +112,10 @@ if [ -e "$OBJTOP"/cddl/lib/libzfs/.depend.libzfs_changelist.o ] && \
     egrep -qw "cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c" \
     "$OBJTOP"/cddl/lib/libzfs/.depend.libzfs_changelist.o; then
 	echo "Removing old ZFS tree"
-	run rm -rf "$OBJTOP"/cddl "$OBJTOP"/obj-lib32/cddl
+	for libcompat in "" $ALL_libcompats; do
+		dirprfx=${libcompat:+obj-lib${libcompat}/}
+		run rm -rf "$OBJTOP"/${dirprfx}cddl
+	done
 fi
 
 # 20200916  WARNS bumped, need bootstrapped crunchgen stubs
@@ -127,7 +136,10 @@ fi
 # 20210108  821aa63a0940   non-widechar version of ncurses removed
 if [ -e "$OBJTOP"/lib/ncurses/ncursesw ]; then
 	echo "Removing stale ncurses objects"
-	run rm -rf "$OBJTOP"/lib/ncurses "$OBJTOP"/obj-lib32/lib/ncurses
+	for libcompat in "" $ALL_libcompats; do
+		dirprfx=${libcompat:+obj-lib${libcompat}/}
+		run rm -rf "$OBJTOP"/${dirprfx}lib/ncurses
+	done
 fi
 
 # 20210608  f20893853e8e    move from atomic.S to atomic.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202412092148.4B9Lmwp8033219>