[106668] trunk/base/src

jmr at macports.org jmr at macports.org
Tue Jun 4 02:13:41 PDT 2013


Revision: 106668
          https://trac.macports.org/changeset/106668
Author:   jmr at macports.org
Date:     2013-06-04 02:13:40 -0700 (Tue, 04 Jun 2013)
Log Message:
-----------
run destroot/archivefetch instead of install target when doing a forced upgrade.
install is a noop for an already installed port, so effectively we didn't have
the new copy ready to go before uninstalling, meaning the build could still fail
after the old copy was gone.

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

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2013-06-04 06:04:12 UTC (rev 106667)
+++ trunk/base/src/macports1.0/macports.tcl	2013-06-04 09:13:40 UTC (rev 106668)
@@ -3788,14 +3788,47 @@
     }
 
     if {$will_build} {
-        # install version_in_tree (but don't activate yet)
-        if {[catch {set result [mportexec $workername install]} result] || $result != 0} {
-            if {[info exists ::errorInfo]} {
-                ui_debug "$::errorInfo"
+        if {$already_installed
+            && ([info exists options(ports_upgrade_force)] || $build_override == 1)} {
+            # Tell archivefetch/unarchive not to use the installed archive, i.e. a
+            # fresh one will be either fetched or built locally.
+            # Ideally this would be done in the interp_options when we mportopen,
+            # but we don't know if we want to do this at that point.
+            set mportinterp [ditem_key $workername workername]
+            $mportinterp eval "set force_archive_refresh yes"
+
+            # run archivefetch and destroot for version_in_tree
+            # doing this instead of just running install ensures that we have the
+            # new copy ready but not yet installed, so we can safely uninstall the
+            # existing one.
+            if {[catch {set result [mportexec $workername archivefetch]} result] || $result != 0} {
+                if {[info exists ::errorInfo]} {
+                    ui_debug "$::errorInfo"
+                }
+                ui_error "Unable to upgrade port: $result"
+                catch {mportclose $workername}
+                return 1
             }
-            ui_error "Unable to upgrade port: $result"
-            catch {mportclose $workername}
-            return 1
+            # the following is a noop if archivefetch found an archive
+            if {[catch {set result [mportexec $workername destroot]} result] || $result != 0} {
+                if {[info exists ::errorInfo]} {
+                    ui_debug "$::errorInfo"
+                }
+                ui_error "Unable to upgrade port: $result"
+                catch {mportclose $workername}
+                return 1
+            }
+        } else {
+            # Normal non-forced case
+            # install version_in_tree (but don't activate yet)
+            if {[catch {set result [mportexec $workername install]} result] || $result != 0} {
+                if {[info exists ::errorInfo]} {
+                    ui_debug "$::errorInfo"
+                }
+                ui_error "Unable to upgrade port: $result"
+                catch {mportclose $workername}
+                return 1
+            }
         }
     }
 

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2013-06-04 06:04:12 UTC (rev 106667)
+++ trunk/base/src/port1.0/portutil.tcl	2013-06-04 09:13:40 UTC (rev 106668)
@@ -2450,7 +2450,7 @@
 
 # return path to a downloaded or installed archive for this port
 proc find_portarchive_path {} {
-    global portdbpath subport version revision portvariants
+    global portdbpath subport version revision portvariants force_archive_refresh
     set installed 0
     if {[registry_exists $subport $version $revision $portvariants]} {
         set installed 1
@@ -2458,7 +2458,7 @@
     set archiverootname [file rootname [get_portimage_name]]
     foreach unarchive.type [supportedArchiveTypes] {
         set fullarchivename "${archiverootname}.${unarchive.type}"
-        if {$installed} {
+        if {$installed && ![tbool force_archive_refresh]} {
             set fullarchivepath [file join $portdbpath software $subport $fullarchivename]
         } else {
             set fullarchivepath [file join $portdbpath incoming/verified $fullarchivename]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130604/2e07d38d/attachment.html>


More information about the macports-changes mailing list