Sebastian Günther schrieb am 26.04.2009 19:55:
> * Alan McKinnon (alan.mckin...@gmail.com) [26.04.09 18:49]:
>> It should be easy enough to write a program that examines world and displays 
>> all packages it finds that are dependencies of something else in world, but 
>> I 
>> haven't found one, and prefer the manual approach above.
>>
> 
> 
> #!/bin/bash
> for i in $( cat /var/lib/portage/world ); do 
>         equery d $i; 
> done
> 
> Slow, ugly, but does the job
> 
> Sebastian
> 

Afaik equery does not give the correct output.

Use emerge -pv --depclean on every entry in the world file.

This may however report false positives when packages are involved that
have post dependencies. Happens here with slim,mozilla-thunderbird and
audacious-plugins for instance.

I have attached a small perl script that examines all world entries. It
will take some time for your large world file but give some hints on
unneeded packages.

-- 
Daniel Pielmeier
#!/usr/bin/perl
#
#
#

use strict;
use diagnostics;
use warnings;

my ($package,$status,$line) = ();
my @depclean = ();
my $world = "/var/lib/portage/world";

print "Examining: $world\n\n";

open(WORLD,"<$world") || die("world: $!");

foreach $package (<WORLD>) {
        chomp $package;
        @depclean = qx(emerge -pv --depclean "$package");
        foreach $line ( @depclean ) {
                if ( $line =~ ">>> These are the packages that would be 
unmerged:" ) {
                        $status = "needed";
                        write;
                } elsif ( $line =~ ">>> No packages selected for removal by 
depclean" ) {
                        $status = "unneeded";
                        write;
                }
        }
}

format STDOUT_TOP =
Atom:                                            Status: (required in world)
.

format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$package, $status
.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to