#! /bin/bash # set -x export tab=' ' export space=' ' export whitespace="${tab}${space}" export pound='#' export openparen='(' export backquote='`' source '/etc/make.conf' for use in ${USE} ; do export use echo "checking ${use}" if [[ "$(echo ${use} | sed 's/-//')" != "${use}" ]] ; then grep_opt="" use="$(echo ${use} | sed 's/-//')" else grep_opt="-v" fi echo $( set +x find '/usr/portage/' -name '*.ebuild' -print | xargs grep -H "^[^${pound}]*[${whitespace}${openparen}${backquote}]use[${whitespace}]-*${use} ^[^${pound}]*[${whitespace}${openparen}${backquote}]use_enable[${whitespace}]-*${use} ^[^${pound}]*[${whitespace}${openparen}${backquote}]use_with[${whitespace}]-*${use}" | grep -F $(echo "${use}" | sed 's/-//') | sed 's/-[0-9].*//g;s|/usr/portage/[^/]*/[^/]*/||g;s|^|/var/db/pkg/*/|;s|$|*/USE|' | uniq ) | xargs grep -F -H -l ${grep_opt} ${use} 2>/dev/null | sed 's|/var/db/pkg/||;s|/USE||' | sort -u done