git: d6b1b779b8e7 - stable/15 - check-old-libs: Show information about packages

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Tue, 16 Jun 2026 01:00:54 UTC
The branch stable/15 has been updated by des:

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

commit d6b1b779b8e75f55da5beaa087f2e11bfc28133d
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-06 07:54:21 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-16 01:00:11 +0000

    check-old-libs: Show information about packages
    
    If pkg is installed, for each old library found to still be present,
    check if any installed packages either provide or require the library,
    and inform the user.
    
    MFC after:      1 week
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D53977
    
    (cherry picked from commit 8d9dff23f206cb86aed9857a985ed09cd38eb5ac)
---
 Makefile.inc1 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 2c79a8c7920a..fc973f51fd13 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -3829,6 +3829,15 @@ check-old-libs: .PHONY
 	while read file; do \
 		if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \
 			echo "${DESTDIR}/$${file}"; \
+			if packages=$$(${LOCALBASE:Q}/sbin/pkg -r ${DESTDIR:U/} \
+			    shlib -qP $${file##*/} 2>/dev/null) && \
+			    [ -n "$${packages}" ]; then \
+				echo "    also provided by:" $${packages}; \
+			elif packages=$$(${LOCALBASE:Q}/sbin/pkg -r ${DESTDIR:U/} \
+			    shlib -qR $${file##*/} 2>/dev/null) && \
+			    [ -n "$${packages}" ]; then \
+				echo "    required by:" $${packages}; \
+			fi; \
 		fi; \
 		for ext in debug symbols; do \
 		  if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \