Howdy,

I was wanting to install just kdebase-3.4.0 without unmasking all of kde-3.4.0. The "HOWTO
Update KDE 3.3 to KDE 3.4" (http://www.gentoo-wiki.com/HOWTO_Update_KDE_3.3_to_KDE_3.4)
suggested running emerge kdebase -p, find a package that is blocking, then add that package to
/etc/portage/packages.keywords, and repeat until no more packages are blocking. Tedious. So here's a perl script to do just that. It will work for any package.


Usage:  unmask.pl packageName

-- begin: unmask.pl --------------------------------------------
#!/usr/bin/perl -w

# quick hack to recursively unmask all packages that are blocking the given
# package from emerging.
# usage: unmask.pl packageName

print "unmasking:=$ARGV[0]\n";

&doit;
exit(0);

# doit()
sub doit {
   local $flag = 1;
   local $package = $ARGV[0];

while($flag) {
$flag = 0;
open my $fh, "emerge $package -p|" || die "could not open: emerge $package -p";
while(<$fh>) {
if(/^\-\s+(.*)\-[\d\.]+\s+\(masked by\:\s+(\~\S+)\s+keyword\)/) {
unmask($1, $2);
$flag = 1;
last;
}
}
close($fh);
}
}


# unmask the file by adding it to /etc/portage/package.keywords
sub unmask
{
local($name, $arch) = @_;
print "unmasking: $name\n";
open my $fh, ">>/etc/portage/package.keywords" || die "can't open package.keywords: $!";
print $fh "$name $arch\n";
close $fh;
}
-- end: unmask.pl --------------------------------------------


Have fun,
Roy
--
gentoo-user@gentoo.org mailing list



Reply via email to