Deactivate hack and increasing revision
ryandesign at macports.org
Wed Sep 6 07:52:04 UTC 2017
I thought we needed to increase the revision of a port when we added the deactivate hack, but it was not done for ssh-copy-id and yet it seems to work. I'm trying to understand why it works.
When the ssh-copy-id files were removed from the openssh port  and the port was thus made to no longer conflict with the ssh-copy-id port, the ssh-copy-id port would install, but could not be activated if the prior version of openssh was installed, as would be the case during an upgrade . This version of ssh-copy-id did build and install and activate successfully on the buildbot workers (since they did not have openssh active at the time) and is being distributed by our packages server.
The deactivate hack was added to the port , but because its revision was not increased, my understanding was that my machine would still complain that ssh-copy-id could not be activated because openssh was active, because the pre-activate block added in  would not be used, because MacPorts would look at the version of the Portfile that was already stored in the registry with the installed copy of the port, not the version of the Portfile in the ports tree. And yet, the upgrade now works for me.
I was sure that activate and deactivate phases were run from a copy of the Portfile kept in the registry, since the activate and deactivate phases of the current version of the Portfile in the ports tree wouldn't necessarily be compatible with whatever probably older version of the port the user had installed. And yet, if I add 'ui_msg "hello"' to the pre-activate block of the Portfile, and then tell MacPorts to install a binary from our server which doesn't contain that message, I still get:
$ sudo port -b install ssh-copy-id
---> Fetching archive for ssh-copy-id
---> Attempting to fetch ssh-copy-id-7.5p1_1.darwin_16.noarch.tbz2 from https://packages.macports.org/ssh-copy-id
---> Attempting to fetch ssh-copy-id-7.5p1_1.darwin_16.noarch.tbz2.rmd160 from https://packages.macports.org/ssh-copy-id
---> Installing ssh-copy-id @7.5p1_1
---> Deactivating openssh @7.3p1_0+kerberos5+universal+xauth
---> Activating ssh-copy-id @7.5p1_1
---> Cleaning ssh-copy-id
More information about the macports-dev