Ticket #29093: portfetch.tcl.3.diff
File portfetch.tcl.3.diff, 2.5 KB (added by ci42, 14 years ago) |
---|
-
portfetch.tcl
old new 61 61 commands bzr 62 62 commands cvs 63 63 commands svn 64 commands git 65 commands hg 64 66 65 67 # Defaults 66 68 default extract.suffix .tar.gz … … 97 99 98 100 default git.cmd {[findBinary git $portutil::autoconf::git_path]} 99 101 default git.dir {${workpath}} 100 default git.branch {} 102 default git.branch {HEAD} 103 default git.pre_args "" 104 default git.args "" 105 default git.post_args {"${git.url} ${distname}"} 101 106 102 107 default hg.cmd {[findBinary hg $portutil::autoconf::hg_path]} 103 108 default hg.dir {${workpath}} 104 109 default hg.tag {tip} 110 default hg.args {"clone --rev ${hg.tag} ${hg.url} ${workpath}/${distname}"} 105 111 106 112 # Set distfiles 107 113 default distfiles {[portfetch::suffix $distname]} … … 369 375 370 376 # Perform a git fetch 371 377 proc portfetch::gitfetch {args} { 372 global worksrcpath373 global git. url git.branch git.sha1 git.cmd378 global distname 379 global git.dir git.args git.post_args git.branch 374 380 375 set options "-q" 376 if {[string length ${git.branch}] == 0} { 377 # if we're just using HEAD, we can make a shallow repo 378 set options "$options --depth=1" 379 } 380 set cmdstring "${git.cmd} clone $options ${git.url} ${worksrcpath} 2>&1" 381 ui_debug "Executing: $cmdstring" 382 if {[catch {system $cmdstring} result]} { 381 set git.args "clone -q -n" 382 if {[catch {command_exec git "" "2>&1"} result]} { 383 383 return -code error [msgcat::mc "Git clone failed"] 384 384 } 385 385 386 if {[string length ${git.branch}] > 0} { 387 set env "GIT_DIR=${worksrcpath}/.git GIT_WORK_TREE=${worksrcpath}" 388 set cmdstring "$env ${git.cmd} checkout -q ${git.branch} 2>&1" 389 ui_debug "Executing $cmdstring" 390 if {[catch {system $cmdstring} result]} { 391 return -code error [msgcat::mc "Git checkout failed"] 392 } 386 set git.dir ${git.dir}/${distname} 387 set git.args "checkout -q -b ${git.branch}" 388 set git.post_args "" 389 if {[catch {command_exec git "" "2>&1"} result]} { 390 return -code error [msgcat::mc "Git checkout failed"] 393 391 } 394 392 395 393 if {[info exists patchfiles]} { … … 401 399 402 400 # Perform a mercurial fetch. 403 401 proc portfetch::hgfetch {args} { 404 global worksrcpath prefix_frozen 405 global hg.url hg.tag hg.cmd 406 407 set cmdstring "${hg.cmd} clone --rev ${hg.tag} ${hg.url} ${worksrcpath} 2>&1" 408 ui_debug "Executing: $cmdstring" 409 if {[catch {system $cmdstring} result]} { 402 if {[catch {command_exec hg "" "2>&1"} result]} { 410 403 return -code error [msgcat::mc "Mercurial clone failed"] 411 404 } 412 405