diff options
author | mat <mat@FreeBSD.org> | 2018-07-26 19:09:46 +0800 |
---|---|---|
committer | mat <mat@FreeBSD.org> | 2018-07-26 19:09:46 +0800 |
commit | 41119a60bcb6f030f1c4b49f070704c55386d064 (patch) | |
tree | 7a84179b4cd489ee679bb0b24e54c3530392d3cf /Mk | |
parent | b26f490b57554b364e147ec8db7dfbec43fbb846 (diff) | |
download | freebsd-ports-gnome-41119a60bcb6f030f1c4b49f070704c55386d064.tar.gz freebsd-ports-gnome-41119a60bcb6f030f1c4b49f070704c55386d064.tar.zst freebsd-ports-gnome-41119a60bcb6f030f1c4b49f070704c55386d064.zip |
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
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Scripts/check-stagedir.sh | 22 | ||||
-rw-r--r-- | Mk/Scripts/check_leftovers.sh | 6 | ||||
-rw-r--r-- | Mk/Scripts/plist_sub_sed_sort.sh | 2 |
3 files changed, 17 insertions, 13 deletions
diff --git a/Mk/Scripts/check-stagedir.sh b/Mk/Scripts/check-stagedir.sh index 5c85f2c1cbf2..0b0f1377351c 100644 --- a/Mk/Scripts/check-stagedir.sh +++ b/Mk/Scripts/check-stagedir.sh @@ -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 diff --git a/Mk/Scripts/check_leftovers.sh b/Mk/Scripts/check_leftovers.sh index 3db2290403a5..044317b2c5dd 100644 --- a/Mk/Scripts/check_leftovers.sh +++ b/Mk/Scripts/check_leftovers.sh @@ -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 diff --git a/Mk/Scripts/plist_sub_sed_sort.sh b/Mk/Scripts/plist_sub_sed_sort.sh index 1272f9ef94d0..3dbab42183ad 100644 --- a/Mk/Scripts/plist_sub_sed_sort.sh +++ b/Mk/Scripts/plist_sub_sed_sort.sh @@ -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 |