Gentoo Archives: gentoo-amd64

From: Roy Wright <royw@×××××.com>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] Too much ~amd64 ?
Date: Wed, 18 Jan 2006 18:19:46
Message-Id: 43CE8612.6000605@cisco.com
In Reply to: [gentoo-amd64] Too much ~amd64 ? by Michael Ulm
1 Michael Ulm wrote:
2
3 >
4 > At the moment, I am considering the following paths
5 >
6 > 1) spending several hours checking out the ~amd64 packages I
7 > emerged, to see if they are available in stable, and which
8 > dependencies can then be brought back to amd64. As spare
9 > time is a rather scarce resource for me, I don't want to do
10 > this unless absolutely necessary
11 >
12 I run a mostly stable x86 system with specific ~x86 specified in
13 package.keywords. I hit the same problem you have so wrote the
14 following perl script to help manage package.keywords. You will
15 need to specify your ~arch in the $arch variable. Place the script
16 in /etc/portage directory. Run the script from /etc/portage directory.
17 Note, I always save a copy of package.keywords before running
18 the script just to be safe. Here's how I usually run it:
19
20 royw-gentoo portage # pwd
21 /etc/portage
22 royw-gentoo portage # ls
23 check-package-keywords.pl mirrors package.mask
24 package.use sets
25 find-test-kde package.keywords package.unmask profile
26 royw-gentoo portage # cp package.keywords package.keywords.save
27 royw-gentoo portage # ./check-package-keywords.pl >package.keywords.new
28 royw-gentoo portage # ls
29 check-package-keywords.pl mirrors package.keywords.new
30 package.mask package.use sets
31 find-test-kde package.keywords package.keywords.save
32 package.unmask profile
33
34 Then I examine package.keywords.new. If I like it, then I can simply
35 replace
36 package.keywords with it.
37
38 Here's a sample output:
39
40 app-admin/eselect ~x86
41 app-admin/eselect-opengl ~x86
42 app-cdr/k3b ~x86
43 app-crypt/gpgme ~x86
44 # NOT INSTALLED app-emulation/wine ~x86
45 app-misc/beagle ~x86
46 app-office/openoffice ~x86
47 app-portage/gentoolkit ~x86
48 # NOT INSTALLED app-portage/kuroo ~x86
49 # NOT INSTALLED app-text/evince ~x86
50 app-text/iso-codes ~x86
51 # STABLE app-text/poppler ~x86
52 # STABLE app-text/xpdf ~x86
53 app-vim/eruby-syntax ~x86
54
55
56 HTH,
57 Roy
58
59 ------------------------------------------------
60 #!/usr/bin/perl
61
62 # check-package-keywords.pl - this script checks each package in the
63 package.keywords
64 # file to see if what is installed is stable.
65
66 $arch = '~x86';
67
68 $packageKeywords = '/etc/portage/package.keywords';
69 $tmpFilename = "$packageKeywords.tmp";
70 $debug = 0;
71
72 # slurp package.keywords into @packages
73 open(IN, "<$packageKeywords") || die "Unable to open for reading
74 $packageKeywords\n";
75 @packages = <IN>;
76 close(IN);
77
78 # temporarily rename package.keywords to package.keywords.tmp
79 # this is necessary because eix will report packages stable if they are
80 # set to ~arch in package.keywords
81 unlink $tmpFilename;
82 rename $packageKeywords, $tmpFilename;
83
84 foreach $line (@packages) {
85 # skip comments
86 if($line =~ /^\s*\#/) {
87 print $line;
88 next;
89 }
90 # only validate ~arch lines
91 if($line =~ /^\s*(\S+)\s+\~/) {
92 validate($1);
93 }
94 }
95
96 # restore package.keywords
97 rename $tmpFilename, $packageKeywords;
98
99 exit 0;
100
101 sub validate {
102 local ($pkg) = @_;
103 local $line;
104 local @stable;
105 local @unstable;
106 local $installed;
107 local $outLine;
108
109 # use eix to find stable, testing, and installation states
110 open(EIX, "eix -Ae $pkg|") || die "Unable to run eix for package
111 $pkg\n";
112 while(<EIX>) {
113 $line = $_;
114 if($line =~ /^\s+Available\s+versions\:/) {
115 @stable = ($line =~ m/\s(\d\S+)/g);
116 @unstable = ($line =~ m/\s\~(\d\S+)/g);
117 }
118 elsif($line =~ /^\s+Installed\:/) {
119 @installed = ($line =~ m/\s(\d\S+)/g);
120 }
121 }
122 close(EIX);
123
124 # generate replacement line which will comment out stable or not
125 installed
126 # packages.
127 $outLine = "$pkg $arch";
128 if($#installed < 0) {
129 $outLine = "# NOT INSTALLED $outLine";
130 }
131 else {
132 # all installed versions must be stable to declare the package
133 stable
134 foreach $inst (@installed) {
135 $found = 0;
136 foreach $v (@stable) {
137 if($v eq $inst) {
138 $found = 1;
139 last;
140 }
141 }
142 if(!$found) {
143 last;
144 }
145 }
146 if($found) {
147 $outLine = "# STABLE $outLine";
148 }
149 }
150 print "$outLine\n";
151 if($debug) {
152 print "stable: @stable\n";
153 print "testing: @unstable\n";
154 print "installed: @installed\n";
155 print "\n";
156 }
157 }
158
159 --
160 gentoo-amd64@g.o mailing list