Date: Mon, 12 Sep 2011 00:50:33 +0000 (UTC) From: Doug Barton <dougb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r225496 - user/dougb/portmaster Message-ID: <201109120050.p8C0oXjX003035@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dougb Date: Mon Sep 12 00:50:33 2011 New Revision: 225496 URL: http://svn.freebsd.org/changeset/base/225496 Log: Add the ability to retry package creation. This is mostly useful for PM_SU_CMD after a build that took so long that your sudo ticket has expired. While I'm at it, apply the benefits of looking at old code with fresh eyes to the other place where there are 3 options in the menu (and thus neither of the get_answer*() variants are appropriate. Modified: user/dougb/portmaster/portmaster Modified: user/dougb/portmaster/portmaster ============================================================================== --- user/dougb/portmaster/portmaster Sun Sep 11 23:37:40 2011 (r225495) +++ user/dougb/portmaster/portmaster Mon Sep 12 00:50:33 2011 (r225496) @@ -1714,16 +1714,27 @@ pm_pkg_create () { echo " ===>>> Package saved to ${1}/All" ; echo '' fi else - echo '' - echo "===>>> Package creation failed for ${2}!" - echo '' + local answer + + while : ; do + echo -e "\n===>>> Package creation failed for ${2}!\n" + + [ -n "$backup" -a -n "$PM_IGNORE_FAILED_BACKUP_PACKAGE" ] && return - [ -n "$backup" -a -n "$PM_IGNORE_FAILED_BACKUP_PACKAGE" ] && return + echo "===>>> Ignore this error [i]" + echo "===>>> Abort update [a]" + echo "===>>> Retry [r]" + echo -e "\n===>>> How would you like to proceed? [i] \c" + read answer ; echo '' - echo "===>>> Ignore this error [i]" - echo "===>>> Abort [a]" - get_answer_g i a "\n===>>> How would you like to proceed?" - case "$?" in 1) fail "Package creation failed for $2" ;; esac + case "$answer" in + ''|[iI]) break ;; + [aA]) fail "Package creation failed for $2" ;; + [rR]) pm_pkg_create $1 $2 ; break ;; + *) echo " ===>>> $answer is not a valid response" ;; + esac + done + unset answer fi } @@ -3455,26 +3466,25 @@ fetch_package () { echo " on setting the PACKAGESITE environment variable" [ "$PM_PACKAGES" = only -a -z "$FETCH_ONLY" ] && fail $ponly_err if [ -n "$FETCH_ONLY" ]; then - while [ -z "$continue" ]; do + while : ; do echo -e "\n===>>> There is no valid package to install\n" echo "===>>> Abort update [a]" echo "===>>> Retry fetch [r]" echo "===>>> Continue if possible [c]" - echo '' - echo -n "===>>> How would you like to proceed? [a] " + echo -e "\n===>>> How would you like to proceed? [a] \c" read answer ; echo '' case "$answer" in - a|'') fail "No package exists for $new_port" ;; - r) if fetch_package $new_port try ; then + ''|[aA]) fail "No package exists for $new_port" ;; + [rR]) if fetch_package $new_port try ; then latest_pv=$new_port - continue=continue + break fi ;; - c) safe_exit ;; + [cC]) safe_exit ;; *) echo " ===>>> $answer is not a valid response" ;; esac done - unset continue answer + unset answer fi else latest_pv=${latest_pv#*href=\"}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109120050.p8C0oXjX003035>