Opened 17 years ago

Closed 16 years ago

#11501 closed defect (fixed)

BUG: uninstall should consider upgraded ports before failing

Reported by: yves@… Owned by: jmroot (Joshua Root)
Priority: Low Milestone: MacPorts 1.7.0
Component: base Version:
Keywords: Cc:
Port:

Description (last modified by jmroot (Joshua Root))

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 (1)

uninstall-upgraded.diff (1.9 KB) - added by jmroot (Joshua Root) 16 years ago.
proposed fix

Download all attachments as: .zip

Change History (15)

comment:1 Changed 17 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.

comment:2 Changed 17 years ago by pipping@…

Milestone: MacPorts 1.5

comment:3 Changed 17 years ago by yves@…

Milestone: MacPorts 1.5Feature Requests
Version: 1.4

comment:4 Changed 17 years ago by jmpp@…

Milestone: Feature RequestsMacPorts base enhancements

Milestone Feature Requests deleted

comment:5 Changed 17 years ago by nox@…

Milestone: MacPorts base enhancementsMacPorts base bugs
Priority: Nice to haveLow

comment:6 Changed 16 years ago by jmroot (Joshua Root)

Cc: jmr@… added
Milestone: MacPorts base bugsMacPorts 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.

comment:7 Changed 16 years ago by raimue (Rainer Müller)

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.

comment:8 Changed 16 years 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} {

comment:9 Changed 16 years 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.

comment:10 in reply to:  8 Changed 16 years ago by jmroot (Joshua Root)

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 16 years ago by jmroot (Joshua Root)

Attachment: uninstall-upgraded.diff added

proposed fix

comment:11 Changed 16 years ago by jmroot (Joshua Root)

Cc: jmr@… removed
Owner: changed from macports-tickets@… to jmr@…
Status: newassigned

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.

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

Keywords: ticketformatting added

comment:13 Changed 16 years ago by jmroot (Joshua Root)

Description: modified (diff)
Keywords: ticketformatting removed

comment:14 Changed 16 years ago by raimue (Rainer Müller)

Resolution: fixed
Status: assignedclosed

Marking fixed, targeted for 1.7.0.

Note: See TracTickets for help on using tickets.