I never removed udept due to popular demand and it is still in the tree (you need to unmask it though). So you can still use dep -w -p. However, since it is unmaintained you will see errors printed to the screen, but on my systems the actual output still seems to be accurate.slick wrote:How is the current way to clean up the world file? Are there any new scripts or like that?

Would it be ok for a total newbie to ebuilds to attempt to bump udept to a new version and subsequently maintain the ebuild? If so, any location I could retrieve the source from other than portage? The websites as listed in the first post of this thread don't work anymore.FuzzyRay wrote:I never removed udept due to popular demand and it is still in the tree (you need to unmask it though). So you can still use dep -w -p. However, since it is unmaintained you will see errors printed to the screen, but on my systems the actual output still seems to be accurate.
Considering the state of the most recent source, I'm looking at a total rework with a partner.loftwyr wrote:If you want to maintain it, more power to you. You can get the source from the gentoo mirrors (just emerge -F udept) and copy it somewhere for the updating.

Code: Select all
#!/bin/sh
for PKG in `cat /var/lib/portage/world`; do
REVDEP_COUNT=`qdepends -C -Q ${PKG} | wc -l`
if [ ! "${REVDEP_COUNT}" = "0" ]; then
echo "*** ${PKG} is in world file, but has reverse deps"
qdepends -C -Q ${PKG}
echo ""
fi
doneThanks, "Don't Panic", I tried to enhance it and speed it up, also added an option to let the script do the actual removal, caution!Dont Panic wrote: I've called this script chk-world-deps.sh
Code: Select all
#!/bin/bash
#
# About: Clean up your worldfile by removing entries which are dependencies of
# other packages, speak: Which have reverse dependencies.
#
# Usage: You may provide the '-v' switch to get more output.
VERBOSE=false
SUGGESTED_PKGS="" # suggested for removal
WORLDFILE=/var/lib/portage/world
# Check if verbose flag was specified
[[ $1 = "-v" ]] && VERBOSE=true
# Find removeable packages
for PKG in `cat $WORLDFILE`; do
$VERBOSE && echo "${PKG}'s revdese dependencies:"
REVDEPS=`qdepends -C -Q $PKG`
if [[ -n $REVDEPS ]]; then
for DEP in $REVDEPS; do
$VERBOSE && echo -e "\t*** $DEP"
done
SUGGESTED_PKGS="$SUGGESTED_PKGS $PKG"
else
true # need this to overcome an empty else if VERBOSE isn't set
$VERBOSE && echo -e "\t--- No dependencies found"
fi
done
# Summary, what may be removed?
if [[ -z $SUGGESTED_PKGS ]]; then
echo "Couldn't find any reverse dependencies. Your world file is minimal!"
exit
else
echo -e "\n***********************************\n"
echo "Suggested for removal:"
for SUGGEST in $SUGGESTED_PKGS; do
echo $SUGGEST
done
fi
# Actually remove world file entries
echo -e "\n***********************************\n"
echo "WARNING: Be shure to have a *recent* copy of your worldfile!"
echo -n "Do you want to remove all suggest now? (y/n) "
read -n1 ANSWER
if [[ $ANSWER = "y" ]] || [[ $ANSWER = "Y" ]]; then
# Slash escaping is - as always - rather obscure.
# Here we find the slash and replace it by backslash and slash: / -> \/
SUGGESTED_PKGS=`echo $SUGGESTED_PKGS | sed 's/\//\\\\\//g'`
for SUGGESTED in $SUGGESTED_PKGS; do
sed -i "/$SUGGESTED/d" $WORLDFILE
done
fi

More useful for me. If "-v" then "No dependencies found" - simply no output. Thanks all.Henry78 wrote:Thanks, "Don't Panic", I tried to enhance it and speed it up, also added an option to let the script do the actual removal, caution!Dont Panic wrote: I've called this script chk-world-deps.sh
Code: Select all
#!/bin/bash
# About: Clean up your worldfile by removing entries which are dependencies of
# other packages, speak: Which have reverse dependencies.
#
# Usage: You may provide the '-v' switch to get more output.
WORLDFILE=/var/lib/portage/world
VERBOSE=false
SUGGESTED_PKGS="" # suggested for removal
# Check if verbose flag was specified
[[ $1 = "-v" ]] && VERBOSE=true
# Find removeable packages
for PKG in `cat $WORLDFILE`; do
REVDEPS=`qdepends -C -Q $PKG`
if [[ -n $REVDEPS ]]; then
$VERBOSE && echo "${PKG}:"
for DEP in $REVDEPS; do
$VERBOSE && echo -e "\t $DEP"
done
SUGGESTED_PKGS="$SUGGESTED_PKGS $PKG"
fi
done
# Summary, what may be removed?
if [[ -z $SUGGESTED_PKGS ]]; then
echo "Couldn't find any reverse dependencies. Your world file is minimal!"
exit
else
$VERBOSE && echo
echo -e "Suggested for removal:"
for SUGGEST in $SUGGESTED_PKGS; do
echo -e "\t $SUGGEST"
done
fi
# Actually remove world file entries
echo
echo "WARNING: Be shure to have a *recent* copy of your worldfile!"
echo -n "Do you want to remove all suggest now? (y/n) "
read -n1 ANSWER
if [[ $ANSWER = "y" ]] || [[ $ANSWER = "Y" ]]; then
# Slash escaping is - as always - rather obscure.
# Here we find the slash and replace it by backslash and slash: / -> \/
SUGGESTED_PKGS=`echo $SUGGESTED_PKGS | sed 's/\//\\\\\//g'`
for SUGGESTED in $SUGGESTED_PKGS; do
sed -i "/$SUGGESTED/d" $WORLDFILE
done
fi Code: Select all
bigiron hosts $ echo "//" | sed 's:/:\\/:g'
\/\/
There is also, let me name it "reverse approach".
You first make a back up and empty your world file:
1) gentoo ~ #cp /var/lib/portage/world ~/ && >/var/lib/portage/world
and then build it again:
2) gentoo ~ #regenworld
"regenworld" will put some packages which it thinks belong to the world
list.
Now check what portage finds to be useless when the world set is almost
empty:
3) gentoo ~ #emerge --depclean --pretend
From the list shown by the above command you chose the program packages
you *want* to have installed and put them in the world file. One "atom"
("category-name/package-name", without version numbers) per line.
Now do as "emerge --depclean" recommends:
4) gentoo ~ #emerge --update --newuse --deep world
Repeat the steps from (2) to (4) until (3) shows only packages that are
not familiar to you and (4) doesn't want to install anything.
Next. Check if there are no system packages in the list (3) shows:
5) gentoo ~ #emerge -pve system
It should not happen that (3) wants to remove system packages but its
better to be sure.
Now "cross your fingers" and execute emerge --deplcean for real (without
--pretend).
6) emerge --deplcean
Immediately after (6) finishes you *must* do:
7) emerge -DuN world
revdep-rebuild
When ( is successfully finished you should have a "clean" world set
within a healthy system.
If something goes wrong you can bring back your working "world" and
recheck all packages:
#cp ~/world /var/lib/portage/world
#emerge -DuN world
#revdep-rebuild
One more thing. You remember that saying "If it works don't fix it",
don't you?
I mean your system should work properly even with "polluted" world set,
no matter there are additional packages in it.