#!/bin/bash
#
# This is a draft 
#
# Helper script to clean keywords and useflag not needed anymore
# On a system where portage.use and portage.accept_keywords are heavily edited, it become hard to keep it clean 
#
# What it does
#
# Compare installed ebuild list with portage.*/* list, display entry portage.*/* of uninstalled ebuild.
#
# Output installed ebuild
#
# eix-installed -q all | sed 's/\(.*\)\/\(.*\)-[0-9].*/\1\/\2/
#
# Output portage.*/*
#
# package.use
# cat /etc/portage/package.use/* | sed 's/[=|>]*//'  | sed 's/\(.*\)\/\(.*\)-[0-9].*/\1\/\2/' | sed 's/ .*//' | sort -u 
#
# package.accept_keywords
# cat /etc/portage/package.accept_keywords/* | sed 's/[=|>]*//'  | sed 's/\(.*\)\/\(.*\)-[0-9].*/\1\/\2/'
## 


LIST=clean

while IFS= read ebuild; do
reix=$(eix -I $ebuild)
if [[ $reix == "No matches found" ]]; then
echo $ebuild
fi
done < $LIST

