Ticket #11971: multi-init.diff
File multi-init.diff, 8.6 KB (added by jmroot (Joshua Root), 17 years ago) |
---|
-
src/port1.0/portfetch.tcl
510 510 # Perform a standard fetch, assembling fetch urls from 511 511 # the listed url varable and associated distfile 512 512 proc fetchfiles {args} { 513 global distpath all_dist_files UI_PREFIX fetch_urls513 global fulldistpath 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 $ distpath]} {519 if {[catch {file mkdir $ distpath} result]} {518 if {![file isdirectory $fulldistpath]} { 519 if {[catch {file mkdir $fulldistpath} result]} { 520 520 return -code error [format [msgcat::mc "Unable to create distribution files path: %s"] $result] 521 521 } 522 522 } … … 538 538 set sorted no 539 539 540 540 foreach {url_var distfile} $fetch_urls { 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]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] 545 545 } 546 546 if {!$sorted} { 547 547 sortsites … … 558 558 ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]" 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} ${ distpath}/${distfile}.TMP} result] &&562 ![catch {system "mv ${ distpath}/${distfile}.TMP ${distpath}/${distfile}"}]} {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}"}]} { 563 563 564 564 # Special hack to check for sourceforge mirrors, which don't return a proper error code on failure 565 565 if {![string equal $effectiveURL $file_url] && … … 569 569 # *SourceForge hackage in effect* 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 ${distpath}/${distfile}.TMP572 exec rm -f [file join $fulldistpath ${distfile}.TMP] 573 573 574 574 # Continue on to try the next mirror, if any 575 575 } else { … … 582 582 583 583 } else { 584 584 ui_debug "[msgcat::mc "Fetching failed:"]: $result" 585 exec rm -f ${distpath}/${distfile}.TMP585 exec rm -f [file join $fulldistpath ${distfile}.TMP] 586 586 } 587 587 } 588 588 if {![info exists fetched]} { … … 595 595 596 596 # Utility function to delete fetched files. 597 597 proc fetch_deletefiles {args} { 598 global distpath fetch_urls598 global fulldistpath fetch_urls 599 599 foreach {url_var distfile} $fetch_urls { 600 if {[file isfile $distpath/$distfile]} {601 exec rm -f ${distpath}/${distfile}600 if {[file isfile [file join $fulldistpath $distfile]]} { 601 exec rm -f [file join $fulldistpath $distfile] 602 602 } 603 603 } 604 604 } 605 605 606 606 # Utility function to add files to a list of fetched files. 607 607 proc fetch_addfilestomap {filemapname} { 608 global distpath fetch_urls $filemapname608 global fulldistpath fetch_urls $filemapname 609 609 foreach {url_var distfile} $fetch_urls { 610 if {[file isfile $distpath/$distfile]} {611 filemap set $filemapname $distpath/$distfile1610 if {[file isfile [file join $fulldistpath $distfile]]} { 611 filemap set $filemapname [file join $fulldistpath $distfile] 1 612 612 } 613 613 } 614 614 } 615 615 616 616 # Initialize fetch target 617 617 proc fetch_init {args} { 618 global distfiles distname distpath all_dist_files dist_subdir fetch.type618 global distfiles distname distpath fulldistpath all_dist_files dist_subdir fetch.type 619 619 620 if {[info exist distpath] && [info exists dist_subdir]} { 621 set distpath ${distpath}/${dist_subdir} 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 } 622 626 } 623 627 } 624 628 -
src/package1.0/portarchive.tcl
61 61 global variations package.destpath workpath 62 62 global ports_force ports_source_only ports_binary_only 63 63 global portname portversion portrevision portvariants 64 global archive.destpath archive.type archive.file archive.path 64 global archive.destpath archive.type archive.file archive.path archive.fulldestpath 65 65 66 66 # Check mode in case archive called directly by user 67 67 if {[option portarchivemode] != "yes"} { … … 82 82 83 83 # Define archive destination directory and target filename 84 84 if {![string equal ${archive.destpath} ${workpath}] && ![string equal ${archive.destpath} ""]} { 85 set archive.destpath [file join ${archive.destpath} [option os.platform] [option os.arch]] 85 set archive.fulldestpath [file join ${archive.destpath} [option os.platform] [option os.arch]] 86 } else { 87 set archive.fulldestpath ${archive.destpath} 86 88 } 87 89 88 90 # Determine if archive should be skipped … … 100 102 foreach archive.type [option portarchivetype] { 101 103 if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} { 102 104 set archive.file "${portname}-${portversion}_${portrevision}${portvariants}.[option os.arch].${archive.type}" 103 set archive.path "[file join ${archive. destpath} ${archive.file}]"105 set archive.path "[file join ${archive.fulldestpath} ${archive.file}]" 104 106 } else { 105 107 ui_debug "Skipping [string toupper ${archive.type}] archive: $errmsg" 106 108 set unsupported [expr $unsupported + 1] … … 238 240 global UI_PREFIX variations 239 241 global workpath destpath portpath ports_force 240 242 global portname portversion portrevision portvariants 241 global archive. destpath archive.type archive.file archive.path243 global archive.fulldestpath archive.type archive.file archive.path 242 244 243 245 # Create archive destination path (if needed) 244 if {![file isdirectory ${archive. destpath}]} {245 system "mkdir -p ${archive. destpath}"246 if {![file isdirectory ${archive.fulldestpath}]} { 247 system "mkdir -p ${archive.fulldestpath}" 246 248 } 247 249 248 250 # Copy state file into destroot for archiving … … 317 319 if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} { 318 320 # Define archive file/path 319 321 set archive.file "${portname}-${portversion}_${portrevision}${portvariants}.[option os.arch].${archive.type}" 320 set archive.path "[file join ${archive. destpath} ${archive.file}]"322 set archive.path "[file join ${archive.fulldestpath} ${archive.file}]" 321 323 322 324 # Setup archive command 323 325 archive_command_setup -
src/package1.0/portunarchive.tcl
61 61 global UI_PREFIX target_state_fd variations workpath 62 62 global ports_force ports_source_only ports_binary_only 63 63 global portname portversion portrevision portvariants portpath 64 global unarchive.srcpath unarchive.type unarchive.file unarchive.path 64 global unarchive.srcpath unarchive.type unarchive.file unarchive.path unarchive.fullsrcpath 65 65 66 66 # Check mode in case archive called directly by user 67 67 if {[option portarchivemode] != "yes"} { … … 82 82 83 83 # Define archive directory, file, and path 84 84 if {![string equal ${unarchive.srcpath} ${workpath}] && ![string equal ${unarchive.srcpath} ""]} { 85 set unarchive.srcpath [file join ${unarchive.srcpath} [option os.platform] [option os.arch]] 85 set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] [option os.arch]] 86 } else { 87 set unarchive.fullsrcpath ${unarchive.srcpath} 86 88 } 87 89 88 90 # Determine if unarchive should be skipped … … 104 106 foreach unarchive.type [option portarchivetype] { 105 107 if {[catch {archiveTypeIsSupported ${unarchive.type}} errmsg] == 0} { 106 108 set unarchive.file "${portname}-${portversion}_${portrevision}${portvariants}.[option os.arch].${unarchive.type}" 107 set unarchive.path "[file join ${unarchive. srcpath} ${unarchive.file}]"109 set unarchive.path "[file join ${unarchive.fullsrcpath} ${unarchive.file}]" 108 110 if {[file exist ${unarchive.path}]} { 109 111 set found 1 110 112 break