Date: Mon, 16 Nov 2009 06:10:24 +0000 (UTC) From: Doug Barton <dougb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r199312 - user/dougb/portmaster Message-ID: <200911160610.nAG6AOv1059806@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911160610.nAG6AOv1059806>