Question regarding builders and require_active_variants

Ryan Schmidt ryandesign at
Thu Nov 18 08:27:31 UTC 2021

On Nov 16, 2021, at 10:48, Jason Liu wrote:

> When using `require_active_variants` in a Portfile, are the builders smart enough to then install dependencies using the required variants?

No. The build will fail with the same message that a user would see.

On Nov 17, 2021, at 10:23, Christopher Nielsen  wrote:

> Ultimately I’m going to fix this issue once and for all, via segregated subports for X11 and Quartz. (That will need to be done for all of the key foundational ports, including: glib2, gtk2, gtk3, gtk-osx-application-XXX, etc.


> In the interim, I’d be curious whether there’s a short-term buildbot-related fix for Quartz-only ports like RawTherapee. Josh/Ryan…?

On Nov 17, 2021, at 11:06, Jason Liu wrote:

> Is there no way to make the buildbots "smarter", so that if the Portfile has a `require_active_variants` line, to simply just go ahead and install the dependency with that variant enabled? I'm not necessarily asking for this sort of behavior in MacPorts base, which would affect all users, but only on the buildbots, so that they could complete a larger number of package builds.
> Or would this be considered "too smart by half"?

Of course anything can be done by writing more code. We could modify buildbot/mpbb to install ports with certain variants in response to require_active_variants. To do so, we would first have to write code to allow buildbot/mpbb to install ports with certain variants at all. The ticket for that is here:

Some work has been done on that but I don't know how complete it is and I have not evaluated the work that has been done. The intention was not to automatically build all combinations of variants but to build certain standard variants by default (like +quartz, +x11, and +universal (for those ports that need to be built universal to satisfy another port's needs)) and to allow developers to input variant names when forcing builds on the buildbot web interface. But subports are a better solution for the x11/quartz distinction as Christopher mentioned above.

In my opinion, we should not make buildbot/mpbb smarter to accommodate require_active_variants. We should pursue solutions which benefit all users (and buildbot/mpbb is a user), not just buildbot/mpbb.

Variants should not be used for features upon which other ports might depend. The ticket for that proposal is here but I think we've rejected it:

Since a port can only be installed with one set of variants at a time, variants are not a good model for dependencies. Imagine that one port X requires gtk3 +quartz and that another port Y requires gtk3 +x11 and that the gtk3 +quartz and +x11 variants conflict with one another. What happens if you want to install both ports X and Y? Does MacPorts activate whichever variant of gtk3 was depended upon last, thus breaking the previously installed ports that depended upon a different variant? Or does MacPorts issue an error preventing the second installation from occurring? Neither is good because neither would allow the user to install and use both ports at the same time.

The number of problems that allowing dependencies on variants raises indicates to me that we should not pursue allowing dependencies on variants. Instead, we should either always enable the port features upon which some other port might depend, or else break the optional functionality out into separate ports or subports upon which other ports can then depend.

More information about the macports-dev mailing list