Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Clean out your world file
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3 ... 27, 28, 29  
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3464

PostPosted: Thu Oct 01, 2009 3:20 pm    Post subject: Reply with quote

How is the current way to clean up the world file? Are there any new scripts or like that?
Back to top
View user's profile Send private message
FuzzyRay
Developer
Developer


Joined: 02 Oct 2003
Posts: 77

PostPosted: Thu Oct 01, 2009 8:22 pm    Post subject: Reply with quote

slick wrote:
How is the current way to clean up the world file? Are there any new scripts or like that?


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.
Back to top
View user's profile Send private message
Ray ishido
Tux's lil' helper
Tux's lil' helper


Joined: 17 Jan 2006
Posts: 141
Location: Piracicaba (Brazil)

PostPosted: Tue Dec 01, 2009 1:02 pm    Post subject: Reply with quote

Hi,
if dep no longer works, does emerge --depclean do the trick?
Back to top
View user's profile Send private message
genstorm
Advocate
Advocate


Joined: 05 Apr 2007
Posts: 2349
Location: Austria

PostPosted: Tue Dec 01, 2009 1:05 pm    Post subject: Reply with quote

--depclean only cares about dependencies, based on world entries, not cleaning the world file.
_________________
backend.cpp:92:2: warning: #warning TODO - this error message is about as useful as a cooling unit in the arctic
Back to top
View user's profile Send private message
Makitk
n00b
n00b


Joined: 18 Feb 2010
Posts: 2
Location: Netherlands

PostPosted: Thu Feb 18, 2010 11:54 am    Post subject: Reply with quote

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.


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.

If this isn't allowed, please do let me know, but it seems like a handy program to keep around, so an update to it would be necessary to keep it in the list for the future.
I know I can use it... :oops:
_________________
"When Mirage shows you files you can't find using Dolphin, it truly lives up to its name." - me
Back to top
View user's profile Send private message
loftwyr
l33t
l33t


Joined: 29 Dec 2004
Posts: 970
Location: 43°38'23.62"N 79°27'8.60"W

PostPosted: Thu Feb 18, 2010 1:57 pm    Post subject: Reply with quote

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.
_________________
My emerge --info
Have you run revdep-rebuild lately? It's in gentoolkit and it's worth a shot if things don't work well.
Celebrating 5 years of Gentoo-ing.
Back to top
View user's profile Send private message
Makitk
n00b
n00b


Joined: 18 Feb 2010
Posts: 2
Location: Netherlands

PostPosted: Mon Feb 22, 2010 11:35 pm    Post subject: Reply with quote

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.

Considering the state of the most recent source, I'm looking at a total rework with a partner.
Further information with regards to that particular project will be released in due time. When related to udept, I'll link to it in this thread.

Might take a while, however. :oops:
_________________
"When Mirage shows you files you can't find using Dolphin, it truly lives up to its name." - me
Back to top
View user's profile Send private message
Dont Panic
Guru
Guru


Joined: 20 Jun 2007
Posts: 320
Location: SouthEast U.S.A.

PostPosted: Tue Feb 23, 2010 3:20 am    Post subject: Reply with quote

I know udept did many more things, but I wrote a quick script to replicate the functionality of checking your world file for entries that could be cleaned.

I've called this script chk-world-deps.sh
Code:
#!/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
done

It can be run as a normal user, and simply checks every entry in the world file for reverse dependencies ('wc -l' counts the number of lines returned by the qdepends run). In theory, a package doesn't have to be in the world file if it has other packages that depend on it.

This script doesn't write back to the world file. But it could be modified to do so by adding a 'emerge --deselect ${PKG}' line, and then running as root.
Back to top
View user's profile Send private message
Henry78
Apprentice
Apprentice


Joined: 12 Jul 2004
Posts: 186
Location: Austria

PostPosted: Wed Apr 28, 2010 8:05 pm    Post subject: Reply with quote

Dont Panic wrote:

I've called this script chk-world-deps.sh


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!
Code:

#!/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
Back to top
View user's profile Send private message
orionbelt
Tux's lil' helper
Tux's lil' helper


Joined: 05 Apr 2006
Posts: 83
Location: Brussels, Belgium

PostPosted: Thu Jun 17, 2010 2:04 pm    Post subject: Difference between "qdepends -Q" and "equery Reply with quote

The script above uses "qdepends -Q" to determine dependencies. However, "equery depends" is also supposed to do that, and it looks like it is more thorough in its dependency searches, as mentioned in this thread:

https://forums.gentoo.org/viewtopic-p-6317971.html#6317971

Is there any reason why "qdepends -Q" should be preferred over "equery depends" ?
Back to top
View user's profile Send private message
Dont Panic
Guru
Guru


Joined: 20 Jun 2007
Posts: 320
Location: SouthEast U.S.A.

PostPosted: Wed Jun 23, 2010 3:41 pm    Post subject: Reply with quote

The reason I used 'qdepends -Q' as opposed to 'equery depends' is because equery tends to return false positives when employeed in the context of this script.

The 'equery' command does not take into account your actual USE flag settings. The 'qdepends' command attempts to do so.

The 'qdepends' command is not perfect, but is the closest thing I could find.

I've provided more details in another thread, so in the interest of avoiding cross-posting, I supply the link here: Difference between "qdepends -Q" and "equery depends" ?
Back to top
View user's profile Send private message
atommixz
n00b
n00b


Joined: 24 Jun 2010
Posts: 4

PostPosted: Thu Jun 24, 2010 2:43 pm    Post subject: Reply with quote

Henry78 wrote:
Dont Panic wrote:

I've called this script chk-world-deps.sh


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!


More useful for me. If "-v" then "No dependencies found" - simply no output. Thanks all.

$ cat ./script/chk-world-deps.sh
Code:
#!/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
Back to top
View user's profile Send private message
s0be
Apprentice
Apprentice


Joined: 23 Nov 2002
Posts: 223

PostPosted: Thu Jun 24, 2010 3:23 pm    Post subject: Reply with quote

To clean up your slash replacement (a little, anyways):

Code:
bigiron hosts $ echo "//" | sed 's:/:\\/:g'
\/\/
Back to top
View user's profile Send private message
green2000
n00b
n00b


Joined: 05 Dec 2010
Posts: 3

PostPosted: Sun Dec 05, 2010 6:26 am    Post subject: "reverse approach" to cleaning world file Reply with quote

from http://help.lockergnome.com/linux/gentoo-Clean-world-file--ftopict362179.html
Quote:


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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Goto page Previous  1, 2, 3 ... 27, 28, 29
Page 29 of 29

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum