Revision
68413
Author
jmr@macports.org
Date
2010-06-02 20:26:35 -0700 (Wed, 02 Jun 2010)

Log Message

set mtime of PortIndex to that of the newest Portfile parsed, to avoid the possibility of missing changes to unsynced existing ports

Modified Paths

Diff

Modified: trunk/base/src/port/portindex.tcl (68412 => 68413)


--- trunk/base/src/port/portindex.tcl	2010-06-03 03:05:34 UTC (rev 68412)
+++ trunk/base/src/port/portindex.tcl	2010-06-03 03:26:35 UTC (rev 68413)
@@ -38,14 +38,14 @@
 }
 
 proc pindex {portdir} {
-    global target oldfd oldmtime qindex fd directory archive outdir stats full_reindex \
+    global target oldfd oldmtime newest qindex fd directory archive outdir stats full_reindex \
            ui_options port_options save_prefix keepkeys
 
     # try to reuse the existing entry if it's still valid
     if {$full_reindex != "1" && $archive != "1" && [info exists qindex([string tolower [file tail $portdir]])]} {
         try {
             set mtime [file mtime [file join $directory $portdir Portfile]]
-            if {$oldmtime > $mtime} {
+            if {$oldmtime >= $mtime} {
                 set offset $qindex([string tolower [file tail $portdir]])
                 seek $oldfd $offset
                 gets $oldfd line
@@ -109,6 +109,10 @@
         set len [expr [string length $output] + 1]
         puts $fd [list $portinfo(name) $len]
         puts $fd $output
+        set mtime [file mtime [file join $directory $portdir Portfile]]
+        if {$mtime > $newest} {
+            set newest $mtime
+        }
     }
 }
 
@@ -188,6 +192,7 @@
 # open old index for comparison
 if {[file isfile $outpath] && [file isfile ${outpath}.quick]} {
     set oldmtime [file mtime $outpath]
+    set newest $oldmtime
     if {![catch {set oldfd [open $outpath r]}] && ![catch {set quickfd [open ${outpath}.quick r]}]} {
         if {![catch {set quicklist [read $quickfd]}]} {
             foreach entry [split $quicklist "\n"] {
@@ -196,6 +201,8 @@
         }
         close $quickfd
     }
+} else {
+    set newest 0
 }
 
 set tempportindex [mktemp "/tmp/mports.portindex.XXXXXXXX"]
@@ -213,6 +220,7 @@
 }
 close $fd
 file rename -force $tempportindex $outpath
+file mtime $outpath $newest
 mports_generate_quickindex $outpath
 puts "\nTotal number of ports parsed:\t$stats(total)\
       \nPorts successfully parsed:\t[expr $stats(total) - $stats(failed)]\