Date: Thu, 26 Jul 2018 11:09:47 +0000 (UTC) From: Mathieu Arnold <mat@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r475361 - head/Mk/Scripts Message-ID: <201807261109.w6QB9l1M048676@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807261109.w6QB9l1M048676>