Index: Mk/Scripts/qa.sh =================================================================== --- Mk/Scripts/qa.sh +++ Mk/Scripts/qa.sh @@ -1004,10 +1004,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/Uses/charsetfix.mk =================================================================== --- Mk/Uses/charsetfix.mk +++ Mk/Uses/charsetfix.mk @@ -19,7 +19,7 @@ _USES_patch+= 600:charsetfix-post-patch charsetfix-post-patch: - @${FIND} ${WRKSRC} -name "${CHARSETFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} \ + @${FIND} ${WRKSRC} -name "${CHARSETFIX_MAKEFILEIN}" -type f | ${XARGS} ${FRAMEWORK_REINPLACE_CMD} \ -e 's|need_charset_alias=true|need_charset_alias=false|g ; \ s|test -f $$(charset_alias)|false|g ;\ s|test -f $$(DESTDIR)$$(libdir)/charset.alias|false|g' Index: Mk/Uses/gnome.mk =================================================================== --- Mk/Uses/gnome.mk +++ Mk/Uses/gnome.mk @@ -104,7 +104,7 @@ GNOME_MAKEFILEIN?= Makefile.in SCROLLKEEPER_DIR= /var/db/rarian -referencehack_PRE_PATCH= ${FIND} ${WRKSRC} -name "Makefile.in" -type f | ${XARGS} ${REINPLACE_CMD} -e \ +referencehack_PRE_PATCH= ${FIND} ${WRKSRC} -name "Makefile.in" -type f | ${XARGS} ${FRAMEWORK_REINPLACE_CMD} -e \ "s|test \"\$$\$$installfiles\" = '\$$(srcdir)/html/\*'|:|" GNOME_HTML_DIR?= ${PREFIX}/share/doc @@ -313,12 +313,12 @@ intltool_BUILD_DEPENDS= ${LOCALBASE}/bin/intltool-extract:textproc/intltool -intlhack_PRE_PATCH= ${FIND} ${WRKSRC} -name "intltool-merge.in" | ${XARGS} ${REINPLACE_CMD} \ +intlhack_PRE_PATCH= ${FIND} ${WRKSRC} -name "intltool-merge.in" | ${XARGS} ${FRAMEWORK_REINPLACE_CMD} \ 's|mkdir $$lang or|mkdir $$lang, 0777 or| ; \ s|^push @INC, "/.*|push @INC, "${LOCALBASE}/share/intltool";| ; \ s|/usr/bin/iconv|${ICONV_CMD}|g ; \ s|unpack *[(]'"'"'U\*'"'"'|unpack ('"'"'C*'"'"'|' ; \ - ${FIND} ${WRKSRC} -name configure | ${XARGS} ${REINPLACE_CMD} \ + ${FIND} ${WRKSRC} -name configure | ${XARGS} ${FRAMEWORK_REINPLACE_CMD} \ 's/DATADIRNAME=lib/DATADIRNAME=share/' intlhack_USE_GNOME_IMPL=intltool Index: Mk/Uses/pathfix.mk =================================================================== --- Mk/Uses/pathfix.mk +++ Mk/Uses/pathfix.mk @@ -28,7 +28,7 @@ pathfix: .if ${USES:Mcmake*} .for file in ${PATHFIX_CMAKELISTSTXT} - @${FIND} ${PATHFIX_WRKSRC} -name "${file}" -type f | ${XARGS} ${REINPLACE_CMD} -e \ + @${FIND} ${PATHFIX_WRKSRC} -name "${file}" -type f | ${XARGS} ${FRAMEWORK_REINPLACE_CMD} -e \ 's|[{]CMAKE_INSTALL_LIBDIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \ s|[{]CMAKE_INSTALL_DATAROOTDIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \ s|[{]INSTALL_LIB_DIR[}]/pkgconfig|{CMAKE_INSTALL_PREFIX}/libdata/pkgconfig|g ; \ @@ -43,7 +43,7 @@ .endfor .else .for file in ${PATHFIX_MAKEFILEIN} - @${FIND} ${PATHFIX_WRKSRC} -name "${file}" -type f | ${XARGS} ${REINPLACE_CMD} -e \ + @${FIND} ${PATHFIX_WRKSRC} -name "${file}" -type f | ${XARGS} ${FRAMEWORK_REINPLACE_CMD} -e \ 's|[(]libdir[)]/locale|(prefix)/share/locale|g ; \ s|[(]libdir[)]/pkgconfig|(prefix)/libdata/pkgconfig|g ; \ s|[(]LIBDIR[)]/pkgconfig|(PREFIX)/libdata/pkgconfig|g ; \ Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -1032,6 +1032,7 @@ FLAVORS?= FLAVOR?= OVERLAYS?= +REWARNFILE?= ${WRKDIR}/reinplace_warnings.txt # Disallow forced FLAVOR as make argument since we cannot change it to the # proper default. .if empty(FLAVOR) && !empty(.MAKEOVERRIDES:MFLAVOR) @@ -1622,6 +1623,7 @@ PREFIX=${PREFIX} \ LINUXBASE=${LINUXBASE} \ LOCALBASE=${LOCALBASE} \ + REWARNFILE=${REWARNFILE} \ "STRIP=${STRIP}" \ TMPPLIST=${TMPPLIST} \ CURDIR='${.CURDIR}' \ @@ -2010,7 +2012,12 @@ # Macro for doing in-place file editing using regexps REINPLACE_ARGS?= -i.bak +.if defined(DEVELOPER) +REINPLACE_CMD?= ${SETENV} WRKSRC=${WRKSRC} REWARNFILE=${REWARNFILE} ${PORTSDIR}/Tools/scripts/sed_checked.sh +.else REINPLACE_CMD?= ${SED} ${REINPLACE_ARGS} +.endif +FRAMEWORK_REINPLACE_CMD?= ${SED} -i.bak # 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,13 @@ +#!/bin/sh + +set -e +/usr/bin/sed -i.bak "$@" +for x in "${@}" ; do + if [ -f "${x}" ]; then + if cmp -s "${x}" "${x}".bak ; then + if [ ! -z "${REWARNFILE}" ]; then + echo sed failed: backup file same as original: ${x#${WRKSRC}/} >> ${REWARNFILE} + fi + fi + fi +done