Skip to content

Instantly share code, notes, and snippets.

@kentfredric
Last active February 5, 2017 01:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kentfredric/15fa5d73b8f1b50ac66c4726321cc18b to your computer and use it in GitHub Desktop.
Save kentfredric/15fa5d73b8f1b50ac66c4726321cc18b to your computer and use it in GitHub Desktop.
BADSLOTS=(
"dev-lang/perl:0/5.24"
"x11-libs/gtk+:3/3"
"net-libs/gnutls:0/0"
)
PHASES=(
"depend"
"rdepend"
"pdepend"
)
>/tmp/rebuild_me.1
exec 3<>/tmp/rebuild_me.1
>/tmp/rebuild_me
function get_ebuilds() {
local phase atom
phase=$1
atom=$2
echo -n "Querying for ${atom} in ${phase}: " >>/dev/stderr
qdepends --nocolor "--${phase}" --quiet --query "${atom}" | wc -l >&2
qdepends --nocolor "--${phase}" --quiet --query "${atom}"
}
function get_ebuild_slots() {
xargs qdepends --nocolor --quiet -k SLOT | sed 's/: /:/'
}
function format_slots() {
xargs qatom --quiet --nocolor --format "%{CATEGORY}/%{PN}%[SLOT]" | sed -r 's|:([^/]*)/[^/]*|:\1|'
}
for SLOT in "${BADSLOTS[@]}"; do
for PHASE in "${PHASES[@]}"; do
get_ebuilds "${PHASE}" "${SLOT}=" | get_ebuild_slots | format_slots >&3
sort -u /tmp/rebuild_me.1 > /tmp/rebuild_me
echo -n " ... total rebuilds so far: " >&2
wc -l </tmp/rebuild_me >&2
done
done
echo "Copy /tmp/rebuild_me to /etc/portage/sets/ and "
echo " try emerge -va1 -k n @rebuild_me"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment