1 |
commit: abc758f4cb662024ad88c17fefb68767785f271e |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Nov 30 07:05:38 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 30 07:05:38 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=abc758f4 |
7 |
|
8 |
sys-apps/portage: backport patsub_replacement disablement for Bash 5.2 |
9 |
|
10 |
Quoting Portage's NEWS: |
11 |
""" |
12 |
* ebuild: Handle Bash 5.2's change in behavior which enables the shopt |
13 |
'patsub_replacement' by default. This is needed to avoid breaking existing |
14 |
working ebuilds. Future EAPIs will need to adjust the logic |
15 |
added by this change. See bug #881383. |
16 |
""" |
17 |
|
18 |
Bug: https://bugs.gentoo.org/881383 |
19 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
20 |
|
21 |
...ortage-3.0.39-bash-5.2-patsub_replacement.patch | 49 ++++++++++++++++++++++ |
22 |
...e-3.0.39-r2.ebuild => portage-3.0.39-r3.ebuild} | 1 + |
23 |
2 files changed, 50 insertions(+) |
24 |
|
25 |
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 |
26 |
new file mode 100644 |
27 |
index 000000000000..90c678998a05 |
28 |
--- /dev/null |
29 |
+++ b/sys-apps/portage/files/portage-3.0.39-bash-5.2-patsub_replacement.patch |
30 |
@@ -0,0 +1,49 @@ |
31 |
+https://github.com/gentoo/portage/commit/69cac73ba0a7bcf2e2cff88c60d389895a550623 |
32 |
+ |
33 |
+From 69cac73ba0a7bcf2e2cff88c60d389895a550623 Mon Sep 17 00:00:00 2001 |
34 |
+From: Sam James <sam@g.o> |
35 |
+Date: Wed, 30 Nov 2022 01:09:12 +0000 |
36 |
+Subject: [PATCH] ebuild.sh: disable patsub_replacement in Bash 5.2 |
37 |
+ |
38 |
+patsub_replacement is a new option in bash-5.2 that is also default-on |
39 |
+in that release. The default value is not gated by BASH_COMPAT (see bug #881383), |
40 |
+hence we need to disable it for older Bashes to avoid behaviour changes in ebuilds |
41 |
+and eclasses. |
42 |
+ |
43 |
+Thanks to Kerin for both raising this & being persistent with trying |
44 |
+to get Bash 5.2 to be suitable for use in Gentoo. |
45 |
+ |
46 |
+Bug: https://bugs.gentoo.org/881383 |
47 |
+Thanks-to: Kerin Millar <kfm@×××××××××.net> |
48 |
+Signed-off-by: Sam James <sam@g.o> |
49 |
+--- a/bin/ebuild.sh |
50 |
++++ b/bin/ebuild.sh |
51 |
+@@ -18,6 +18,7 @@ source "${PORTAGE_BIN_PATH}/isolated-functions.sh" || exit 1 |
52 |
+ # used instead. |
53 |
+ __check_bash_version() { |
54 |
+ # Figure out which min version of bash we require. |
55 |
++ # Adjust patsub_replacement logic below on new EAPI! |
56 |
+ local maj min |
57 |
+ if ___eapi_bash_3_2 ; then |
58 |
+ maj=3 min=2 |
59 |
+@@ -50,6 +51,19 @@ __check_bash_version() { |
60 |
+ if ___eapi_bash_3_2 && [[ ${BASH_VERSINFO[0]} -gt 3 ]] ; then |
61 |
+ shopt -s compat32 |
62 |
+ fi |
63 |
++ |
64 |
++ # patsub_replacement is a new option in bash-5.2 that is also default-on |
65 |
++ # in that release. The default value is not gated by BASH_COMPAT (see bug #881383), |
66 |
++ # hence we need to disable it for older Bashes to avoid behaviour changes in ebuilds |
67 |
++ # and eclasses. |
68 |
++ # |
69 |
++ # New EAPI note: a newer EAPI (after 8) may well adopt Bash 5.2 as its minimum version. |
70 |
++ # If it does, this logic will need to be adjusted to only disable patsub_replacement |
71 |
++ # for < ${new_api}! |
72 |
++ if (( BASH_VERSINFO[0] >= 6 || ( BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 2 ) )) ; then |
73 |
++ shopt -u patsub_replacement |
74 |
++ fi |
75 |
++ |
76 |
+ } |
77 |
+ __check_bash_version |
78 |
+ |
79 |
+ |
80 |
|
81 |
diff --git a/sys-apps/portage/portage-3.0.39-r2.ebuild b/sys-apps/portage/portage-3.0.39-r3.ebuild |
82 |
similarity index 99% |
83 |
rename from sys-apps/portage/portage-3.0.39-r2.ebuild |
84 |
rename to sys-apps/portage/portage-3.0.39-r3.ebuild |
85 |
index 430e100baf73..a98bde44683f 100644 |
86 |
--- a/sys-apps/portage/portage-3.0.39-r2.ebuild |
87 |
+++ b/sys-apps/portage/portage-3.0.39-r3.ebuild |
88 |
@@ -86,6 +86,7 @@ pkg_pretend() { |
89 |
python_prepare_all() { |
90 |
local PATCHES=( |
91 |
"${FILESDIR}"/${P}-implicit-func-decls-no-fatal.patch |
92 |
+ "${FILESDIR}"/${P}-bash-5.2-patsub_replacement.patch |
93 |
) |
94 |
|
95 |
distutils-r1_python_prepare_all |