summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-11-11 15:58:40 +0000
committerMichał Górny <mgorny@gentoo.org>2013-11-11 15:58:40 +0000
commit77c5bc309c3bd262935c16ed757799b3ca49d1fd (patch)
treecddb6a52941ea4748c0a31a5c3f0b3f6becdff35 /eclass
parentsys-apps/kexec-tools: Drop USE=zlib as it is always requiered, #490326 (diff)
downloadgentoo-2-77c5bc309c3bd262935c16ed757799b3ca49d1fd.tar.gz
gentoo-2-77c5bc309c3bd262935c16ed757799b3ca49d1fd.tar.bz2
gentoo-2-77c5bc309c3bd262935c16ed757799b3ca49d1fd.zip
Read all shebangs before moving files to avoid breaking symlinks that are going to be scanned.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/distutils-r1.eclass47
2 files changed, 35 insertions, 18 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 8e26ff97eccf..07aa90ac150c 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1053 2013/11/09 10:22:06 graaff Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1054 2013/11/11 15:58:40 mgorny Exp $
+
+ 11 Nov 2013; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass:
+ Read all shebangs before moving files to avoid breaking symlinks that are
+ going to be scanned.
09 Nov 2013; Hans de Graaff <graaff@gentoo.org> ruby-fakegem.eclass:
Add a yard recipe for creating documentation.
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 2b609b485648..49cd155eaa64 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.90 2013/10/26 17:47:51 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.91 2013/11/11 15:58:40 mgorny Exp $
# @ECLASS: distutils-r1
# @MAINTAINER:
@@ -422,35 +422,48 @@ _distutils-r1_wrap_scripts() {
local PYTHON_SCRIPTDIR=${bindir}
fi
- local f
- while IFS= read -r -d '' f; do
- local basename=${f##*/}
- debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
+ local f python_files=() non_python_files=()
+
+ if [[ -d ${path}${PYTHON_SCRIPTDIR} ]]; then
+ for f in "${path}${PYTHON_SCRIPTDIR}"/*; do
+ [[ -d ${f} ]] && die "Unexpected directory: ${f}"
+ debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
+
+ local shebang
+ read -r shebang < "${f}"
+ if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then
+ debug-print "${FUNCNAME}: matching shebang: ${shebang}"
+ python_files+=( "${f}" )
+ elif _python_want_python_exec2; then
+ debug-print "${FUNCNAME}: non-matching shebang: ${shebang}"
+ non_python_files+=( "${f}" )
+ fi
- [[ -d ${f} ]] && die "Unexpected directory: ${f}"
+ mkdir -p "${path}${bindir}" || die
+ done
- mkdir -p "${path}${bindir}" || die
- local shebang
- read -r shebang < "${f}"
- if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then
- debug-print "${FUNCNAME}: matching shebang: ${shebang}"
+ for f in "${python_files[@]}"; do
+ local basename=${f##*/}
if ! _python_want_python_exec2; then
local newf=${f%/*}/${basename}-${EPYTHON}
- debug-print "${FUNCNAME}: renaming to ${newf#${path}}"
+ debug-print "${FUNCNAME}: renaming ${f#${path}/} to ${newf#${path}/}"
mv "${f}" "${newf}" || die
fi
debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
_python_ln_rel "${path}${EPREFIX}"$(_python_get_wrapper_path) \
"${path}${bindir}/${basename}" || die
- elif _python_want_python_exec2; then
- debug-print "${FUNCNAME}: non-matching shebang: ${shebang}"
+ done
+
+ # (non-empty only with python-exec:2)
+ for f in "${non_python_files[@]}"; do
+ local basename=${f##*/}
- debug-print "${FUNCNAME}: moving to ${bindir}/${basename}"
+ debug-print "${FUNCNAME}: moving ${f#${path}/} to ${bindir}/${basename}"
mv "${f}" "${path}${bindir}/${basename}" || die
- fi
- done < <(find "${path}${PYTHON_SCRIPTDIR}" -mindepth 1 -print0)
+ done
+ fi
}
# @FUNCTION: distutils-r1_python_install