Complex variants handling, deactivating variants if needed
Mihai Moldovan
ionic at macports.org
Sun Jul 8 04:44:46 UTC 2018
Hi
I have a problem with rather complicated variants handling.
In a port, cocoa and x11 conflict. Either of one (but only one) of these
variants shall be set.
The cocoa variant is only supported on newer OS X/macOS versions.
The universal variant shall pull in x11 (and conflict with cocoa).
Trying to model that in a Portfile merely with default_variants is not enough,
because previously cocoa and x11 were not conflicting and users might have had
the port installed with both variants enabled.
In theory, automatic selection should be possible by disabling the variant we
don't want, but I've noticed that a.) we don't have a variant_unset proc in
base, b.) using default_variants with a negative variant description is not
enough to override previously selected variants and c.) emulating something like
variant_unset leads to bad side effects.
I've done so in [0], but it's not working as intended. Deactivating a variant
using "set variations(variant) -" seems to *pass down* the variant selection to
port dependencies, which is bad. As if a user had requested a specific variant
combination for a port on the command line while installing it, this is
typically passed to the port and all dependencies, so that behavior makes sense,
but is undesirable in this case.
Consequently, I think that this behavior might also be problematic for the
variant_set proc we have in base, in case a port only wants to force-enable a
variant for itself. Portfile authors might not be aware of the additional
pass-down. variant_set is used in a few Portfiles already, which should be
checked for undesirable side-effects.
Long story short, is there a better implementation for the original problem,
that doesn't have the shortcomings mentioned?
Mihai
[0]
https://github.com/macports/macports-ports/blob/bed79e26ac5a2438559d6577e773e0a18d59f700/gnome/gstreamer1-gst-plugins-base/Portfile#L115
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 898 bytes
Desc: OpenPGP digital signature
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20180708/6c04247f/attachment-0001.sig>
More information about the macports-dev
mailing list