commit: 918b21dea9fc7e714c08dcedc24d0daf6b52ccdb
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 2 07:44:21 2023 +0000
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Jun 3 16:26:13 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=918b21de
texlive-module.eclass: Reduce number of executed external commands
For texlive-latexextra-2021[doc], the number of "mv" commands is
reduced from 12718 to 3130. Speedup is also by a factor of about 4,
which saves another 4 seconds.
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
eclass/texlive-module.eclass | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index 6b411cb76c84..65c442d5b67f 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.eclass
@@ -164,10 +164,18 @@ texlive-module_src_unpack() {
sed -e 's/\/[^/]*$//' -e "s:^:${RELOC_TARGET}/:" "${T}/reloclist" |
sort -u |
xargs mkdir -p || die
- local i
+ local i dir="" files=()
while read i; do
- mv "${i}" "${RELOC_TARGET}/${i%/*}" || die
+ if [[ ${RELOC_TARGET}/${i%/*} != "${dir}" ]]; then
+ # new dir, do the previous move
+ [[ -z ${dir} ]] || mv "${files[@]}" "${dir}" || die
+ dir="${RELOC_TARGET}/${i%/*}"
+ files=()
+ fi
+ # collect files with same destination dir
+ files+=( "${i}" )
done < "${T}/reloclist"
+ mv "${files[@]}" "${dir}" || die
}
# @FUNCTION: texlive-module_add_format