[53704] trunk/base/src

jmr at macports.org jmr at macports.org
Sun Jul 12 05:16:50 PDT 2009


Revision: 53704
          http://trac.macports.org/changeset/53704
Author:   jmr at macports.org
Date:     2009-07-12 05:16:49 -0700 (Sun, 12 Jul 2009)
Log Message:
-----------
Remove the -x flag and make its behaviour the default, improve error propagation, and handle the -p option where it is now needed. Fixes #13918.

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/port/port.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-07-12 11:53:05 UTC (rev 53703)
+++ trunk/base/src/macports1.0/macports.tcl	2009-07-12 12:16:49 UTC (rev 53704)
@@ -2312,7 +2312,11 @@
                 array set portinfo [mportinfo $workername]
                 
                 # upgrade its dependencies first
-                _upgrade_dependencies portinfo depscache globalvarlist variationslist options
+                set status [_upgrade_dependencies portinfo depscache globalvarlist variationslist options]
+                if {$status != 0 && ![ui_isset ports_processall]} {
+                    catch {mportclose $workername}
+                    return $status
+                }
                 # now install it
                 if {[catch {set result [mportexec $workername install]} result]} {
                     global errorInfo
@@ -2340,7 +2344,7 @@
             return 0
         } else {
             ui_error "Checking installed version failed: $result"
-            exit 1
+            return 1
         }
     } else {
         # we'll now take care of upgrading it, so we can add it to the cache
@@ -2458,7 +2462,11 @@
 
     # first upgrade dependencies
     if {![info exists options(ports_nodeps)]} {
-        _upgrade_dependencies portinfo depscache globalvarlist variationslist options
+        set status [_upgrade_dependencies portinfo depscache globalvarlist variationslist options]
+        if {$status != 0 && ![ui_isset ports_processall]} {
+            catch {mportclose $workername}
+            return $status
+        }
     } else {
         ui_debug "Not following dependencies"
     }
@@ -2487,7 +2495,11 @@
                     foreach dep $deplist {
                         set mpname [lindex $dep 2]
                         if {![llength [array get depscache port:${mpname}]]} {
-                            macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache
+                            set status [macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache]
+                            if {$status != 0 && ![ui_isset ports_processall]} {
+                                catch {mportclose $workername}
+                                return $status
+                            }
                         }
                     }
                 }
@@ -2625,7 +2637,11 @@
             foreach dep $deplist {
                 set mpname [lindex $dep 2]
                 if {![llength [array get depscache port:${mpname}]]} {
-                    macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache
+                    set status [macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache]
+                    if {$status != 0 && ![ui_isset ports_processall]} {
+                        catch {mportclose $workername}
+                        return $status
+                    }
                 }
             }
         }
@@ -2656,21 +2672,25 @@
     set saved_do_dependents [info exists options(ports_do_dependents)]
     unset -nocomplain options(ports_do_dependents)
 
+    set status 0
     # each dep type is upgraded
     foreach dtype {depends_fetch depends_extract depends_build depends_lib depends_run} {
         if {[info exists portinfo($dtype)]} {
             foreach i $portinfo($dtype) {
                 set d [lindex [split $i :] end]
                 if {![llength [array get depscache port:${d}]] && ![llength [array get depscache $i]]} {
-                    upgrade $d $i $globalvarlist $variationslist [array get options] depscache
+                    set status [upgrade $d $i $globalvarlist $variationslist [array get options] depscache]
+                    if {$status != 0 && ![ui_isset ports_processall]} break
                 }
             }
         }
+        if {$status != 0 && ![ui_isset ports_processall]} break
     }
     # restore dependent-following to its former value
     if {$saved_do_dependents} {
         set options(ports_do_dependents) yes
     }
+    return $status
 }
 
 # mportselect

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2009-07-12 11:53:05 UTC (rev 53703)
+++ trunk/base/src/port/port.tcl	2009-07-12 12:16:49 UTC (rev 53704)
@@ -2007,8 +2007,7 @@
     array set depscache {}
     foreachport $portlist {
         if {![registry::entry_exists_for_name $portname]} {
-            ui_error "$portname is not installed"
-            return 1
+            break_softcontinue "$portname is not installed" 1 status
         }
         if {![info exists depscache(port:$portname)]} {
             # Global variations will have to be merged into the specified
@@ -2019,11 +2018,14 @@
             set global_variations_list [mport_filtervariants [array get global_variations] yes]
             set variations_list [mport_filtervariants [array get requested_variations] yes]
             
-            macports::upgrade $portname "port:$portname" $global_variations_list $variations_list [array get options] depscache
+            set status [macports::upgrade $portname "port:$portname" $global_variations_list $variations_list [array get options] depscache]
+            if {$status != 0 && ![macports::ui_isset ports_processall]} {
+                return $status
+            }
         }
     }
 
-    return 0
+    return $status
 }
 
 
@@ -3216,11 +3218,6 @@
                         # Ignore errors while processing within a command
                         set ui_options(ports_processall) yes
                     }
-                    x {
-                        # Exit with error from any command while in batch/interactive mode
-                        set ui_options(ports_exit) yes
-                    }
-
                     f {
                         set global_options(ports_force) yes
                     }
@@ -3292,7 +3289,7 @@
     set action_status 0
 
     # Process an action if there is one
-    while {$action_status == 0 && [moreargs]} {
+    while {($action_status == 0 || [macports::ui_isset ports_processall]) && [moreargs]} {
         set action [lookahead]
         advance
         
@@ -3375,11 +3372,6 @@
 
         # semaphore to exit
         if {$action_status == -999} break
-
-        # If we're not in exit mode then ignore the status from the command
-        if { ![macports::ui_isset ports_exit] } {
-            set action_status 0
-        }
     }
     
     return $action_status
@@ -3502,7 +3494,7 @@
 
     # Main command loop
     set exit_status 0
-    while { $exit_status == 0 } {
+    while { $exit_status == 0 || [macports::ui_isset ports_processall] } {
 
         # Calculate our prompt
         if { $noisy } {
@@ -3522,11 +3514,9 @@
         set exit_status [process_cmd $line]
         
         # Check for semaphore to exit
-        if {$exit_status == -999} break
-        
-        # Ignore status unless we're in error-exit mode
-        if { ![macports::ui_isset ports_exit] } {
+        if {$exit_status == -999} {
             set exit_status 0
+            break
         }
     }
 
@@ -3568,16 +3558,10 @@
             close $in
         }
 
-        # Check for semaphore to exit
-        if {$exit_status == -999} {
-            set exit_status 0
-            break
+        # Exit on first failure unless -p was given
+        if {$exit_status != 0 && ![macports::ui_isset ports_processall]} {
+            return $exit_status
         }
-
-        # Ignore status unless we're in error-exit mode
-        if { ![macports::ui_isset ports_exit] } {
-            set exit_status 0
-        }
     }
 
     return $exit_status
@@ -3662,16 +3646,11 @@
 if { [llength $remaining_args] > 0 } {
 
     # If there are remaining arguments, process those as a command
-
-    # Exit immediately, by default, unless we're going to be processing command files
-    if {![info exists ui_options(ports_commandfiles)]} {
-        set ui_options(ports_exit) yes
-    }
     set exit_status [process_cmd $remaining_args]
 }
 
 # Process any prescribed command files, including standard input
-if { $exit_status == 0 && [info exists ui_options(ports_commandfiles)] } {
+if { ($exit_status == 0 || [macports::ui_isset ports_processall]) && [info exists ui_options(ports_commandfiles)] } {
     set exit_status [process_command_files $ui_options(ports_commandfiles)]
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090712/5ef38469/attachment-0001.html>


More information about the macports-changes mailing list