[64960] trunk/base/src

jmr at macports.org jmr at macports.org
Thu Mar 18 07:27:41 PDT 2010


Revision: 64960
          http://trac.macports.org/changeset/64960
Author:   jmr at macports.org
Date:     2010-03-18 07:27:40 -0700 (Thu, 18 Mar 2010)
Log Message:
-----------
treat ports installed for a different os.platform or os.major as outdated

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	2010-03-18 14:25:07 UTC (rev 64959)
+++ trunk/base/src/macports1.0/macports.tcl	2010-03-18 14:27:40 UTC (rev 64960)
@@ -2704,6 +2704,8 @@
         set oldnegatedvariant {}
     }
     set requestedflag [registry::property_retrieve $regref requested]
+    set os_platform_installed [registry::property_retrieve $regref os_platform]
+    set os_major_installed [registry::property_retrieve $regref os_major]
 
     # Before we do
     # dependencies, we need to figure out the final variants,
@@ -2787,7 +2789,7 @@
     set revision_in_tree "$portinfo(revision)"
     set epoch_in_tree "$portinfo(epoch)"
 
-    set epoch_override 0
+    set build_override 0
     set will_install yes
     # check installed version against version in ports
     if { ( [rpm-vercomp $version_installed $version_in_tree] > 0
@@ -2797,11 +2799,15 @@
         if {$portname != $newname} { 
             ui_debug "ignoring versions, installing replacement port"
         } elseif { $epoch_installed < $epoch_in_tree } {
-            set epoch_override 1
+            set build_override 1
             ui_debug "epoch override ... upgrading!"
         } elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants) eq "yes"
                   && [info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
             ui_debug "variant override ... upgrading!"
+        } elseif {[_mportkey $workername os.platform] != $os_platform_installed
+                  || [_mportkey $workername os.major] != $os_major_installed} {
+            ui_debug "platform mismatch ... upgrading!"
+            set build_override 1
         } else {
             if {[info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
                 ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Use 'upgrade --enforce-variants' to switch to the requested variants."
@@ -2814,7 +2820,7 @@
 
     set will_build no
     # avoid building again unnecessarily
-    if {$will_install && ([info exists options(ports_upgrade_force)] || $epoch_override == 1
+    if {$will_install && ([info exists options(ports_upgrade_force)] || $build_override == 1
         || ![registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)])} {
         set will_build yes
     }
@@ -2901,7 +2907,7 @@
     } else {
         # are we installing an existing version due to force or epoch override?
         if {[registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
-            && ([info exists options(ports_upgrade_force)] || $epoch_override == 1)} {
+            && ([info exists options(ports_upgrade_force)] || $build_override == 1)} {
              ui_debug "Uninstalling $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
             # we have to force the uninstall in case of dependents
             set force_cur [info exists options(ports_force)]

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2010-03-18 14:25:07 UTC (rev 64959)
+++ trunk/base/src/port/port.tcl	2010-03-18 14:27:40 UTC (rev 64960)
@@ -723,6 +723,9 @@
     # Now process the list, keeping only those ports that are outdated
     set results {}
     if { [llength $ilist] > 0 } {
+        global tcl_platform
+        set os_platform [string tolower $tcl_platform(os)]
+        set os_major [lindex [split $tcl_platform(osVersion) .] 0]
         foreach i $ilist {
 
             # Get information about the installed port
@@ -772,6 +775,16 @@
                     set comp_result [rpm-vercomp $installed_revision $latest_revision]
                 }
             }
+            if {$comp_result == 0} {
+                set regref [registry::open_entry $portname $installed_version $installed_revision $installed_variants $installed_epoch]
+                set os_platform_installed [registry::property_retrieve $regref os_platform]
+                set os_major_installed [registry::property_retrieve $regref os_major]
+                if {$os_platform_installed != "" && $os_platform_installed != 0
+                    && $os_major_installed != "" && $os_major_installed != 0
+                    && ($os_platform_installed != $os_platform || $os_major_installed != $os_major)} {
+                    set comp_result -1
+                }
+            }
 
             # Add outdated ports to our results list
             if { $comp_result < 0 } {
@@ -2386,8 +2399,11 @@
     }
 
     set num_outdated 0
-    if { [llength $ilist] > 0 } {   
-        foreach i $ilist { 
+    if { [llength $ilist] > 0 } {
+        global tcl_platform
+        set os_platform [string tolower $tcl_platform(os)]
+        set os_major [lindex [split $tcl_platform(osVersion) .] 0]
+        foreach i $ilist {
         
             # Get information about the installed port
             set portname [lindex $i 0]
@@ -2433,11 +2449,24 @@
             }
             
             # Compare versions, first checking epoch, then version, then revision
-            set comp_result [expr $installed_epoch - $latest_epoch]
+            set epoch_comp_result [expr $installed_epoch - $latest_epoch]
+            set comp_result [rpm-vercomp $installed_version $latest_version]
             if { $comp_result == 0 } {
-                set comp_result [rpm-vercomp $installed_version $latest_version]
-                if { $comp_result == 0 } {
-                    set comp_result [rpm-vercomp $installed_revision $latest_revision]
+                set comp_result [rpm-vercomp $installed_revision $latest_revision]
+            }
+            set reason ""
+            if {$comp_result == 0 && $epoch_comp_result != 0} {
+                set reason { (epoch $installed_epoch $relation $latest_epoch)}
+                set comp_result $epoch_comp_result
+            } elseif {$comp_result == 0 && $epoch_comp_result == 0} {
+                set regref [registry::open_entry $portname $installed_version $installed_revision [lindex $i 3] $installed_epoch]
+                set os_platform_installed [registry::property_retrieve $regref os_platform]
+                set os_major_installed [registry::property_retrieve $regref os_major]
+                if {$os_platform_installed != "" && $os_platform_installed != 0
+                    && $os_major_installed != "" && $os_major_installed != 0
+                    && ($os_platform_installed != $os_platform || $os_major_installed != $os_major)} {
+                    set comp_result -1
+                    set reason { (platform $os_platform_installed $os_major_installed != $os_platform $os_major)}
                 }
             }
             
@@ -2461,7 +2490,7 @@
                     }
                     incr num_outdated
 
-                    puts [format "%-30s %-24s %1s" $portname "$installed_compound $relation $latest_compound" $flag]
+                    puts [format "%-30s %-24s %1s" $portname "$installed_compound $relation $latest_compound [subst $reason]" $flag]
                 }
                 
             }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100318/7effffa3/attachment-0001.html>


More information about the macports-changes mailing list