Changeset 36687
- Timestamp:
- 2008-05-11 15:01:57 (6 months ago)
- Files:
-
- 1 modified
-
trunk/base/src/port1.0/portfetch.tcl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/base/src/port1.0/portfetch.tcl
r36679 r36687 511 511 # the listed url varable and associated distfile 512 512 proc fetchfiles {args} { 513 global fulldistpath all_dist_files UI_PREFIX fetch_urls513 global distpath all_dist_files UI_PREFIX fetch_urls 514 514 global fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert 515 515 global distfile site 516 516 global portverbose 517 517 518 if {![file isdirectory $ fulldistpath]} {519 if {[catch {file mkdir $ fulldistpath} result]} {518 if {![file isdirectory $distpath]} { 519 if {[catch {file mkdir $distpath} result]} { 520 520 return -code error [format [msgcat::mc "Unable to create distribution files path: %s"] $result] 521 521 } … … 539 539 540 540 foreach {url_var distfile} $fetch_urls { 541 if {![file isfile [file join $fulldistpath $distfile]]} {542 ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $distfile $ fulldistpath]"543 if {![file writable $ fulldistpath]} {544 return -code error [format [msgcat::mc "%s must be writable"] $ fulldistpath]541 if {![file isfile $distpath/$distfile]} { 542 ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $distfile $distpath]" 543 if {![file writable $distpath]} { 544 return -code error [format [msgcat::mc "%s must be writable"] $distpath] 545 545 } 546 546 if {!$sorted} { … … 559 559 set file_url [portfetch::assemble_url $site $distfile] 560 560 set effectiveURL "" 561 if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} ${ fulldistpath}/${distfile}.TMP} result] &&562 ![catch {system "mv ${ fulldistpath}/${distfile}.TMP ${fulldistpath}/${distfile}"}]} {561 if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} ${distpath}/${distfile}.TMP} result] && 562 ![catch {system "mv ${distpath}/${distfile}.TMP ${distpath}/${distfile}"}]} { 563 563 564 564 # Special hack to check for sourceforge mirrors, which don't return a proper error code on failure … … 570 570 # The url seen by curl seems to have been a redirect to the sourceforge mirror page 571 571 ui_debug "[msgcat::mc "Fetching from sourceforge mirror failed"]" 572 exec rm -f [file join $fulldistpath ${distfile}.TMP]572 exec rm -f ${distpath}/${distfile}.TMP 573 573 574 574 # Continue on to try the next mirror, if any … … 583 583 } else { 584 584 ui_debug "[msgcat::mc "Fetching failed:"]: $result" 585 exec rm -f [file join $fulldistpath ${distfile}.TMP]585 exec rm -f ${distpath}/${distfile}.TMP 586 586 } 587 587 } … … 596 596 # Utility function to delete fetched files. 597 597 proc fetch_deletefiles {args} { 598 global fulldistpath fetch_urls598 global distpath fetch_urls 599 599 foreach {url_var distfile} $fetch_urls { 600 if {[file isfile [file join $fulldistpath $distfile]]} {601 exec rm -f [file join $fulldistpath $distfile]600 if {[file isfile $distpath/$distfile]} { 601 exec rm -f ${distpath}/${distfile} 602 602 } 603 603 } … … 606 606 # Utility function to add files to a list of fetched files. 607 607 proc fetch_addfilestomap {filemapname} { 608 global fulldistpath fetch_urls $filemapname608 global distpath fetch_urls $filemapname 609 609 foreach {url_var distfile} $fetch_urls { 610 if {[file isfile [file join $fulldistpath $distfile]]} {611 filemap set $filemapname [file join $fulldistpath $distfile]1610 if {[file isfile $distpath/$distfile]} { 611 filemap set $filemapname $distpath/$distfile 1 612 612 } 613 613 } … … 616 616 # Initialize fetch target 617 617 proc fetch_init {args} { 618 global distfiles distname distpath fulldistpath all_dist_files dist_subdir fetch.type 619 620 if {[info exist distpath]} { 621 if {[info exists dist_subdir]} { 622 set fulldistpath [file join $distpath $dist_subdir] 623 } else { 624 set fulldistpath $distpath 625 } 618 global distfiles distname distpath all_dist_files dist_subdir fetch.type 619 620 if {[info exist distpath] && [info exists dist_subdir]} { 621 set distpath ${distpath}/${dist_subdir} 626 622 } 627 623 }

