From owner-svn-src-user@FreeBSD.ORG Tue Jul 27 23:03:50 2010 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 B05141065676; Tue, 27 Jul 2010 23:03:50 +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 A01F28FC13; Tue, 27 Jul 2010 23:03:50 +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 o6RN3obV035483; Tue, 27 Jul 2010 23:03:50 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6RN3oMB035481; Tue, 27 Jul 2010 23:03:50 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201007272303.o6RN3oMB035481@svn.freebsd.org> From: Doug Barton Date: Tue, 27 Jul 2010 23:03:50 +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: r210554 - 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: Tue, 27 Jul 2010 23:03:50 -0000 Author: dougb Date: Tue Jul 27 23:03:50 2010 New Revision: 210554 URL: http://svn.freebsd.org/changeset/base/210554 Log: Brain-o fixes and other items noticed by bf: 1. If $PM_LOG exists but is not writable, warn the user 2. If PORTSDIR exists, but isn't a ports tree, warn the user 3. Add some more things to avoid checking in read_distinfos_all() 4. When setting PACKAGES run tests against $pd, not literal /usr/ports Other fixes: 1. When using $INSTALLED_LIST don't output the terminal \n to PM_LOG so we don't get 2 empty lines in a row. 2. In read_distinfos*() don't cd into the directory if /distinfo exists. For the _all() case the speedup is very noticable, around 30%. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Tue Jul 27 22:55:24 2010 (r210553) +++ user/dougb/portmaster/portmaster Tue Jul 27 23:03:50 2010 (r210554) @@ -188,8 +188,10 @@ parent_exit () { esac fi if [ -n "$PM_LOG" ]; then - if [ -f "$PM_LOG" ]; then + if [ -w "$PM_LOG" ]; then echo '' >> $PM_LOG + elif [ -e "$PM_LOG" -a ! -w "$PM_LOG" ]; then + echo "===>>> Warning: $PM_LOG exists, but is not writable" elif [ -e "$PM_LOG" -o -L "$PM_LOG" ]; then echo "===>>> Warning: $PM_LOG exists, but is not a regular file" else @@ -203,7 +205,7 @@ parent_exit () { case "$show_list" in all) echo "===>>> The following actions were performed:" echo -e $INSTALLED_LIST - [ -n "$PM_LOG" ] && echo -e $INSTALLED_LIST >> $PM_LOG ;; + [ -n "$PM_LOG" ] && echo -e ${INSTALLED_LIST%\n} >> $PM_LOG ;; one) echo "===>>> $ilist complete" ; echo '' [ -n "$PM_LOG" ] && echo " $ilist" >> $PM_LOG ;; esac @@ -535,6 +537,9 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then fi fi + [ -n "$pd" ] && [ ! -r "${pd}/Mk/bsd.port.mk" ] && + fail "The ports directory ($pd) does not seem to contain a ports tree" + if [ -n "$PM_INDEX" ]; then if [ -z "$INDEXFILE" ]; then ver=`uname -r` @@ -876,11 +881,10 @@ read_distinfos () { origin=$moved_npd fi - pm_cd $pd/$origin || continue - - if [ -s distinfo ]; then - distinfo=distinfo + if [ -s "${origin}/distinfo" ]; then + distinfo="${origin}/distinfo" else + pm_cd $origin || continue distinfo=`pm_make -V MD5_FILE` fi @@ -905,16 +909,17 @@ read_distinfos_all () { echo "===>>> Gathering distinfo list for all ports" echo ' (This will take several minutes)' echo '' + for origin in ${pd}/*/*; do case "${origin#$pd/}" in - Mk/*|T*|distfiles/*|packages/*|*/[Mm]akefile) continue ;; esac + Mk/*|T*|distfiles/*|packages/*|*/[Mm]akefile*|CVS/*|*/CVS) continue ;; esac [ -d "$origin" ] || continue - pm_cd $origin || continue - if [ -s distinfo ]; then - distinfo=distinfo + if [ -s "${origin}/distinfo" ]; then + distinfo="${origin}/distinfo" else + pm_cd $origin || continue distinfo=`pm_make -V MD5_FILE` fi @@ -1001,11 +1006,11 @@ init_packages_var () { PACKAGES=`pm_make -f/usr/share/mk/bsd.port.mk -V PACKAGES 2>/dev/null` if [ -z "$PACKAGES" ]; then - if [ -d /usr/ports/packages -a -w /usr/ports/packages ]; then - PACKAGES='/usr/ports/packages' + if [ -d "${pd}/packages" -a -w "${pd}/packages" ]; then + PACKAGES="${pd}/packages" else - if [ -d /usr/ports/ -a -w /usr/ports/ ]; then - PACKAGES='/usr/ports/packages' + if [ -d "${pd}/" -a -w "${pd}/" ]; then + PACKAGES="${pd}/packages" else fail 'The value of PACKAGES cannot be empty and the directory must be writable' fi