6

I want to query a installed package, and it must have specified use flag:

e.g. eix -I curl:use flag

Currently I am using grep to filter the output. I want to know if it is possible to do it in one command line.

David S.
  • 5,589

2 Answers2

9

If you want to use eix, you can use its --installed-with-use option:

$ eix --installed-with-use ipv6 curl

You may omit the last argument to enumerate all of the query results for any installed package with a particular useflag:

$ eix --installed-with-use ipv6

If you need to check if a particular package is installed with a particular useflag and can use eix, then you could do:

#!/bin/sh
if ! eix -q --installed-with-use ipv6 net-misc/curl; then
    echo "Our distribution server only has an IPv6 address. Please reinstall net-misc/curl with USE=ipv6." >&2
    exit 1
fi
binki
  • 781
2

You can use the q utility like following:

q use +flag

Or it's alias quse:

quse +flag

To do this you need to have the portage-utils package installed.

replay
  • 8,553
  • 1
  • 27
  • 31
  • 2
    unfortunately, quse does not help me filter the packages that are currently installed. so, i am going with @binki 's answer. thanks :) – David S. Jan 01 '14 at 04:28
  • You're right, his answer is better. I also didn't know eix --installed-with-use so thanks for that – replay Jan 01 '14 at 06:39