Index: Mk/Scripts/qa.sh =================================================================== --- Mk/Scripts/qa.sh +++ Mk/Scripts/qa.sh @@ -2,8 +2,8 @@ # MAINTAINER: portmgr@FreeBSD.org # $FreeBSD$ -if [ -z "${STAGEDIR}" -o -z "${PREFIX}" -o -z "${LOCALBASE}" ]; then - echo "STAGEDIR, PREFIX, LOCALBASE required in environment." >&2 +if [ -z "${STAGEDIR}" -o -z "${PREFIX}" -o -z "${LOCALBASE}" -o -z "${REWARNFILE}" ]; then + echo "STAGEDIR, PREFIX, LOCALBASE, REWARNFILE required in environment." >&2 exit 1 fi @@ -1006,10 +1006,18 @@ return 0 } +reinplace() +{ + if [ -f ${REWARNFILE} ]; then + warn "Possible REINPLACE_CMD issues" + cat ${REWARNFILE} + fi +} + checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo" checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" checks="$checks proxydeps sonames perlcore no_arch gemdeps gemfiledeps flavors" -checks="$checks license depends_blacklist pkgmessage" +checks="$checks license depends_blacklist pkgmessage reinplace" ret=0 cd ${STAGEDIR} || exit 1 Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -1617,6 +1617,9 @@ PREFIX=${PREFIX} \ LINUXBASE=${LINUXBASE} \ LOCALBASE=${LOCALBASE} \ + REWARNFILE=${WRKDIR}/reinplace_warnings.txt \ + WRKDIR=${WRKDIR} \ + WRKSRC=${WRKSRC} \ "STRIP=${STRIP}" \ TMPPLIST=${TMPPLIST} \ CURDIR='${.CURDIR}' \ @@ -2005,7 +2008,12 @@ # Macro for doing in-place file editing using regexps REINPLACE_ARGS?= -i.bak +.if defined(DEVELOPER) +REINPLACE_CMD?= ${SETENV} REWARNFILE=${WRKDIR}/reinplace_warnings.txt ${PORTSDIR}/Tools/scripts/sed_checked.sh +.else REINPLACE_CMD?= ${SED} ${REINPLACE_ARGS} +.endif +FRAMEWORK_REINPLACE_CMD?= ${SED} ${REINPLACE_ARGS} # Names of cookies used to skip already completed stages EXTRACT_COOKIE?= ${WRKDIR}/.extract_done.${PORTNAME}.${PREFIX:S/\//_/g} Index: Tools/scripts/sed_checked.sh =================================================================== --- /dev/null +++ Tools/scripts/sed_checked.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +#set -x + +/usr/bin/sed -i.bak "$@" +STATUS=0 +for x in "${@}" ; do + if [ -f "${x}" 2>&1 > /dev/null ]; then + if [ ! -f ${x}.bak ]; then + STATUS=1 + FILE=${x} + fi + cmp ${x} ${x}.bak > /dev/null 2>&1 + if [ $? -ne 1 ]; then + STATUS=2 + FILE=${x} + fi + fi +done + +if [ ${STATUS} -eq 1 ]; then + echo sed failed: backup file not created: ${FILE} +fi +if [ ${STATUS} -eq 2 ]; then + echo sed failed: backup file same as original: ${FILE} + if [ ! -z "${REWARNFILE}" ]; then + echo sed failed: backup file same as original: ${FILE} >> ${REWARNFILE} + fi +fi + +#exit ${STATUS} +exit 0