What would be a good way to remove all of gnome (and then put back / exclude any bits evolution needs)
I wrote this Perl script a while back to uninstall a package tree (Gnome or KDE). It will find any packages that were installed by the 'emerge gnome' that aren't needed by anything but other packages that were installed by the 'emerge gnome'. You must have qpkg installed (emerge gentoolkit) to use this script.
#! /usr/bin/perl
my @pkgs1, @pkgs2, @world, @system, $line, $line2, $pkg;
open WORLD, "< /var/cache/edb/world";
foreach $line (<WORLD>) {
chomp $line;
push @world, $line;
}
close WORLD;open SYSTEM, "emerge --nospinner -ep system |";
foreach $line (<SYSTEM>) {
chomp $line;
$line =~ /\[.+\] (.+\/.+)-\d.*\s*$/;
$line2 = $1;
if($line2 eq "") {
next;
}
push @system, $line2;
}
close SYSTEM;open QUERY, "emerge --nospinner -ep gnome |";
foreach $line (<QUERY>) {
if($line !~ /^\[.+\]/) {
next;
}
$line =~ s/^\[.+\] (.+) /$1/;
chomp $line;
push (@pkgs1, $line);
}
close QUERY;PKG:
foreach $pkg (@pkgs1) {
open QUERY, "qpkg -q -nc $pkg |";
DEP:
foreach $line (<QUERY>) {
$line =~ s/\s+//;
if(($line =~ /\*$/) || ($line =~ /DEPENDED/)) {
next DEP;
}
chomp $line;
foreach $line2 (reverse @pkgs1) {
if($line eq $line2) {
next DEP;
}
if($line2 eq $pkg) {
next PKG;
}
}
next PKG;
}
foreach $line (@world) {
if($pkg =~ /$line/) {
next PKG;
}
}
foreach $line (@system) {
if($pkg =~ /$line/) {
next PKG;
}
}
foreach my $tmp (@pkgs2) {
if($tmp eq $pkg) {
next PKG;
}
}
push @pkgs2, $pkg;
print "$pkg is safe to unmerge\n";
}
-- Andrew Gaffney
-- [EMAIL PROTECTED] mailing list
