Date: Thu, 13 Jun 2019 22:22:06 +0000 (UTC) From: Bryan Drewery <bdrewery@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r504140 - head/Mk/Scripts Message-ID: <201906132222.x5DMM6db084584@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bdrewery Date: Thu Jun 13 22:22:06 2019 New Revision: 504140 URL: https://svnweb.freebsd.org/changeset/ports/504140 Log: parse_plist: Avoid excess fork+exec inside the loop for stripping (mode) lines. Need to do it still after stripping away @comment though. The @dir handling could probably be improved as well somehow. Modified: head/Mk/Scripts/functions.sh Modified: head/Mk/Scripts/functions.sh ============================================================================== --- head/Mk/Scripts/functions.sh Thu Jun 13 22:14:10 2019 (r504139) +++ head/Mk/Scripts/functions.sh Thu Jun 13 22:22:06 2019 (r504140) @@ -25,13 +25,21 @@ parse_plist() { cwd=${PREFIX} cwd_save= commented_cwd= - while read -r line; do + # Strip (owner,group,perm) from keywords + sed -Ee 's/^@\([^)]*\)[[:space:]]+//' \ + -e 's/^(@[[:alpha:]]+)\([^)]*\)[[:space:]]+/\1 /' \ + | while read -r line; do # Handle deactivated OPTIONS. Treat "@comment file" as being in # the plist so it does not show up as an orphan. PLIST_SUB uses # a @comment to deactive files. XXX: It would be better to # make all ports use @ignore instead of @comment. if [ ${parse_comments} -eq 1 -a -z "${line%%@comment *}" ]; then line="${line##*@comment }" + # Strip (owner,group,perm) from keywords + # Need to do this again after stripping away @comment. + line="$(printf %s "$line" \ + | sed -Ee 's/^@\([^)]*\)[[:space:]]+//' \ + -e 's/^(@[[:alpha:]]+)\([^)]*\)[[:space:]]+/\1 /')" # Remove @comment so it can be parsed as a file, # but later prepend it again to create a list of # all files commented and uncommented. @@ -52,10 +60,6 @@ parse_plist() { fi fi - # Strip (owner,group,perm) from keywords - line="$(printf %s "$line" \ - | sed -Ee 's/^@\([^)]*\)[[:space:]]+//' \ - -e 's/^(@[[:alpha:]]+)\([^)]*\)[[:space:]]+/\1 /')" case $line in @dir*|'@unexec rmdir'*|'@unexec /bin/rmdir'*) line="$(printf %s "$line" \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906132222.x5DMM6db084584>