Opened 12 years ago

Closed 11 years ago

Last modified 4 years ago

#36179 closed enhancement (fixed)

Please add port select --summary option

Reported by: cdeil (Christoph Deil) Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 2.3.0
Component: base Version: 2.1.2
Keywords: Cc: neverpanic (Clemens Lang), KubaO (Kuba Ober), devshashwatpandey@…
Port:

Description

I love how easy it is with port select to switch between versions.

But finding out which of the ports I have installed support port select is tricky. I have to google to find http://stackoverflow.com/questions/8016692/on-macports-what-ports-are-supported-by-port-select and then I see

$ ls /opt/local/etc/select
clang     cython    gcc       ipython   llvm      mysql     nosetests pep8      python    qt4       scala     sphinx
$ port select --show gcc
The currently selected version for 'gcc' is 'mp-gcc47'.
$ port select --show python
The currently selected version for 'python' is 'python27'.

Would it be possible to have one command (e.g. called --summary) that shows an overview table:

$ port select --summary
Portgroup   Selected   Options
gcc         mp-gcc47   none llvm-gcc42 mp-gcc45 mp-gcc47 mp-llvm-gcc42
python      python27   none python27 python32
...

Attachments (8)

port.diff (2.6 KB) - added by devshashwatpandey@… 11 years ago.
macports.diff (1.4 KB) - added by devshashwatpandey@… 11 years ago.
base-select-summary.diff (5.1 KB) - added by nerdling (Jeremy Lavergne) 11 years ago.
combine previous patches, fix bugs and whitespace
base-select-summary.2.diff (5.2 KB) - added by nerdling (Jeremy Lavergne) 11 years ago.
fix rearranged lines: undefined $commands
base-select-summary.3.diff (5.2 KB) - added by raimue (Rainer Müller) 11 years ago.
Version 2 of the patch returned one portgroup only, moved the return statement to the correct location
base-select-summary.4.diff (5.3 KB) - added by nerdling (Jeremy Lavergne) 11 years ago.
formatting
base-select-summary.5.diff (5.3 KB) - added by nerdling (Jeremy Lavergne) 11 years ago.
pick up raim's version 3 changes
base-select-summary.6.diff (5.3 KB) - added by nerdling (Jeremy Lavergne) 11 years ago.
calculate row widths

Download all attachments as: .zip

Change History (18)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Component: portsbase

To see the select ports that you've already installed, run:

port installed name:_select$

To see the available select ports that you haven't installed yet, run:

port echo name:_select$ and not installed

comment:2 Changed 12 years ago by neverpanic (Clemens Lang)

Cc: cal@… added

If you know some Tcl (or even if you don't, since it's not too complicated) I'd welcome a patch on this one.

To start, see source:trunk/base/src/macports1.0/macports.tcl@97839:3986-4094#L3986 where this is implemented.

comment:3 Changed 12 years ago by KubaO (Kuba Ober)

Cc: kuba@… added

Cc Me!

Changed 11 years ago by devshashwatpandey@…

Attachment: port.diff added

Changed 11 years ago by devshashwatpandey@…

Attachment: macports.diff added

comment:4 Changed 11 years ago by devshashwatpandey@…

I have added the --summary option for port select. But, I could not test it properly. Please report any bugs.

comment:5 Changed 11 years ago by devshashwatpandey@…

Cc: devshashwatpandey@… added

Cc Me!

comment:6 Changed 11 years ago by neverpanic (Clemens Lang)

Looks good at first sight – unfortunately I can't test right now because my working copy is busy tracking other changes and I don't want to risk mixing them (why don't we use git again? :/).

One thing I noticed is that your changes put set group [lindex $portlist 0] before the length check of $portlist. Since lindex doesn't fail on invalid indices that's not a problem per-se, I just think it would be a little cleaner to move it after the check. The indentation seems to be a little off in some places, too, but that's just a cosmetic issue.

Everything else seems to be in order – what's the problem with testing it? Don't have any select-capable ports installed? You can just install python_select or mysql_select – they won't have anything to select, but they should still show up just fine in your summary output.

Last edited 11 years ago by neverpanic (Clemens Lang) (previous) (diff)

comment:7 in reply to:  1 Changed 11 years ago by nerdling (Jeremy Lavergne)

Replying to ryandesign@…: You can combine those ideas to get the requested feature:

for i in `port -q echo installed and name:_select$`; do port select --list ${i%%_select*}; done

Changed 11 years ago by nerdling (Jeremy Lavergne)

Attachment: base-select-summary.diff added

combine previous patches, fix bugs and whitespace

comment:8 Changed 11 years ago by nerdling (Jeremy Lavergne)

I've fixed a bug, and rearranged the code to make a cleaner diff. Please see attached.

Changed 11 years ago by nerdling (Jeremy Lavergne)

Attachment: base-select-summary.2.diff added

fix rearranged lines: undefined $commands

Changed 11 years ago by raimue (Rainer Müller)

Attachment: base-select-summary.3.diff added

Version 2 of the patch returned one portgroup only, moved the return statement to the correct location

Changed 11 years ago by nerdling (Jeremy Lavergne)

Attachment: base-select-summary.4.diff added

formatting

Changed 11 years ago by nerdling (Jeremy Lavergne)

Attachment: base-select-summary.5.diff added

pick up raim's version 3 changes

Changed 11 years ago by nerdling (Jeremy Lavergne)

Attachment: base-select-summary.6.diff added

calculate row widths

comment:9 Changed 11 years ago by nerdling (Jeremy Lavergne)

Resolution: fixed
Status: newclosed

Added in r117607.

Thanks!

comment:10 Changed 4 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.3.0
Note: See TracTickets for help on using tickets.