Revision
70272
Author
jmr@macports.org
Date
2010-08-04 00:29:46 -0700 (Wed, 04 Aug 2010)

Log Message

merge r70271 from trunk:
 when distfiles are only present in the altworkpath, link/copy into distpath so ports can find them there (#25937)

Modified Paths

Diff

Modified: branches/release_1_9/base/src/port1.0/portfetch.tcl (70271 => 70272)


--- branches/release_1_9/base/src/port1.0/portfetch.tcl	2010-08-04 07:27:22 UTC (rev 70271)
+++ branches/release_1_9/base/src/port1.0/portfetch.tcl	2010-08-04 07:29:46 UTC (rev 70272)
@@ -460,11 +460,19 @@
     set sorted no
 
     foreach {url_var distfile} $fetch_urls {
-        if {![file isfile $distpath/$distfile] && ($usealtworkpath || ![file isfile ${altprefix}${distpath}/$distfile])} {
+        if {![file isfile "${distpath}/${distfile}"]} {
             ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $distfile $distpath]"
             if {![file writable $distpath]} {
                 return -code error [format [msgcat::mc "%s must be writable"] $distpath]
             }
+            if {!$usealtworkpath && [file isfile ${altprefix}${distpath}/${distfile}]} {
+                if {[catch {file link -hard "${distpath}/${distfile}" "${altprefix}${distpath}/${distfile}"}]} {
+                    ui_debug "failed to hardlink ${distfile} into distpath, copying instead"
+                    file copy "${altprefix}${distpath}/${distfile}" "${distpath}/${distfile}"
+                }
+                ui_info "Found $distfile in ${altprefix}${distpath}"
+                continue
+            }
             if {!$sorted} {
                 sortsites fetch_urls [mirror_sites $fallback_mirror_site {} {} [get_full_mirror_sites_path]] master_sites
                 set sorted yes