Ticket #36179: base-select-summary.4.diff
File base-select-summary.4.diff, 5.3 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 2617 set w1 5 2618 set w2 10 2619 set w3 15 2620 set formatStr "%-*s %-*s %-*s" 2621 puts [format $formatStr $w1 "Name" $w2 "Selected" $w3 "Options"] 2622 foreach pg $portgroups { 2623 if {[catch {mportselect list $pg} versions]} { 2624 ui_error "The list of versions could not be obtained: $versions" 2625 return 1 2626 } 2627 foreach v $versions { 2628 if {[catch {mportselect show $pg} selected_version]} { 2629 ui_error "The 'show' command failed: $selected_version" 2630 return 1 2631 } 2632 } 2633 # TODO: format output 2634 # portgroup | active | options options options 2635 puts [format $formatStr $w1 [string trim $pg] $w2 $selected_version $w3 [join $versions " "]] 2636 return 0 2637 } 2638 } 2604 2639 default { 2605 2640 ui_error "An unknown command '$command' was specified." 2606 2641 return 1 … … 4294 4329 clean {all archive dist work logs} 4295 4330 mirror {new} 4296 4331 lint {nitpick} 4297 select {list set show }4332 select {list set show summary} 4298 4333 log {{phase 1} {level 1}} 4299 4334 upgrade {force enforce-variants no-replace no-rev-upgrade} 4300 4335 rev-upgrade {id-loadcmd-check}