commit:     90ab23e9707f3e99d96ddffd3156e8b7463c6cf3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  2 21:44:23 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun  2 21:46:30 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90ab23e9

dev-libs/mpfr: optimise SRC_URI generation

Thanks to radhermit's new pkgcraft tooling.

Before:
```
dev-libs/mpfr-4.1.1_p1::.: 9.772001ms
dev-libs/mpfr-4.2.0::.: 10.090884ms
dev-libs/mpfr-4.1.0_p13-r1::.: 25.19919ms
dev-libs/mpfr-4.2.0_p9::.: 42.215071ms
```

After:
```
dev-libs/mpfr-4.1.0_p13-r1::.: 8.216098ms
dev-libs/mpfr-4.1.1_p1::.: 8.41175ms
dev-libs/mpfr-4.2.0::.: 8.736772ms
dev-libs/mpfr-4.2.0_p9::.: 9.751731ms
```

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/mpfr/mpfr-4.1.0_p13-r1.ebuild | 17 +++++++++++++----
 dev-libs/mpfr/mpfr-4.1.1_p1.ebuild     | 17 +++++++++++++----
 dev-libs/mpfr/mpfr-4.2.0.ebuild        | 16 ++++++++++++----
 dev-libs/mpfr/mpfr-4.2.0_p9.ebuild     | 17 +++++++++++++----
 4 files changed, 51 insertions(+), 16 deletions(-)

diff --git a/dev-libs/mpfr/mpfr-4.1.0_p13-r1.ebuild 
b/dev-libs/mpfr/mpfr-4.1.0_p13-r1.ebuild
index c745a8df1724..25319964c958 100644
--- a/dev-libs/mpfr/mpfr-4.1.0_p13-r1.ebuild
+++ b/dev-libs/mpfr/mpfr-4.1.0_p13-r1.ebuild
@@ -18,18 +18,27 @@ MY_P=${PN}-${MY_PV}
 DESCRIPTION="Library for multiple-precision floating-point computations with 
exact rounding"
 HOMEPAGE="https://www.mpfr.org/ https://gitlab.inria.fr/mpfr";
 SRC_URI="https://www.mpfr.org/${MY_P}/${MY_P}.tar.xz";
+
 if [[ ${PV} == *_p* ]] ; then
        # If this is a patch release, we have to download each of the patches:
        # -_pN = N patches
        # - patch file names are like: patch01, patch02, ..., patch10, patch12, 
..
        #
        # => name the ebuild _pN where N is the number of patches on the 'bugs' 
page.
-       for ((my_patch_index=1; my_patch_index <= MY_PATCH; my_patch_index++)); 
do
-               SRC_URI+=" $(printf "https://www.mpfr.org/${MY_P}/patch%02d -> 
${MY_P}-patch%02d.patch " ${my_patch_index}{,})"
-               MY_PATCHES+=( "${DISTDIR}"/$(printf ${MY_P}-patch%02d.patch 
${my_patch_index}) )
+       patch_url_base="https://www.mpfr.org/${MY_P}";
+       my_patch_index=
+
+       for ((my_patch_index=1; my_patch_index <= MY_PATCH ; my_patch_index++)) 
; do
+               printf -v mangled_patch_ver "patch%02d" "${my_patch_index}"
+
+               SRC_URI+=" ${patch_url_base}/${mangled_patch_ver} -> 
${MY_P}-${mangled_patch_ver}.patch"
+
+               MY_PATCHES+=( "${DISTDIR}"/${MY_P}-${mangled_patch_ver}.patch )
        done
-       unset my_patch_index
+
+       unset patch_url_base my_patch_index mangled_patch_ver
 fi
+
 S="${WORKDIR}/${MY_P}"
 
 LICENSE="LGPL-2.1"

diff --git a/dev-libs/mpfr/mpfr-4.1.1_p1.ebuild 
b/dev-libs/mpfr/mpfr-4.1.1_p1.ebuild
index f448fa9556f6..cfa58819d8f8 100644
--- a/dev-libs/mpfr/mpfr-4.1.1_p1.ebuild
+++ b/dev-libs/mpfr/mpfr-4.1.1_p1.ebuild
@@ -18,18 +18,27 @@ MY_P=${PN}-${MY_PV}
 DESCRIPTION="Library for multiple-precision floating-point computations with 
exact rounding"
 HOMEPAGE="https://www.mpfr.org/ https://gitlab.inria.fr/mpfr";
 SRC_URI="https://www.mpfr.org/${MY_P}/${MY_P}.tar.xz";
+
 if [[ ${PV} == *_p* ]] ; then
        # If this is a patch release, we have to download each of the patches:
        # -_pN = N patches
        # - patch file names are like: patch01, patch02, ..., patch10, patch12, 
..
        #
        # => name the ebuild _pN where N is the number of patches on the 'bugs' 
page.
-       for ((my_patch_index=1; my_patch_index <= MY_PATCH; my_patch_index++)); 
do
-               SRC_URI+=" $(printf "https://www.mpfr.org/${MY_P}/patch%02d -> 
${MY_P}-patch%02d.patch " ${my_patch_index}{,})"
-               MY_PATCHES+=( "${DISTDIR}"/$(printf ${MY_P}-patch%02d.patch 
${my_patch_index}) )
+       patch_url_base="https://www.mpfr.org/${MY_P}";
+       my_patch_index=
+
+       for ((my_patch_index=1; my_patch_index <= MY_PATCH ; my_patch_index++)) 
; do
+               printf -v mangled_patch_ver "patch%02d" "${my_patch_index}"
+
+               SRC_URI+=" ${patch_url_base}/${mangled_patch_ver} -> 
${MY_P}-${mangled_patch_ver}.patch"
+
+               MY_PATCHES+=( "${DISTDIR}"/${MY_P}-${mangled_patch_ver}.patch )
        done
-       unset my_patch_index
+
+       unset patch_url_base my_patch_index mangled_patch_ver
 fi
+
 S="${WORKDIR}/${MY_P}"
 
 LICENSE="LGPL-2.1"

diff --git a/dev-libs/mpfr/mpfr-4.2.0.ebuild b/dev-libs/mpfr/mpfr-4.2.0.ebuild
index 1306c9897965..2d6a6826dd43 100644
--- a/dev-libs/mpfr/mpfr-4.2.0.ebuild
+++ b/dev-libs/mpfr/mpfr-4.2.0.ebuild
@@ -27,12 +27,20 @@ if [[ ${PV} == *_p* ]] ; then
        # - patch file names are like: patch01, patch02, ..., patch10, patch12, 
..
        #
        # => name the ebuild _pN where N is the number of patches on the 'bugs' 
page.
-       for ((my_patch_index=1; my_patch_index <= MY_PATCH; my_patch_index++)); 
do
-               SRC_URI+=" $(printf "https://www.mpfr.org/${PN}-$(ver_cut 
1-3)/patch%02d -> ${PN}-$(ver_cut 1-3)-patch%02d.patch " ${my_patch_index}{,})"
-               MY_PATCHES+=( "${DISTDIR}"/$(printf ${PN}-$(ver_cut 
1-3)-patch%02d.patch ${my_patch_index}) )
+       patch_url_base="https://www.mpfr.org/${MY_P}";
+       my_patch_index=
+
+       for ((my_patch_index=1; my_patch_index <= MY_PATCH ; my_patch_index++)) 
; do
+               printf -v mangled_patch_ver "patch%02d" "${my_patch_index}"
+
+               SRC_URI+=" ${patch_url_base}/${mangled_patch_ver} -> 
${MY_P}-${mangled_patch_ver}.patch"
+
+               MY_PATCHES+=( "${DISTDIR}"/${MY_P}-${mangled_patch_ver}.patch )
        done
-       unset my_patch_index
+
+       unset patch_url_base my_patch_index mangled_patch_ver
 fi
+
 S="${WORKDIR}/${MY_P}"
 
 LICENSE="LGPL-2.1"

diff --git a/dev-libs/mpfr/mpfr-4.2.0_p9.ebuild 
b/dev-libs/mpfr/mpfr-4.2.0_p9.ebuild
index f622527c68cf..bcbbe69004fc 100644
--- a/dev-libs/mpfr/mpfr-4.2.0_p9.ebuild
+++ b/dev-libs/mpfr/mpfr-4.2.0_p9.ebuild
@@ -27,12 +27,21 @@ if [[ ${PV} == *_p* ]] ; then
        # - patch file names are like: patch01, patch02, ..., patch10, patch12, 
..
        #
        # => name the ebuild _pN where N is the number of patches on the 'bugs' 
page.
-       for ((my_patch_index=1; my_patch_index <= MY_PATCH; my_patch_index++)); 
do
-               SRC_URI+=" $(printf "https://www.mpfr.org/${PN}-$(ver_cut 
1-3)/patch%02d -> ${PN}-$(ver_cut 1-3)-patch%02d.patch " ${my_patch_index}{,})"
-               MY_PATCHES+=( "${DISTDIR}"/$(printf ${PN}-$(ver_cut 
1-3)-patch%02d.patch ${my_patch_index}) )
+       patch_url_base="https://www.mpfr.org/${MY_P}";
+       my_patch_index=
+
+       for ((my_patch_index=1; my_patch_index <= MY_PATCH ; my_patch_index++)) 
; do
+               printf -v mangled_patch_ver "patch%02d" "${my_patch_index}"
+
+               SRC_URI+=" ${patch_url_base}/${mangled_patch_ver} -> 
${MY_P}-${mangled_patch_ver}.patch"
+
+               MY_PATCHES+=( "${DISTDIR}"/${MY_P}-${mangled_patch_ver}.patch )
        done
-       unset my_patch_index
+
+       unset patch_url_base my_patch_index mangled_patch_ver
+
 fi
+
 S="${WORKDIR}/${MY_P}"
 
 LICENSE="LGPL-2.1"

Reply via email to