From owner-svn-src-user@FreeBSD.ORG Sun Jun 10 07:57:50 2012 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 0AC79106566B; Sun, 10 Jun 2012 07:57: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 E01438FC14; Sun, 10 Jun 2012 07:57:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5A7vnIg081782; Sun, 10 Jun 2012 07:57:49 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5A7vn2L081780; Sun, 10 Jun 2012 07:57:49 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201206100757.q5A7vn2L081780@svn.freebsd.org> From: Doug Barton Date: Sun, 10 Jun 2012 07:57:49 +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: r236841 - 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: Sun, 10 Jun 2012 07:57:50 -0000 Author: dougb Date: Sun Jun 10 07:57:49 2012 New Revision: 236841 URL: http://svn.freebsd.org/changeset/base/236841 Log: Add robust error handling for pm_cd_pd, to avoid the problem of exit not being called from a function. Fix an error handling fix for pm_mktemp from the previous commit Speed up the determination of WRKDIRPREFIX Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sun Jun 10 07:40:43 2012 (r236840) +++ user/dougb/portmaster/portmaster Sun Jun 10 07:57:49 2012 (r236841) @@ -294,8 +294,7 @@ safe_exit () { pm_cd () { builtin cd $1 2>/dev/null || return 1; } pm_cd_pd () { [ -n "$PM_INDEX_ONLY" ] && return 2; - builtin cd $pd/$1 2>/dev/null || - fail "Cannot cd to port directory: $pd/$1"; } + builtin cd $pd/$1 2>/dev/null || return 1; } pm_kill () { /bin/kill $* >/dev/null 2>/dev/null; } pm_make () { ( unset -v CUR_DEPS INSTALLED_LIST PM_DEPTH build_l; unset -v PM_URB_LIST; @@ -1663,7 +1662,11 @@ check_for_updates () { echo " ===>>> New version available: $port_ver" [ -e "$pdb/$iport/+IGNOREME" ] && echo " ===>>> +IGNOREME file is present for $1" - pm_cd_pd $origin && check_state + if pm_cd_pd $origin ; then + check_state + else + fail "Cannot cd to port directory: $pd/$origin" + fi num_updates=$(( $num_updates + 1 )) else unset moved_npd @@ -1731,7 +1734,7 @@ pm_pkg_create () { if [ -z "$PM_INDEX_ONLY" ]; then local latest_link - pm_cd_pd $portdir + pm_cd_pd $portdir || fail "Cannot cd to port directory: $pd/$portdir" latest_link=`pm_make -V LATEST_LINK` cd ${1}/Latest $PM_SU_CMD ln -sf ../All/$pkg ${latest_link}.tbz @@ -1865,7 +1868,7 @@ set_distfiles_and_subdir () { [ -z "$dist_list_files" ] && find_dl_distfiles $1 if [ -d "$pd/$1" ]; then - pm_cd_pd $1 + pm_cd_pd $1 || fail "Cannot cd to port directory: $pd/$1" else return 1 fi @@ -2367,7 +2370,7 @@ gen_dep_list () { local list if [ -z "$PM_INDEX_ONLY" ]; then - pm_cd_pd $portdir + pm_cd_pd $portdir || fail "Cannot cd to port directory: $pd/$portdir" list=`pm_make $* | sort -u` else local temp_list l @@ -2870,7 +2873,7 @@ make_config () { config_type=config-conditional [ -n "$PM_FORCE_CONFIG" ] && config_type=config pm_sv Running \'make $config_type\' - pm_cd_pd $portdir + pm_cd_pd $portdir || fail "Cannot cd to port directory: $pd/$portdir" pm_make_s $config_type } @@ -2931,8 +2934,13 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S NO_DEP_UPDATES=no_dep_updates ; build_l='' export NO_DEP_UPDATES build_l - [ -z "$PM_INDEX_ONLY" ] && - pm_cd_pd && PM_WRKDIRPREFIX=`pm_make_b -V WRKDIRPREFIX` && pm_cd - + if [ -z "$PM_INDEX_ONLY" ]; then + if pm_cd_pd Mk ; then + PM_WRKDIRPREFIX=`pm_make_b -V WRKDIRPREFIX` && pm_cd - + else + fail "Cannot cd to port directory: $pd/Mk" + fi + fi fi if [ -n "$PM_BUILD_ONLY_LIST" ]; then @@ -2955,8 +2963,13 @@ if [ "$$" -eq "$PM_PARENT_PID" -a -z "$S fi # Set the file name here so it's visible to the children - [ -z "$DONT_SCRUB_DISTFILES" -a -z "$FETCH_ONLY" -a -z "$PM_PACKAGES" ] && - export DI_FILES=`pm_mktemp DI-FILES` || fail 'mktemp failed for DI-FILES' + if [ -z "$DONT_SCRUB_DISTFILES" -a -z "$FETCH_ONLY" -a -z "$PM_PACKAGES" ]; then + if DI_FILES=`pm_mktemp DI-FILES` ; then + export DI_FILES + else + fail 'mktemp failed for DI-FILES' + fi + fi [ -n "$PM_URB" ] && multiport $PM_URB_IPORTS [ $# -gt 1 -a -z "$REPLACE_ORIGIN" ] && multiport "$@" @@ -3329,7 +3342,7 @@ fi # [ -n "$PM_FIRST_PASS" ] [ -z "$PM_BUILDING" ] && export PM_BUILDING=pmbuildingmain -pm_cd_pd $portdir +pm_cd_pd $portdir || fail "Cannot cd to port directory: $pd/$portdir" if [ -n "$PM_BUILD_ONLY_LIST" ]; then case "$build_only_dl_g" in @@ -3356,7 +3369,7 @@ if [ -z "$NO_DEP_UPDATES" ]; then dependency_check run-depends-list fi fi - pm_cd_pd $portdir + pm_cd_pd $portdir || fail "Cannot cd to port directory: $pd/$portdir" elif [ "$$" -eq "$PM_PARENT_PID" ]; then echo "===>>> All dependencies are up to date" echo '' @@ -3619,7 +3632,7 @@ if [ -z "$use_package" ]; then fi fi - pm_cd_pd $portdir + pm_cd_pd $portdir || fail "Cannot cd to port directory: $pd/$portdir" [ -z "$DONT_PRE_CLEAN" ] && { pm_make clean NOCLEANDEPENDS=ncd || fail 'make clean failed'; echo ''; } @@ -3713,13 +3726,13 @@ if [ -n "$upg_port" -o -n "$ro_upg_port" pm_pkg_delete_s -f $upg_port fi - pm_cd_pd $portdir + pm_cd_pd $portdir || fail "Cannot cd to port directory: $pd/$portdir" fi if [ -z "$PM_THOROUGH" -a -z "$NO_DEP_UPDATES" ]; then echo '' ; echo "===>>> Starting check for runtime dependencies" dependency_check run-depends-list - pm_cd_pd $portdir + pm_cd_pd $portdir || fail "Cannot cd to port directory: $pd/$portdir" fi if [ -n "$FETCH_ONLY" ]; then # Only reached here if using packages