From owner-svn-ports-all@freebsd.org Mon Apr 10 15:21:27 2017 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01AA4D37818; Mon, 10 Apr 2017 15:21:27 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8CCA360; Mon, 10 Apr 2017 15:21:26 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3AFLPIS096930; Mon, 10 Apr 2017 15:21:25 GMT (envelope-from amdmi3@FreeBSD.org) Received: (from amdmi3@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3AFLPbb096929; Mon, 10 Apr 2017 15:21:25 GMT (envelope-from amdmi3@FreeBSD.org) Message-Id: <201704101521.v3AFLPbb096929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: amdmi3 set sender to amdmi3@FreeBSD.org using -f From: Dmitry Marakasov Date: Mon, 10 Apr 2017 15:21:25 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r438176 - head/Mk/Scripts X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Apr 2017 15:21:27 -0000 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} }