Date: Sun, 30 Jun 2019 23:02:45 +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: r505522 - head/Mk/Scripts Message-ID: <201906302302.x5UN2jeH006588@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bdrewery Date: Sun Jun 30 23:02:44 2019 New Revision: 505522 URL: https://svnweb.freebsd.org/changeset/ports/505522 Log: Reduce code duplication from r504140. Suggested by: cem Sponsored by: DellEMC Modified: head/Mk/Scripts/functions.sh Modified: head/Mk/Scripts/functions.sh ============================================================================== --- head/Mk/Scripts/functions.sh Sun Jun 30 22:08:19 2019 (r505521) +++ head/Mk/Scripts/functions.sh Sun Jun 30 23:02:44 2019 (r505522) @@ -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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906302302.x5UN2jeH006588>