[70144] branches/release_1_9/base/src/port1.0/portchecksum.tcl
jmr at macports.org
jmr at macports.org
Fri Jul 30 05:37:37 PDT 2010
Revision: 70144
http://trac.macports.org/changeset/70144
Author: jmr at macports.org
Date: 2010-07-30 05:37:36 -0700 (Fri, 30 Jul 2010)
Log Message:
-----------
merge r70143 from trunk:
print a link to a helpful wiki page when there is a checksum mismatch and the downloaded file appears to incorrectly contain HTML (#25128)
Revision Links:
--------------
http://trac.macports.org/changeset/70143
Modified Paths:
--------------
branches/release_1_9/base/src/port1.0/portchecksum.tcl
Modified: branches/release_1_9/base/src/port1.0/portchecksum.tcl
===================================================================
--- branches/release_1_9/base/src/port1.0/portchecksum.tcl 2010-07-30 12:32:20 UTC (rev 70143)
+++ branches/release_1_9/base/src/port1.0/portchecksum.tcl 2010-07-30 12:37:36 UTC (rev 70144)
@@ -251,6 +251,12 @@
set fail yes
}
}
+ if {[tbool fail] && ![regexp {\.html?$} ${distfile}] &&
+ ![catch {strsed [exec [findBinary file $portutil::autoconf::file_path] $fullpath --brief --mime] {s/;.*$//}} mimetype]
+ && "text/html" == $mimetype} {
+ # file --mime-type would be preferable to file --mime and strsed, but is only available as of Snow Leopard
+ set wrong_mimetype yes
+ }
}
}
@@ -279,6 +285,18 @@
ui_info "The correct checksum line may be:"
ui_info [format "%-20s%s" "checksums" [join $sums [format " \\\n%-20s" ""]]]
+ if {[tbool wrong_mimetype]} {
+ # We got an HTML file, though the distfile name does not suggest that one was
+ # expected. Probably a helpful DNS server sent us to its search results page
+ # instead of admitting that the server we asked for doesn't exist, or a mirror that
+ # no longer has the file served its error page with a 200 response.
+ ui_msg "***"
+ ui_msg "The non-matching file appears to be HTML. See this page for possible reasons"
+ ui_msg "for the checksum mismatch:"
+ ui_msg "<http://trac.macports.org/wiki/MisbehavingServers>"
+ ui_msg "***"
+ }
+
return -code error "[msgcat::mc "Unable to verify file checksums"]"
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100730/69ee0a26/attachment.html>
More information about the macports-changes
mailing list