diff options
-rw-r--r-- | paludis/repositories/e/eapis/exheres-0.conf | 2 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/0/builtin_init.bash | 2 | ||||
-rwxr-xr-x | paludis/repositories/e/ebuild/ebuild.bash | 36 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild/exheres-0/builtin_init.bash | 2 | ||||
-rwxr-xr-x | paludis/repositories/e/ebuild/source_functions.bash | 15 |
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 87802ec65..2c1d27fa1 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 ec049bba4..fca0f9919 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 211aceaf0..e435dd687 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 12cd3e722..c16c4a857 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 92f9541ec..f3f91b7cf 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() { |