diff options
author | Ulrich Müller <ulm@gentoo.org> | 2023-06-02 01:09:59 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2023-06-03 18:26:12 +0200 |
commit | 6ee282f0645dcfccf1836b9cc7ae55556629eb8b (patch) | |
tree | b23858870398ca2da402b6df5a6eafc351a3ed40 /eclass | |
parent | media-gfx/libimagequant: Stabilize 4.2.0 amd64, #907768 (diff) | |
download | gentoo-6ee282f0645dcfccf1836b9cc7ae55556629eb8b.tar.gz gentoo-6ee282f0645dcfccf1836b9cc7ae55556629eb8b.tar.bz2 gentoo-6ee282f0645dcfccf1836b9cc7ae55556629eb8b.zip |
texlive-module.eclass: Speed up SRC_URI calculation
For texlive-latexextra-2021, SRC_URI calculation ran for 37 seconds
here. Reduced it to 0.025 seconds (i.e. more than a factor 1000) by
using bash arrays and parameter expansion instead of nested loops.
Reported-by: Tim Harder <radhermit@gentoo.org>
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/texlive-module.eclass | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass index fea4003c37a8..6b411cb76c84 100644 --- a/eclass/texlive-module.eclass +++ b/eclass/texlive-module.eclass @@ -99,32 +99,39 @@ TEXLIVE_DEVS=${TEXLIVE_DEVS:- zlogene dilfridge sam } BDEPEND="${COMMON_DEPEND} app-arch/xz-utils" -for i in ${TEXLIVE_MODULE_CONTENTS}; do - for tldev in ${TEXLIVE_DEVS}; do - SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}" - done +tl_uri_prefix="https://dev.gentoo.org/~@dev@/distfiles/texlive/tl-" +tl_uri_suffix="-${PV}.${PKGEXT}" + +tl_uri=( ${TEXLIVE_MODULE_CONTENTS} ) +tl_uri=( "${tl_uri[@]/%/${tl_uri_suffix}}" ) +for tldev in ${TEXLIVE_DEVS}; do + SRC_URI+=" ${tl_uri[*]/#/${tl_uri_prefix/@dev@/${tldev}}}" done # Forge doc SRC_URI -[[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]] && SRC_URI="${SRC_URI} doc? (" -for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do +if [[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]]; then + SRC_URI+=" doc? (" + tl_uri=( ${TEXLIVE_MODULE_DOC_CONTENTS} ) + tl_uri=( "${tl_uri[@]/%/${tl_uri_suffix}}" ) for tldev in ${TEXLIVE_DEVS}; do - SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}" + SRC_URI+=" ${tl_uri[*]/#/${tl_uri_prefix/@dev@/${tldev}}}" done -done -[[ -n ${TEXLIVE_MODULE_DOC_CONTENTS} ]] && SRC_URI="${SRC_URI} )" + SRC_URI+=" )" +fi # Forge source SRC_URI -if [[ -n ${TEXLIVE_MODULE_SRC_CONTENTS} ]] ; then - SRC_URI="${SRC_URI} source? (" - for i in ${TEXLIVE_MODULE_SRC_CONTENTS}; do - for tldev in ${TEXLIVE_DEVS}; do - SRC_URI="${SRC_URI} https://dev.gentoo.org/~${tldev}/distfiles/texlive/tl-${i}-${PV}.${PKGEXT}" - done +if [[ -n ${TEXLIVE_MODULE_SRC_CONTENTS} ]]; then + SRC_URI+=" source? (" + tl_uri=( ${TEXLIVE_MODULE_SRC_CONTENTS} ) + tl_uri=( "${tl_uri[@]/%/${tl_uri_suffix}}" ) + for tldev in ${TEXLIVE_DEVS}; do + SRC_URI+=" ${tl_uri[*]/#/${tl_uri_prefix/@dev@/${tldev}}}" done - SRC_URI="${SRC_URI} )" + SRC_URI+=" )" fi +unset tldev tl_uri tl_uri_prefix tl_uri_suffix + RDEPEND="${COMMON_DEPEND}" IUSE="${IUSE} doc" |