[MacPorts] #44493: Support wildcard on versions
#44493: Support wildcard on versions -----------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: base | Version: 2.3.1 Keywords: | Port: -----------------------------+-------------------------------- Out of consistency reasons, I'm very much surprised to notice that the following is *not* working: {{{ $ port echo installed and gcc\* gcc45 @4.5.4_6 gcc45 @4.5.4_8 gcc45 @4.5.4_9 [..] $ port uninstall installed and gcc45@\* Error: No ports matched the given expression }}} while this works very well: {{{ $ port uninstall installed and gcc45\* ---> Uninstalling gcc45 @4.5.4_8 ---> Cleaning gcc45 ---> Deactivating gcc45 @4.5.4_9 ---> Cleaning gcc45 ---> Uninstalling gcc45 @4.5.4_9 ---> Cleaning gcc45 }}} -- Ticket URL: <https://trac.macports.org/ticket/44493> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support wildcard on versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: closed Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: worksforme | Keywords: Port: | ------------------------------+-------------------------------- Changes (by mf2k@…): * status: new => closed * resolution: => worksforme Comment: You have typed too many characters - including an "@". Wildcards are supported. In your case you want: {{{ port echo installed and gcc* }}} To uninstall all installed gcc ports type: {{{ sudo port uninstall gcc* }}} -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support wildcard on versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: closed Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: worksforme | Keywords: Port: | ------------------------------+-------------------------------- Comment (by mf2k@…): Also, this format is what I use: {{{ port installed gcc* }}} -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:2> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support wildcard on versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: closed Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: worksforme | Keywords: Port: | ------------------------------+-------------------------------- Comment (by ora.et.labora@…): Replying to [comment:1 mf2k@…]:
You have typed too many characters - including an "@". Wildcards are supported. In your case you want:
{{{ port echo installed and gcc* }}}
No, I haven't typed to many characters. I repeat myself, it is for '''consistency''' reasons. See, it is for example possible to install a particular version of a port. Here I'm taking port "gcc" as an example, it is however not "gcc" related. So, I can do this: {{{ $ port install gcc@4.5.4_8 }}} Later on, I would like to remove all 4.5.4 versions hanging around, so my target is to be able to express this like {{{ $ port uninstall gcc@4.5.4\* }}} I'm not familiar at the moment how you, the MacPorts community, name something like "gcc@4.5.4_8". Let's agree for the sake of discussion that "gcc@4.5.4_8" is the canonical port name, that "gcc" is the port's base- name, that "4.5.4_8" is the version part and that "@" is the separator terminal character. The above "uninstall" command does not work as expected, cause the wildcard is only supported on the base-name of the port name and *not* supported on the version part. __My request for enhancement is about to support wildcards on the complete port name__. ----
To uninstall all installed gcc ports type:
True, but you missed the point: it is not about uninstalling *all* ports but very selectively uninstalling ports! -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:3> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support wildcard on versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: closed Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: worksforme | Keywords: Port: | ------------------------------+-------------------------------- Comment (by ora.et.labora@…): Replying to [comment:2 mf2k@…]:
Also, this format is what I use:
{{{ port installed gcc* }}}
You probably meant {{{ port _some_action_ installed gcc* }}} while I wrote {{{ $ port uninstall installed and gcc45\* }}} I used the "$" sign to indicate that the command can be typed like this into the (shell) terminal. Further, I used __and__ //expressis verbis// to combine the two boolean expressions __installed__ and __gcc45*__. I have no clue my those logical operators are not mentioned in the [https://guide.macports.org guide], `man port` seems to be the authorative source by now. -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:4> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support wildcard on versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: closed Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: worksforme | Keywords: Port: | ------------------------------+-------------------------------- Comment (by mf2k@…): Replying to [comment:4 ora.et.labora@…]:
port install gcc@4.5.4_8
Versions cannot be used with the install command. Macports only installs the latest version of any port.
Replying to [comment:2 mf2k@…]:
Also, this format is what I use:
{{{ port installed gcc* }}}
You probably meant {{{ port _some_action_ installed gcc* }}}
No, I meant what I typed.
while I wrote {{{ $ port uninstall installed and gcc45\* }}}
I used the "$" sign to indicate that the command can be typed like this
into the (shell) terminal.
Further, I used __and__ //expressis verbis// to combine the two boolean
expressions __installed__ and __gcc45*__. I have no clue my those logical operators are not mentioned in the [https://guide.macports.org guide], `man port` seems to be the authorative source by now. This makes no sense to me. You can only uninstall installed ports. One would never type {{{port uninstall installed and}}} anything. In your sample code, simply type: {{{ port uninstall gcc45* }}} That will uninstall all installed versions of gcc45. To address your request. You are correct that wildcards cannot be used on specific versions. Honestly, that hardly seems useful. One can always uninstall singular versions by typing the complete name as reported by the {{{port installed}}} command e.g. {{{ port uninstall gcc45 @4.5.4_8 }}} or all versions as I specified above. I'm not seeing In what situation your request is useful? -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support wildcard on versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: reopened Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: | Keywords: Port: | ------------------------------+-------------------------------- Changes (by mf2k@…): * status: closed => reopened * resolution: worksforme => Comment: All that said. I will re-open the ticket should a committer want to take this on. -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support wildcard on versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: reopened Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: | Keywords: Port: | ------------------------------+-------------------------------- Comment (by ora.et.labora@…):
This makes no sense to me. You can only uninstall installed ports. One would never type port uninstall installed and anything. In your sample code, simply type:
Sorry to disagree, but it makes very much sense to me: I working nowadays a lot with the `echo` action. For example, to see which versions of gcc are installed, I'm typing: {{{ $ port echo installed and gcc\* }}} Then I'm starting to refine the select expression to narrow down what I'm really interested in: {{{ $ port echo installed and gcc4\* }}} Eventually, when happy with my selection, I __only__ exchange the action to that what I really want to do. In my example above, I just used `uninstall` as example action. It could be any other action as well, i.e. {{{ $ port dependents installed and gcc4\* }}} I hope that you finally agree that `uninstall installed and ..` makes sense. Btw, I regard `port installed` as just another shortcut for `port echo installed` where I clearly prefer the second variant due to its "subject verb object" structure. While it makes non sense to remove action "installed", it would be good to mark this action as "deprecated". ----
Honestly, that hardly seems useful. One can always uninstall singular versions by typing the complete name as reported by the port installed command e.g.
Please re-think this argument again for one moment and please elaborate why wildcards have been introduced? -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support wildcard on versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: reopened Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: | Keywords: Port: | ------------------------------+-------------------------------- Comment (by ora.et.labora@…): Nevertheless, thanks for keeping this enhancement request open. Perhaps I can myself come up with a patch demonstrating this enhancement. -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support globs in port versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: reopened Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: | Keywords: Port: | ------------------------------+-------------------------------- Comment (by larryv@…): Your point about consistency is taken, but MacPorts is not really designed to work with different versions of ports. For instance… Replying to [comment:3 ora.et.labora@…]:
Here I'm taking port "gcc" as an example, it is however not "gcc" related. So, I can do this:
{{{ $ port install gcc@4.5.4_8 }}}
…this does not work in the general case. It might work for activating an inactive port `gcc@4.5.4_8` (I have not tried it because I use `port activate` for this purpose), but if such a port is not present, you will get the latest version of `gcc`. Supporting wildcards in versions would work rather differently than the way wildcards currently work. I believe a glob is internally transformed into a list of matching portnames before the action is executed; the expansion is done using the port index and does not consider any installed ports. Globbing on the version string would have to consult the registry. The relevant code is in [[browser:trunk/base/src/port/port.tcl|port.tcl]], although one could make the argument that globs should be handled by [[browser:trunk/base/src/macports1.0/macports.tcl|macports.tcl]]. -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:9> MacPorts <http://www.macports.org/> Ports system for OS X
#44493: Support globs in port versions ------------------------------+-------------------------------- Reporter: ora.et.labora@… | Owner: macports-tickets@… Type: enhancement | Status: reopened Priority: Normal | Milestone: Component: base | Version: 2.3.1 Resolution: | Keywords: Port: | ------------------------------+-------------------------------- Comment (by larryv@…): Replying to [comment:5 mf2k@…]:
This makes no sense to me. You can only uninstall installed ports. One would never type {{{port uninstall installed and}}} anything. In your sample code, simply type:
{{{ port uninstall gcc45* }}}
That will uninstall all installed versions of gcc45.
This wouldn’t work. That command would expand to `port uninstall gcc45` (since there is only one port name that matches that glob) and would throw an error if there were more than one `gcc45` installed. The `installed and FOO` expression is necessary because only the `installed` pseudo-portname breaks out the separate installed ports: {{{ % sudo port uninstall scala2.11 ---> The following versions of scala2.11 are currently installed: ---> scala2.11 @2.11.1_0 ---> scala2.11 @2.11.2_0 (active) Error: port uninstall failed: Registry error: Please specify the full version as recorded in the port registry. % sudo port uninstall installed and scala2.11 ---> Uninstalling scala2.11 @2.11.1_0 ---> Cleaning scala2.11 ---> Deactivating scala2.11 @2.11.2_0 ---> Cleaning scala2.11 ---> Uninstalling scala2.11 @2.11.2_0 ---> Cleaning scala2.11 % }}} -- Ticket URL: <https://trac.macports.org/ticket/44493#comment:10> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts