From owner-svn-ports-head@freebsd.org Sun Jun 30 23:02:45 2019 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D941315E2817; Sun, 30 Jun 2019 23:02:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7872275C98; Sun, 30 Jun 2019 23:02:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 68E094730; Sun, 30 Jun 2019 23:02:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5UN2jVS006589; Sun, 30 Jun 2019 23:02:45 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5UN2jeH006588; Sun, 30 Jun 2019 23:02:45 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201906302302.x5UN2jeH006588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 30 Jun 2019 23:02:45 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r505522 - head/Mk/Scripts X-SVN-Group: ports-head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/Mk/Scripts X-SVN-Commit-Revision: 505522 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7872275C98 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jun 2019 23:02:46 -0000 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.