[52581] branches/images-and-archives/base/src

blb at macports.org blb at macports.org
Thu Jun 18 22:30:48 PDT 2009


Revision: 52581
          http://trac.macports.org/changeset/52581
Author:   blb at macports.org
Date:     2009-06-18 22:30:47 -0700 (Thu, 18 Jun 2009)
Log Message:
-----------
Finish installimage command support

Modified Paths:
--------------
    branches/images-and-archives/base/src/macports1.0/macports.tcl
    branches/images-and-archives/base/src/port/port.tcl

Modified: branches/images-and-archives/base/src/macports1.0/macports.tcl
===================================================================
--- branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-06-19 04:53:14 UTC (rev 52580)
+++ branches/images-and-archives/base/src/macports1.0/macports.tcl	2009-06-19 05:30:47 UTC (rev 52581)
@@ -2663,7 +2663,8 @@
 
 # Procedure to install an image file; protocols currently supported
 # are file: and anything which curl supports.
-proc macports::install_image {imageurl} {
+# Note that this installs the image but does not activate it.
+proc macports::install_image {imageurl {portinfo ""}} {
     set filetoinstall ""
     set tmpfetchdir [mkdtemp [file join [gettmpdir] mpimagefetchXXXXXXXX]]
     try {
@@ -2694,8 +2695,9 @@
         if {![file exists $filetoinstall]} {
             throw MACPORTS "The file $filetoinstall does not exist"
         }
-        ui_info "Installing from image at $imageurl"
-        set result [install_register_imagefile $filetoinstall]
+        ui_msg "---> Installing from image at $imageurl"
+        upvar $portinfo myportinfo
+        set result [install_register_imagefile $filetoinstall myportinfo]
     } catch {* errorCode errorMessage } {
         return -code error $errorMessage
     } finally {
@@ -2710,7 +2712,10 @@
 # Install means to simply copy to the right path as the file is not expected
 # to be there as yet.  Registering it of course means simply adding to
 # the registry as installed, but not active.
-proc macports::install_register_imagefile {imagefile} {
+# An optional second argument can be given which must be an array (or
+# not exist at all) which will be filled with information on the port
+# just installed & registered (eg, keys of name, version, revision, etc)
+proc macports::install_register_imagefile {imagefile {portinfo ""}} {
     global env macports::portimagefilepath macports::prefix
 
     set mytempdir [mkdtemp [file join [gettmpdir] mpimageXXXXXXXX]]
@@ -2763,6 +2768,10 @@
             }
         }
         registry::write_entry $regref
+        if {$portinfo ne ""} {
+            upvar $portinfo myportinfo
+            array set myportinfo [array get imagevars]
+        }
     } catch {* errorCode errorMessage } {
         return -code error $errorMessage
     } finally {

Modified: branches/images-and-archives/base/src/port/port.tcl
===================================================================
--- branches/images-and-archives/base/src/port/port.tcl	2009-06-19 04:53:14 UTC (rev 52580)
+++ branches/images-and-archives/base/src/port/port.tcl	2009-06-19 05:30:47 UTC (rev 52581)
@@ -1798,12 +1798,14 @@
     }
     foreach imageurl $portlist {
         if {![macports::global_option_isset ports_dryrun]} {
-            if {[catch {macports::install_image $imageurl} result] || $result != 0} {
+            if {[catch {macports::install_image $imageurl portinfo} result] || $result != 0} {
                 ui_error "Failed to install from image: $result"
                 return 1
             } else {
-               # Need to extract information from this image (name, version, etc)
-               ui_msg "activate here"
+                if {[catch {registry::activate $portinfo(name) "$portinfo(version)_$portinfo(revision)$portinfo(portvariants)" [array get options]} result] } {
+                    ui_error "Failed to activate: $result"
+                    return 1
+                }
             }
         } else {
             ui_msg "Skipping install of image $imageurl (dry run)"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090618/ca8d58d5/attachment.html>


More information about the macports-changes mailing list