From owner-svn-src-user@FreeBSD.ORG Mon Nov 16 06:10:24 2009 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57B9D1065676; Mon, 16 Nov 2009 06:10:24 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 474978FC08; Mon, 16 Nov 2009 06:10:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAG6AOgN059808; Mon, 16 Nov 2009 06:10:24 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAG6AOv1059806; Mon, 16 Nov 2009 06:10:24 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200911160610.nAG6AOv1059806@svn.freebsd.org> From: Doug Barton Date: Mon, 16 Nov 2009 06:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199312 - user/dougb/portmaster X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2009 06:10:24 -0000 Author: dougb Date: Mon Nov 16 06:10:24 2009 New Revision: 199312 URL: http://svn.freebsd.org/changeset/base/199312 Log: Fix 2 places where we generate a list of ports by using cut to process directory names in /var/db/pkg. The previous code assumed that the value of PKG_DBDIR would always be 3 directories deep, which is not necessarily a valid assumption. In one spot this allows us to avoid an external shell call altogether, in the other an internal function is a necessary evil to avoid other even more complex alternatives. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Mon Nov 16 05:12:23 2009 (r199311) +++ user/dougb/portmaster/portmaster Mon Nov 16 06:10:24 2009 (r199312) @@ -449,6 +449,16 @@ check_regular_file () { [ ! -L "$1" -a -f "$1" ] || fail "ERROR: $1 is not a regular file!" } +strip_to_iport () { + local in + + while read in; do + in="${in%/+CONTENTS}" + in="${in##*/}" + echo $in + done +} + check_dependency_files () { # Global: grep_deps local origin iport ro_opd @@ -465,7 +475,7 @@ check_dependency_files () { # Always rely on the grep'ed dependencies instead of +REQUIRED_BY grep_deps=`pm_mktemp grep-deps-${iport}` egrep -l "DEPORIGIN:($origin|$ro_opd)$" $pdb/*/+CONTENTS | - cut -f 5 -d '/' | sort -u > $grep_deps + strip_to_iport | sort -u > $grep_deps if [ ! -s "$grep_deps" ]; then if [ -s "$pdb/$iport/+REQUIRED_BY" ]; then @@ -1767,8 +1777,9 @@ create_master_rb_list () { # Global: MASTER_RB_LIST local req_by - for req_by in `grep -l DEPORIGIN:$portdir$ $pdb/*/+CONTENTS | \ - cut -f 5 -d '/'`; do + for req_by in `grep -l DEPORIGIN:$portdir$ $pdb/*/+CONTENTS`; do + req_by="${req_by%/+CONTENTS}" + req_by="${req_by##*/}" MASTER_RB_LIST="${MASTER_RB_LIST}${req_by} " done