diff options
author | Bryan Drewery <bdrewery@FreeBSD.org> | 2019-06-13 22:22:06 +0000 |
---|---|---|
committer | Bryan Drewery <bdrewery@FreeBSD.org> | 2019-06-13 22:22:06 +0000 |
commit | 5211362c1423385b22e1ff82eef8adedb5e40e4f (patch) | |
tree | fecd568081a68509634838bb91947445bcab7450 /Mk/Scripts | |
parent | Remove the .error as it is causing unintended side effects. (diff) |
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/Scripts')
-rw-r--r-- | Mk/Scripts/functions.sh | 14 |
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" \ |