port "activate instead"

Ryan Schmidt ryandesign at macports.org
Mon May 25 18:20:04 PDT 2015

On May 25, 2015, at 10:50 AM, René J.V. Bertin wrote:
> It's been a while that I miss a possibility to switch between foo and foo-devel ports without having to do the deactivation manually in a separate step. A normal `port activate foo` takes are automatically of deactivating the currently active version; how hard would it be to extend the activate syntax so it accepts an "instead of <port>" argument that would replace the "currently active" port to be deactivated?

The reason why activating an inactive version of a port works automatically is that it can easily check for another active version of that port and deactivate it first.

The reason why activating e.g. foo-devel doesn't work automatically if foo is already active is that MacPorts doesn't know that foo and foo-devel are compatible alternatives. All it knows is that the ports conflict (meaning: they install at least one file with the same absolute path) so they cannot be active at the same time.

The solution for this problem probably falls under the long-standing feature request to have ports be able to indicate that they provide alternatives of one another. For example, I might envision a new key "provides" with a default value of "${subport}". And a port like graphviz-devel would declare that it "provides graphviz". There would no longer be a need to declare in the graphviz and graphviz-devel portfiles that they conflict with one another. And there would be no need to use path:-style dependencies in other ports that depend on graphviz. And activating one would transparently deactivate the other.

More information about the macports-dev mailing list