Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 200065 Details for
Bug 279915
Shebang line of /usr/bin/emerge is interpreted incorrectly when app-admin/eselect-python-20090801 is installed and Linux <2.6.28 or non-Linux kernel is used
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
python.eselect.patch
python.eselect.patch (text/plain), 3.61 KB, created by
Arfrever Frehtes Taifersar Arahesis (RETIRED)
on 2009-08-03 22:18:52 UTC
(
hide
)
Description:
python.eselect.patch
Filename:
MIME Type:
Creator:
Arfrever Frehtes Taifersar Arahesis (RETIRED)
Created:
2009-08-03 22:18:52 UTC
Size:
3.61 KB
patch
obsolete
>Index: python.eselect >=================================================================== >--- python.eselect (revision 189) >+++ python.eselect (working copy) >@@ -24,23 +24,60 @@ find_targets() { > done > } > >-set_python_script() { >- local script="${INTERPRETER_PATH}${1}" target="${2}" >- cat << EOF > "${script}" >-#!/bin/bash >-# Gentoo Python wrapper script >+set_python() { >+ local program="${INTERPRETER_PATH}python" program_source target="${1}" >+ program_source="$(mktemp || die "mktemp failed")" >+ mv "${program_source}"{,.c} >+ program_source+=".c" >+ cat << EOF > "${program_source}" >+#include <limits.h> >+#include <stdlib.h> >+#include <string.h> >+#include <unistd.h> > >-[[ "\${EPYTHON}" =~ (/|^python\$) ]] && EPYTHON="${target}" >-"\${0%/*}/\${EPYTHON:-${target}}" "\$@" >+const char* name = "### Gentoo Python wrapper for ${target} program ###"; >+ >+int main(int argc, char** argv) >+{ >+ if (strlen(name) == 0) >+ { >+ abort(); >+ } >+ >+ char* EPYTHON = getenv("EPYTHON"); >+ if (! EPYTHON || (strcmp(EPYTHON, "python") == 0) || strchr(EPYTHON, '/')) >+ { >+ EPYTHON = "${target}"; >+ } >+ >+ char buf[PATH_MAX + 1]; >+ if (readlink("/proc/self/exe", buf, sizeof(buf) - 1) != -1) >+ { >+ char* last_path_sep = strrchr(buf, '/'); >+ if (last_path_sep) >+ { >+ *last_path_sep = 0; >+ } >+ char* absolute_python_path = strcat(strcat(buf, "/"), EPYTHON); >+ execv(absolute_python_path, argv); >+ } >+ else >+ { >+ execvp(EPYTHON, argv); >+ } >+ >+ return 1; >+} > EOF >- chmod +x "${script}" >+ ${CC:-gcc} ${CFLAGS} ${LDFLAGS} "${program_source}" -o "${program}" >+ rm -f "${program_source}" > } > >-set_python_config_script() { >- local script="${INTERPRETER_PATH}${1}" target="${2}" >+set_python_config() { >+ local script="${INTERPRETER_PATH}python-config" target="${1}" > cat << EOF > "${script}" > #!/bin/bash >-# Gentoo python-config wrapper script >+# Gentoo Python wrapper for ${target} script > > [[ "\${EPYTHON}" =~ (/|^python\$) ]] && EPYTHON="${target/-config-/}" > python_config="\${EPYTHON/python/python-config-}" >@@ -100,11 +137,11 @@ set_scripts_and_symlinks() { > if [[ -f "${INTERPRETER_PATH}${target}" ]]; then > remove_symlinks > set_man_symlink "${target}" >- >+ > pushd "${INTERPRETER_PATH}" 1>/dev/null >- set_python_script "python" "${target}" >+ set_python "${target}" > ln -nfs "${target}" "${target%.*}" >- set_python_config_script "python-config" "${target/python/python-config-}" >+ set_python_config "${target/python/python-config-}" > ln -nfs "${target/python/pydoc}" pydoc > ln -nfs "${target/python/idle}" idle > # 2to3 for >=2.6 >@@ -138,8 +175,9 @@ describe_show() { > } > > do_show() { >- active=$(canonicalise "${INTERPRETER_PATH}python") >- echo ${active#${INTERPRETER_PATH}} >+ active=$(< "${INTERPRETER_PATH}python") >+ active=$(echo "${active}" | grep -Eo "### Gentoo Python wrapper for [^[:space:]]+ program ###" | sed -e "s/.*### Gentoo Python wrapper for \([^[:space:]]\+\) program ###.*/\1/") >+ echo "${active}" > } > > ### list action ### >@@ -178,6 +216,13 @@ do_set() { > elif [[ -n "${2}" ]]; then > die -q "Too many parameters" > else >+ if [[ -z "${CFLAGS}" && -f /etc/make.conf ]]; then >+ CFLAGS="$(. /etc/make.conf; echo "${CFLAGS}")" >+ fi >+ if [[ -z "${LDFLAGS}" && -f /etc/make.conf ]]; then >+ LDFLAGS="$(. /etc/make.conf; echo "${LDFLAGS}")" >+ fi >+ > if ! remove_symlinks; then > die -q "Can't remove existing provider" > elif ! set_scripts_and_symlinks "${1}"; then >@@ -220,7 +265,7 @@ do_update() { > fi > > local targets=( $(cd "${INTERPRETER_PATH}"; ls python?.?|sort -r) ) target >- >+ > # Ignore slots > for slot in ${ignored_slots[@]}; do > targets=( ${targets[@]/python${slot}/} )
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 279915
:
199927
|
199932
|
199940
|
200017
|
200027
| 200065 |
200082
|
200087
|
200095
|
200127