Date: Sat, 23 Nov 2013 12:23:19 +0000 (UTC) From: Matthias Andree <mandree@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r334663 - head/Mk/Scripts Message-ID: <201311231223.rANCNJ6C088595@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mandree Date: Sat Nov 23 12:23:19 2013 New Revision: 334663 URL: http://svnweb.freebsd.org/changeset/ports/334663 Log: - in qa.sh, properly work with filenames containing blank or tab, by setting IFS to just LF - in check-stagedir.sh, properly detect unset environmental variables, and list them all - in check-stagedir.sh, also list the full prefix as known, not just its parents PR: 184039 Approved by: portmgr (bapt) Modified: head/Mk/Scripts/check-stagedir.sh (contents, props changed) head/Mk/Scripts/qa.sh Modified: head/Mk/Scripts/check-stagedir.sh ============================================================================== --- head/Mk/Scripts/check-stagedir.sh Sat Nov 23 12:16:10 2013 (r334662) +++ head/Mk/Scripts/check-stagedir.sh Sat Nov 23 12:23:19 2013 (r334663) @@ -1,5 +1,6 @@ #!/bin/sh # ports/Mk/Scripts/check-stagedir.sh - called from ports/Mk/bsd.stage.mk +# $FreeBSD$ set -e export LC_ALL=C @@ -21,16 +22,17 @@ case "$1" in esac # validate environment -envfault=0 +envfault= for i in STAGEDIR PREFIX LOCALBASE WRKDIR WRKSRC MTREE_FILE \ TMPPLIST DATADIR DOCSDIR EXAMPLESDIR do - if eval test -z "\$$i" ; then - echo >&2 "Environment variable $i undefined. Aborting." - envfault=1 + if ! ( eval ": \${${i}?}" ) 2>/dev/null ; then + envfault="${envfault}${envfault:+" "}${i}" fi done -if [ $envfault -ne 0 ] ; then +if [ -n "$envfault" ] ; then + echo "Environment variables $envfault undefined. Aborting." \ + | fmt >&2 exit 1 fi @@ -85,9 +87,9 @@ fi a=${PREFIX} while :; do + echo ${a} a=${a%/*} [ -z "${a}" ] && break - echo ${a} done } > ${WRKDIR}/.mtree Modified: head/Mk/Scripts/qa.sh ============================================================================== --- head/Mk/Scripts/qa.sh Sat Nov 23 12:16:10 2013 (r334662) +++ head/Mk/Scripts/qa.sh Sat Nov 23 12:23:19 2013 (r334663) @@ -7,6 +7,9 @@ if [ -z "${STAGEDIR}" -o -z "${PREFIX}" exit 1 fi +LF=$(printf '\nX') +LF=${LF%X} + warn() { echo "Warning: $@" >&2 } @@ -17,7 +20,7 @@ err() { shebang() { rc=0 - for f in `find ${STAGEDIR} -type f`; do + IFS="$LF" ; for f in `find ${STAGEDIR} -type f`; do interp=$(sed -n -e '1s/^#![[:space:]]*\([^[:space:]]*\).*/\1/p;2q' $f) case "$interp" in "") ;; @@ -37,7 +40,7 @@ shebang() { symlinks() { rc=0 - for l in `find ${STAGEDIR} -type l`; do + IFS="$LF" ; for l in `find ${STAGEDIR} -type l`; do link=$(readlink ${l}) case "${link}" in ${STAGEDIR}*) err "Bad symlinks ${l} pointing inside the stage directory" @@ -50,7 +53,7 @@ symlinks() { paths() { rc=0 dirs="${STAGEDIR} ${WRKDIR}" - for f in `find ${STAGEDIR} -type f`;do + IFS="$LF" ; for f in `find ${STAGEDIR} -type f`;do for d in ${dirs}; do if grep -q ${d} ${f} ; then err "${f} is referring to ${d}" @@ -64,7 +67,7 @@ paths() { stripped() { [ -x /usr/bin/file ] || return # this is fatal [ -n "${STRIP}" ] || return 0 - for f in `find ${STAGEDIR} -type f`; do + IFS="$LF" ; for f in `find ${STAGEDIR} -type f`; do output=`/usr/bin/file ${f}` case "${output}" in *:*\ ELF\ *,\ not\ stripped*) warn "${f} is not stripped consider using \${STRIP_CMD}";;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311231223.rANCNJ6C088595>