[106717] trunk/base/src

jmr at macports.org jmr at macports.org
Wed Jun 5 22:59:31 PDT 2013


Revision: 106717
          https://trac.macports.org/changeset/106717
Author:   jmr at macports.org
Date:     2013-06-05 22:59:31 -0700 (Wed, 05 Jun 2013)
Log Message:
-----------
fix a regression introduced with statefile v2, where any port whose portfile
had been modified after an archive was built with a v2 statefile would be
immediately cleaned after unarchiving, thus making it build from source and
defeating the purpose of the unarchive target.

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

Modified: trunk/base/src/package1.0/portunarchive.tcl
===================================================================
--- trunk/base/src/package1.0/portunarchive.tcl	2013-06-06 02:30:49 UTC (rev 106716)
+++ trunk/base/src/package1.0/portunarchive.tcl	2013-06-06 05:59:31 UTC (rev 106717)
@@ -278,6 +278,7 @@
         file copy -force $plus_state $statefile
         file mtime $statefile [clock seconds]
         chownAsRoot $statefile
+        update_statefile checksum [sha256 file [option portpath]/Portfile] $statefile
         set newstate 1
     } else {
         # fake it

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2013-06-06 02:30:49 UTC (rev 106716)
+++ trunk/base/src/port1.0/portutil.tcl	2013-06-06 05:59:31 UTC (rev 106717)
@@ -1833,6 +1833,25 @@
     flush $fd
 }
 
+# Change the value of an existing statefile key
+# caller must call open_statefile after this
+proc update_statefile {class name path} {
+    set fd [open $path r]
+    while {[gets $fd line] >= 0} {
+        if {[lindex $line 0] != "${class}:"} {
+            lappend lines $line
+        }
+    }
+    close $fd
+    # truncate
+    set fd [open $path w]
+    puts $fd "$class: $name"
+    foreach line $lines {
+        puts $fd $line
+    }
+    close $fd
+}
+
 ##
 # Check that recorded selection of variants match the current selection
 #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130605/a17d746f/attachment.html>


More information about the macports-changes mailing list