aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Bo ├śrsted Andresen <bo.andresen@zlin.dk> 2010-03-06 11:35:34 +0000
committerAvatar Bo ├śrsted Andresen <bo.andresen@zlin.dk> 2010-03-10 15:19:28 +0000
commit2e650b0eda2f7efe25d4f7d2f3494ded4a96ed6e (patch)
treeeb30c78d8634297e02535a30d51fc3117f66f34a
parent95ca9fd309779c12713b8e27374c6900d6a163d7 (diff)
downloadpaludis-2e650b0eda2f7efe25d4f7d2f3494ded4a96ed6e.tar.gz
paludis-2e650b0eda2f7efe25d4f7d2f3494ded4a96ed6e.tar.xz
Enable extglob in exheres-0 only.
ebuild_need_extglob is needed early in ebuild.bash. It is also needed in source_functions because that gets loaded by write_binary_ebuild.bash and write_vdb_entry.bash. extglob gets enabled when PALUDIS_SHELL_OPTIONS is unset to make sure things keep working on exheres-0 with old paludis and new ebuild.bash. This is only to keep a clean upgrade path.
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf2
-rw-r--r--paludis/repositories/e/ebuild/0/builtin_init.bash2
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash36
-rw-r--r--paludis/repositories/e/ebuild/exheres-0/builtin_init.bash2
-rwxr-xr-xpaludis/repositories/e/ebuild/source_functions.bash15
5 files changed, 48 insertions, 9 deletions
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index 87802ec..2c1d27f 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -340,7 +340,7 @@ doins_symlink = true
failure_is_fatal = true
no_s_workdir_fallback = true
fix_mtimes = true
-shell_options = globstar
+shell_options = extglob globstar
unpack_suffixes = tar tar.gz,tgz,tar.Z tar.bz2,tbz2,tbz zip,ZIP,jar gz,Z,z bz2 rar,RAR lha,LHa,LHA,lzh a,deb tar.lzma lzma 7z,7Z tar.xz xz
diff --git a/paludis/repositories/e/ebuild/0/builtin_init.bash b/paludis/repositories/e/ebuild/0/builtin_init.bash
index ec049bb..fca0f99 100644
--- a/paludis/repositories/e/ebuild/0/builtin_init.bash
+++ b/paludis/repositories/e/ebuild/0/builtin_init.bash
@@ -66,7 +66,7 @@ builtin_init()
touch ${TMPDIR}/build_start_time
export D="${PALUDIS_PACKAGE_BUILDDIR}/image/"
- export D="${D//+(\/)//}"
+ ebuild_cleanup_slashes D
mkdir -p "${D}" || die "Couldn't create \$D (\"${D}\")"
declare -r D="${D}"
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index 211acea..e435dd6 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -25,6 +25,27 @@ set +C
[[ -n "${PALUDIS_TRACE}" ]] && set -x
+ebuild_need_extglob()
+{
+ eval "_ebuild_need_extglob_$(declare -f ${1})"
+ eval "
+ ${1}()
+ {
+ eval \"
+ shopt -s extglob
+ _ebuild_need_extglob_${1} \\\"\\\${@}\\\"
+ eval \\\"\$(shopt -p extglob); return \\\${?}\\\"
+ \"
+ }"
+}
+
+ebuild_cleanup_slashes()
+{
+ export "${1}=${!1//+(\/)//}"
+ export "${1}=${!1/%*(\/)}/"
+}
+ebuild_need_extglob ebuild_cleanup_slashes
+
ebuild_sanitise_envvars()
{
local p
@@ -81,12 +102,13 @@ if [[ -z "${PALUDIS_DO_NOTHING_SANDBOXY}" ]] ; then
fi
shopt -s expand_aliases
-shopt -s extglob
+[[ -z ${PALUDIS_SHELL_OPTIONS} && unset == ${PALUDIS_SHELL_OPTIONS-unset} ]] &&
+ shopt -s extglob
for p in ${PALUDIS_SHELL_OPTIONS} ; do
shopt -s ${p}
done
-export ROOT="${ROOT%+(/)}/"
+ebuild_cleanup_slashes ROOT
export EBUILD_PROGRAM_NAME="$0"
@@ -276,10 +298,12 @@ ebuild_scrub_environment()
done )
export -n SANDBOX_ACTIVE
- unset -v $(
- for v in ${!BASH_*}; do
- [[ ${v#BASH_} != @(ARGC|ARGV|LINENO|SOURCE|VERSINFO|REMATCH) ]] && echo ${v}
- done )
+ for v in ${!BASH_*}; do
+ case "${v#BASH_}" in
+ ARGC|ARGV|LINENO|SOURCE|VERSINFO|REMATCH) ;;
+ *) unset -v ${v} ;;
+ esac
+ done
set >"${1}"
print_exports >>"${1}"
diff --git a/paludis/repositories/e/ebuild/exheres-0/builtin_init.bash b/paludis/repositories/e/ebuild/exheres-0/builtin_init.bash
index 12cd3e7..c16c4a8 100644
--- a/paludis/repositories/e/ebuild/exheres-0/builtin_init.bash
+++ b/paludis/repositories/e/ebuild/exheres-0/builtin_init.bash
@@ -66,7 +66,7 @@ builtin_init()
touch ${TMPDIR}/build_start_time
export IMAGE="${PALUDIS_PACKAGE_BUILDDIR}/image/"
- export IMAGE="${IMAGE//+(\/)//}"
+ ebuild_cleanup_slashes IMAGE
mkdir -p "${IMAGE}" || die "Couldn't create \$IMAGE (\"${IMAGE}\")"
declare -r IMAGE="${IMAGE}"
diff --git a/paludis/repositories/e/ebuild/source_functions.bash b/paludis/repositories/e/ebuild/source_functions.bash
index 92f9541..f3f91b7 100755
--- a/paludis/repositories/e/ebuild/source_functions.bash
+++ b/paludis/repositories/e/ebuild/source_functions.bash
@@ -20,6 +20,20 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
+ebuild_need_extglob()
+{
+ eval "_ebuild_need_extglob_$(declare -f ${1})"
+ eval "
+ ${1}()
+ {
+ eval \"
+ shopt -s extglob
+ _ebuild_need_extglob_${1} \\\"\\\${@}\\\"
+ eval \\\"\$(shopt -p extglob); return \\\${?}\\\"
+ \"
+ }"
+}
+
ebuild_safe_source()
{
set -- "${@}" '[^a-zA-Z_]*' '*[^a-zA-Z0-9_]*' \
@@ -38,6 +52,7 @@ ebuild_safe_source()
source "${1}"
eval "trap DEBUG; shopt -u extdebug; set +T; return ${?}"
}
+ebuild_need_extglob ebuild_safe_source
ebuild_verify_not_changed_from_global_scope()
{