[67207] trunk/base/src/macports1.0/macports.tcl

jmr at macports.org jmr at macports.org
Sun May 2 12:04:41 PDT 2010


Revision: 67207
          http://trac.macports.org/changeset/67207
Author:   jmr at macports.org
Date:     2010-05-02 12:04:35 -0700 (Sun, 02 May 2010)
Log Message:
-----------
rsync the PortIndex from a platform-specific subdir

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

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2010-05-02 14:47:58 UTC (rev 67206)
+++ trunk/base/src/macports1.0/macports.tcl	2010-05-02 19:04:35 UTC (rev 67207)
@@ -1889,21 +1889,27 @@
                 file mkdir $destdir
                 # Keep rsync happy with a trailing slash
                 if {[string index $source end] != "/"} {
-                    set source "${source}/"
+                    append source "/"
                 }
-                # don't sync PortIndex unless it doesn't exist
-                set exclude_option ""
-                if {[file isfile $indexfile]} {
-                    set exclude_option " '--exclude=/PortIndex*'"
-                }
+                # don't sync PortIndex yet; we grab the platform specific one afterwards
+                set exclude_option "'--exclude=/PortIndex*'"
                 # Do rsync fetch
-                set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options}${exclude_option} ${source} ${destdir}"
+                set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} ${exclude_option} ${source} ${destdir}"
                 ui_debug $rsync_commandline
                 if {[catch {system $rsync_commandline}]} {
                     ui_error "Synchronization of the local ports tree failed doing rsync"
                     incr numfailed
                     continue
                 }
+                # now sync the index if the local file is missing or older than a day
+                if {![file isfile $indexfile] || [expr [clock seconds] - [file mtime $indexfile]] > 86400} {
+                    set remote_indexfile "${source}PortIndex_${macports::os_platform}_${macports::os_major}_${macports::os_arch}/PortIndex"
+                    set rsync_commandline "${macports::autoconf::rsync_path} ${rsync_options} $remote_indexfile ${destdir}"
+                    ui_debug $rsync_commandline
+                    if {[catch {system $rsync_commandline}]} {
+                        ui_debug "Synchronization of the PortIndex failed doing rsync"
+                    }
+                }
                 if {[catch {system "chmod -R a+r \"$destdir\""}]} {
                     ui_warn "Setting world read permissions on parts of the ports tree failed, need root?"
                 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100502/0fca8f15/attachment.html>


More information about the macports-changes mailing list