From: Michał Górny Date: Tue, 14 Apr 2020 13:14:42 +0000 (+0200) Subject: texlive-module.eclass: Optimize src_unpack() X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=97812dcc9ddb1e043d8a67216692b214d62099a7;p=gentoo.git texlive-module.eclass: Optimize src_unpack() 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 --- 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