aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authoramdmi3 <amdmi3@FreeBSD.org>2017-04-10 23:21:25 +0800
committeramdmi3 <amdmi3@FreeBSD.org>2017-04-10 23:21:25 +0800
commitb03cd4f1c30376a15cf984a907cfa3c2d19e2192 (patch)
tree8244c96654fa46750bca07750e42a21140fbfca9 /Mk
parent2675657c002fee1c5a761e23f37cc25c7caf015c (diff)
downloadfreebsd-ports-gnome-b03cd4f1c30376a15cf984a907cfa3c2d19e2192.tar.gz
freebsd-ports-gnome-b03cd4f1c30376a15cf984a907cfa3c2d19e2192.tar.zst
freebsd-ports-gnome-b03cd4f1c30376a15cf984a907cfa3c2d19e2192.zip
Treat python shebangs without version specified (e.g. `/usr/local/bin/python'
and `/usr/bin/env python') as invalid, because ports always depend on specific version of python (e.g. python2 or python3), and generic `python' which is link to either of them may point to incorrect version or be not available at all (since it's installed by separate optional python metaport) Approved by: portmgr (mat), python (sunpoet) Differential Revision: D9332
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/qa.sh23
1 files changed, 19 insertions, 4 deletions
diff --git a/Mk/Scripts/qa.sh b/Mk/Scripts/qa.sh
index c4fb8257dc38..db3fec8cd259 100644
--- a/Mk/Scripts/qa.sh
+++ b/Mk/Scripts/qa.sh
@@ -29,7 +29,7 @@ list_stagedir_elfs() {
}
shebangonefile() {
- local f interp rc
+ local f interp interparg badinterp rc
f="$@"
rc=0
@@ -42,8 +42,12 @@ shebangonefile() {
esac
interp=$(sed -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p;2q' "${f}")
+ badinterp=""
case "${interp}" in
"") ;;
+ ${LOCALBASE}/bin/python|${PREFIX}/bin/python)
+ badinterp="${interp}"
+ ;;
${LINUXBASE}/*) ;;
${LOCALBASE}/bin/perl5.* | ${PREFIX}/bin/perl5.*)
# lang/perl5* are allowed to have these shebangs.
@@ -59,16 +63,27 @@ shebangonefile() {
/bin/sh) ;;
/bin/tcsh) ;;
/usr/bin/awk) ;;
- /usr/bin/env) ;;
+ /usr/bin/env)
+ interparg=$(sed -n -e '1s/^#![[:space:]]*[^[:space:]]*[[:space:]]*\([^[:space:]]*\).*/\1/p;2q' "${f}")
+ case "${interparg}" in
+ python)
+ badinterp="${interp} ${interparg}"
+ ;;
+ esac
+ ;;
/usr/bin/nawk) ;;
/usr/bin/sed) ;;
/usr/sbin/dtrace) ;;
*)
- err "'${interp}' is an invalid shebang you need USES=shebangfix for '${f#${STAGEDIR}${PREFIX}/}'"
- rc=1
+ badinterp="${interp}"
;;
esac
+ if [ -n "${badinterp}" ]; then
+ err "'${badinterp}' is an invalid shebang you need USES=shebangfix for '${f#${STAGEDIR}${PREFIX}/}'"
+ rc=1
+ fi
+
return ${rc}
}