[54376] trunk/base

jmr at macports.org jmr at macports.org
Sat Jul 25 12:45:03 PDT 2009


Revision: 54376
          http://trac.macports.org/changeset/54376
Author:   jmr at macports.org
Date:     2009-07-25 12:45:02 -0700 (Sat, 25 Jul 2009)
Log Message:
-----------
Add upgrade options --enforce-variants and --force. The former upgrades when the port is not outdated but the requested variants don't match those installed. The latter is now used instead of the global -f option to force rebuild. Closes #20156.

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

Modified: trunk/base/doc/port.1
===================================================================
--- trunk/base/doc/port.1	2009-07-25 18:53:19 UTC (rev 54375)
+++ trunk/base/doc/port.1	2009-07-25 19:45:02 UTC (rev 54376)
@@ -364,7 +364,7 @@
 .Pp
 To force an upgrade (rebuild) use:
 .Pp
-.Dl "port -f upgrade vim"
+.Dl "port upgrade --force vim"
 .Pp
 To upgrade
 .Ar portname
@@ -379,7 +379,7 @@
 then the variants active in the latest installed version of the port, and 
 finally the global variants specified in variants.conf, if any.  Note that 
 upgrade will not normally rebuild a port only to change the selected 
-variants; you can either specify -f, or deactivate the port and reinstall it 
+variants; you can either specify --enforce-variants, or deactivate the port and reinstall it 
 with different variants. 
 .Ss clean
 Clean the files used for building

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2009-07-25 18:53:19 UTC (rev 54375)
+++ trunk/base/src/macports1.0/macports.tcl	2009-07-25 19:45:02 UTC (rev 54376)
@@ -2482,13 +2482,19 @@
     if { ( [rpm-vercomp $version_installed $version_in_tree] > 0
             || ([rpm-vercomp $version_installed $version_in_tree] == 0
                 && [rpm-vercomp $revision_installed $revision_in_tree] >= 0 ))
-        && ![info exists options(ports_force)] } {
-        ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
-        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)\". Specify -f to force upgrade."
-        }
-        if { $epoch_installed >= $epoch_in_tree } {
+        && ![info exists options(ports_upgrade_force)] } {
+        if { $epoch_installed < $epoch_in_tree } {
+            set epoch_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!"
+        } 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."
+            } else {
+                ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
+            }
             # Check if we have to do dependents
             if {[info exists options(ports_do_dependents)]} {
                 # We do dependents ..
@@ -2512,9 +2518,6 @@
             }
             mportclose $workername
             return 0
-        } else {
-            set epoch_override 1
-            ui_debug "epoch override ... upgrading!"
         }
     }
 
@@ -2527,7 +2530,7 @@
     }
 
     # avoid building again unnecessarily
-    if {[info exists options(ports_force)] || $epoch_override == 1
+    if {[info exists options(ports_upgrade_force)] || $epoch_override == 1
         || ![registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
         if {[catch {set result [mportexec $workername $upgrade_action]} result] || $result != 0} {
             global errorInfo
@@ -2559,7 +2562,8 @@
         }
     } else {
         # are we installing an existing version due to force or epoch override?
-        if {[registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
+        if {[registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
+            && ([info exists options(ports_upgrade_force)] || $epoch_override == 1)} {
              ui_debug "Uninstalling $portname ${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-help.tcl
===================================================================
--- trunk/base/src/port/port-help.tcl	2009-07-25 18:53:19 UTC (rev 54375)
+++ trunk/base/src/port/port-help.tcl	2009-07-25 19:45:02 UTC (rev 54376)
@@ -277,10 +277,15 @@
 
 set porthelp(upgrade) {
 Upgrades the given ports to the latest version. Respects global options
--n, -R, -u, and -f (see the port man page).  Note that in selecting variants
+-n, -R, and -u (see the port man page).  Note that in selecting variants
 to use in the upgraded build of the port, the order of precedence is variants
 specified on the command line, then variants active in the latest installed
 version of the port, then the variants.conf file.
+
+--force             Ignore circumstances that would normally cause ports to be
+                    skipped (e.g. not outdated).
+--enforce-variants  If the installed variants do not match those requested,
+                    upgrade even if the port is not outdated.
 }
 
 set porthelp(url) {

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2009-07-25 18:53:19 UTC (rev 54375)
+++ trunk/base/src/port/port.tcl	2009-07-25 19:45:02 UTC (rev 54376)
@@ -3115,6 +3115,7 @@
     mirror      {new}
     lint        {nitpick}
     select      {list set show}
+    upgrade     {force enforce-variants}
 }
 
 global cmd_implied_options
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090725/4aae621c/attachment-0001.html>


More information about the macports-changes mailing list