Skip to content

Instantly share code, notes, and snippets.

@garymacindoe
Created May 6, 2015 12:48
Show Gist options
  • Save garymacindoe/2cc122dbc3edf7d40a7f to your computer and use it in GitHub Desktop.
Save garymacindoe/2cc122dbc3edf7d40a7f to your computer and use it in GitHub Desktop.
Checks for invalid/obsolete entries in Gentoo Portage's world file
#!/bin/bash
#
# Author: Gary Macindoe
# Date: May 2015
WORLD_FILE=/var/lib/portage/world
while read package;
do
DEPS=$(grep -l ${package} /var/db/pkg/*/*/{,R}DEPEND | cut -d'/' -f5,6 | sort -u);
if [ "${DEPS}" ] && [[ "${DEPS}" != "${package}"-* ]];
then
echo -e "\E[1;31;40m${package}\E[0m"
echo "${DEPS}" | while read dep
do
echo " ${dep}"
done
else
echo -e "\E[1;32;40m${package}\E[0m"
fi
done < ${WORLD_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment