Fix bug in Slotting logic when using --package-names
authorfuzzyray <fuzzyray@gentoo.org>
Sun, 17 Sep 2006 23:22:16 +0000 (23:22 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Sun, 17 Sep 2006 23:22:16 +0000 (23:22 -0000)
svn path=/; revision=317

trunk/src/revdep-rebuild/revdep-rebuild

index 7548525d935cb8b4d24a095778b164badf8d3712..d633c3f2e4cac4f0bb9097bf43198211070c786c 100755 (executable)
@@ -548,15 +548,15 @@ if $PACKAGE_NAMES ; then
                                # Get the slot
                                PKG="$(echo $EXACT_PKG | sed 's/-r[0-9].*$//;s/\(^.*\/*\)-.*$/\1/')"
                                SLOT=$(cat /var/db/pkg/${EXACT_PKG}/SLOT)
+                               OTHER_VERSIONS=$(/usr/lib/gentoolkit/bin/find_pkgs.py $PKG | grep -v "($SLOT)" | awk '{print $2}')
                                # If SLOT is equal to 0, then just see what portage says is latest version
-                               if [ "$SLOT" = "0" ]
+                               if [ "$SLOT" = "0" -o "x$OTHER_VERSIONS" = "x" ]
                                then
                                        best_visible=$(portageq best_visible $PORTAGE_ROOT $PKG)
                                        [ "x" != "x$best_visible" ] && echo $best_visible
                                        continue
                                fi
                                # Otherwise mask the other SLOTTED versions and check for latest
-                               OTHER_VERSIONS=$(/usr/lib/gentoolkit/bin/find_pkgs.py $PKG | grep -v "($SLOT)" | awk '{print $2}')
                                if [ -f /etc/portage/package.mask ]
                                then
                                        mv -f /etc/portage/package.mask /etc/portage/package.mask.revdep-rebuild.backup
@@ -610,6 +610,7 @@ echo -n -e "${GR}Evaluating package order...${NO}"
 if [ -f $LLIST.5_order ] ; then
        echo " using existing $LLIST.5_order."
 else
+       set_trap "$LLIST.5_order"
        RAW_REBUILD_LIST="$(cat $LLIST.4_ebuilds | sed s/^/=/ | tr '\n' ' ')"
        if [ ! -z "$RAW_REBUILD_LIST" ] ; then
                REBUILD_GREP="^\\($( (EMERGE_DEFAULT_OPTS="" emerge --nospinner --pretend --oneshot --nodeps --quiet $RAW_REBUILD_LIST ; echo $? >$LLIST.5a_status ) | sed -n 's/\./\\&/g;s/ //g;s/$/\\/;s/\[[^]]*\]//gp' | tr '\n' '|' | sed 's/|$//'))\$"