Order of activation/deactivation pre/post phases

Ryan Schmidt ryandesign at macports.org
Wed Feb 25 12:33:58 PST 2015


On Feb 25, 2015, at 8:56 AM, Artur Szostak wrote:

> OK, so as I suspected, activation performs the dependency check and triggers a deactivation of the older port.
> Not knowing much about the internals of MacPorts, my assumption would have been that all, pre-<phase>, <phase>, pos-<phase> groups happen atomically as a transaction. But apparently that is not the way the Portfile API works. Might be good for someone to mention that in the documentation at some point.
> 
> But now for the problem that triggered this question:
> I want a Portfile to download a large amount of demo data. A few Gbytes worth. I dont want to destroot it because then the binary packages become huge and unmanageable. The demo data need only be present when the port is active. Not knowing the correct way to overload the activate and deactivate phases in a Portfile. My solution was to place the download and cleanup in the pre-activate and post-deactivate hooks. The reason for pre-activate and not post-activate is that I noticed that the port would get marked as all OK, even if the demo data did not download and unpack correctly. i.e. post-activate is already too late, the port has been fully registered at that point.
> This port works fine up to the point that one tries to upgrade it to a newer version. At which point the demo data is missing after an upgrade because of the order that the hooks are called.
> 
> Is there an easy and correct way to overload the activate/deactivate phase itself? That should solve this problem.

You probably shouldn't do all that second-guessing of the port system, and should just install the demo files in the destroot, as you would any other file. If the demo data is a separate download, with a separate version number and release schedule from the software installed by the rest of the port, making the demo data a separate port as Daniel suggested is a great idea.





More information about the macports-dev mailing list