From e1ddda2f1d39b3d732414d9b9c396c14e1356009 Mon Sep 17 00:00:00 2001 From: dougb Date: Wed, 19 Mar 2008 21:47:16 +0000 Subject: New Implementation ================== The previous code tried to handle moved ports in much the same way as it handled replacing a port with the -o option, but this would sometimes create problems if we are deep in a dependency graph. So rather than re-implement only a portion of the -o code, use the whole thing instead. We accomplish this by either exec'ing ourselves with the proper -o options if we are in the dependency tree, or by asking the user to restart with the proper -o options if they specified the moved port on the command line. The latter is necessary to avoid having to duplicate all the "initialize the parent process" code. This allows me to simplify the code in a few places since -o is now the only special case. Bug Fixes ========= 1. Don't try to derive $portdir from $upg_port if using -o 2. Don't try to build a port with an +IGNOREME file if we are doing the dependent ports in -r mode Minor tweak: Add some whitespace after a warning message --- ports-mgmt/portmaster/files/portmaster.sh.in | 38 +++++++++++++--------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'ports-mgmt') diff --git a/ports-mgmt/portmaster/files/portmaster.sh.in b/ports-mgmt/portmaster/files/portmaster.sh.in index d782d2055fc4..6d336809098d 100644 --- a/ports-mgmt/portmaster/files/portmaster.sh.in +++ b/ports-mgmt/portmaster/files/portmaster.sh.in @@ -41,7 +41,7 @@ umask 022 version () { local rcs cvs - rcs='$Id: portmaster,v 2.24 2008/01/30 01:40:33 doug Exp $' + rcs='$Id: portmaster,v 2.27 2008/03/19 21:32:24 doug Exp $' cvs='$FreeBSD$' rcs="${rcs#*,v }" ; rcs="${rcs%% *}" @@ -161,6 +161,7 @@ safe_exit () { echo " but first take a moment to review the error messages" echo -n " above. Then press Enter when ready to proceed. " read DISCARD + echo '' fi p='less -e' @@ -367,7 +368,7 @@ check_regular_file () { check_dependency_files () { # Global: grep_deps - local origin iport ro_opd moved_opd + local origin iport ro_opd origin=$1 ; iport=$2 @@ -376,12 +377,10 @@ check_dependency_files () { origin=`echo $origin | sed 's#\+#\\\\+#g'` ;; esac case "$ro_opd" in *+*) ro_opd=`echo $ro_opd | sed 's#\+#\\\\+#g'` ;; esac - case "$moved_opd" in *+*) - moved_opd=`echo $moved_opd | sed 's#\+#\\\\+#g'` ;; esac # Always rely on the grep'ed dependencies instead of +REQUIRED_BY grep_deps=`pm_mktemp grep-deps-${iport}` - egrep -l "DEPORIGIN:($origin|$ro_opd|$moved_opd)$" $pdb/*/+CONTENTS | + egrep -l "DEPORIGIN:($origin|$ro_opd)$" $pdb/*/+CONTENTS | cut -f 5 -d '/' | sort -u > $grep_deps if [ ! -s "$grep_deps" ]; then @@ -491,13 +490,11 @@ IFS=' } find_moved_port () { - # Global: moved_opd moved_npd + # Global: moved_npd local sf iport IFS l sf=$1 # Search for iport=$2 - # Old port directory, do not update if we recurse - [ -z "$moved_opd" ] && moved_opd=$1 # To avoid having each word of the reason treated separately IFS=' @@ -1769,7 +1766,7 @@ else fi fi -if [ -n "$upg_port" ]; then +if [ -n "$upg_port" -a -z "$REPLACE_ORIGIN" ]; then portdir=`origin_from_pdb $upg_port` [ -n "$portdir" ] || fail "No ORIGIN in $pdb/$upg_port/+CONTENTS" elif [ -z "$portdir" ]; then @@ -1779,8 +1776,15 @@ fi if [ ! -d "$pd/$portdir" ]; then find_moved_port $portdir $upg_port || no_valid_port [ -n "$moved_npd" ] || no_valid_port - portdir=$moved_npd - [ -d "$pd/$portdir" ] || no_valid_port + [ -d "$pd/$moved_npd" ] || no_valid_port + + if [ "$$" -eq "$PARENT_PID" ]; then + echo "===>>> To update this port run:" + echo "===>>> ${0##*/} $ARGS -o $moved_npd $upg_port" + fail 'Port has moved' + else + exec $0 $ARGS -o $moved_npd $upg_port + fi fi [ -z "$upg_port" -a -z "$REPLACE_ORIGIN" ] && upg_port=`iport_from_origin ${portdir}` @@ -1811,7 +1815,7 @@ if [ -e "$pdb/$upg_port/+IGNOREME" ]; then fi ;; esac - elif [ -n "$NO_RECURSIVE_CONFIG" ]; then + elif [ -n "$NO_RECURSIVE_CONFIG" -o -n "$URB_YES" ]; then echo '' echo "===>>> $upg_port has an +IGNOREME file, ignoring" echo '' @@ -2172,12 +2176,8 @@ if [ -s "$grep_deps" ]; then grep -ql "DEPORIGIN:$ro_opd$" $dp_cont && update_contents $dp_cont $portdir $new_port $ro_opd fi - if [ -n "$moved_opd" ]; then - grep -ql "DEPORIGIN:$moved_opd$" $dp_cont && - update_contents $dp_cont $portdir $new_port $moved_opd - fi # Do this one last so it can get deleted as a duplicate - # if either of the other two were present. + # if ro_opd is present. if grep -ql "DEPORIGIN:$portdir$" $dp_cont; then update_contents $dp_cont $portdir $new_port fi @@ -2232,10 +2232,6 @@ if [ -z "$DONT_SCRUB_DISTFILES" ]; then delete_all_distfiles $ro_opd delete_dist_list fi - if [ -n "$moved_opd" ]; then - delete_all_distfiles $moved_opd - delete_dist_list - fi fi if [ -n "$UPDATE_REQ_BYS" -a -s "$pdb/$new_port/+REQUIRED_BY" ]; then -- cgit