svn commit: r438176 - head/Mk/Scripts
Dmitry Marakasov
amdmi3 at FreeBSD.org
Mon Apr 10 15:21:27 UTC 2017
Author: amdmi3
Date: Mon Apr 10 15:21:25 2017
New Revision: 438176
URL: https://svnweb.freebsd.org/changeset/ports/438176
Log:
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
Modified:
head/Mk/Scripts/qa.sh
Modified: head/Mk/Scripts/qa.sh
==============================================================================
--- head/Mk/Scripts/qa.sh Mon Apr 10 15:08:47 2017 (r438175)
+++ head/Mk/Scripts/qa.sh Mon Apr 10 15:21:25 2017 (r438176)
@@ -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}
}
More information about the svn-ports-head
mailing list