New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Ticket #11501 (closed defect: fixed)

Opened 2 years ago

Last modified 9 months ago

BUG: uninstall should consider upgraded ports before failing

Reported by: yves@… Owned by: jmr@…
Priority: Low Milestone: MacPorts 1.7.0
Component: base Version:
Keywords: Cc:
Port:

Description (last modified by jmr@…) (diff)

Example (the story is real, only the versions numbers have been changed) :

port upgrade gtk2
	...
port installed :
	gtk2 2.10.4
	gtk2 2.10.8 (active)
port uninstall inactive :
	can't uninstall gtk2 2.10.4 because gimp2 depends on it.

Attachments

uninstall-upgraded.diff (1.9 KB) - added by jmr@… 14 months ago.
proposed fix

Change History

  Changed 2 years ago by yves@…

example rewritten with decent formatting

port upgrade gtk2
    ...

port installed :
    gtk2 2.10.4
    gtk2 2.10.8 (active)

port uninstall inactive :
    can't uninstall gtk2 2.10.4 because gimp2 depends on it.

  Changed 2 years ago by pipping@…

  • milestone set to MacPorts 1.5

  Changed 2 years ago by yves@…

  • version 1.4 deleted
  • milestone changed from MacPorts 1.5 to Feature Requests

  Changed 2 years ago by jmpp@…

  • milestone changed from Feature Requests to MacPorts base enhancements

Milestone Feature Requests deleted

  Changed 2 years ago by nox@…

  • priority changed from Nice to have to Low
  • milestone changed from MacPorts base enhancements to MacPorts base bugs

  Changed 14 months ago by jmr@…

  • cc jmr@… added
  • milestone changed from MacPorts base bugs to MacPorts 1.6.1

Simple fix attached: don't error out due to dependents unless this is the only version of the port installed.

Nominating for the upcoming release.

  Changed 14 months ago by raimue@…

Acceptable solution. But this will not reduce the need to use -f when also using -u on upgrade because uninstall comes before installing.

$ sudo port -unf upgrade less
...
--->  Deactivating less @418_0
--->  Uninstalling less @418_0
--->  Installing less @418_0
--->  Activating less @418_0

But that would be another issue, let's get this one fixed first.

follow-up: ↓ 10   Changed 14 months ago by yves@…

Thanks for looking into this.

I don't know much of the inner workings but the test could balso check if the port to be uninstalled is active or not :

if {$nb_versions_installed == 1 port_is_active} {

  Changed 14 months ago by yves@…

em ... forgot to pre-format the thing

if {$nb_versions_installed == 1 || port_is_active} {

Of course, port_is_active probably does not exists as such, unless I am very lucky.

in reply to: ↑ 8   Changed 14 months ago by jmr@…

Replying to yves@macports.org:

I don't know much of the inner workings but the test could also check if the port to be uninstalled is active or not :

The activation status is available in the registry entry. Though, to trip this check with more than one version of the port installed, you must have specifically asked to uninstall the active version, either directly or through a pseudo-port. We could assume the user knows what he's doing and is going to activate the other version after uninstalling this one, or we could assume he's done something silly like entered the wrong version number or said 'port uninstall active'. I guess it is better to err on the side of caution and make him either use -f or deactivate first.

Changed 14 months ago by jmr@…

proposed fix

  Changed 14 months ago by jmr@…

  • cc jmr@… removed
  • owner changed from macports-tickets@… to jmr@…
  • status changed from new to assigned

Committed the patch to trunk in r36747. Leaving this ticket open until the change is either merged to the branch or retargeted to a later release.

  Changed 10 months ago by ryandesign@…

  • keywords ticketformatting added

  Changed 10 months ago by jmr@…

  • keywords ticketformatting removed
  • description modified (diff)

  Changed 9 months ago by raimue@…

  • status changed from assigned to closed
  • resolution set to fixed

Marking fixed, targeted for 1.7.0.

Note: See TracTickets for help on using tickets.