Changeset 124243
- Timestamp:
- Aug 21, 2014, 6:36:26 PM (10 years ago)
- Location:
- trunk/base
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/base
- Property svn:mergeinfo changed
-
trunk/base/doc/port.1
r123679 r124243 25 25 .sp 26 26 .nf 27 \fBport\fR [\fB\-bcdfkn opqRstuvy\fR] [\fB\-D\fR \fIportdir\fR] [\fB\-F\fR \fIcmdfile\fR] [\fIaction\fR] [\fIactionflags\fR]27 \fBport\fR [\fB\-bcdfknNopqRstuvy\fR] [\fB\-D\fR \fIportdir\fR] [\fB\-F\fR \fIcmdfile\fR] [\fIaction\fR] [\fIactionflags\fR] 28 28 [[\fIportname\fR | \fIpseudo\-portname\fR | \fIport\-expressions\fR | \fIport\-url\fR]] 29 29 [[\fI@version\fR] [+/\-variant \&...] \&... [option=value \&...]] … … 465 465 \-q 466 466 .RS 4 467 Quiet mode, suppress informational messages to a minimum 467 Quiet mode, suppress informational messages to a minimum, implies \-N 468 .RE 469 .PP 470 \-N 471 .RS 4 472 Non-Interactive mode, no interactive questions asked 468 473 .RE 469 474 .PP -
trunk/base/doc/port.1.txt
r123677 r124243 11 11 -------- 12 12 [cmdsynopsis] 13 *port* [*-bcdfkn opqRstuvy*] [*-D* 'portdir'] [*-F* 'cmdfile'] ['action'] ['actionflags']13 *port* [*-bcdfknNopqRstuvy*] [*-D* 'portdir'] [*-F* 'cmdfile'] ['action'] ['actionflags'] 14 14 [['portname' | 'pseudo-portname' | 'port-expressions' | 'port-url']] 15 15 [['@version'] [+/-variant ...] ... [option=value ...]] … … 131 131 132 132 -q:: 133 Quiet mode, suppress informational messages to a minimum 133 Quiet mode, suppress informational messages to a minimum, implies -N 134 135 -N:: 136 Non-interactive mode, interactive questions are not asked 134 137 135 138 .Installation and upgrade -
trunk/base/src/macports1.0/macports.tcl
r124047 r124243 2058 2058 # print the dep list 2059 2059 if {[llength $dlist] > 0} { 2060 set depstring "$macports::ui_prefix Dependencies to be installed:" 2061 foreach ditem $dlist { 2062 append depstring " [ditem_key $ditem provides]" 2063 } 2064 ui_msg $depstring 2065 } 2066 2060 ## 2061 # User Interaction Question 2062 # Asking before installing dependencies 2063 if {[info exists macports::ui_options(questions_yesno)]} { 2064 set deplist {} 2065 foreach ditem $dlist { 2066 lappend deplist [ditem_key $ditem provides] 2067 } 2068 set retvalue [$macports::ui_options(questions_yesno) "The following dependencies will be installed: " "TestCase#2" [lsort $deplist] {y} 0] 2069 if {$retvalue == 1} { 2070 return 0 2071 } 2072 } else { 2073 set depstring "$macports::ui_prefix Dependencies to be installed:" 2074 foreach ditem $dlist { 2075 append depstring " [ditem_key $ditem provides]" 2076 } 2077 ui_msg $depstring 2078 } 2079 } 2080 2067 2081 # install them 2068 2082 set result [dlist_eval $dlist _mportactive [list _mportexec activate]] … … 4871 4885 } 4872 4886 4873 ui_msg "$macports::ui_prefix Rebuilding in order" 4887 set broken_portnames {} 4888 if {![info exists macports::ui_options(questions_yesno)]} { 4889 ui_msg "$macports::ui_prefix Rebuilding in order" 4890 } 4874 4891 foreach port $topsort_ports { 4875 ui_msg " [$port name] @[$port version] [$port variants][$port negated_variants]" 4892 lappend broken_portnames [$port name]@[$port version][$port variants] 4893 if {![info exists macports::ui_options(questions_yesno)]} { 4894 ui_msg " [$port name] @[$port version] [$port variants][$port negated_variants]" 4895 } 4896 } 4897 4898 ## 4899 # User Interaction Question 4900 # Asking before rebuilding in rev-upgrade 4901 if {[info exists macports::ui_options(questions_yesno)]} { 4902 ui_msg "You can always run 'port rev-upgrade' again to fix errors." 4903 set retvalue [$macports::ui_options(questions_yesno) "The following ports will be rebuilt:" "TestCase#1" $broken_portnames {y} 0] 4904 if {$retvalue == 1} { 4905 # quit as user answered 'no' 4906 return 0 4907 } 4908 unset macports::ui_options(questions_yesno) 4876 4909 } 4877 4910 -
trunk/base/src/pextlib1.0/Makefile.in
- Property svn:mergeinfo changed
/branches/gsoc14-interactive/base/src/pextlib1.0/Makefile.in (added) merged: 123796,124236
- Property svn:mergeinfo changed
-
trunk/base/src/pextlib1.0/sha2.c
- Property svn:mergeinfo changed
/branches/gsoc14-interactive/base/src/pextlib1.0/sha2.c (added) merged: 123796
- Property svn:mergeinfo changed
-
trunk/base/src/pextlib1.0/sha2.h
- Property svn:mergeinfo changed
/branches/gsoc14-interactive/base/src/pextlib1.0/sha2.h (added) merged: 123796
- Property svn:mergeinfo changed
-
trunk/base/src/port/port.tcl
r124047 r124243 316 316 set portname [lindex $ilist 0 0] 317 317 ui_notice "The following versions of $portname are currently installed:" 318 foreach i [portlist_sortint $ilist] { 318 foreach i [portlist_sortint $ilist] { 319 319 set iname [lindex $i 0] 320 320 set iversion [lindex $i 1] … … 333 333 } 334 334 } 335 336 335 337 336 proc entry_for_portlist {portentry} { … … 4494 4493 q { 4495 4494 set ui_options(ports_quiet) yes 4495 # quiet implies noninteractive 4496 set ui_options(ports_noninteractive) yes 4496 4497 } 4497 4498 p { 4498 4499 # Ignore errors while processing within a command 4499 4500 set ui_options(ports_processall) yes 4501 } 4502 N { 4503 # Interactive mode is available or not 4504 set ui_options(ports_noninteractive) yes 4500 4505 } 4501 4506 f { … … 5286 5291 } 5287 5292 5293 # Create namespace for questions 5294 namespace eval portclient::questions { 5295 5296 package require Tclx 5297 ## 5298 # Function that handles printing of a timeout. 5299 # 5300 # @param time 5301 # The amount of time for which a timeout is to occur. 5302 # @param def 5303 # The default action to be taken in the occurence of a timeout. 5304 proc ui_timeout {def timeout} { 5305 fconfigure stdin -blocking 0 5306 5307 signal error {TERM INT} 5308 while {$timeout >= 0} { 5309 if {[catch {set inp [read stdin]} err]} { 5310 return -code error "Ctrl-C" 5311 } 5312 if {$inp eq "\n"} { 5313 return $def 5314 } 5315 puts -nonewline "\r" 5316 puts -nonewline [format "Continuing in %02d s. Press Ctrl-C to exit: " $timeout] 5317 flush stdout 5318 after 1000 5319 incr timeout -1 5320 } 5321 puts "" 5322 fconfigure stdin -blocking 1 5323 signal -restart error {TERM INT} 5324 return $def 5325 } 5326 5327 ## 5328 # Main function that displays numbered choices for a multiple choice question. 5329 # 5330 # @param msg 5331 # The question specific message that is to be printed before asking the question. 5332 # @param ???name??? 5333 # May be a qid will be of better use instead as the client does not do anything port specific. 5334 # @param ports 5335 # The list of ports for which the question is being asked. 5336 proc ui_choice {msg name ports} { 5337 # Print the main message 5338 puts $msg 5339 5340 # Print portname or port list suitably 5341 set i 1 5342 foreach port $ports { 5343 puts -nonewline " $i) " 5344 puts [string map {@ " @" ( " ("} $port] 5345 incr i 5346 } 5347 } 5348 5349 ## 5350 # Displays a question with 'yes' and 'no' as options. 5351 # Waits for user input indefinitely unless a timeout is specified. 5352 # Shows the list of port passed to it without any numbers. 5353 # 5354 # @param msg 5355 # The question specific message that is to be printed before asking the question. 5356 # @param ???name??? 5357 # May be a qid will be of better use instead as the client does not do anything port specific. 5358 # @param ports 5359 # The port/list of ports for which the question is being asked. 5360 # @param def 5361 # The default answer to the question. 5362 # @param time 5363 # The amount of time for which a timeout is to occur. 5364 proc ui_ask_yesno {msg name ports def {timeout 0}} { 5365 # Set number default to the given letter default 5366 if {$def == {y}} { 5367 set default 0 5368 } else { 5369 set default 1 5370 } 5371 5372 puts -nonewline $msg 5373 set leftmargin " " 5374 5375 # Print portname or port list suitably 5376 if {[llength $ports] == 1} { 5377 puts -nonewline " " 5378 puts [string map {@ " @"} $ports] 5379 } else { 5380 puts "" 5381 foreach port $ports { 5382 puts -nonewline $leftmargin 5383 puts [string map {@ " @"} $port] 5384 } 5385 } 5386 5387 # Check if timeout is set or not 5388 if {$timeout > 0} { 5389 # Run ui_timeout and skip the rest of the stuff here 5390 return [ui_timeout $default $timeout] 5391 } 5392 5393 # Check for the default and print accordingly 5394 if {$def == {y}} { 5395 puts -nonewline "Continue? \[Y/n\]: " 5396 flush stdout 5397 } else { 5398 puts -nonewline "Continue? \[y/N\]: " 5399 flush stdout 5400 } 5401 5402 # User input (probably requires some input error checking code) 5403 while 1 { 5404 signal error {TERM INT} 5405 if {[catch {set input [gets stdin]} err]} { 5406 return -code error "Ctrl-C" 5407 } 5408 signal -restart error {TERM INT} 5409 if {$input in {y Y}} { 5410 return 0 5411 } elseif {$input in {n N}} { 5412 return 1 5413 } elseif {$input == ""} { 5414 return $default 5415 } else { 5416 puts "Please enter either 'y' or 'n'." 5417 } 5418 } 5419 } 5420 5421 ## 5422 # Displays a question with a list of numbered choices and asks the user to enter a number to specify their choice. 5423 # Waits for user input indefinitely. 5424 # 5425 # @param msg 5426 # The question specific message that is to be printed before asking the question. 5427 # @param ???name??? 5428 # May be a qid will be of better use instead as the client does not do anything port specific. 5429 # @param ports 5430 # The port/list of ports for which the question is being asked. 5431 proc ui_ask_singlechoice {msg name ports} { 5432 ui_choice $msg $name $ports 5433 5434 # User Input (single input restriction) 5435 while 1 { 5436 puts -nonewline "Enter a number to select an option: " 5437 flush stdout 5438 signal error {TERM INT} 5439 if {[catch {set input [gets stdin]} err]} { 5440 return -code error "Ctrl-C" 5441 } 5442 signal -restart error {TERM INT} 5443 if {($input <= [llength $ports] && [string is integer -strict $input])} { 5444 return $input 5445 } else { 5446 puts "Please enter an index from the above list." 5447 } 5448 } 5449 } 5450 5451 ## 5452 # Displays a question with a list of numbered choices and asks the user to enter a space separated string of numbers to specify their choice. 5453 # Waits for user input indefinitely. 5454 # 5455 # @param msg 5456 # The question specific message that is to be printed before asking the question. 5457 # @param ???name??? 5458 # May be a qid will be of better use instead as the client does not do anything port specific. 5459 # @param ports 5460 # The list of ports for which the question is being asked. 5461 proc ui_ask_multichoice {msg name ports} { 5462 5463 ui_choice $msg $name $ports 5464 5465 # User Input (with Multiple input parsing) 5466 while 1 { 5467 puts -nonewline "Enter the numbers to select the options: " 5468 flush stdout 5469 signal error {TERM INT} 5470 if {[catch {set input [gets stdin]} err]} { 5471 return -code error "Ctrl-C" 5472 } 5473 signal -restart error {TERM INT} 5474 set count 0 5475 # check if input is non-empty and otherwise fine 5476 if {$input == ""} { 5477 continue 5478 } 5479 foreach num $input { 5480 if {($num <= [llength $ports] && [string is integer -strict $num])} { 5481 incr count 5482 } else { 5483 puts "Please enter numbers separated by a space which are indices from the above list." 5484 break 5485 } 5486 } 5487 if {$count == [llength $input]} { 5488 return $input 5489 } 5490 } 5491 } 5492 } 5288 5493 5289 5494 ########################################## … … 5339 5544 set ui_options(progress_download) portclient::progress::download 5340 5545 set ui_options(progress_generic) portclient::progress::generic 5546 } 5547 5548 if {[isatty stdin] 5549 && [isatty stdout] 5550 && (![info exists ui_options(ports_quiet)] || $ui_options(ports_quiet) ne "yes") 5551 && (![info exists ui_options(ports_noninteractive)] || $ui_options(ports_noninteractive) ne "yes")} { 5552 set ui_options(questions_yesno) portclient::questions::ui_ask_yesno 5553 set ui_options(questions_singlechoice) portclient::questions::ui_ask_singlechoice 5554 set ui_options(questions_multichoice) portclient::questions::ui_ask_multichoice 5341 5555 } 5342 5556 -
trunk/base/src/registry2.0/portimage.tcl
r121711 r124243 186 186 } 187 187 188 ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $specifier]"189 190 188 if { [$requested installtype] ne "image" } { 191 189 return -code error "Image error: ${name} @${specifier} not installed as an image." … … 195 193 return -code error "Image error: ${name} @${specifier} is not active." 196 194 } 197 195 198 196 if {![info exists options(ports_nodepcheck)] || ![string is true -strict $options(ports_nodepcheck)]} { 199 registry::check_dependents $requested $force "deactivate" 200 } 201 197 set retvalue [registry::check_dependents $requested $force "deactivate"] 198 if {$retvalue eq "quit"} { 199 return 200 } 201 } 202 203 ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $specifier]" 204 202 205 _deactivate_contents $requested [$requested files] $force 203 206 } … … 221 224 222 225 if { [llength $ilist] > 1 } { 223 ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]" 226 set portilist {} 227 set msg "The following versions of $name are currently installed:" 228 if {[macports::ui_isset ports_noninteractive]} { 229 ui_msg "$UI_PREFIX [msgcat::mc $msg]" 230 } 224 231 foreach i $ilist { 225 232 set iname [$i name] … … 227 234 set irevision [$i revision] 228 235 set ivariants [$i variants] 229 if { [$i state] eq "installed" } { 230 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]" 236 ## 237 # User Interaction Question 238 # Asking choice to select option in case of ambiguous activate 239 if {[info exists macports::ui_options(questions_singlechoice)]} { 240 if { [$i state] eq "installed" } { 241 lappend portilist $iname@${iversion}_${irevision}${ivariants}(active) 242 } else { 243 lappend portilist $iname@${iversion}_${irevision}${ivariants} 244 } 231 245 } else { 232 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]" 233 } 246 if { [$i state] eq "installed" } { 247 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]" 248 } else { 249 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] $iname $iversion $irevision $ivariants]" 250 } 251 } 252 } 253 if {[info exists macports::ui_options(questions_singlechoice)]} { 254 set retvalue [$macports::ui_options(questions_singlechoice) $msg "Choice_Q1" $portilist] 255 set index [expr { $retvalue - 1 }] 256 return [lindex $ilist $index] 234 257 } 235 258 throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry." -
trunk/base/src/registry2.0/portuninstall.tcl
r119694 r124243 42 42 namespace eval registry_uninstall { 43 43 44 # generate list of all dependencies of the port 45 proc generate_deplist {port {optslist ""}} { 46 array set options $optslist 47 # note deps before we uninstall if we're going to uninstall them too 48 if {[info exists options(ports_uninstall_follow-dependencies)] && [string is true -strict $options(ports_uninstall_follow-dependencies)]} { 49 set deptypes {depends_fetch depends_extract depends_build depends_lib depends_run} 50 set all_dependencies {} 51 # look up deps from the saved portfile if possible 52 if {![catch {set mport [mportopen_installed [$port name] [$port version] [$port revision] [$port variants] $optslist]}]} { 53 array set depportinfo [mportinfo $mport] 54 mportclose $mport 55 foreach type $deptypes { 56 if {[info exists depportinfo($type)]} { 57 foreach dep $depportinfo($type) { 58 lappend all_dependencies [lindex [split $dep :] end] 59 } 60 } 61 } 62 # append those from the registry (could be different because of path deps) 63 foreach dep [$port dependencies] { 64 lappend all_dependencies [$dep name] 65 } 66 } else { 67 # grab the deps from the dep map 68 set portname [$port name] 69 set depmaplist [registry::list_depends $portname [$port version] [$port revision] [$port variants]] 70 foreach dep $depmaplist { 71 lappend all_dependencies [lindex $dep 0] 72 } 73 # and the ones from the current portfile 74 if {![catch {mportlookup $portname} result] && [llength $result] >= 2} { 75 array set depportinfo [lindex $result 1] 76 set porturl $depportinfo(porturl) 77 set variations {} 78 set minusvariant [lrange [split [registry::property_retrieve $port negated_variants] -] 1 end] 79 set plusvariant [lrange [split [$port variants] +] 1 end] 80 foreach v $plusvariant { 81 lappend variations $v "+" 82 } 83 foreach v $minusvariant { 84 lappend variations $v "-" 85 } 86 if {![catch {set mport [mportopen $porturl [concat $optionslist subport $portname] [array get variations]]} result]} { 87 array unset depportinfo 88 array set depportinfo [mportinfo $mport] 89 mportclose $mport 90 } 91 foreach type $deptypes { 92 if {[info exists depportinfo($type)]} { 93 foreach dep $depportinfo($type) { 94 lappend all_dependencies [lindex [split $dep :] end] 95 } 96 } 97 } 98 } 99 } 100 array unset depportinfo 101 set all_dependencies [lsort -unique $all_dependencies] 102 return $all_dependencies 103 } 104 return {} 105 } 106 44 107 # takes a composite version spec rather than separate version,revision,variants 45 108 proc uninstall_composite {portname {v ""} {optionslist ""}} { … … 90 153 # set portname again since the one we were passed may not have had the correct case 91 154 set portname [[lindex $ilist 0] name] 92 ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $portname are currently installed:"]" 93 foreach i [portlist_sortint $ilist] { 155 set msg "The following versions of $portname are currently installed:" 156 if {[macports::ui_isset ports_noninteractive]} { 157 ui_msg "$UI_PREFIX [msgcat::mc $msg]" 158 } 159 set sortedlist [portlist_sortint $ilist] 160 foreach i $sortedlist { 94 161 set ispec "[$i version]_[$i revision][$i variants]" 95 if {[$i state] eq "installed"} { 96 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s (active)"] [$i name] $ispec]" 162 ## 163 # User Interaction Question 164 # Asking choice to select option in case of ambiguous uninstall 165 if {[info exists macports::ui_options(questions_multichoice)]} { 166 if { [$i state] eq "installed" } { 167 lappend portilist [$i name]@[$i version]_[$i revision][$i variants](active) 168 } else { 169 lappend portilist [$i name]@[$i version]_[$i revision][$i variants] 170 } 97 171 } else { 98 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s"] [$i name] $ispec]" 99 } 172 if {[$i state] eq "installed"} { 173 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s (active)"] [$i name] $ispec]" 174 } else { 175 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s"] [$i name] $ispec]" 176 } 177 } 178 } 179 if {[info exists macports::ui_options(questions_multichoice)]} { 180 set retstring [$macports::ui_options(questions_multichoice) $msg "Choice_Q2" $portilist] 181 foreach index $retstring { 182 set uport [lindex $sortedlist [expr { $index - 1 }]] 183 uninstall [$uport name] [$uport version] [$uport revision] [$uport variants] 184 } 185 return 0 100 186 } 101 187 throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry." … … 113 199 } 114 200 201 set userinput {} 115 202 # uninstall dependents if requested 116 203 if {[info exists options(ports_uninstall_follow-dependents)] && $options(ports_uninstall_follow-dependents) eq "yes"} { … … 135 222 } else { 136 223 # check its dependents 137 registry::check_dependents $port ${uninstall.force} "uninstall" 224 set userinput [registry::check_dependents $port ${uninstall.force} "uninstall"] 225 if {$userinput eq "quit"} { 226 return 0 227 } 138 228 } 139 229 # if it's active, deactivate it … … 142 232 ui_msg "For $portname @${composite_spec}: skipping deactivate (dry run)" 143 233 } else { 144 if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $port deactivate $optionslist]} { 145 portimage::deactivate $portname $version $revision $variants [array get options] 234 if {$userinput eq "forcedbyuser"} { 235 set options(ports_nodepcheck) "yes" 236 } 237 if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $port deactivate [array get options]]} { 238 if {$userinput eq "forcedbyuser"} { 239 portimage::deactivate $portname $version $revision $variants [array get options] 240 unset options(ports_nodepcheck) 241 } else { 242 portimage::deactivate $portname $version $revision $variants [array get options] 243 } 146 244 } 147 245 } … … 149 247 150 248 set ref $port 151 152 # note deps before we uninstall if we're going to uninstall them too 153 if {[info exists options(ports_uninstall_follow-dependencies)] && [string is true -strict $options(ports_uninstall_follow-dependencies)]} { 154 set deptypes {depends_fetch depends_extract depends_build depends_lib depends_run} 155 set all_dependencies {} 156 # look up deps from the saved portfile if possible 157 if {![catch {set mport [mportopen_installed [$port name] [$port version] [$port revision] [$port variants] $optionslist]}]} { 158 array set depportinfo [mportinfo $mport] 159 mportclose $mport 160 foreach type $deptypes { 161 if {[info exists depportinfo($type)]} { 162 foreach dep $depportinfo($type) { 163 lappend all_dependencies [lindex [split $dep :] end] 164 } 165 } 166 } 167 # append those from the registry (could be different because of path deps) 168 foreach dep [$port dependencies] { 169 lappend all_dependencies [$dep name] 170 } 171 } else { 172 # grab the deps from the dep map 173 set depmaplist [registry::list_depends $portname $version $revision $variants] 174 foreach dep $depmaplist { 175 lappend all_dependencies [lindex $dep 0] 176 } 177 # and the ones from the current portfile 178 if {![catch {mportlookup $portname} result] && [llength $result] >= 2} { 179 array set depportinfo [lindex $result 1] 180 set porturl $depportinfo(porturl) 181 set variations {} 182 set minusvariant [lrange [split [registry::property_retrieve $ref negated_variants] -] 1 end] 183 set plusvariant [lrange [split $variants +] 1 end] 184 foreach v $plusvariant { 185 lappend variations $v "+" 186 } 187 foreach v $minusvariant { 188 lappend variations $v "-" 189 } 190 if {![catch {set mport [mportopen $porturl [concat $optionslist subport $portname] [array get variations]]} result]} { 191 array unset depportinfo 192 array set depportinfo [mportinfo $mport] 193 mportclose $mport 194 } 195 foreach type $deptypes { 196 if {[info exists depportinfo($type)]} { 197 foreach dep $depportinfo($type) { 198 lappend all_dependencies [lindex [split $dep :] end] 199 } 200 } 201 } 202 } 203 } 204 array unset depportinfo 205 set all_dependencies [lsort -unique $all_dependencies] 249 # save list of dependencies if --follow-dependencies specified 250 if {[info exists options(ports_uninstall_follow-dependencies)]} { 251 set all_dependencies [registry_uninstall::generate_deplist $port $optionslist] 206 252 } 207 253 … … 251 297 } 252 298 253 # uninstall dependencies if requested 299 set uports {} 300 # create list of all dependencies that will be uninstalled, if requested 254 301 if {[info exists options(ports_uninstall_follow-dependencies)] && [string is true -strict $options(ports_uninstall_follow-dependencies)]} { 255 302 # don't uninstall dependencies' dependents … … 258 305 set optionslist [array get options] 259 306 } 260 while 1 { 261 set remaining_list {} 262 foreach dep $all_dependencies { 263 if {![catch {set ilist [registry::installed $dep]}]} { 264 set remaining 0 265 foreach i $ilist { 266 set iversion [lindex $i 1] 267 set irevision [lindex $i 2] 268 set ivariants [lindex $i 3] 269 if {[llength [registry::list_dependents $dep $iversion $irevision $ivariants]] == 0} { 270 set regref [registry::open_entry $dep $iversion $irevision $ivariants [lindex $i 5]] 271 if {![registry::property_retrieve $regref requested] && ([info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall $optionslist])} { 272 registry_uninstall::uninstall $dep $iversion $irevision $ivariants $optionslist 307 set alldeps $all_dependencies 308 set portilist {} 309 for {set j 0} {$j < [llength $alldeps]} {incr j} { 310 set dep [lindex $alldeps $j] 311 if {![catch {set ilist [registry::installed $dep]}]} { 312 foreach i $ilist { 313 set dependents {} 314 set iversion [lindex $i 1] 315 set irevision [lindex $i 2] 316 set ivariants [lindex $i 3] 317 set dependentlist [registry::list_dependents $dep $iversion $irevision $ivariants] 318 foreach depdt $dependentlist { 319 lappend dependents [lindex $depdt 2] 320 } 321 set regref [registry::open_entry $dep $iversion $irevision $ivariants [lindex $i 5]] 322 if {![registry::property_retrieve $regref requested]} { 323 if {[llength $dependents] == 0} { 324 lappend uports $dep 325 lappend portilist $dep@[lindex $i 1]_$irevision 326 } else { 327 foreach depdt $dependents { 328 set count 0 329 foreach p $uports { 330 if {[string match $p $depdt]} { 331 incr count 332 } 333 } 334 if {$count == [llength $dependents]} { 335 lappend uports $dep 336 lappend portilist $dep@[lindex $i 1]_$irevision 337 } 273 338 } 274 } else {275 set remaining 1276 339 } 277 340 } 278 if {$remaining} { 279 lappend remaining_list $dep 280 } 281 } 282 } 283 if {[llength $remaining_list] == 0 || [llength $remaining_list] == [llength $all_dependencies]} { 284 break 285 } 286 set all_dependencies $remaining_list 287 } 288 } 289 341 } 342 } 343 set depref [registry::entry imaged $dep] 344 set depdeps [registry_uninstall::generate_deplist $depref $optionslist] 345 foreach d $depdeps { 346 set index [lsearch $alldeps $d] 347 if {$index == -1} { 348 lappend alldeps $d 349 } 350 } 351 } 352 ## User Interaction Question 353 # show a list of all dependencies to be uninstalled with a timeout when --follow-dependencies is specified 354 if {[info exists macports::ui_options(questions_yesno)]} { 355 $macports::ui_options(questions_yesno) "The following dependencies will be uninstalled:" "Timeout_1" $portilist {y} 10 356 } 357 unset options(ports_uninstall_follow-dependencies) 358 } 359 360 # uninstall all dependencies in order from uports 361 foreach dp $uports { 362 if {![catch {set ilist [registry::installed $dp]}]} { 363 foreach i $ilist { 364 set iversion [lindex $i 1] 365 set irevision [lindex $i 2] 366 set ivariants [lindex $i 3] 367 set regref [registry::open_entry $dp $iversion $irevision $ivariants [lindex $i 5]] 368 if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $regref uninstall [array get options]]} { 369 registry_uninstall::uninstall $dp $iversion $irevision $ivariants [array get options] 370 } 371 } 372 } 373 } 374 290 375 return 0 291 376 } -
trunk/base/src/registry2.0/receipt_sqlite.tcl
- Property svn:mergeinfo changed
/branches/gsoc14-interactive/base/src/registry2.0/receipt_sqlite.tcl (added) merged: 123796
- Property svn:mergeinfo changed
-
trunk/base/src/registry2.0/registry_util.tcl
r117407 r124243 78 78 } 79 79 if { [llength $deplist] > 0 } { 80 ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to %s %s @%s_%s%s, the following ports depend on it:"] $action [$port name] [$port version] [$port revision] [$port variants]]" 81 foreach depport $deplist { 82 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] [$depport name] [$depport version] [$depport revision] [$depport variants]]" 80 ## User Interaction Question 81 # ask if user wants to uninstall a port and thereby break its dependents 82 if {[info exists macports::ui_options(questions_yesno)] && ![string is true -strict $force]} { 83 set portulist {} 84 foreach depport $deplist { 85 lappend portulist [$depport name]@[$depport version]_[$depport revision] 86 } 87 ui_msg "Note: It is not recommended to uninstall/deactivate a port that has dependents as it breaks the dependents." 88 set retvalue [$macports::ui_options(questions_yesno) "The following ports will break:" "breakDeps" $portulist {n} 0] 89 if {$retvalue == 0} { 90 set force "yes" 91 } else { 92 return quit 93 } 94 } else { 95 ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to %s %s @%s_%s%s, the following ports depend on it:"] $action [$port name] [$port version] [$port revision] [$port variants]]" 96 foreach depport $deplist { 97 ui_msg "$UI_PREFIX [format [msgcat::mc " %s @%s_%s%s"] [$depport name] [$depport version] [$depport revision] [$depport variants]]" 98 } 83 99 } 84 100 if { [string is true -strict $force] } { 85 101 ui_warn "[string totitle $action] forced. Proceeding despite dependencies." 102 return forcedbyuser 86 103 } else { 87 104 throw registry::uninstall-error "Please uninstall the ports that depend on [$port name] first." -
trunk/base/tests/test/library.tcl.in
r120186 r124243 86 86 cd $pwd 87 87 88 set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -d test >&output} ]88 set result [catch {exec env PORTSRC=${portsrc} ${bindir}/port -d -N test >&output} ] 89 89 cd $back 90 90 return $result
Note: See TracChangeset
for help on using the changeset viewer.