#!/bin/bash # Purpose: To discover which of your installed packages is broken # with modular X. Uses a binary search and greps emerge output for blocks on # X. Will work even if multiple packages are not ported to modular X. PORTDIR=$(/usr/bin/portageq envvar PORTDIR) PKGFILE="/var/lib/portage/world" CATEGORY=$1 decho() { if [[ -n "$DEBUG" ]]; then echo $@ fi } usage() { echo echo "${0##*/} [ CATEGORY ]" echo " Discover packages that haven't been ported to modular X dependencies." echo " By default, acts on ${PKGFILE}. If passed CATEGORY," echo " it will check ${PORTDIR}/CATEGORY instead." exit 1 } # Get all the packages in a given category get_category_packages() { local PORTDIR=$1 local CATEGORY=$2 local PKG PKGS pushd $PORTDIR &> /dev/null for PKG in $(ls $CATEGORY); do if [[ "${PKG}" == "CVS" ]]; then continue elif [[ -d ${CATEGORY}/${PKG} ]]; then PKGS="$PKGS ${CATEGORY}/${PKG}" fi done popd &> /dev/null echo $PKGS } # Takes list of packages, returns list of those blocking modular X # **char find_blocker(**char full_array) find_blocker() { python /root/modular/find_broken_modular_package.py "${@}" } if [[ "$1" = -h ]] || [[ "$1" = --help ]]; then usage fi if [[ -n "$CATEGORY" ]]; then PKGS=$(get_category_packages $PORTDIR $CATEGORY) else PKGS=$(<$PKGFILE) fi find_blocker $PKGS