From owner-svn-ports-head@freebsd.org Thu Jul 26 11:09:48 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 738BF104B6DE; Thu, 26 Jul 2018 11:09:48 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 241A38A181; Thu, 26 Jul 2018 11:09:48 +0000 (UTC) (envelope-from mat@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF7C22B3; Thu, 26 Jul 2018 11:09:47 +0000 (UTC) (envelope-from mat@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6QB9lkl048679; Thu, 26 Jul 2018 11:09:47 GMT (envelope-from mat@FreeBSD.org) Received: (from mat@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6QB9l1M048676; Thu, 26 Jul 2018 11:09:47 GMT (envelope-from mat@FreeBSD.org) Message-Id: <201807261109.w6QB9l1M048676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mat set sender to mat@FreeBSD.org using -f From: Mathieu Arnold Date: Thu, 26 Jul 2018 11:09:47 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r475361 - head/Mk/Scripts X-SVN-Group: ports-head X-SVN-Commit-Author: mat X-SVN-Commit-Paths: head/Mk/Scripts X-SVN-Commit-Revision: 475361 X-SVN-Commit-Repository: ports 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.27 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: Thu, 26 Jul 2018 11:09:48 -0000 Author: mat Date: Thu Jul 26 11:09:46 2018 New Revision: 475361 URL: https://svnweb.freebsd.org/changeset/ports/475361 Log: Extract PLIST_SUB substitutions into a sed script. This fixes PLIST_SUB being too big and PLIST_SUB_SED getting bigger than _POSIX2_LINE_MAX. PR: 222355 Reported by: asomers Reviewed by: asomers, mfechner Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D14014 Modified: head/Mk/Scripts/check-stagedir.sh (contents, props changed) head/Mk/Scripts/check_leftovers.sh (contents, props changed) head/Mk/Scripts/plist_sub_sed_sort.sh (contents, props changed) Modified: head/Mk/Scripts/check-stagedir.sh ============================================================================== --- head/Mk/Scripts/check-stagedir.sh Thu Jul 26 10:37:36 2018 (r475360) +++ head/Mk/Scripts/check-stagedir.sh Thu Jul 26 11:09:46 2018 (r475361) @@ -88,20 +88,22 @@ setup_plist_seds() { unset PORT_OPTIONS fi - sed_plist_sub=$(echo "${PLIST_SUB_SED}" | /bin/sh ${SCRIPTSDIR}/plist_sub_sed_sort.sh) + sed_plist_sub=$(mktemp -t sed_plist_sub) + # We only exit 0 or exit 1 + trap "rm -f ${sed_plist_sub}" EXIT 1 + echo "${PLIST_SUB_SED}" | /bin/sh ${SCRIPTSDIR}/plist_sub_sed_sort.sh ${sed_plist_sub} unset PLIST_SUB_SED # Used for generate_plist - sed_files_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} \ - ${sed_portdocsexamples} /^share\/licenses/d; \ + sed_files_gen="${sed_portdocsexamples} /^share\/licenses/d; \ \#${LOCALBASE}/lib/debug#d;" - sed_dirs_gen="s!^${PREFIX}/!!g; ${sed_plist_sub} s,^,@dir ,; \ + sed_dirs_gen="s,^,@dir ,; \ ${sed_portdocsexamples} \ /^@dir share\/licenses/d;" # These prevent ignoring DOCS/EXAMPLES dirs with sed_portdocsexamples - sed_files="s!^${PREFIX}/!!g; ${sed_plist_sub} /^share\/licenses/d; \ + sed_files="/^share\/licenses/d; \ \#${LOCALBASE}/lib/debug#d;" - sed_dirs="s!^${PREFIX}/!!g; ${sed_plist_sub} s,^,@dir ,; \ + sed_dirs="s,^,@dir ,; \ /^@dir share\/licenses/d;" } @@ -114,7 +116,7 @@ generate_plist() { find ${STAGEDIR} -type f -o -type l | sort | \ sed -e "s,${STAGEDIR},," >${WRKDIR}/.staged-files comm -13 ${WRKDIR}/.plist-files ${WRKDIR}/.staged-files | \ - sed -e "${sed_files_gen}" \ + sed -e "s!^${PREFIX}/!!g;" -f "${sed_plist_sub}" -e "${sed_files_gen}" \ >>${WRKDIR}/.staged-plist || : ### HANDLE DIRS @@ -131,7 +133,7 @@ generate_plist() { >${WRKDIR}/.staged-dirs-dfs-sorted # Find all staged dirs and then sort them by depth-first (find -d -s) comm -13 ${WRKDIR}/.traced-dirs ${WRKDIR}/.staged-dirs-sorted \ - | sort_dfs | sed "${sed_dirs_gen}" \ + | sort_dfs | sed -e "s!^${PREFIX}/!!g;" -f "${sed_plist_sub}" -e "${sed_dirs_gen}" \ >>${WRKDIR}/.staged-plist || : } @@ -185,7 +187,7 @@ check_missing_plist_items() { echo "===> Checking for items in pkg-plist which are not in STAGEDIR" : >${WRKDIR}/.invalid-plist-missing comm -23 ${WRKDIR}/.plist-files-no-comments ${WRKDIR}/.staged-files | \ - sed -e "${sed_files}" \ + sed -e "s!^${PREFIX}/!!g;" -f "${sed_plist_sub}" -e "${sed_files}" \ >>${WRKDIR}/.invalid-plist-missing || : # Look for directories, then sort them by DFS. Must create the dirs @@ -203,7 +205,7 @@ check_missing_plist_items() { sed -e "s,^${WRKDIR}/.missing-dirs,," | \ while read -r dir; do \ grep -x "${dir}" ${WRKDIR}/.missing-plist-dirs || :; done | \ - sed "${sed_dirs}" \ + sed -e "s!^${PREFIX}/!!g;" -f "${sed_plist_sub}" -e "${sed_dirs}" \ >>${WRKDIR}/.invalid-plist-missing || : rm -rf ${WRKDIR}/.missing-dirs if [ -s "${WRKDIR}/.invalid-plist-missing" ]; then Modified: head/Mk/Scripts/check_leftovers.sh ============================================================================== --- head/Mk/Scripts/check_leftovers.sh Thu Jul 26 10:37:36 2018 (r475360) +++ head/Mk/Scripts/check_leftovers.sh Thu Jul 26 11:09:46 2018 (r475361) @@ -46,7 +46,9 @@ if [ -z "${CCACHE_DIR}" ]; then CCACHE_DIR=$(make -C ${portdir} -VCCACHE_DIR) fi homedirs=$(awk -F: -v users="$(make -C ${portdir} -V USERS|sed -e 's, ,|,g;/^$/d;s,^,^(,;s,$,)$,')" 'users && $1 ~ users {print $9}' ${PORTSDIR}/UIDs|sort -u|sed -e "s|/usr/local|${PREFIX}|"|tr "\n" " ") -plistsub_sed=$(make -C ${portdir} -VPLIST_SUB_SED | /bin/sh ${PORTSDIR}/Mk/Scripts/plist_sub_sed_sort.sh) +plistsub_sed=$(mktemp -t plistsub_sed) +trap "rm -f ${plistsub_sed}" EXIT 1 +make -C ${portdir} -VPLIST_SUB_SED | /bin/sh ${PORTSDIR}/Mk/Scripts/plist_sub_sed_sort.sh ${plistsub_sed} tmpplist=$(make -C ${portdir} -VTMPPLIST) while read -r modtype path extra; do @@ -69,7 +71,7 @@ while read -r modtype path extra; do esac ignore_path=0 - sub_path=$(echo "$path" | sed -e "s|^${PREFIX}/||" -e "${plistsub_sed}") + sub_path=$(echo "$path" | sed -e "s|^${PREFIX}/||" -f "${plistsub_sed}") orig_sub_path="${sub_path}" # If this is a directory, use @dir in output is_dir=0 Modified: head/Mk/Scripts/plist_sub_sed_sort.sh ============================================================================== --- head/Mk/Scripts/plist_sub_sed_sort.sh Thu Jul 26 10:37:36 2018 (r475360) +++ head/Mk/Scripts/plist_sub_sed_sort.sh Thu Jul 26 11:09:46 2018 (r475361) @@ -14,4 +14,4 @@ awk '{ gsub(/\\./, ".", a[2]) print length(a[2]), sedp } -}' | sort -rn | awk '{$1=""; print $0}' | paste -s -d ' ' - +}' | sort -rn | awk '{$1=""; print $0}' > $1