Hey, On Tue, Jul 04, 2017 at 10:00:16PM +0200, Clemens Lang wrote: > > I am attaching a patch to only print active variants that are not > > enabled by default (or disabled default variants). To me the result > > looks like what we want to have: > > > > $ tools/dependencies.tcl wine | grep -E 'glib2|cairo' > > glib2 +universal > > cairo +universal > > $ tools/dependencies.tcl gtk3 +quartz | grep -E 'glib2|cairo' > > glib2 +quartz > > cairo > > No, this won't work, because with this output you can no longer > distinguish 'cairo (default variants)' from 'cairo -quartz-x11'. This > is probably not a valid configuration for the cairo port specifically, > but you get the idea.
I had another look at your proposed patch. In general, the idea of printing active variants that are not enabled by default and disabled default variants is correct. We need a string that uniquely identifies a specific variant combination when passed to 'port install', and your idea fulfills that property. However, the implementation has problems: - Due to the way how $depinfo(active_variants) works, it only contains positive variants. Hence $active_variants($variant) eq "-" can never be true and your code will never disable a default variant. This works in your gtk3 +quartz example for the same reason that 'port info glib2 +quartz' does not show x11 as a default variant. - $default_variants does not contain default variants that have been disabled for this port. Just because a variant is not in default_variants does not mean that it is not a default variant of the given port, it might just have been disabled for this instance. It's weird, I know. Note, btw, that this did work correctly before https://github.com/macports/mpbb/commit/4462924d822cb61464b6ecb8badcc9949231527b I'm adding Joshua to Cc. Since Joshua's commit did improve speed quite a bit (turns out the extra Portfile execution comes with a hefty performance penalty), how about this approach: - Print all selected variants that are not default. - Intersect the set of variants explicitly disabled on the command line with the set of available variants of a port, and print those. This will still give us a situation where disabling a non-default variant of a port will cause a failcache miss, but your patch already had these downsides. Reviews please: https://github.com/macports/mpbb/pull/4 -- Clemens
