Variant conflicts

Eric A. Borisch eborisch at macports.org
Thu Nov 19 12:22:31 PST 2015


On Thu, Nov 19, 2015 at 11:07 AM, Gustavo Seabra <gustavo.seabra at gmail.com
<javascript:;>> wrote:
> I apologize for my ignorance… What rest was just for fun? Will the
command work even in the presence of the ports that don’t have a +quartz?
and, in this case, what would happen to those?
>
> The complex command Eric presented earlier is very useful to me as well.
I won’t memorize it either, but I bookmarked the message.
>
> All the best,
> Gustavo Seabra

The sed / xargs part was "for fun." Because regexes are fun, right?

To answer your other question, yes; the port echo line will only show
installed ports that have (but may or may not be selected) both a quartz
and an x11 variant.

For reference, here is the command again;
port echo active and variant:quartz and variant:x11 \
 | sed -n -e '/\+quartz/d;s/@[^+-]*//;s/\+x11/-x11+quartz/p' \
 | sudo xargs -n 2 port install

Breaking down the sed/xargs portion, it:

1) Checks for +quartz to be present (and thus currently active) and ignores
('/d' for delete and continue) those lines. I do this because some ports
(notably cairo) can be both +x11 and +quartz.

2) Removes the version information (between the @ and the first + or -;
will fail as noted if the version string has a + or -)

3) Searches for lines with +x11, and replaces that with -x11+quartz (the
desired action originally requested) and then (/p) prints only  those (-n
argument) lines.

xargs -n 2 then takes each set of two arguments (<port> <new variants>) and
calls "port install" with those arguments.

Glad you found it useful; perhaps you'll find it fun. ;)

 - Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-users/attachments/20151119/b20e53e4/attachment.html>


More information about the macports-users mailing list