Changeset 147347 for trunk/base


Ignore:
Timestamp:
Apr 2, 2016, 12:48:28 AM (4 years ago)
Author:
raimue@…
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/macports1.0/macports.tcl

    r146885 r147347  
    23212321#
    23222322# @param url source URL to check
    2323 # @return a list containing filename and extension or an empty list
    2324 proc _source_is_snapshot {url {filename {}} {extension {}}} {
     2323# @param filename upvar variable name for filename
     2324# @param extension upvar variable name for extension
     2325# @param extension upvar variable name for URL excluding the filename
     2326proc _source_is_snapshot {url {filename {}} {extension {}} {rooturl {}}} {
     2327    upvar $rooturl myrooturl
    23252328    upvar $filename myfilename
    23262329    upvar $extension myextension
    23272330
    2328     if {[regexp {^(?:https?|ftp|rsync)://.+/(.+\.(tar\.gz|tar\.bz2|tar))$} $url -> f e]} {
     2331    if {[regexp {^((?:https?|ftp|rsync)://.+/)(.+\.(tar\.gz|tar\.bz2|tar))$} $url -> u f e]} {
     2332        set myrooturl $u
    23292333        set myfilename $f
    23302334        set myextension $e
     
    24952499                set indexfile [macports::getindex $source]
    24962500                set destdir [file dirname $indexfile]
    2497                 set is_tarball [_source_is_snapshot $source]
     2501                set is_tarball [_source_is_snapshot $source filename extension rooturl]
    24982502                file mkdir $destdir
    24992503
    25002504                if {$is_tarball} {
    2501                     set exclude_option {}
     2505                    set exclude_option "--exclude=*"
     2506                    set include_option "--include=/${filename} --include=/${filename}.rmd160"
    25022507                    # need to do a few things before replacing the ports tree in this case
    25032508                    set destdir [file dirname $destdir]
     2509                    set srcstr $rooturl
    25042510                } else {
    25052511                    # Keep rsync happy with a trailing slash
     
    25092515                    # don't sync PortIndex yet; we grab the platform specific one afterwards
    25102516                    set exclude_option '--exclude=/PortIndex*'
     2517                    set include_option {}
     2518                    set srcstr $source
    25112519                }
    25122520                # Do rsync fetch
    2513                 set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option $source $destdir"
     2521                set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $include_option $exclude_option $srcstr $destdir"
    25142522                try -pass_signal {
    25152523                    system $rsync_commandline
     
    25232531                    # verify signature for tarball
    25242532                    global macports::archivefetch_pubkeys
    2525                     set rsync_commandline "$macports::autoconf::rsync_path $rsync_options $exclude_option ${source}.rmd160 $destdir"
    2526                     try -pass_signal {
    2527                         system $rsync_commandline
    2528                     } catch {*} {
    2529                         ui_error "Synchronization of the ports tree signature failed doing rsync"
    2530                         incr numfailed
    2531                         continue
    2532                     }
    25332533                    set tarball ${destdir}/[file tail $source]
    25342534                    set signature ${tarball}.rmd160
Note: See TracChangeset for help on using the changeset viewer.