From owner-svn-ports-head@freebsd.org Wed Jul 1 20:08:28 2015 Return-Path: Delivered-To: svn-ports-head@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 F30CF9921C2; Wed, 1 Jul 2015 20:08:27 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::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 CA4D31CB5; Wed, 1 Jul 2015 20:08:27 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t61K8Ru4031573; Wed, 1 Jul 2015 20:08:27 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t61K8RrR031570; Wed, 1 Jul 2015 20:08:27 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507012008.t61K8RrR031570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 1 Jul 2015 20:08:27 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r391119 - 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-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2015 20:08:28 -0000 Author: bapt Date: Wed Jul 1 20:08:26 2015 New Revision: 391119 URL: https://svnweb.freebsd.org/changeset/ports/391119 Log: Factorize the function to validate env Reviewed by: antoine Differential Revision: https://reviews.freebsd.org/D2966 Modified: head/Mk/Scripts/check-stagedir.sh head/Mk/Scripts/do-depends.sh head/Mk/Scripts/functions.sh Modified: head/Mk/Scripts/check-stagedir.sh ============================================================================== --- head/Mk/Scripts/check-stagedir.sh Wed Jul 1 19:54:56 2015 (r391118) +++ head/Mk/Scripts/check-stagedir.sh Wed Jul 1 20:08:26 2015 (r391119) @@ -224,20 +224,8 @@ case "$1" in esac # validate environment -envfault= -for i in STAGEDIR PREFIX LOCALBASE WRKDIR WRKSRC MTREE_FILE \ - TMPPLIST PLIST_SUB_SED SCRIPTSDIR \ - PORT_OPTIONS NO_PREFIX_RMDIR -do - if ! ( eval ": \${${i}?}" ) 2>/dev/null ; then - envfault="${envfault}${envfault:+" "}${i}" - fi -done -if [ -n "$envfault" ] ; then - echo "Environment variables $envfault undefined. Aborting." \ - | fmt >&2 - exit 1 -fi +validate_env STAGEDIR PREFIX LOCALBASE WRKDIR WRKSRC MTREE_FILE \ + TMPPLIST PLIST_SUB_SED SCRIPTSDIR PORT_OPTIONS NO_PREFIX_RMDIR set -u Modified: head/Mk/Scripts/do-depends.sh ============================================================================== --- head/Mk/Scripts/do-depends.sh Wed Jul 1 19:54:56 2015 (r391118) +++ head/Mk/Scripts/do-depends.sh Wed Jul 1 20:08:26 2015 (r391119) @@ -7,22 +7,11 @@ set -e . ${dp_SCRIPTSDIR}/functions.sh -envfault= -for i in dp_RAWDEPENDS dp_DEPTYPE dp_DEPENDS_TARGET dp_DEPENDS_PRECLEAN \ +validate_env dp_RAWDEPENDS dp_DEPTYPE dp_DEPENDS_TARGET dp_DEPENDS_PRECLEAN \ dp_DEPENDS_CLEAN dp_DEPENDS_ARGS dp_USE_PACKAGE_DEPENDS \ dp_USE_PACKAGE_DEPENDS_ONLY dp_PKG_ADD dp_PKG_INFO dp_WRKDIR \ dp_PKGNAME dp_STRICT_DEPENDS dp_LOCALBASE dp_LIB_DIRS dp_SH \ dp_SCRIPTSDIR dp_PORTSDIR dp_MAKE -do - if ! (eval ": \${${i}?}" ) >/dev/null; then - envfault="${envfault}${envfault:+" "}${i}" - fi -done -if [ -n "${envfault}" ]; then - echo "Environment variable ${envfault} undefined. Aborting." \ - | fmt >&2 - exit 1 -fi set -u Modified: head/Mk/Scripts/functions.sh ============================================================================== --- head/Mk/Scripts/functions.sh Wed Jul 1 19:54:56 2015 (r391118) +++ head/Mk/Scripts/functions.sh Wed Jul 1 20:08:26 2015 (r391119) @@ -139,3 +139,17 @@ parse_plist() { esac done } + +validate_env() { + local envfault + for i ; do + if ! (eval ": \${${i}?}" ) >/dev/null; then + envfault="${envfault}${envfault:+" "}${i}" + fi + done + if [ -n "${envfault}" ]; then + echo "Environment variable ${envfault} undefined. Aborting." \ + | fmt >&2 + exit 1 + fi +}