aboutsummaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2019-06-13 22:22:06 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2019-06-13 22:22:06 +0000
commit5211362c1423385b22e1ff82eef8adedb5e40e4f (patch)
treefecd568081a68509634838bb91947445bcab7450 /Mk
parent42cbdd2e326b9596e30afd7adeaf15bccc4e849b (diff)
downloadports-5211362c1423385b22e1ff82eef8adedb5e40e4f.tar.gz
ports-5211362c1423385b22e1ff82eef8adedb5e40e4f.zip
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.
Notes
Notes: svn path=/head/; revision=504140
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/functions.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/Mk/Scripts/functions.sh b/Mk/Scripts/functions.sh
index 20affc692b03..87f4e87451ed 100644
--- a/Mk/Scripts/functions.sh
+++ b/Mk/Scripts/functions.sh
@@ -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" \