From 97812dcc9ddb1e043d8a67216692b214d62099a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 14 Apr 2020 15:14:42 +0200 Subject: [PATCH] texlive-module.eclass: Optimize src_unpack() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This goes a bit further than slyfox's work. On my machine, it reduces the post-unpack time from ~44m to ~13m. Bug: https://bugs.gentoo.org/688922 Acked-by: Mikle Kolyada Signed-off-by: Michał Górny --- eclass/texlive-module.eclass | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass index a415205e035f..fc83abe49c54 100644 --- a/eclass/texlive-module.eclass +++ b/eclass/texlive-module.eclass @@ -140,16 +140,14 @@ RELOC_TARGET=texmf-dist texlive-module_src_unpack() { unpack ${A} - grep RELOC tlpkg/tlpobj/* | awk '{print $2}' | sed 's#^RELOC/##' > "${T}/reloclist" || die - { for i in $(<"${T}/reloclist"); do dirname ${i}; done; } | uniq > "${T}/dirlist" - for i in $(<"${T}/dirlist"); do - if [[ ! -d ${RELOC_TARGET}/${i} ]]; then - mkdir -p "${RELOC_TARGET}/${i}" || die - fi - done - for i in $(<"${T}/reloclist"); do - mv "${i}" "${RELOC_TARGET}"/$(dirname "${i}") || die "failed to relocate ${i} to ${RELOC_TARGET}/$(dirname ${i})" - done + sed -n -e 's:\s*RELOC/::p' tlpkg/tlpobj/* > "${T}/reloclist" || die + sed -e 's/\/[^/]*$//' -e "s:^:${RELOC_TARGET}/:" "${T}/reloclist" | + sort -u | + xargs mkdir -p || die + local i + while read i; do + mv "${i}" "${RELOC_TARGET}/${i%/*}" || die + done < "${T}/reloclist" } # @FUNCTION: texlive-module_add_format -- 2.26.2