[78182] trunk/base/src/package1.0/portunarchive.tcl

jmr at macports.org jmr at macports.org
Wed Apr 27 10:02:24 PDT 2011


Revision: 78182
          http://trac.macports.org/changeset/78182
Author:   jmr at macports.org
Date:     2011-04-27 10:02:23 -0700 (Wed, 27 Apr 2011)
Log Message:
-----------
avoid error when unarchiving archives that lack control files

Modified Paths:
--------------
    trunk/base/src/package1.0/portunarchive.tcl

Modified: trunk/base/src/package1.0/portunarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portunarchive.tcl	2011-04-27 16:35:03 UTC (rev 78181)
+++ trunk/base/src/package1.0/portunarchive.tcl	2011-04-27 17:02:23 UTC (rev 78182)
@@ -275,11 +275,18 @@
     }
 
     # Reset state file with archive version
-    close $target_state_fd
     set statefile [file join $workpath .macports.${subport}.state]
-    file copy -force [file join $destpath "+STATE"] $statefile
-    file mtime $statefile [clock seconds]
-    chownAsRoot $statefile
+    set plus_state [file join $destpath "+STATE"]
+    if {[file isfile $plus_state]} {
+        close $target_state_fd
+        file copy -force $plus_state $statefile
+        file mtime $statefile [clock seconds]
+        chownAsRoot $statefile
+        set newstate 1
+    } else {
+        # fake it
+        write_statefile target org.macports.destroot $target_state_fd
+    }
 
     # Cleanup all control files when finished
     set control_files [glob -nocomplain -types f [file join $destpath +*]]
@@ -288,8 +295,10 @@
         file delete -force $file
     }
 
-    # Update the state from unpacked archive version
-    set target_state_fd [open_statefile]
+    if {[info exists newstate]} {
+        # Update the state from unpacked archive version
+        set target_state_fd [open_statefile]
+    }
 
     ui_info "$UI_PREFIX [format [msgcat::mc "Archive %s unpacked"] ${unarchive.file}]"
     return 0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110427/f3c3c8c3/attachment.html>


More information about the macports-changes mailing list