variants vs separate ports
Ryan Schmidt
ryandesign at macports.org
Mon May 24 10:30:37 PDT 2010
On May 24, 2010, at 12:06, Bradley Giesbrecht wrote:
> On May 24, 2010, at 8:59 AM, Ryan Schmidt wrote:
>
>> Conflicting variants is easy. Check out for example the GraphicsMagick port's quality variants (q8, q16, q32).
>
> Right, conflicting is easy. I looked for variant_isset in port sources and came up with this.
> Would this be a reasonable way to ensure that a variant is set?
> Keep in mind that ONE and ONLY ONE variant MUST be set.
>
> pre-fetch {
> if {![array size variations]} {
> variant_set {mailtrain}
> }
> }
>
> Port appears to handle misspelled or nonexistent variations so [array size variations] seems to be zero if the user did not pass in valid variations for this port. I mention this incase the user is installing more then one package or if this port ever became a dependency and variations for other ports are on the command line.
GraphicsMagick uses:
if {![variant_isset q16] && ![variant_isset q32]} {
default_variants +q8
}
This ensures that if the user does not specify +q8, +q16 or +q32, it selects +q8.
The one thing this does not handle is if the user specifically tries to install "GraphicsMagick -q8"; in this case no variant will be selected. I've never been entirely comfortable with that. Perhaps we should indeed be using variant_set instead:
if {![variant_isset q16] && ![variant_isset q32]} {
variant_set q8
}
I'm not certain why we haven't been doing that.
More information about the macports-dev
mailing list