aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2015-11-11 21:12:50 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2015-11-11 21:12:50 +0000
commitac5169c87ee1694e7de9b8c06c321716d8564a28 (patch)
treebb425b613ab7dfddbd8b0ab524e282cc45c01ad5
parent27173447c84657a9aafe57b1b9bfb5c7087b0f39 (diff)
downloadpaludis-ac5169c87ee1694e7de9b8c06c321716d8564a28.tar.gz
paludis-ac5169c87ee1694e7de9b8c06c321716d8564a28.tar.xz
Change bash compatibility level handling
Apparently bash is going to deprecate the compat* shopts in favour of the BASH_COMPAT variable, so use that instead. BASH_COMPAT is only supported in 4.3 and later, but it doesn't hurt to set it anyway - in fact, this is better than the shopt version because 4.2 doesn't support shopt compat42. I don't think it's worth messing around with falling back to shopt for older versions - only EAPIs before 6 would be affected, and those have survived this long without setting anything anyway.
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_5_setup.sh3
-rwxr-xr-xpaludis/repositories/e/e_repository_TEST_6_setup.sh3
-rw-r--r--paludis/repositories/e/eapi.cc1
-rw-r--r--paludis/repositories/e/eapi.hh2
-rw-r--r--paludis/repositories/e/eapis/0.conf2
-rw-r--r--paludis/repositories/e/eapis/6.conf2
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf2
-rw-r--r--paludis/repositories/e/ebuild.cc2
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash1
9 files changed, 11 insertions, 7 deletions
diff --git a/paludis/repositories/e/e_repository_TEST_5_setup.sh b/paludis/repositories/e/e_repository_TEST_5_setup.sh
index 9d43382..c293325 100755
--- a/paludis/repositories/e/e_repository_TEST_5_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_5_setup.sh
@@ -747,8 +747,7 @@ LICENSE="GPL-2"
KEYWORDS="test"
pkg_setup() {
- local compat=$(shopt | sed -n -e '/^compat/s/[ \t]\+on$//p')
- [[ ${compat} == compat32 ]] || die compat=${compat}
+ [[ ${BASH_COMPAT} == 3.2 ]] || die BASH_COMPAT=${BASH_COMPAT}
}
END
diff --git a/paludis/repositories/e/e_repository_TEST_6_setup.sh b/paludis/repositories/e/e_repository_TEST_6_setup.sh
index 33e3d83..b880a50 100755
--- a/paludis/repositories/e/e_repository_TEST_6_setup.sh
+++ b/paludis/repositories/e/e_repository_TEST_6_setup.sh
@@ -1955,8 +1955,7 @@ LICENSE="GPL-2"
KEYWORDS="test"
pkg_setup() {
- local compat=$(shopt | sed -n -e '/^compat/s/[ \t]\+on$//p')
- [[ ${compat} == compat42 ]] || die compat=${compat}
+ [[ ${BASH_COMPAT} == 4.2 ]] || die BASH_COMPAT=${BASH_COMPAT}
}
END
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 05b2c02..e91b51e 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -167,6 +167,7 @@ namespace
std::shared_ptr<const EAPIEbuildOptions> make_ebuild_options(const KeyValueConfigFile & k)
{
return std::make_shared<EAPIEbuildOptions>(make_named_values<EAPIEbuildOptions>(
+ n::bash_compat() = check_get(k, "bash_compat"),
n::binary_from_env_variables() = check_get(k, "binary_from_env_variables"),
n::bracket_merged_variables() = check_get(k, "bracket_merged_variables"),
n::bracket_merged_variables_annotatable() = check_get(k, "bracket_merged_variables_annotatable"),
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index c21902f..9954512 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -40,6 +40,7 @@ namespace paludis
{
typedef Name<struct name_allow_tokens_in_mask_files> allow_tokens_in_mask_files;
typedef Name<struct name_annotations> annotations;
+ typedef Name<struct name_bash_compat> bash_compat;
typedef Name<struct name_best_has_version_host_root> best_has_version_host_root;
typedef Name<struct name_binary_from_env_variables> binary_from_env_variables;
typedef Name<struct name_blocker_resolution> blocker_resolution;
@@ -419,6 +420,7 @@ namespace paludis
struct EAPIEbuildOptions
{
+ NamedValue<n::bash_compat, std::string> bash_compat;
NamedValue<n::binary_from_env_variables, std::string> binary_from_env_variables;
NamedValue<n::bracket_merged_variables, std::string> bracket_merged_variables;
NamedValue<n::bracket_merged_variables_annotatable, std::string> bracket_merged_variables_annotatable;
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 40a6a13..ca9e973 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -18,7 +18,7 @@ require_use_expand_in_iuse = false
profile_iuse_injection = false
support_eclasses = true
support_exlibs = false
-shell_options = compat32
+bash_compat = 3.2
utility_path_suffixes =
ebuild_module_suffixes = 0
f_function_prefix = ebuild_f
diff --git a/paludis/repositories/e/eapis/6.conf b/paludis/repositories/e/eapis/6.conf
index bd8a6fe..d382e61 100644
--- a/paludis/repositories/e/eapis/6.conf
+++ b/paludis/repositories/e/eapis/6.conf
@@ -9,7 +9,7 @@ is_pbin = false
ebuild_module_suffixes = 6 5 4 3 2 1 0
utility_path_suffixes = 6 5 4 3 2 1 0
-shell_options = compat42
+bash_compat = 4.2
shell_options_global = failglob
die_supports_dash_n = true
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index e6856c5..93d93e5 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -18,7 +18,7 @@ require_use_expand_in_iuse = false
profile_iuse_injection = false
support_eclasses = true
support_exlibs = false
-shell_options = compat32
+bash_compat = 3.2
utility_path_suffixes =
ebuild_module_suffixes = paludis-1 1 0
use_expand_separator = _
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 4d66343..a45c5d1 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -284,6 +284,8 @@ EbuildCommand::operator() ()
.setenv("PALUDIS_PIPE_COMMANDS_SUPPORTED", "yes")
.setenv("PALUDIS_PIPE_COMMANDS_STATUS_SUPPORTED", "yes")
.setenv("PALUDIS_PIPE_COMMAND_DELIM", "\2")
+ .setenv("PALUDIS_BASH_COMPAT",
+ params.package_id()->eapi()->supported()->ebuild_options()->bash_compat())
.setenv("PALUDIS_SHELL_OPTIONS",
params.package_id()->eapi()->supported()->ebuild_options()->shell_options())
.setenv("PALUDIS_SHELL_OPTIONS_GLOBAL",
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index f3f51c1..3d3991a 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -84,6 +84,7 @@ EBUILD_METADATA_VARIABLES="DEPEND RDEPEND PDEPEND IUSE IUSE_EFFECTIVE SRC_URI DO
PALUDIS_EBUILD_RDEPEND_WAS_SET PALUDIS_EBUILD_DEPEND REQUIRED_USE SCM_REVISION"
EBUILD_METADATA_VARIABLES_FROM_CPLUSPLUS="SLOT EAPI OPTIONS USE IUSE_EFFECTIVE"
+export -n BASH_COMPAT=${PALUDIS_BASH_COMPAT}
shopt -s expand_aliases
[[ -z ${PALUDIS_SHELL_OPTIONS} && unset == ${PALUDIS_SHELL_OPTIONS-unset} ]] &&
shopt -s extglob