[53715] branches/images-and-archives/base

blb at macports.org blb at macports.org
Sun Jul 12 13:39:10 PDT 2009


Revision: 53715
          http://trac.macports.org/changeset/53715
Author:   blb at macports.org
Date:     2009-07-12 13:39:09 -0700 (Sun, 12 Jul 2009)
Log Message:
-----------
Merge from trunk

Modified Paths:
--------------
    branches/images-and-archives/base/doc/port.1
    branches/images-and-archives/base/src/macports1.0/macports.tcl
    branches/images-and-archives/base/src/port/port.tcl
    branches/images-and-archives/base/src/port1.0/portutil.tcl
    branches/images-and-archives/base/src/registry1.0/registry.tcl

Property Changed:
----------------
    branches/images-and-archives/base/


Property changes on: branches/images-and-archives/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:50249-53680
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:50249-53714
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/images-and-archives/base/doc/port.1
===================================================================
--- branches/images-and-archives/base/doc/port.1	2009-07-12 20:28:49 UTC (rev 53714)
+++ branches/images-and-archives/base/doc/port.1	2009-07-12 20:39:09 UTC (rev 53715)
@@ -229,8 +229,6 @@
 Read and process the
 .Ar file
 of commands specified by the argument. If the argument is '-', then read commands from stdin. If the option is given multiple times, then multiple files will be read.
-.It Fl x
-In batch and interactive mode, exit on the first error encountered. Otherwise, errors during batch execution are simply reported.
 .It Fl p
 Despite any errors encountered, proceed to process multiple ports and commands.
 .It Fl y

Modified: branches/images-and-archives/base/src/macports1.0/macports.tcl
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-07-12 20:28:49 UTC (rev 53714)
+++ branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-07-12 20:39:09 UTC (rev 53715)
@@ -110,9 +110,9 @@
 
 proc macports::ui_init {priority args} {
     # Get the list of channels.
-    try {
+    if {[llength [info commands ui_channels]] > 0} {
         set channels [ui_channels $priority]
-    } catch * {
+    } else {
         set channels [ui_channels_default $priority]
     }
 
@@ -121,15 +121,15 @@
     if {$nbchans == 0} {
         proc ::ui_$priority {args} {}
     } else {
-        try {
+        if {[llength [info commands ui_prefix]] > 0} {
             set prefix [ui_prefix $priority]
-        } catch * {
+        } else {
             set prefix [ui_prefix_default $priority]
         }
 
-        try {
+        if {[llength [info commands ::ui_init]] > 0} {
             eval ::ui_init $priority $prefix $channels $args
-        } catch * {
+        } else {
             if {$nbchans == 1} {
                 set chan [lindex $channels 0]
                 proc ::ui_$priority {args} [subst {
@@ -1811,13 +1811,17 @@
                     lappend matches $name
                     lappend matches $line
                     close $fd
-                    break
+                    set fd -1
                 } catch {*} {
                     ui_warn "It looks like your PortIndex file may be corrupt."
-                    throw
                 } finally {
-                    catch {close $fd}
+                    if {$fd != -1} {
+                        close $fd
+                    }
                 }
+                if {[llength $matches] > 0} {
+                    break
+                }
             }
         } else {
             array set attrs [list name $name]
@@ -1846,8 +1850,8 @@
         if {![file exists ${index}]} {
             continue
         }
-        if {![file exists ${index}.quick] || [file mtime ${index}] > [file mtime ${index}.quick]} {
-            # stale or nonexistent quick index file, so generate a new one
+        if {![file exists ${index}.quick]} {
+            ui_warn "No quick index file found, attempting to generate one for source: $source"
             if {[catch {set quicklist [mports_generate_quickindex ${index}]}]} {
                 continue
             }
@@ -2259,7 +2263,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
@@ -2287,7 +2295,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
@@ -2405,7 +2413,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"
     }
@@ -2434,7 +2446,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
+                            }
                         }
                     }
                 }
@@ -2544,7 +2560,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
+                    }
                 }
             }
         }
@@ -2553,6 +2573,7 @@
 
     # close the port handle
     mportclose $workername
+    return 0
 }
 
 # upgrade_dependencies: helper proc for upgrade
@@ -2575,21 +2596,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: branches/images-and-archives/base/src/port/port.tcl
===================================================================
--- branches/images-and-archives/base/src/port/port.tcl	2009-07-12 20:28:49 UTC (rev 53714)
+++ branches/images-and-archives/base/src/port/port.tcl	2009-07-12 20:39:09 UTC (rev 53715)
@@ -1341,6 +1341,7 @@
             return 1
         }
     }
+    return 0
 }
 
 
@@ -1718,6 +1719,7 @@
         return 1
     }
 
+    set status 0
     foreachport $portlist {
         if {$porturl eq ""} {
             # Look up the port.
@@ -1778,6 +1780,7 @@
             }
         }
     }
+    return $status
 }
 
 
@@ -1994,10 +1997,10 @@
     }
     # shared depscache for all ports in the list
     array set depscache {}
+    set status 0
     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
@@ -2008,11 +2011,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
 }
 
 
@@ -2036,6 +2042,7 @@
 
     registry::open_dep_map
 
+    set status 0
     foreachport $portlist {
         set composite_version [composite_version $portversion [array get variations]]
         if { [catch {set ilist [registry::installed $portname $composite_version]} result] } {
@@ -2063,7 +2070,7 @@
             ui_msg "$portname has no dependents!"
         }
     }
-    return 0
+    return $status
 }
 
 
@@ -2081,6 +2088,10 @@
     }
 
     foreachport $portlist {
+        if {![registry::entry_exists_for_name $portname]} {
+            ui_info "$portname is already uninstalled"
+            continue
+        }
         if { [catch {portuninstall::uninstall $portname [composite_version $portversion [array get variations]] [array get options]} result] } {
             global errorInfo
             ui_debug "$errorInfo"
@@ -2088,7 +2099,7 @@
         }
     }
 
-    return 0
+    return $status
 }
 
 
@@ -3192,11 +3203,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
                     }
@@ -3262,7 +3268,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
         
@@ -3345,11 +3351,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
@@ -3472,7 +3473,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 } {
@@ -3492,11 +3493,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
         }
     }
 
@@ -3538,16 +3537,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
@@ -3632,16 +3625,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)]
 }
 

Modified: branches/images-and-archives/base/src/port1.0/portutil.tcl
===================================================================
--- branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-07-12 20:28:49 UTC (rev 53714)
+++ branches/images-and-archives/base/src/port1.0/portutil.tcl	2009-07-12 20:39:09 UTC (rev 53715)
@@ -1573,10 +1573,13 @@
             return -code error "$statefile is not writable - check permission on port directory"
         }
         if {!([info exists ports_ignore_older] && $ports_ignore_older == "yes") && [file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
-            ui_msg "Portfile changed since last build; discarding previous state."
-            #file delete $statefile
-            delete [file join $workpath]
-            file mkdir [file join $workpath]
+            if {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
+                ui_msg "Portfile changed since last build; discarding previous state."
+                delete [file join $workpath]
+                file mkdir [file join $workpath]
+            } else {
+                ui_msg "Portfile changed since last build but not discarding previous state (dry run)"
+            }
         }
     }
     chownAsRoot $workpath

Modified: branches/images-and-archives/base/src/registry1.0/registry.tcl
===================================================================
--- branches/images-and-archives/base/src/registry1.0/registry.tcl	2009-07-12 20:28:49 UTC (rev 53714)
+++ branches/images-and-archives/base/src/registry1.0/registry.tcl	2009-07-12 20:39:09 UTC (rev 53715)
@@ -437,12 +437,7 @@
 		return -code error "Image error: Can't find image file $macport_file"
 	}
 	
-    if {$v != ""} {
-        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $v]"
-    } else {
-        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
-    }
-
+	# if another version of this port is active, deactivate it first
 	set ilist [registry::installed $name]
 	if { [llength $ilist] > 1 } {
 		foreach i $ilist {
@@ -452,11 +447,17 @@
 			set	ivariants [lindex $i 3]
 			set iactive [lindex $i 4]
 			if { ![string equal ${iversion}_${irevision}${ivariants} ${version}_${revision}${variants}] && $iactive == 1 } {
-				return -code error "Image error: Another version of this port ($iname @${iversion}_${irevision}${ivariants}) is already active."
+				deactivate $iname ${iversion}_${irevision}${ivariants} $optionslist
 			}
 		}
 	}
 
+	if {$v != ""} {
+		ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $v]"
+	} else {
+		ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
+	}
+
 	set ref [registry::open_entry $name $version $revision $variants]
 	
 	if { [registry::property_retrieve $ref active] != 0 } {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090712/11f2f460/attachment-0001.html>


More information about the macports-changes mailing list