summaryrefslogtreecommitdiffstats
path: root/bin/ebuild.sh
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-24 02:36:26 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-24 02:36:26 +0000
commitdca1debbc5fbb9490bc5f5627775ab4fd3fffbef (patch)
tree0667e77b751c644a205b747e99c9f465262d5482 /bin/ebuild.sh
parent4db5c6e5630cd5c0bd59a7c1280d30ad6d044cde (diff)
downloadportage-dca1debbc5fbb9490bc5f5627775ab4fd3fffbef.tar.gz
portage-dca1debbc5fbb9490bc5f5627775ab4fd3fffbef.tar.bz2
portage-dca1debbc5fbb9490bc5f5627775ab4fd3fffbef.zip
In the grep expression that's generated in filter_readonly_variables(),
condense redundant identical expressions into a single one. (trunk r8630) svn path=/main/branches/2.1.2/; revision=8633
Diffstat (limited to 'bin/ebuild.sh')
-rwxr-xr-xbin/ebuild.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 4c1c8402e..6bf3a192d 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1381,18 +1381,20 @@ READONLY_PORTAGE_VARS="D EBUILD EBUILD_PHASE EBUILD_SH_ARGS FILESDIR \
# builtin command. To avoid this problem, this function filters those
# variables out and discards them. See bug #190128.
filter_readonly_variables() {
- local var_prefixes="BASH"
- hasq --filter-sandbox $* && var_prefixes="${var_prefixes} SANDBOX"
- local x var_grep=""
- for x in ${var_prefixes} ; do
- var_grep="${var_grep}|(^|^declare[[:space:]]+-[^[:space:]]+[[:space:]]+)${x}_[_[:alnum:]]*=.*"
- done
+ local x filtered_vars
local readonly_bash_vars="DIRSTACK EUID FUNCNAME GROUPS
PIPESTATUS PPID SHELLOPTS UID"
- for x in ${readonly_bash_vars} ${READONLY_PORTAGE_VARS} ; do
- var_grep="${var_grep}|(^|^declare[[:space:]]+-[^[:space:]]+[[:space:]]+)${x}=.*"
+ filtered_vars="${readonly_bash_vars} ${READONLY_PORTAGE_VARS}
+ BASH_[_[:alnum:]]*"
+ hasq --filter-sandbox $* && \
+ filtered_vars="${filtered_vars} SANDBOX_[_[:alnum:]]*"
+ set -f
+ for x in ${filtered_vars} ; do
+ var_grep="${var_grep}|${x}"
done
+ set +f
var_grep=${var_grep:1} # strip the first |
+ var_grep="(^|^declare[[:space:]]+-[^[:space:]]+[[:space:]]+)(${var_grep})=.*"
# The sed is to remove the readonly attribute from variables such as those
# listed in READONLY_EBUILD_METADATA, since having any readonly attributes
# persisting in the saved environment can be inconvenient when it