diff options
author | 2015-07-10 18:30:20 -0400 | |
---|---|---|
committer | 2015-07-10 18:33:58 -0400 | |
commit | 235864e660871698c551c85ab592b23d931a1819 (patch) | |
tree | 08c412567d5231ae3ce68b38d10c15aa4be57bcb | |
parent | minor naming consistency change for test script (diff) | |
download | pkgcore-235864e660871698c551c85ab592b23d931a1819.tar.gz pkgcore-235864e660871698c551c85ab592b23d931a1819.tar.bz2 pkgcore-235864e660871698c551c85ab592b23d931a1819.zip |
don't assume bash is at /bin/bash, inspect path to find it
This allows us to more easily override the bash version used with a
custom, patched version if trying to debug something. Also, if we want
to support other system types like BSDs in the future its useful as well
since its likely to be found at /usr/local/bin there.
-rwxr-xr-x | bash/ebuild-daemon.bash | 2 | ||||
-rw-r--r-- | bash/ebuild-daemon.lib | 2 | ||||
-rw-r--r-- | bash/ebuild-default-functions.lib | 2 | ||||
-rw-r--r-- | bash/ebuild.lib | 2 | ||||
-rwxr-xr-x | bash/generate_eapi_func_list.bash | 2 | ||||
-rwxr-xr-x | bash/helpers/4/docompress | 2 | ||||
-rwxr-xr-x | bash/helpers/common/prepalldocs | 2 | ||||
-rwxr-xr-x | bash/helpers/common/prepinfo | 2 | ||||
-rwxr-xr-x | bash/helpers/common/prepman | 2 | ||||
-rwxr-xr-x | bash/helpers/common/prepstrip | 2 | ||||
-rwxr-xr-x | bash/helpers/internals/prepall | 2 | ||||
-rwxr-xr-x | bash/helpers/internals/prepallman | 2 | ||||
-rwxr-xr-x | bash/regenerate_dont_export_func_list.bash | 4 | ||||
-rw-r--r-- | pkgcore/const.py | 9 | ||||
-rw-r--r-- | pkgcore/ebuild/processor.py | 2 |
15 files changed, 19 insertions, 20 deletions
diff --git a/bash/ebuild-daemon.bash b/bash/ebuild-daemon.bash index f4e61ce26..a0c80090e 100755 --- a/bash/ebuild-daemon.bash +++ b/bash/ebuild-daemon.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # ebuild-daemon.bash; core ebuild processor handling code # Copyright 2004-2012 Brian Harring <ferringb@gmail.com> # License: BSD/GPL2 diff --git a/bash/ebuild-daemon.lib b/bash/ebuild-daemon.lib index f0fa81233..aecd9d90b 100644 --- a/bash/ebuild-daemon.lib +++ b/bash/ebuild-daemon.lib @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # ebuild-daemon.lib; daemon lib code. # Copyright 2005-2012 Brian Harring <ferringb@gmail.com> # License BSD/GPL2 diff --git a/bash/ebuild-default-functions.lib b/bash/ebuild-default-functions.lib index e04c92b52..0cef800a6 100644 --- a/bash/ebuild-default-functions.lib +++ b/bash/ebuild-default-functions.lib @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # ebuild-default-functions.sh; default functions for ebuild env that aren't saved- specific to the portage instance. # Copyright 2005-2012 Brian Harring <ferringb@gmail.com>: BSD/GPL2 # Copyright 2004-2006 Gentoo Foundation: GPL2 diff --git a/bash/ebuild.lib b/bash/ebuild.lib index 5211dbfdc..101a4edf3 100644 --- a/bash/ebuild.lib +++ b/bash/ebuild.lib @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # ebuild.lib; ebuild phase processing, env handling # Copyright 2005-2012 Brian Harring <ferringb@gmail.com>: BSD/GPL2 diff --git a/bash/generate_eapi_func_list.bash b/bash/generate_eapi_func_list.bash index 2e9f38dad..0cd5dc350 100755 --- a/bash/generate_eapi_func_list.bash +++ b/bash/generate_eapi_func_list.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Generates a list of EAPI specific functions to avoid exporting to the saved # ebuild environment. This script is run dynamically on initialization of the diff --git a/bash/helpers/4/docompress b/bash/helpers/4/docompress index 3cc710882..5fb646d18 100755 --- a/bash/helpers/4/docompress +++ b/bash/helpers/4/docompress @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # for the time being, we're ignoring controllable compression. diff --git a/bash/helpers/common/prepalldocs b/bash/helpers/common/prepalldocs index 5547fd734..98792d0f4 100755 --- a/bash/helpers/common/prepalldocs +++ b/bash/helpers/common/prepalldocs @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 diff --git a/bash/helpers/common/prepinfo b/bash/helpers/common/prepinfo index e9ee5802d..f5a7b1521 100755 --- a/bash/helpers/common/prepinfo +++ b/bash/helpers/common/prepinfo @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright: 2011 Brian Harring <ferringb@gmail.com> # Copyright: 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 diff --git a/bash/helpers/common/prepman b/bash/helpers/common/prepman index 530ca6c22..8e59da8b4 100755 --- a/bash/helpers/common/prepman +++ b/bash/helpers/common/prepman @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright: 2011 Brian Harring <ferringb@gmail.com> # Copyright: 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 diff --git a/bash/helpers/common/prepstrip b/bash/helpers/common/prepstrip index 1a2d37fb5..1fc45ea4c 100755 --- a/bash/helpers/common/prepstrip +++ b/bash/helpers/common/prepstrip @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2008-2011 Brian Harring <ferringb@gmail.com>: BSD/GPL2 # Copyright 1999-2007 Gentoo Foundation: GPL2 # Distributed under the terms of the GNU General Public License v2 diff --git a/bash/helpers/internals/prepall b/bash/helpers/internals/prepall index 5e4e9f285..291464ad3 100755 --- a/bash/helpers/internals/prepall +++ b/bash/helpers/internals/prepall @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright: 2011 Brian Harring <ferringb@gmail.com> # Copyright: 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 diff --git a/bash/helpers/internals/prepallman b/bash/helpers/internals/prepallman index 257498f40..9a43ef15c 100755 --- a/bash/helpers/internals/prepallman +++ b/bash/helpers/internals/prepallman @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 diff --git a/bash/regenerate_dont_export_func_list.bash b/bash/regenerate_dont_export_func_list.bash index 19fbcf715..a6565f936 100755 --- a/bash/regenerate_dont_export_func_list.bash +++ b/bash/regenerate_dont_export_func_list.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Generates a file (or list) of functions defined in the various bash support # libs to avoid exporting to the saved ebuild environment. @@ -7,7 +7,7 @@ export PKGCORE_BIN_PATH=$(dirname "$0") _FP=${1:-${PKGCORE_BIN_PATH}/funcnames/global} if [[ -z ${PKGCORE_CLEAN_ENV} ]]; then - exec env -i PKGCORE_PYTHON_PATH=${PKGCORE_PYTHON_PATH} PKGCORE_CLEAN_ENV=1 /bin/bash "$0" "${_FP}" + exec env -i PKGCORE_PYTHON_PATH=${PKGCORE_PYTHON_PATH} PKGCORE_CLEAN_ENV=1 "$0" "${_FP}" fi export LC_ALL=C # avoid any potential issues of unicode sorting for whacked func names diff --git a/pkgcore/const.py b/pkgcore/const.py index 9a14b9a4a..61b62afdc 100644 --- a/pkgcore/const.py +++ b/pkgcore/const.py @@ -9,6 +9,7 @@ import os osp = os.path import sys from snakeoil import mappings, compatibility +from snakeoil.process import find_binary try: # This is a file written during pkgcore installation; # if it exists, we defer to it. If it doesn't, then we're @@ -22,11 +23,9 @@ PKGCORE_BASE_PATH = osp.dirname(osp.abspath(__file__)) SYSTEM_CONF_FILE = '/etc/pkgcore.conf' USER_CONF_FILE = osp.expanduser('~/.pkgcore.conf') -SANDBOX_BINARY = "/usr/bin/sandbox" - -# should lift these from configuration, or PATH inspection. -BASH_BINARY = "/bin/bash" -COPY_BINARY = "/bin/cp" +SANDBOX_BINARY = '/usr/bin/sandbox' +BASH_BINARY = find_binary('bash') +COPY_BINARY = find_binary('cp') HOST_NONROOT_PATHS = ("/usr/local/bin", "/usr/bin", "/bin") HOST_ROOT_PATHS = ("/usr/local/sbin", "/usr/local/bin", "/usr/sbin", diff --git a/pkgcore/ebuild/processor.py b/pkgcore/ebuild/processor.py index 9a50549f7..2aa6d14aa 100644 --- a/pkgcore/ebuild/processor.py +++ b/pkgcore/ebuild/processor.py @@ -331,7 +331,7 @@ class EbuildProcessor(object): "PKGCORE_EBD_READ_FD": str(max_fd-2), "PKGCORE_EBD_WRITE_FD": str(max_fd-1)}) self.pid = spawn_func( - ["/bin/bash", self.ebd, "daemonize"], + [const.BASH_BINARY, self.ebd, "daemonize"], fd_pipes={0: 0, 1: 1, 2: 2, max_fd-2: cread, max_fd-1: dwrite}, returnpid=True, env=env, *args, **spawn_opts)[0] |