summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-11-30 07:05:38 +0000
committerSam James <sam@gentoo.org>2022-11-30 07:05:38 +0000
commitabc758f4cb662024ad88c17fefb68767785f271e (patch)
tree1d33f43cc2755200c8468123ea51587420145293
parentdev-libs/libgpg-error: update .sig Manifest entry (diff)
downloadgentoo-abc758f4.tar.gz
gentoo-abc758f4.tar.bz2
gentoo-abc758f4.zip
sys-apps/portage: backport patsub_replacement disablement for Bash 5.2
Quoting Portage's NEWS: """ * ebuild: Handle Bash 5.2's change in behavior which enables the shopt 'patsub_replacement' by default. This is needed to avoid breaking existing working ebuilds. Future EAPIs will need to adjust the logic added by this change. See bug #881383. """ Bug: https://bugs.gentoo.org/881383 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--sys-apps/portage/files/portage-3.0.39-bash-5.2-patsub_replacement.patch49
-rw-r--r--sys-apps/portage/portage-3.0.39-r3.ebuild (renamed from sys-apps/portage/portage-3.0.39-r2.ebuild)1
2 files changed, 50 insertions, 0 deletions
diff --git a/sys-apps/portage/files/portage-3.0.39-bash-5.2-patsub_replacement.patch b/sys-apps/portage/files/portage-3.0.39-bash-5.2-patsub_replacement.patch
new file mode 100644
index 000000000000..90c678998a05
--- /dev/null
+++ b/sys-apps/portage/files/portage-3.0.39-bash-5.2-patsub_replacement.patch
@@ -0,0 +1,49 @@
+https://github.com/gentoo/portage/commit/69cac73ba0a7bcf2e2cff88c60d389895a550623
+
+From 69cac73ba0a7bcf2e2cff88c60d389895a550623 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Wed, 30 Nov 2022 01:09:12 +0000
+Subject: [PATCH] ebuild.sh: disable patsub_replacement in Bash 5.2
+
+patsub_replacement is a new option in bash-5.2 that is also default-on
+in that release. The default value is not gated by BASH_COMPAT (see bug #881383),
+hence we need to disable it for older Bashes to avoid behaviour changes in ebuilds
+and eclasses.
+
+Thanks to Kerin for both raising this & being persistent with trying
+to get Bash 5.2 to be suitable for use in Gentoo.
+
+Bug: https://bugs.gentoo.org/881383
+Thanks-to: Kerin Millar <kfm@plushkava.net>
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/bin/ebuild.sh
++++ b/bin/ebuild.sh
+@@ -18,6 +18,7 @@ source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1
+ # used instead.
+ __check_bash_version() {
+ # Figure out which min version of bash we require.
++ # Adjust patsub_replacement logic below on new EAPI!
+ local maj min
+ if ___eapi_bash_3_2 ; then
+ maj=3 min=2
+@@ -50,6 +51,19 @@ __check_bash_version() {
+ if ___eapi_bash_3_2 && [[ ${BASH_VERSINFO[0]} -gt 3 ]] ; then
+ shopt -s compat32
+ fi
++
++ # patsub_replacement is a new option in bash-5.2 that is also default-on
++ # in that release. The default value is not gated by BASH_COMPAT (see bug #881383),
++ # hence we need to disable it for older Bashes to avoid behaviour changes in ebuilds
++ # and eclasses.
++ #
++ # New EAPI note: a newer EAPI (after 8) may well adopt Bash 5.2 as its minimum version.
++ # If it does, this logic will need to be adjusted to only disable patsub_replacement
++ # for < ${new_api}!
++ if (( BASH_VERSINFO[0] >= 6 || ( BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 2 ) )) ; then
++ shopt -u patsub_replacement
++ fi
++
+ }
+ __check_bash_version
+
+
diff --git a/sys-apps/portage/portage-3.0.39-r2.ebuild b/sys-apps/portage/portage-3.0.39-r3.ebuild
index 430e100baf73..a98bde44683f 100644
--- a/sys-apps/portage/portage-3.0.39-r2.ebuild
+++ b/sys-apps/portage/portage-3.0.39-r3.ebuild
@@ -86,6 +86,7 @@ pkg_pretend() {
python_prepare_all() {
local PATCHES=(
"${FILESDIR}"/${P}-implicit-func-decls-no-fatal.patch
+ "${FILESDIR}"/${P}-bash-5.2-patsub_replacement.patch
)
distutils-r1_python_prepare_all