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 [1] 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 [2]. 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 [3], 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 [3] 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
hello
--->  Deactivating openssh @7.3p1_0+kerberos5+universal+xauth
--->  Activating ssh-copy-id @7.5p1_1
--->  Cleaning ssh-copy-id


[1] 
https://github.com/macports/macports-ports/commit/085e656c9a1a681e981940dc04008e804b0e5618

[2] https://trac.macports.org/ticket/54761

[3] 
https://github.com/macports/macports-ports/commit/0002d023f80d6eb0b81446be1172527bae0e05a8



Reply via email to