Opened 15 years ago

Closed 14 years ago

#19176 closed enhancement (fixed)

patch to fixup existing uninstall implementation

Reported by: david.osguthorpe@… Owned by: macports-tickets@…
Priority: Normal Milestone: MacPorts 1.9.0
Component: base Version: 1.7.0
Keywords: Cc: raimue (Rainer Müller), blb@…
Port:

Description

This patch fixes up the pre-existing pkg_uninstall implementation so that it works

Attachments (2)

patch-uninstall.diff (2.7 KB) - added by david.osguthorpe@… 15 years ago.
patch-unsintall-new.diff (3.0 KB) - added by david.osguthorpe@… 15 years ago.

Download all attachments as: .zip

Change History (9)

Changed 15 years ago by david.osguthorpe@…

Attachment: patch-uninstall.diff added

comment:1 Changed 15 years ago by raimue (Rainer Müller)

Cc: raimue@… added

comment:2 Changed 15 years ago by blb@…

Cc: blb@… added
Priority: Not setNormal

Since pkg_uninstall is not actually used, perhaps it would be best to simply delete its handling. Especially as it seems to be a bit messy in usage since as you say in that comment, a number of variables aren't available.

comment:3 in reply to:  2 ; Changed 15 years ago by david.osguthorpe@…

Replying to blb@…:

Since pkg_uninstall is not actually used, perhaps it would be best to simply delete its handling. Especially as it seems to be a bit messy in usage since as you say in that comment, a number of variables aren't available.

I added this because someone was asking for such a procedure on the mailing list recently - Im not sure what you mean by pkg_uninstall is not actually used - you mean that no Portfile defines it - it would only be defined in Portfiles - not in base itself

Well it does actually enable you to do something at uninstall - I was just pointing out that its run in a different context to the rest of the Portfile - its actually probably not useful that destroot is defined - by uninstall time for a normal port install the whole work directory would have been deleted at the install stage in any case - Ive just never sorted out in detail what variables are defined - but theres enough information to operate explicitly on paths you know about - which is what I am using it for (since 1.3/4 odd)

comment:4 in reply to:  3 ; Changed 15 years ago by blb@…

Replying to david.osguthorpe@…:

I added this because someone was asking for such a procedure on the mailing list recently - Im not sure what you mean by pkg_uninstall is not actually used - you mean that no Portfile defines it - it would only be defined in Portfiles - not in base itself

Right, I didn't find any Portfiles which actually define pkg_uninstall.

Well it does actually enable you to do something at uninstall - I was just pointing out that its run in a different context to the rest of the Portfile - its actually probably not useful that destroot is defined - by uninstall time for a normal port install the whole work directory would have been deleted at the install stage in any case - Ive just never sorted out in detail what variables are defined - but theres enough information to operate explicitly on paths you know about - which is what I am using it for (since 1.3/4 odd)

True, and having a pre/post-deactivate and uninstall step is definitely something which would be useful, but I'm not sure if this is the way to do it. It's correct that ${destroot} wouldn't be useful during uninstall, but what other bits may be? I think the better solution is to allow deactivate and uninstall hooks in the Portfile and they can be run by port just like with other, similar steps. I think my primary issue with it is that this method is so different than the rest of the way Portfiles work, though it does have the advantage of being implemented...

comment:5 in reply to:  4 ; Changed 15 years ago by david.osguthorpe@…

Right, I didn't find any Portfiles which actually define pkg_uninstall.

of course as the current implementation does not work its not surprising its not used

True, and having a pre/post-deactivate and uninstall step is definitely something which would be useful, but I'm not sure if this is the way to do it. It's correct that ${destroot} wouldn't be useful during uninstall, but what other bits may be? I think the better solution is to allow deactivate and uninstall hooks in the Portfile and they can be run by port just like with other, similar steps. I think my primary issue with it is that this method is so different than the rest of the way Portfiles work, though it does have the advantage of being implemented...

I dont know what the basis of the original programmers implementation was - but it is consistent with the rest of the current uninstall proc which also totally ignores Portfile - it deletes files based on whats in the registry - and its executed directly

ah - I think Ive just figured out a good reason for this approach - suppose you deactivate a port - this still leaves the files in the registry - now you update the Portfile and change versions etc. and if it had an uninstall phase you change that - now how do you uninstall that older deactivated version correctly? (which of course you were leaving around in case your new version didnt work) - also explains the current uninstall approach of deleting files based only on whats in the registry and why its independent of the whole Portfile fetch-install phases

Changed 15 years ago by david.osguthorpe@…

Attachment: patch-unsintall-new.diff added

comment:6 in reply to:  5 Changed 15 years ago by blb@…

Replying to david.osguthorpe@…:

ah - I think Ive just figured out a good reason for this approach - suppose you deactivate a port - this still leaves the files in the registry - now you update the Portfile and change versions etc. and if it had an uninstall phase you change that - now how do you uninstall that older deactivated version correctly? (which of course you were leaving around in case your new version didnt work) - also explains the current uninstall approach of deleting files based only on whats in the registry and why its independent of the whole Portfile fetch-install phases

This is also a problem if actions should be taken for deactivate, if you have multiple versions installed; again, with it only in the Portfile (and said Portfile only exists in the source repository location) then it's deactivate actions are also from the latest version.

The way to do this for activate (if reactivated later), deactivate, and uninstall is to store either each in some location like the pkg_uninstall here or to keep the correct Portfile around as it was when that version was installed. If #19458 happens that keeps the Portfile with the image so it could be used in such cases...

comment:7 Changed 14 years ago by jmroot (Joshua Root)

Milestone: MacPorts FutureMacPorts 1.9.0
Resolution: fixed
Status: newclosed

Applied in r64640.

Note: See TracTickets for help on using tickets.