commit:     0b7f9ad4c4d57b4348cf7a8a1f058f29ea21a42e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 26 22:54:16 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 26 22:54:16 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0b7f9ad4

sys-libs/readline: drop use of 'eval' for newer versions for patch generation

Use similar approach as dev-libs/mpfr and sys-libs/readline
for generating SRC_URI & patch list.

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

 ...ne-8.2_rc3.ebuild => readline-8.1_p2-r1.ebuild} | 105 +++++++++------------
 sys-libs/readline/readline-8.2_rc3.ebuild          |  51 ++++++----
 sys-libs/readline/readline-9999.ebuild             |  51 ++++++----
 3 files changed, 110 insertions(+), 97 deletions(-)

diff --git a/sys-libs/readline/readline-8.2_rc3.ebuild 
b/sys-libs/readline/readline-8.1_p2-r1.ebuild
similarity index 72%
copy from sys-libs/readline/readline-8.2_rc3.ebuild
copy to sys-libs/readline/readline-8.1_p2-r1.ebuild
index 934a8b1ce368..2732f7d7ae6a 100644
--- a/sys-libs/readline/readline-8.2_rc3.ebuild
+++ b/sys-libs/readline/readline-8.1_p2-r1.ebuild
@@ -3,10 +3,6 @@
 
 EAPI=7
 
-# There's no standard way of versioning the point releases upstream
-# make anyway, so while this was added for RC versions, it's fine
-# in general.
-QA_PKGCONFIG_VERSION=$(ver_cut 1-2)
 VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/chetramey.asc
 inherit flag-o-matic multilib multilib-minimal preserve-libs toolchain-funcs 
usr-ldscript verify-sig
 
@@ -16,53 +12,49 @@ PLEVEL="${PV##*_p}"
 MY_PV="${PV/_p*}"
 MY_PV="${MY_PV/_/-}"
 MY_P="${PN}-${MY_PV}"
-is_release() {
-       case ${PV} in
-               9999|*_alpha*|*_beta*|*_rc*) return 1 ;;
-               *) return 0 ;;
-       esac
-}
+MY_PATCHES=()
+
 [[ ${PV} != *_p* ]] && PLEVEL=0
-patches() {
-       [[ ${PLEVEL} -eq 0 ]] && return 1
-       local opt=$1
-       eval set -- {1..${PLEVEL}}
-       set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
-       if [[ ${opt} == -s ]] ; then
-               echo "${@/#/${DISTDIR}/}"
-       else
-               local u
-               for u in mirror://gnu/${PN} ftp://ftp.cwru.edu/pub/bash ; do
-                       printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
-                       printf "${u}/${PN}-${MY_PV}-patches/%s.sig " "$@"
-               done
-       fi
-}
 
 DESCRIPTION="Another cute console display library"
-HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html 
https://git.savannah.gnu.org/cgit/readline.git";
-
-if [[ ${PV} == 9999 ]] ; then
-       EGIT_REPO_URI="https://git.savannah.gnu.org/git/readline.git";
-       EGIT_BRANCH=devel
-       inherit git-r3
-elif is_release ; then
-       SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
-       SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig )"
-else
-       SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz 
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz";
-       SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig 
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
-fi
-
-if ! is_release ; then
-       inherit autotools
-fi
+HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html";
+
+case ${PV} in
+       *_alpha*|*_beta*|*_rc*)
+               SRC_URI+=" ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz";
+               SRC_URI+=" verify-sig? ( 
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
+       ;;
+
+       *)
+               SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz"
+               SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig 
)"
+
+               if [[ ${PLEVEL} -gt 0 ]] ; then
+                       # bash-5.1 -> bash51
+                       my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
+
+                       patch_url=
+                       my_patch_index=
+
+                       for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; 
my_patch_index++)) ; do
+                               for url in mirror://gnu/${pn} 
ftp://ftp.cwru.edu/pub/bash ; do
+                                       patch_url=$(printf 
"${url}/${PN}-$(ver_cut 1-2)-patches/${my_p}-%03d" ${my_patch_index})
+                                       SRC_URI+=" ${patch_url}"
+                                       SRC_URI+=" verify-sig? ( 
${patch_url}.sig )"
+                               done
+
+                               MY_PATCHES+=( "${DISTDIR}"/$(printf 
${my_p}-%03d ${my_patch_index}) )
+                       done
+
+                       unset my_pn patch_url my_patch_index
+               fi
+       ;;
+esac
 
 LICENSE="GPL-3"
 SLOT="0/8"  # subslot matches SONAME major
-if is_release ; then
-       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-fi
+[[ ${PV} == *_rc* ]] || \
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 IUSE="static-libs +unicode utils"
 
 
RDEPEND=">=sys-libs/ncurses-5.9-r3:=[static-libs?,unicode(+)?,${MULTILIB_USEDEP}]"
@@ -77,27 +69,22 @@ PATCHES=(
        "${FILESDIR}"/${PN}-6.2-rlfe-tgoto.patch #385091
        "${FILESDIR}"/${PN}-7.0-headers.patch
        "${FILESDIR}"/${PN}-8.0-headers.patch
-
-       # TODO: rebase
-       #"${FILESDIR}"/${PN}-8.0-darwin-shlib-versioning.patch
+       "${FILESDIR}"/${PN}-8.0-darwin-shlib-versioning.patch
+       "${FILESDIR}"/${PN}-8.1-windows-signals.patch
 )
 
+# Needed because we don't want the patches being unpacked
+# (which emits annoying and useless error messages)
 src_unpack() {
-       if [[ ${PV} == 9999 ]] ; then
-               git-r3_src_unpack
-       else
-               # Needed because we don't want the patches being unpacked
-               # (which emits annoying and useless error messages)
-               verify-sig_src_unpack
-               unpack ${MY_P}.tar.gz
-       fi
+       verify-sig_src_unpack
+
+       unpack ${MY_P}.tar.gz
 }
 
 src_prepare() {
-       [[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
-       default
+       [[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
 
-       is_release || eautoreconf
+       default
 
        if use prefix && [[ ! -x "${BROOT}"/usr/bin/pkg-config ]] ; then
                # If we're bootstrapping, make a guess. We don't have pkg-config

diff --git a/sys-libs/readline/readline-8.2_rc3.ebuild 
b/sys-libs/readline/readline-8.2_rc3.ebuild
index 934a8b1ce368..6ab39201ac56 100644
--- a/sys-libs/readline/readline-8.2_rc3.ebuild
+++ b/sys-libs/readline/readline-8.2_rc3.ebuild
@@ -16,28 +16,20 @@ PLEVEL="${PV##*_p}"
 MY_PV="${PV/_p*}"
 MY_PV="${MY_PV/_/-}"
 MY_P="${PN}-${MY_PV}"
+MY_PATCHES=()
+
 is_release() {
        case ${PV} in
-               9999|*_alpha*|*_beta*|*_rc*) return 1 ;;
-               *) return 0 ;;
+               9999|*_alpha*|*_beta*|*_rc*)
+                       return 1
+                       ;;
+               *)
+                       return 0
+                       ;;
        esac
 }
+
 [[ ${PV} != *_p* ]] && PLEVEL=0
-patches() {
-       [[ ${PLEVEL} -eq 0 ]] && return 1
-       local opt=$1
-       eval set -- {1..${PLEVEL}}
-       set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
-       if [[ ${opt} == -s ]] ; then
-               echo "${@/#/${DISTDIR}/}"
-       else
-               local u
-               for u in mirror://gnu/${PN} ftp://ftp.cwru.edu/pub/bash ; do
-                       printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
-                       printf "${u}/${PN}-${MY_PV}-patches/%s.sig " "$@"
-               done
-       fi
-}
 
 DESCRIPTION="Another cute console display library"
 HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html 
https://git.savannah.gnu.org/cgit/readline.git";
@@ -47,8 +39,28 @@ if [[ ${PV} == 9999 ]] ; then
        EGIT_BRANCH=devel
        inherit git-r3
 elif is_release ; then
-       SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+       SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz"
        SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig )"
+
+       if [[ ${PLEVEL} -gt 0 ]] ; then
+               # bash-5.1 -> bash51
+               my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
+
+               patch_url=
+               my_patch_index=
+
+               for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; 
my_patch_index++)) ; do
+                       for url in mirror://gnu/${pn} 
ftp://ftp.cwru.edu/pub/bash ; do
+                               patch_url=$(printf "${url}/${PN}-$(ver_cut 
1-2)-patches/${my_p}-%03d" ${my_patch_index})
+                               SRC_URI+=" ${patch_url}"
+                               SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
+                       done
+
+                       MY_PATCHES+=( "${DISTDIR}"/$(printf ${my_p}-%03d 
${my_patch_index}) )
+               done
+
+               unset my_pn patch_url my_patch_index
+       fi
 else
        SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz 
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz";
        SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig 
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
@@ -94,7 +106,8 @@ src_unpack() {
 }
 
 src_prepare() {
-       [[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
+       [[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
+
        default
 
        is_release || eautoreconf

diff --git a/sys-libs/readline/readline-9999.ebuild 
b/sys-libs/readline/readline-9999.ebuild
index 934a8b1ce368..6ab39201ac56 100644
--- a/sys-libs/readline/readline-9999.ebuild
+++ b/sys-libs/readline/readline-9999.ebuild
@@ -16,28 +16,20 @@ PLEVEL="${PV##*_p}"
 MY_PV="${PV/_p*}"
 MY_PV="${MY_PV/_/-}"
 MY_P="${PN}-${MY_PV}"
+MY_PATCHES=()
+
 is_release() {
        case ${PV} in
-               9999|*_alpha*|*_beta*|*_rc*) return 1 ;;
-               *) return 0 ;;
+               9999|*_alpha*|*_beta*|*_rc*)
+                       return 1
+                       ;;
+               *)
+                       return 0
+                       ;;
        esac
 }
+
 [[ ${PV} != *_p* ]] && PLEVEL=0
-patches() {
-       [[ ${PLEVEL} -eq 0 ]] && return 1
-       local opt=$1
-       eval set -- {1..${PLEVEL}}
-       set -- $(printf "${PN}${MY_PV/\.}-%03d " "$@")
-       if [[ ${opt} == -s ]] ; then
-               echo "${@/#/${DISTDIR}/}"
-       else
-               local u
-               for u in mirror://gnu/${PN} ftp://ftp.cwru.edu/pub/bash ; do
-                       printf "${u}/${PN}-${MY_PV}-patches/%s " "$@"
-                       printf "${u}/${PN}-${MY_PV}-patches/%s.sig " "$@"
-               done
-       fi
-}
 
 DESCRIPTION="Another cute console display library"
 HOMEPAGE="https://tiswww.case.edu/php/chet/readline/rltop.html 
https://git.savannah.gnu.org/cgit/readline.git";
@@ -47,8 +39,28 @@ if [[ ${PV} == 9999 ]] ; then
        EGIT_BRANCH=devel
        inherit git-r3
 elif is_release ; then
-       SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz $(patches)"
+       SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz"
        SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig )"
+
+       if [[ ${PLEVEL} -gt 0 ]] ; then
+               # bash-5.1 -> bash51
+               my_p=${PN}$(ver_rs 1-2 '' $(ver_cut 1-2))
+
+               patch_url=
+               my_patch_index=
+
+               for ((my_patch_index=1; my_patch_index <= ${PLEVEL} ; 
my_patch_index++)) ; do
+                       for url in mirror://gnu/${pn} 
ftp://ftp.cwru.edu/pub/bash ; do
+                               patch_url=$(printf "${url}/${PN}-$(ver_cut 
1-2)-patches/${my_p}-%03d" ${my_patch_index})
+                               SRC_URI+=" ${patch_url}"
+                               SRC_URI+=" verify-sig? ( ${patch_url}.sig )"
+                       done
+
+                       MY_PATCHES+=( "${DISTDIR}"/$(printf ${my_p}-%03d 
${my_patch_index}) )
+               done
+
+               unset my_pn patch_url my_patch_index
+       fi
 else
        SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.gz 
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz";
        SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${MY_P}.tar.gz.sig 
ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz.sig )"
@@ -94,7 +106,8 @@ src_unpack() {
 }
 
 src_prepare() {
-       [[ ${PLEVEL} -gt 0 ]] && eapply -p0 $(patches -s)
+       [[ ${PLEVEL} -gt 0 ]] && eapply -p0 "${MY_PATCHES[@]}"
+
        default
 
        is_release || eautoreconf

Reply via email to