Opened 16 years ago
Closed 16 years ago
#17477 closed enhancement (fixed)
Integrate *_select tools into port
Reported by: | blb@… | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | MacPorts 1.8.0 |
Component: | base | Version: | 1.7.0 |
Keywords: | select | Cc: | lperry (Perry Lee), kngspook@…, MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), arthur@… |
Port: |
Description
Currently there are two *_select ports, gcc_select and python_select, and an increasing need for more (perl, ruby, others?). This would work better if they were brought into just one tool, and as Rainer points out putting them into port itself make sense.
Attachments (1)
Change History (14)
Changed 16 years ago by lperry (Perry Lee)
Attachment: | port.tcl.diff added |
---|
comment:1 Changed 16 years ago by lperry (Perry Lee)
Cc: | perry@… added |
---|
comment:2 follow-up: 4 Changed 16 years ago by raimue (Rainer Müller)
Perry, your patch looks good.
But wouldn't it make more sense to have this in port1.0 or macports1.0 in the API, e.g. for use in the MacPorts.framework if anyone ever gets back to it?
Some additional thoughts about the syntax, I would prefer:
port select [--set|--list] <group>
comment:4 follow-up: 5 Changed 16 years ago by kngspook@…
Replying to raimue@…:
Some additional thoughts about the syntax, I would prefer:
port select [--set|--list] <group>
Well, that might imply/be interpreted by a lot of people that "--set" and "--list" are optional. If we go that route, then maybe some additional logic should be in place that basically states:
- if they give only
port select something
, then treat it like a list command - if they give
port select something valid-selection
, then treat it like a set command - if they give
port select something invalid-selection
, then show an error stating as such and give them the list of valid picks.
comment:5 Changed 16 years ago by lperry (Perry Lee)
Replying to kngspook@…:
Replying to raimue@…:
Some additional thoughts about the syntax, I would prefer:
port select [--set|--list] <group>Well, that might imply/be interpreted by a lot of people that "--set" and "--list" are optional. If we go that route, then maybe some additional logic should be in place that basically states:
- if they give only
port select something
, then treat it like a list command- if they give
port select something valid-selection
, then treat it like a set command- if they give
port select something invalid-selection
, then show an error stating as such and give them the list of valid picks.
Also, I'll move the code to port1.0 -- after the discussion in IRC, it seems like that is the most reasonable place to put it (factoring in the whole reality differing from ideals ;)).
One additional command that I'm thinking of implementing is to show the currently selected version (the current *_select tools don't show this). I'll likely try to add this command after implementing the above suggestions.
comment:6 Changed 16 years ago by lperry (Perry Lee)
perry@phoenix ~/src/macports-users-perry/base-select $ sudo port select Error: port select [--list|--set|--show] [<group> [<version]] perry@phoenix ~/src/macports-users-perry/base-select $ sudo port select python Error: The 'show' command failed. Enable debug mode to see why. perry@phoenix ~/src/macports-users-perry/base-select $ sudo port select --list python Available Versions: base none python25 python25-apple perry@phoenix ~/src/macports-users-perry/base-select $ sudo port select python python25 Selecting 'python25' for 'python' succeeded. 'python25' is now active. perry@phoenix ~/src/macports-users-perry/base-select $ sudo port select --set python python25-apple Selecting 'python25-apple' for 'python' succeeded. 'python25-apple' is now active. perry@phoenix ~/src/macports-users-perry/base-select $ sudo port select --set python foo Selecting 'foo' for 'python' failed. Enable debug mode to see why.
comment:7 Changed 16 years ago by lperry (Perry Lee)
I forgot to mention that I created a proc in macports1.0 called mportselect. It returns "" on error (using ui_debug to indicate the nature of the error). The only two files that have been modified are port/port.tcl and macports1.0/macports.tcl.
comment:8 Changed 16 years ago by lperry (Perry Lee)
For the sake of completeness (mostly as a proof of concept), I've quickly implemented --show in r44056. It needs to be written ASAP (for reasons that will be obvious when you look at the code ;)).
The main problem is that the currently selected version is not logged when using a *_select tool (and of course port select). Using the current method I've implemented won't work if (1) more than one version symlinks to the same file or (2) there are no symlinks (e.g., 'none' for the 'python' group).
We should standardize how the currently selected version for each group is logged. One thought is have a symlink in the confpath that points to the currently selected version. As an example:
perry@phoenix /opt/local/etc/select/python $ ls -l total 20 -rw-r--r-- 2 root admin 310 2008-12-16 20:34 base -rw-r--r-- 2 root admin 24 2008-12-16 20:34 none -rw-r--r-- 2 root admin 344 2008-12-06 18:35 python25 -rw-r--r-- 2 root admin 151 2008-12-16 20:34 python25-apple lrwxr-xr-x 1 root admin 8 2008-12-19 23:24 selected -> python25
comment:9 Changed 16 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Cc: | mcalhoun@… added |
---|
Cc Me!
comment:11 Changed 16 years ago by lperry (Perry Lee)
Since my last update, I've integrated Rainer's latest changes to *_select (specifically --show now uses the 'current' symlink to determine the selected version) and added more specific error messages to port select (r44676).
After more testing, I'll likely merge the code into trunk/base since all of the essential functionality seems to be there now.
comment:12 Changed 16 years ago by lperry (Perry Lee)
Merged into trunk/base in r44693.
For now I'll leave this ticket open for feedback. If it ends up being inactive for some time, I'll go ahead and close it, assuming all is well ;).
comment:13 Changed 16 years ago by lperry (Perry Lee)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Closing.
I've attached a patch that integrates some of the *_select tools' functionality in port.
The syntax is
port select <module> <action> <options>
, with the following actions currently available: list, set