OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 1999-2011 Gentoo Foundation | 2 # Copyright 1999-2011 Gentoo Foundation |
3 # Distributed under the terms of the GNU General Public License v2 | 3 # Distributed under the terms of the GNU General Public License v2 |
4 | 4 |
5 PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" | 5 PORTAGE_BIN_PATH="${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}" |
6 PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}" | 6 PORTAGE_PYM_PATH="${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}" |
7 | 7 |
8 if [[ $PORTAGE_SANDBOX_COMPAT_LEVEL -lt 22 ]] ; then | 8 if [[ $PORTAGE_SANDBOX_COMPAT_LEVEL -lt 22 ]] ; then |
9 # Ensure that /dev/std* streams have appropriate sandbox permission for | 9 # Ensure that /dev/std* streams have appropriate sandbox permission for |
10 # bug #288863. This can be removed after sandbox is fixed and portage | 10 # bug #288863. This can be removed after sandbox is fixed and portage |
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 } | 1819 } |
1820 | 1820 |
1821 # @FUNCTION: preprocess_ebuild_env | 1821 # @FUNCTION: preprocess_ebuild_env |
1822 # @DESCRIPTION: | 1822 # @DESCRIPTION: |
1823 # Filter any readonly variables from ${T}/environment, source it, and then | 1823 # Filter any readonly variables from ${T}/environment, source it, and then |
1824 # save it via save_ebuild_env(). This process should be sufficient to prevent | 1824 # save it via save_ebuild_env(). This process should be sufficient to prevent |
1825 # any stale variables or functions from an arbitrary environment from | 1825 # any stale variables or functions from an arbitrary environment from |
1826 # interfering with the current environment. This is useful when an existing | 1826 # interfering with the current environment. This is useful when an existing |
1827 # environment needs to be loaded from a binary or installed package. | 1827 # environment needs to be loaded from a binary or installed package. |
1828 preprocess_ebuild_env() { | 1828 preprocess_ebuild_env() { |
1829 » local _portage_filter_opts="" | 1829 » local _portage_filter_opts="--filter-features --filter-locale --filter-p
ath --filter-sandbox" |
1830 » if [ -f "${T}/environment.raw" ] ; then | 1830 |
1831 » » # This is a signal from the python side, indicating that the | 1831 » # If environment.raw is present, this is a signal from the python side, |
1832 » » # environment may contain stale SANDBOX_{DENY,PREDICT,READ,WRITE
} | 1832 » # indicating that the environment may contain stale FEATURES and |
1833 » » # and FEATURES variables that should be filtered out. Between | 1833 » # SANDBOX_{DENY,PREDICT,READ,WRITE} variables that should be filtered ou
t. |
1834 » » # phases, these variables are normally preserved. | 1834 » # Otherwise, we don't need to filter the environment. |
1835 » » _portage_filter_opts+=" --filter-features --filter-locale --filt
er-path --filter-sandbox" | 1835 » [ -f "${T}/environment.raw" ] || return 0 |
1836 » fi | 1836 |
1837 filter_readonly_variables $_portage_filter_opts < "${T}"/environment \ | 1837 filter_readonly_variables $_portage_filter_opts < "${T}"/environment \ |
1838 >> "$T/environment.filtered" || return $? | 1838 >> "$T/environment.filtered" || return $? |
1839 unset _portage_filter_opts | 1839 unset _portage_filter_opts |
1840 mv "${T}"/environment.filtered "${T}"/environment || return $? | 1840 mv "${T}"/environment.filtered "${T}"/environment || return $? |
1841 rm -f "${T}/environment.success" || return $? | 1841 rm -f "${T}/environment.success" || return $? |
1842 # WARNING: Code inside this subshell should avoid making assumptions | 1842 # WARNING: Code inside this subshell should avoid making assumptions |
1843 # about variables or functions after source "${T}"/environment has been | 1843 # about variables or functions after source "${T}"/environment has been |
1844 # called. Any variables that need to be relied upon should already be | 1844 # called. Any variables that need to be relied upon should already be |
1845 # filtered out above. | 1845 # filtered out above. |
1846 ( | 1846 ( |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2355 [[ ! -s $SANDBOX_LOG ]] | 2355 [[ ! -s $SANDBOX_LOG ]] |
2356 "$PORTAGE_BIN_PATH"/ebuild-ipc exit $? | 2356 "$PORTAGE_BIN_PATH"/ebuild-ipc exit $? |
2357 fi | 2357 fi |
2358 exit 0 | 2358 exit 0 |
2359 ) | 2359 ) |
2360 exit $? | 2360 exit $? |
2361 fi | 2361 fi |
2362 | 2362 |
2363 # Do not exit when ebuild.sh is sourced by other scripts. | 2363 # Do not exit when ebuild.sh is sourced by other scripts. |
2364 true | 2364 true |
OLD | NEW |