From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1425693-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B39CA158094 for <garchives@archives.gentoo.org>; Sat, 6 Aug 2022 21:01:27 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D252FE0C5E; Sat, 6 Aug 2022 21:01:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9C530E0C5E for <gentoo-commits@lists.gentoo.org>; Sat, 6 Aug 2022 21:01:26 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A06B5341235 for <gentoo-commits@lists.gentoo.org>; Sat, 6 Aug 2022 21:01:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id CCA1E566 for <gentoo-commits@lists.gentoo.org>; Sat, 6 Aug 2022 21:01:23 +0000 (UTC) From: "Sam James" <sam@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org> Message-ID: <1659819628.e8f0e06784549fc4c8a06e0a43ff946d6a895683.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/estrip X-VCS-Directories: bin/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: e8f0e06784549fc4c8a06e0a43ff946d6a895683 X-VCS-Branch: master Date: Sat, 6 Aug 2022 21:01:23 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 4401d3b0-bf71-49fd-9ed3-a050ec077cbe X-Archives-Hash: 1be5cab3f6e939b66f3c94c21907dbdf commit: e8f0e06784549fc4c8a06e0a43ff946d6a895683 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Aug 1 01:44:02 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Aug 6 21:00:28 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e8f0e067 estrip: apply scanelf optimisation to EAPI 7+ / dostrip (No need to do ${D%/} etc here as dostrip is in EAPI 7+ only.) See: bb88e766897f5e7e0b0a10c48cf99a04edb73a40 Bug: https://bugs.gentoo.org/749624 Bug: https://bugs.gentoo.org/862606 Signed-off-by: Sam James <sam <AT> gentoo.org> Closes: https://github.com/gentoo/portage/pull/879 Signed-off-by: Sam James <sam <AT> gentoo.org> bin/estrip | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/bin/estrip b/bin/estrip index 0ed35111d..68ce8bd4d 100755 --- a/bin/estrip +++ b/bin/estrip @@ -64,12 +64,51 @@ while [[ $# -gt 0 ]] ; do done if [[ ${find_paths[@]} ]]; then + # We can avoid scanelf calls for binaries we already + # checked in install_qa_check (where we generate + # NEEDED for everything installed). + # + # EAPI 7+ has controlled stripping (dostrip) though + # which is why estrip has the queue/dequeue logic, + # so we need to take the intersection of: + # 1. files scanned earlier (all ELF installed) + # (note that this should be a superset of 2., so we don't + # need to worry about unknown files appearing) + # + # 2. the files we're interested in right now + scanelf_results=() + if [[ -f "${PORTAGE_BUILDDIR}"/build-info/NEEDED ]] ; then + # The arguments may not be exact files (probably aren't), but search paths/directories + # which should then be searched recursively. + while IFS= read -r needed_entry ; do + for find_path in "${find_paths[@]}" ; do + # NEEDED has a bunch of entries like: + # /usr/lib64/libfoo.so libc.so + # + # find_path entries may be exact paths (like /usr/lib64/libfoo.so) + # or instead /usr/lib64, or ${ED}/usr, etc. + # + # We check if the beginning (i.e. first entry) of the NEEDED line + # matches the path given + # e.g. find_path="/usr/lib64" will match needed_entry="/usr/lib64/libfoo.so libc.so". + needed_entry_file="${needed_entry% *}" + if [[ "${needed_entry_file}" =~ ^${find_path##${D}} ]] ; then + scanelf_results+=( "${D}${needed_entry_file}" ) + fi + done + done < "${PORTAGE_BUILDDIR}"/build-info/NEEDED + else + scanelf_results=$(scanelf -yqRBF '#k%F' -k '.symtab' "${find_paths[@]}") + fi + while IFS= read -r path; do >> "${path}.estrip" || die done < <( - scanelf -yqRBF '#k%F' -k '.symtab' "${find_paths[@]}" + printf "%s\n" "${scanelf_results[@]}" find "${find_paths[@]}" -type f ! -type l -name '*.a' ) + + unset scanelf_results needed_entry needed_entry_file find_path fi exit 0