From 054a73caf2cf333210b1e938eeb41747ec842c51 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 17 Apr 2016 17:12:14 +0200 Subject: hooks/rewrite-python-shebang: simplify and check for unset $off correctly. --- common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'common') diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh index c7384b4acda..e45c6044458 100644 --- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh +++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh @@ -2,7 +2,7 @@ # - rewrites python shebangs with the corresponding python version hook() { - local pyver= shebang= warn= + local pyver= shebang= warn= off= case $pkgname in python-*) @@ -26,11 +26,10 @@ hook() { shebang="#!/usr/bin/python$pyver" find ${PKGDESTDIR} -type f -print0 | \ xargs -0 grep -H -b -m 1 "^#!.*\([[:space:]]\|/\)python\([[:space:]]\|$\)" -- | while IFS=: read -r f off _; do - [ "$off" -a "$off" -eq 0 ] || continue + [ -z "$off" ] && continue if [ "$warn" ]; then - msg_warn "$pkgname: multiple python versions defined!" - msg_warn "$pkgname: using $pyver for shebang" - warn= + msg_warn "$pkgver: multiple python versions defined! (using $pyver for shebangs)\n" + unset warn fi echo " Unversioned shebang replaced by '$shebang': ${f#$PKGDESTDIR}" sed -i "1s@.*python@${shebang}@" -- "$f" -- cgit v1.2.3