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

raimue at macports.org raimue at macports.org
Fri Apr 1 17:48:29 PDT 2016


Revision: 147347
          https://trac.macports.org/changeset/147347
Author:   raimue at macports.org
Date:     2016-04-01 17:48:28 -0700 (Fri, 01 Apr 2016)
Log Message:
-----------
mportsync: fetch tar and signature at once

Both ports.tar and ports.tar.rmd160 can be transferred in the same connection,
removing the need for setting up another rsync process and its connection time.

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

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2016-04-01 23:14:49 UTC (rev 147346)
+++ trunk/base/src/macports1.0/macports.tcl	2016-04-02 00:48:28 UTC (rev 147347)
@@ -2320,12 +2320,16 @@
 # (private)
 #
 # @param url source URL to check
-# @return a list containing filename and extension or an empty list
-proc _source_is_snapshot {url {filename {}} {extension {}}} {
+# @param filename upvar variable name for filename
+# @param extension upvar variable name for extension
+# @param extension upvar variable name for URL excluding the filename
+proc _source_is_snapshot {url {filename {}} {extension {}} {rooturl {}}} {
+    upvar $rooturl myrooturl
     upvar $filename myfilename
     upvar $extension myextension
 
-    if {[regexp {^(?:https?|ftp|rsync)://.+/(.+\.(tar\.gz|tar\.bz2|tar))$} $url -> f e]} {
+    if {[regexp {^((?:https?|ftp|rsync)://.+/)(.+\.(tar\.gz|tar\.bz2|tar))$} $url -> u f e]} {
+        set myrooturl $u
         set myfilename $f
         set myextension $e
 
@@ -2494,13 +2498,15 @@
                 # Where to, boss?
                 set indexfile [macports::getindex $source]
                 set destdir [file dirname $indexfile]
-                set is_tarball [_source_is_snapshot $source]
+                set is_tarball [_source_is_snapshot $source filename extension rooturl]
                 file mkdir $destdir
 
                 if {$is_tarball} {
-                    set exclude_option {}
+                    set exclude_option "--exclude=*"
+                    set include_option "--include=/${filename} --include=/${filename}.rmd160"
                     # need to do a few things before replacing the ports tree in this case
                     set destdir [file dirname $destdir]
+                    set srcstr $rooturl
                 } else {
                     # Keep rsync happy with a trailing slash
                     if {[string index $source end] ne "/"} {
@@ -2508,9 +2514,11 @@
                     }
                     # don't sync PortIndex yet; we grab the platform specific one afterwards
                     set exclude_option '--exclude=/PortIndex*'
+                    set include_option {}
+                    set srcstr $source
                 }
                 # 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 $include_option $exclude_option $srcstr $destdir"
                 try -pass_signal {
                     system $rsync_commandline
                 } catch {*} {
@@ -2522,14 +2530,6 @@
                 if {$is_tarball} {
                     # verify signature for tarball
                     global macports::archivefetch_pubkeys
-                    set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option ${source}.rmd160 $destdir"
-                    try -pass_signal {
-                        system $rsync_commandline
-                    } catch {*} {
-                        ui_error "Synchronization of the ports tree signature failed doing rsync"
-                        incr numfailed
-                        continue
-                    }
                     set tarball ${destdir}/[file tail $source]
                     set signature ${tarball}.rmd160
                     set openssl [macports::findBinary openssl $macports::autoconf::openssl_path]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160401/ce770dfc/attachment.html>


More information about the macports-changes mailing list