Michael Ulm wrote:


At the moment, I am considering the following paths

1) spending several hours checking out the ~amd64 packages I
   emerged, to see if they are available in stable, and which
   dependencies can then be brought back to amd64. As spare
   time is a rather scarce resource for me, I don't want to do
   this unless absolutely necessary

I run a mostly stable x86 system with specific ~x86 specified in
package.keywords.  I hit the same problem you have so wrote the
following perl script to help manage package.keywords.  You will
need to specify your ~arch in the $arch variable.  Place the script
in /etc/portage directory.  Run the script from /etc/portage directory.
Note, I always save a copy of package.keywords before running
the script just to be safe.  Here's how I usually run it:

royw-gentoo portage # pwd
/etc/portage
royw-gentoo portage # ls
check-package-keywords.pl mirrors package.mask package.use sets
find-test-kde              package.keywords  package.unmask  profile
royw-gentoo portage # cp package.keywords package.keywords.save
royw-gentoo portage # ./check-package-keywords.pl >package.keywords.new
royw-gentoo portage # ls
check-package-keywords.pl mirrors package.keywords.new package.mask package.use sets find-test-kde package.keywords package.keywords.save package.unmask profile

Then I examine package.keywords.new. If I like it, then I can simply replace
package.keywords with it.

Here's a sample output:

app-admin/eselect ~x86
app-admin/eselect-opengl ~x86
app-cdr/k3b ~x86
app-crypt/gpgme ~x86
# NOT INSTALLED app-emulation/wine ~x86
app-misc/beagle ~x86
app-office/openoffice ~x86
app-portage/gentoolkit ~x86
# NOT INSTALLED app-portage/kuroo ~x86
# NOT INSTALLED app-text/evince ~x86
app-text/iso-codes ~x86
# STABLE app-text/poppler ~x86
# STABLE app-text/xpdf ~x86
app-vim/eruby-syntax ~x86


HTH,
Roy

------------------------------------------------
#!/usr/bin/perl

# check-package-keywords.pl - this script checks each package in the package.keywords
# file to see if what is installed is stable.

$arch = '~x86';

$packageKeywords = '/etc/portage/package.keywords';
$tmpFilename = "$packageKeywords.tmp";
$debug = 0;

# slurp package.keywords into @packages
open(IN, "<$packageKeywords") || die "Unable to open for reading $packageKeywords\n";
@packages = <IN>;
close(IN);

# temporarily rename package.keywords to package.keywords.tmp
# this is necessary because eix will report packages stable if they are
# set to ~arch in package.keywords
unlink $tmpFilename;
rename $packageKeywords, $tmpFilename;

foreach $line (@packages) {
   # skip comments
   if($line =~ /^\s*\#/) {
       print $line;
       next;
   }
   # only validate ~arch lines
   if($line =~ /^\s*(\S+)\s+\~/) {
       validate($1);
   }
}

# restore package.keywords
rename $tmpFilename, $packageKeywords;

exit 0;

sub validate {
   local ($pkg) = @_;
   local $line;
   local @stable;
   local @unstable;
   local $installed;
   local $outLine;

   # use eix to find stable, testing, and installation states
open(EIX, "eix -Ae $pkg|") || die "Unable to run eix for package $pkg\n";
   while(<EIX>) {
       $line = $_;
       if($line =~ /^\s+Available\s+versions\:/) {
           @stable = ($line =~ m/\s(\d\S+)/g);
           @unstable = ($line =~ m/\s\~(\d\S+)/g);
       }
       elsif($line =~ /^\s+Installed\:/) {
           @installed = ($line =~ m/\s(\d\S+)/g);
       }
   }
   close(EIX);

# generate replacement line which will comment out stable or not installed
   # packages.
   $outLine = "$pkg $arch";
   if($#installed < 0) {
       $outLine = "# NOT INSTALLED $outLine";
   }
   else {
# all installed versions must be stable to declare the package stable
       foreach $inst (@installed) {
           $found = 0;
           foreach $v (@stable) {
               if($v eq $inst) {
                   $found = 1;
                   last;
               }
           }
           if(!$found) {
               last;
           }
       }
       if($found) {
           $outLine = "# STABLE $outLine";
       }
   }
   print "$outLine\n";
   if($debug) {
       print "stable: @stable\n";
       print "testing: @unstable\n";
       print "installed: @installed\n";
       print "\n";
   }
}

--
gentoo-amd64@gentoo.org mailing list

Reply via email to