svn commit: r505522 - head/Mk/Scripts

Bryan Drewery bdrewery at FreeBSD.org
Sun Jun 30 23:02:46 UTC 2019


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 at 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.


More information about the svn-ports-head mailing list