From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1524777-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 1E0F215806E
	for <garchives@archives.gentoo.org>; Fri,  2 Jun 2023 18:39:37 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 5A4D0E08DA;
	Fri,  2 Jun 2023 18:39:36 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 3EF21E08DA
	for <gentoo-commits@lists.gentoo.org>; Fri,  2 Jun 2023 18:39:36 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 2B336341380
	for <gentoo-commits@lists.gentoo.org>; Fri,  2 Jun 2023 18:39:35 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 89F59A71
	for <gentoo-commits@lists.gentoo.org>; Fri,  2 Jun 2023 18:39:33 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1685731146.c4f94037c93aba068d04b843784e59067a589f33.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/ncurses-compat/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-libs/ncurses-compat/ncurses-compat-6.4_p20230401.ebuild
X-VCS-Directories: sys-libs/ncurses-compat/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: c4f94037c93aba068d04b843784e59067a589f33
X-VCS-Branch: master
Date: Fri,  2 Jun 2023 18:39:33 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 061356b3-b3c7-4df9-9551-064803ac6851
X-Archives-Hash: 611a2fd210929a3e26230fbe912ac32c

commit:     c4f94037c93aba068d04b843784e59067a589f33
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  2 18:35:35 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun  2 18:39:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4f94037

sys-libs/ncurses-compat: optimise SRC_URI generation

Thanks to radhermit's new pkgcraft tooling.

Before:
```
sys-libs/ncurses-compat-6.4_p20230401::gentoo: 46.290096ms
```

After:
```
sys-libs/ncurses-compat-6.4_p20230401::gentoo: 9.308438ms
```

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

 .../ncurses-compat-6.4_p20230401.ebuild            | 52 ++++++++++------------
 1 file changed, 24 insertions(+), 28 deletions(-)

diff --git a/sys-libs/ncurses-compat/ncurses-compat-6.4_p20230401.ebuild b/sys-libs/ncurses-compat/ncurses-compat-6.4_p20230401.ebuild
index 9732adbcdda4..b4d792b322ad 100644
--- a/sys-libs/ncurses-compat/ncurses-compat-6.4_p20230401.ebuild
+++ b/sys-libs/ncurses-compat/ncurses-compat-6.4_p20230401.ebuild
@@ -62,36 +62,32 @@ if [[ ${PV} == *_p* ]] ; then
 	)
 
 	if [[ -z ${PATCH_DATES[@]} ]] ; then
-		SRC_URI+=" https://invisible-island.net/archives/${PN}/${PV/_p*}/${P/_p/-}.patch.sh.gz"
-		SRC_URI+=" verify-sig? ( https://invisible-island.net/archives/${PN}/${PV/_p*}/${P/_p/-}.patch.sh.gz.asc"
+		SRC_URI+=" https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P/_p/-}.patch.sh.gz"
+		SRC_URI+=" verify-sig? ( https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P/_p/-}.patch.sh.gz.asc"
 
 		# If we have a rollup patch, use that instead of the individual ones.
-		UPSTREAM_PATCHES+=( "${WORKDIR}"/${P/_p/-}-patch.sh )
+		UPSTREAM_PATCHES+=( patch.sh )
 	else
-		patch_url=
-		my_patch_index=
-
-		# We keep a bunch of mirrors here as we've had reports of invisible*.net
-		# being 403 forbidden for some users.
-		urls=(
-			"https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P}-%s"
-			"https://invisible-mirror.net/archives/${PN}/${PV/_p*}/${MY_P}-%s"
-			"https://dev.gentoo.org/~${GENTOO_PATCH_DEV}/distfiles/${CATEGORY}/${PN}/${MY_P}-%s"
-		)
-
-		for ((my_patch_index=0; my_patch_index < "${#PATCH_DATES[@]}"; my_patch_index++)); do
-			for url in "${urls[@]}" ; do
-				patch_url="$(printf ${urls} ${PATCH_DATES[${my_patch_index}]}.patch.gz)"
-				SRC_URI+=" ${patch_url}"
-				SRC_URI+=" verify-sig? ( ${patch_url}.asc )"
-			done
-
-			UPSTREAM_PATCHES+=( "${WORKDIR}"/${MY_P}-${PATCH_DATES[${my_patch_index}]}.patch )
-		done
-
-		unset patch_url
-		unset my_patch_index
-		unset urls
+		# We use a mirror as well because we've had reports of 403 forbidden for some users.
+		upstream_url_base="https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P}-"
+		upstream_m_url_base="https://invisible-mirror.net/archives/${PN}/${PV/_p*}/${MY_P}-"
+
+		# Prefix each date with the upstream location (https://invisible-island.net/archives/${PN}/${PV/_p*}/${MY_P})
+		mangled_patches=( "${PATCH_DATES[@]/#/${upstream_url_base}}" )
+		# Suffix each with .patch.gz
+		mangled_patches=( "${mangled_patches[@]/%/.patch.gz}" )
+		mangled_patches_sig=( "${mangled_patches[@]/%/.asc}" )
+		# Repeat for .patch.gz.asc for verify-sig
+		SRC_URI+=" ${mangled_patches[@]}"
+		SRC_URI+=" verify-sig? ( ${mangled_patches_sig[@]} )"
+
+		# For all of the URLs, chuck in invisible-island.net too:
+		SRC_URI+=" ${mangled_patches[@]/${upstream_url_base}/${upstream_m_url_base}}"
+		SRC_URI+=" verify-sig? ( ${mangled_patches_sig[@]/${upstream_url_base}/${upstream_m_url_base}} )"
+
+		UPSTREAM_PATCHES=( "${PATCH_DATES[@]/%/.patch}" )
+
+		unset upstream_url_base upstream_m_url_base mangled_patches mangled_patches_sig
 	fi
 fi
 
@@ -115,7 +111,7 @@ BDEPEND="verify-sig? ( sec-keys/openpgp-keys-thomasdickey )"
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-	"${UPSTREAM_PATCHES[@]}"
+	"${UPSTREAM_PATCHES[@]/#/${WORKDIR}/${MY_P}-}"
 
 	# When rebasing Gentoo's patchset, please use git from a clean
 	# src_prepare with upstream patches already applied. git am --reject