[118714] trunk/base/src

cal at macports.org cal at macports.org
Tue Apr 8 17:28:08 PDT 2014


Revision: 118714
          https://trac.macports.org/changeset/118714
Author:   cal at macports.org
Date:     2014-04-08 17:28:08 -0700 (Tue, 08 Apr 2014)
Log Message:
-----------
base: abort instead of trying the next mirror if download operations are interrupted by a signal, #43280

Modified Paths:
--------------
    trunk/base/src/package1.0/portarchivefetch.tcl
    trunk/base/src/port1.0/portfetch.tcl

Modified: trunk/base/src/package1.0/portarchivefetch.tcl
===================================================================
--- trunk/base/src/package1.0/portarchivefetch.tcl	2014-04-09 00:26:55 UTC (rev 118713)
+++ trunk/base/src/package1.0/portarchivefetch.tcl	2014-04-09 00:28:08 UTC (rev 118714)
@@ -225,13 +225,20 @@
                 ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $archive ${site}]"
                 set file_url [portfetch::assemble_url $site $archive]
                 set effectiveURL ""
-                if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} {"${incoming_path}/${archive}.TMP"}} result]} {
-                    # Successful fetch
+                try {
+                    eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} {"${incoming_path}/${archive}.TMP"}
                     set fetched 1
-                    break
-                } else {
-                    ui_debug "[msgcat::mc "Fetching archive failed:"]: $result"
+                } catch {{POSIX SIG SIGINT} eCode eMessage} {
+                    ui_debug [msgcat::mc "Aborted fetching archive due to SIGINT"]
                     file delete -force "${incoming_path}/${archive}.TMP"
+                    throw
+                } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+                    ui_debug [msgcat::mc "Aborted fetching archive due to SIGTERM"]
+                    file delete -force "${incoming_path}/${archive}.TMP"
+                    throw
+                } catch {{*} eCode eMessage} {
+                    ui_debug [msgcat::mc "Fetching archive failed: %s" $eMessage]
+                    file delete -force "${incoming_path}/${archive}.TMP"
                     incr failed_sites
                     if {$failed_sites > 2 && ![tbool ports_binary_only] && ![_archive_available]} {
                         break

Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl	2014-04-09 00:26:55 UTC (rev 118713)
+++ trunk/base/src/port1.0/portfetch.tcl	2014-04-09 00:28:08 UTC (rev 118714)
@@ -536,13 +536,21 @@
             foreach site $urlmap($url_var) {
                 ui_notice "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]"
                 set file_url [portfetch::assemble_url $site $distfile]
-                if {![catch {eval curl fetch $fetch_options {$file_url} {"${distpath}/${distfile}.TMP"}} result] &&
-                    ![catch {file rename -force "${distpath}/${distfile}.TMP" "${distpath}/${distfile}"} result]} {
+                try {
+                    eval curl fetch $fetch_options {$file_url} {"${distpath}/${distfile}.TMP"}
+                    file rename -force "${distpath}/${distfile}.TMP" "${distpath}/${distfile}"
                     set fetched 1
                     break
-                } else {
-                    ui_debug "[msgcat::mc "Fetching distfile failed"]: $result"
+                } catch {{POSIX SIG SIGINT} eCode eMessage} {
+                    ui_debug [msgcat::mc "Aborted fetching distfile due to SIGINT"]
                     file delete -force "${distpath}/${distfile}.TMP"
+                    throw
+                } catch {{POSIX SIG SIGTERM} eCode eMessage} {
+                    ui_debug [msgcat::mc "Aborted fetching distfile due to SIGTERM"]
+                    file delete -force "${distpath}/${distfile}.TMP"
+                    throw
+                } catch {{*} eCode eMessage} {
+                    ui_debug [msgcat::mc "Fetching distfile failed: %s" $eMessage]
                 }
             }
             if {![info exists fetched]} {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140408/ccf34839/attachment.html>


More information about the macports-changes mailing list