From nobody Tue Sep 12 18:32:39 2023 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RlXJ74CTXz4ss9d; Tue, 12 Sep 2023 18:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RlXJ73gBjz4dKy; Tue, 12 Sep 2023 18:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694543559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GXWPb5OHCuVtIG0L/WVlEWd3nwjJatNcVSNqS/xw7iA=; b=kIGqOoO9xZrSaBNrXQeegXh9X222yCM+ZZo6gFFyLDMUaKhfxnv9ZLZEJWeFtA2lYLCGUX Www6FbA6ocIDud5QCz6SDNdHFPV6zStq7gDeQo/78TGss6yMPvM3t+pYfyW79v8HIWXjfR En8udf+aRPjYSxbCEMJZidps2FaPFU/UodTpSqzYGndQOrwAQEstH7e13x8bM9f+wayJZL t2LpKk5kC0inl1im0NXuh3FA2rP4R63UBC9Rg8Q6llzRnuVgrQS7h7cyD9h7B3ktL2S4dl lfbNlopJjgstwsKtBaLBZin4n/ByeJE4B/Lt8nrxwXek4r/7aoipj/spLfcZ1Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694543559; a=rsa-sha256; cv=none; b=DDtk+ZrZRQwqd7l0wxzQdMkrArbKYLg53zKlv/A0Pk9B+L/lRIZw6sf+t5WnjrQGFejaOS lCUsV5BX+dp4MRWM+0eJ3uFav5zk2bkPp8ZW8TnizZKyp2puvAf+s9H0sCn1DPtpAiIDe6 OfvXFi/82vBfNY067HPIcn3gNOSjKOsClzQThE/1u1sE6yzLYU2JPox8aMtIsbZCsEhn6i Xt6sn0FqpgH2ioD6d7ywO01NjZuButiaOzGkHcEjTrGRktGOxQ/kcXUwnSmhC0rJZje/i0 lDGQJAf6VtuUWKvCKp7aDCXUWKG2Vq9upQewUzLhWBvR6Q49nJUFci9fRw3J0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694543559; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GXWPb5OHCuVtIG0L/WVlEWd3nwjJatNcVSNqS/xw7iA=; b=x/Jpd+zybDYc15c04WaaM/L7nLptHnBXWGZ3JJegI04Yq2vFTq5evfc+SW/Drfymsa4QTF 0361c/n/+qYEmJ9dWSUowG13d1ZLACf1hl/7AcghX2btV9iVYW9uMJW7lEdlZfQoTocR62 qcOf3dy+pmuSYlnZXLMoUF0JaAcRuu7gqdeJai+fjq+44ObOD04rf1GINifyly09zGscAD QcXhpx+iWZVoJszUVWdF18/GsxDgi7KkLPOwn2zO6JJFvku72t+yuthVMEuD5v5wgG9WE1 0FWbeADLQNMxkkjurGRUoNaHPdCJ5/DkxqNDQO9IzeAJ41FPT33BfmMyGoSi9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RlXJ72knJzjkZ; Tue, 12 Sep 2023 18:32:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38CIWdRi055175; Tue, 12 Sep 2023 18:32:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38CIWd2k055172; Tue, 12 Sep 2023 18:32:39 GMT (envelope-from git) Date: Tue, 12 Sep 2023 18:32:39 GMT Message-Id: <202309121832.38CIWd2k055172@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: "Tobias C. Berner" Subject: git: f3790c0170d8 - main - sanity: warn about unnused LIB_DEPENDS entries List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tcberner X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f3790c0170d85995b0fa58c6c50cef03088bf5ec Auto-Submitted: auto-generated The branch main has been updated by tcberner: URL: https://cgit.FreeBSD.org/ports/commit/?id=f3790c0170d85995b0fa58c6c50cef03088bf5ec commit f3790c0170d85995b0fa58c6c50cef03088bf5ec Author: Tobias C. Berner AuthorDate: 2023-09-12 15:21:03 +0000 Commit: Tobias C. Berner CommitDate: 2023-09-12 18:27:47 +0000 sanity: warn about unnused LIB_DEPENDS entries `stage-qa` already warns about missing dependencies. However, it does not warn about possibly unneeded ones. This change tries to address this, by simply walking the list of linked against shared libraries and then matching the entries of LIB_DEPENDS against them. Note: this may lead to false positives -- as always, user your brain, and don't rely on output of static tools alone. Possible output might look like: [...] ====> Running Q/A tests (stage-qa) Warning: you might not need LIB_DEPENDS on libqgpgme.so Warning: you might not need LIB_DEPENDS on libintl.so Warning: you might not need LIB_DEPENDS on libKF5IconThemes.so Warning: you might not need LIB_DEPENDS on libqca-qt5.so Warning: you might not need LIB_DEPENDS on libQt5Test.so [...] Note, that in this case all are false positives. Differential Revision: https://reviews.freebsd.org/D27304 --- Mk/Scripts/qa.sh | 11 ++++++++++- Mk/bsd.port.mk | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh index bdbff58cdb23..63fa9f6f370e 100644 --- a/Mk/Scripts/qa.sh +++ b/Mk/Scripts/qa.sh @@ -649,7 +649,7 @@ proxydeps_suggest_uses() { } proxydeps() { - local file dep_file dep_file_pkg already rc + local file dep_file dep_file_pkg already rc dep_lib_file dep_lib_files rc=0 @@ -697,6 +697,8 @@ proxydeps() { rc=1 fi already="${already} ${dep_file}" + dep_lib_file=$(basename ${dep_file}) + dep_lib_files="${dep_lib_files} ${dep_lib_file%%.so*}.so" done <<-EOT $(env LD_LIBMAP_DISABLE=1 ldd -a "${STAGEDIR}${file}" | \ awk ' @@ -712,6 +714,13 @@ proxydeps() { sed -e 's/^\.//') EOT + # Check whether all files in LIB_DPEENDS are actually linked against + for _library in ${WANTED_LIBRARIES} ; do + if ! listcontains ${_library} "${dep_lib_files}" ; then + warn "you might not need LIB_DEPENDS on ${_library}" + fi + done + [ -z "${PROXYDEPS_FATAL}" ] && return 0 return ${rc} diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index b11c99fc0476..4679774d9640 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1650,6 +1650,7 @@ QA_ENV+= STAGEDIR=${STAGEDIR} \ PKGORIGIN=${PKGORIGIN} \ LIB_RUN_DEPENDS='${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,}' \ UNIFIED_DEPENDS=${_UNIFIED_DEPENDS:C,([^:]*:[^:]*):?.*,\1,:O:u:Q} \ + WANTED_LIBRARIES='${LIB_DEPENDS:C,([^:]*):([^:]*):?.*,\1,}' \ PKGBASE=${PKGBASE} \ LICENSE="${LICENSE}" \ LICENSE_PERMS="${_LICENSE_PERMS}" \