aboutsummaryrefslogtreecommitdiff
path: root/Mk
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2019-06-30 23:02:44 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2019-06-30 23:02:44 +0000
commit245e0379ee6260f0e6e8f4f2c844fd6a0eacd8e4 (patch)
treec7bc50ac4a2f151ef0d1f5d730aa6107d8cca2ce /Mk
parentcc0259a98d0da6ee0c388dff09243af9897ac13f (diff)
downloadports-245e0379ee6260f0e6e8f4f2c844fd6a0eacd8e4.tar.gz
ports-245e0379ee6260f0e6e8f4f2c844fd6a0eacd8e4.zip
Notes
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/functions.sh15
1 files changed, 8 insertions, 7 deletions
diff --git a/Mk/Scripts/functions.sh b/Mk/Scripts/functions.sh
index 87f4e87451ed..63ba4b06ce98 100644
--- a/Mk/Scripts/functions.sh
+++ b/Mk/Scripts/functions.sh
@@ -4,6 +4,12 @@
#
# MAINTAINER: portmgr@FreeBSD.org
+# Strip (owner,group,perm) from keywords
+_strip_perms() {
+ sed -Ee 's/^@\([^)]*\)[[:space:]]+//' \
+ -e 's/^(@[[:alpha:]]+)\([^)]*\)[[:space:]]+/\1 /'
+}
+
# Expand TMPPLIST to absolute paths, splitting files and dirs into separate
# descriptors.
# Input:
@@ -25,10 +31,7 @@ parse_plist() {
cwd=${PREFIX}
cwd_save=
commented_cwd=
- # Strip (owner,group,perm) from keywords
- sed -Ee 's/^@\([^)]*\)[[:space:]]+//' \
- -e 's/^(@[[:alpha:]]+)\([^)]*\)[[:space:]]+/\1 /' \
- | while read -r line; do
+ _strip_perms | 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
@@ -37,9 +40,7 @@ parse_plist() {
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 /')"
+ line="$(printf %s "$line" | _strip_perms)"
# 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.