Ticket #36179: base-select-summary.2.diff
File base-select-summary.2.diff, 5.2 KB (added by nerdling (Jeremy Lavergne), 11 years ago) |
---|
-
src/macports1.0/macports.tcl
4192 4192 } 4193 4193 4194 4194 # mportselect 4195 # * command: The only valid commands are list, set and show4195 # * command: The only valid commands are list, set, show and summary 4196 4196 # * group: This argument should correspond to a directory under 4197 4197 # ${macports::prefix}/etc/select. 4198 4198 # * version: This argument is only used by the 'set' command. 4199 4199 # On error mportselect returns with the code 'error'. 4200 proc mportselect {command group{version {}}} {4200 proc mportselect {command {group ""} {version {}}} { 4201 4201 ui_debug "mportselect \[$command] \[$group] \[$version]" 4202 4202 4203 4203 set conf_path ${macports::prefix}/etc/select/$group … … 4226 4226 } 4227 4227 return [lsort $lversions] 4228 4228 } 4229 summary { 4230 # Return the list of portgroups in ${macports::prefix}/etc/select 4231 if {[catch {set lportgroups [glob -directory $conf_path -tails *]} result]} { 4232 global errorInfo 4233 ui_debug "${result}: $errorInfo" 4234 return -code error [concat "No ports with the select" \ 4235 "option were found."] 4236 } 4237 return [lsort $lportgroups] 4238 } 4229 4239 set { 4230 4240 # Use ${conf_path}/$version to read in sources. 4231 4241 if {$version eq {} || $version eq {base} || $version eq {current} -
src/port/port.tcl
463 463 464 464 # Execute the enclosed block once for every element in the portlist 465 465 # When the block is entered, the following variables will have been set: 466 # 466 # portspec, porturl, portname, portversion, options, variations, requested_variations 467 467 proc foreachport {portlist block} { 468 468 set savedir [pwd] 469 469 foreach portspec $portlist { … … 2504 2504 proc action_select { action portlist opts } { 2505 2505 ui_debug "action_select \[$portlist] \[$opts]..." 2506 2506 2507 # Error out if no group is specified. 2508 if {[llength $portlist] < 1} { 2509 ui_error "port select \[--list|--set|--show] <group> \[<version>]" 2507 array set opts_array $opts 2508 set commands [array names opts_array ports_select_*] 2509 array unset opts_array 2510 2511 # Error out if no group is specified or command is not --summary. 2512 if {[llength $portlist] < 1 && [string map {ports_select_ ""} [lindex $commands 0]] != "summary"} { 2513 ui_error "port select \[--list|--set|--show|--summary] \<group> \[<version>]" 2510 2514 return 1 2511 2515 } 2516 2512 2517 set group [lindex $portlist 0] 2513 2514 array set opts_array $opts 2515 set commands [array names opts_array ports_select_*] 2516 array unset opts_array 2517 # If no command (--set, --show, --list) is specified *but* more than one 2518 # argument is specified, default to the set command. 2518 2519 # If no command (--set, --show, --list, --summary) is specified *but* 2520 # more than one argument is specified, default to the set command. 2519 2521 if {[llength $commands] < 1 && [llength $portlist] > 1} { 2520 2522 set command set 2521 2523 ui_debug [concat "Although no command was specified, more than " \ … … 2601 2603 "'$selected_version'."] 2602 2604 return 0 2603 2605 } 2606 summary { 2607 if {[llength $portlist] > 0} { 2608 ui_warn [concat "The 'summary' command does not expect any " \ 2609 "arguments. Extra arguments will be ignored."] 2610 } 2611 2612 if {[catch {mportselect $command} portgroups]} { 2613 ui_error "The 'summary' command failed: $portgroups" 2614 return 1 2615 } 2616 puts "Portgroups\tOptions" 2617 foreach pg $portgroups { 2618 ui_notice $pg 2619 if {[catch {mportselect list $pg} versions]} { 2620 ui_error "The list of versions could not be obtained: $versions" 2621 return 1 2622 } 2623 foreach v $versions { 2624 ui_notice -nonewline "\t" 2625 if {[catch {mportselect show $pg} selected_version]} { 2626 ui_error "The 'show' command failed: $selected_version" 2627 return 1 2628 } 2629 if {$selected_version == $v} { 2630 ui_msg "$v (active)" 2631 } else { 2632 ui_msg "$v" 2633 } 2634 } 2635 return 0 2636 } 2637 } 2604 2638 default { 2605 2639 ui_error "An unknown command '$command' was specified." 2606 2640 return 1 … … 4294 4328 clean {all archive dist work logs} 4295 4329 mirror {new} 4296 4330 lint {nitpick} 4297 select {list set show }4331 select {list set show summary} 4298 4332 log {{phase 1} {level 1}} 4299 4333 upgrade {force enforce-variants no-replace no-rev-upgrade} 4300 4334 rev-upgrade {id-loadcmd-check}