Gentoo Archives: gentoo-commits

From: Sven Eden <sven.eden@×××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/ufed:master commit in: /
Date: Fri, 01 Feb 2013 10:49:59
Message-Id: 1359554589.ffc687420a76332329082abab9e787f441910091.yamakuzure@gentoo
1 commit: ffc687420a76332329082abab9e787f441910091
2 Author: Sven Eden <sven.eden <AT> gmx <DOT> de>
3 AuthorDate: Wed Jan 30 14:03:09 2013 +0000
4 Commit: Sven Eden <sven.eden <AT> gmx <DOT> de>
5 CommitDate: Wed Jan 30 14:03:09 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ffc68742
7
8 Removed obsolete passages and changed the output to include the many more details.
9
10 ---
11 ufed.pl.in | 189 ++++++++++++++++++++++--------------------------------------
12 1 files changed, 69 insertions(+), 120 deletions(-)
13
14 diff --git a/ufed.pl.in b/ufed.pl.in
15 index 299c79d..bf09de4 100644
16 --- a/ufed.pl.in
17 +++ b/ufed.pl.in
18 @@ -17,54 +17,14 @@ my $interface = 'ufed-curses';
19 # . " --read-var-info=yes"
20 # . " XX_libexecdir@/ufed-curses 2>/tmp/ufed_memcheck.log";
21
22 -# no longer needed
23 -# my %use_descriptions;
24 -
25 sub finalise;
26 sub flags_dialog;
27 sub save_flags;
28
29 -# deprecated, the functionality is merged into Portage.pm
30 -# delete $Portage::all_flags{'*'};
31 -# read_use_descs;
32 -# @use_descriptions{qw(bootstrap build)};
33 -#
34 -#$Portage::make_conf_flags{'-*'} = 1
35 -# if defined $Portage::make_conf_flags{'*'}
36 -# && !$Portage::make_conf_flags{'*'};
37 -#
38 -#for(keys %Portage::all_flags) {
39 -# @{$use_descriptions{$_}} = "[(Unknown)] g"
40 -# if not exists $use_descriptions{$_};
41 -#}
42 -#@{$use_descriptions{'-*'}} = '[Never enable any flags other than those specified in make.conf] g';
43 -#
44 -#for(@Portage::archs) {
45 -# delete $Portage::default_flags{$_};
46 -# delete $Portage::all_flags{$_};
47 -# delete $use_descriptions{$_};
48 -#}
49 -#for my $flag (keys %Portage::use_masked_flags) {
50 -# my $masked = 1;
51 -# for my $mask (values %{$Portage::use_masked_flags{$flag}}) {
52 -# last if not($masked &&= $mask);
53 -# }
54 -# if($masked) {
55 -# if (defined($use_descriptions{$flag})) {
56 -# for (my $i = 0; $i < scalar @{$use_descriptions{$flag}}; ++$i) {
57 -# $use_descriptions{$flag}->[$i] =~ s/ [lg]$/ m/ ;
58 -# $use_descriptions{$flag}->[$i] =~ s/ L$/ M/ ;
59 -# }
60 -# } else {
61 -# delete $use_descriptions{$flag};
62 -# delete $Portage::default_flags{$flag};
63 -# delete $Portage::all_flags{$flag};
64 -# }
65 -# }
66 -#}
67
68 flags_dialog;
69
70 +
71 # Take a list and return it ordered the following way:
72 # Put "-*" first, followed by enabling flags and put
73 # disabling flags to the end.
74 @@ -112,49 +72,86 @@ sub flags_dialog {
75 # Write out flags
76 for my $flag (sort { uc $a cmp uc $b } keys %$Portage::use_flags) {
77 my $conf = $Portage::use_flags->{$flag}; ## Shortcut
78 - my $state = "g";
79 - $outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
80 +# deprecated: The output is updated to match the new data structure.
81 +# my $state = "g";
82 +#
83 +# $outTxt .= sprintf ("%s %s (%s%s) %d\n", $flag,
84 +# defined($conf->{global}{conf}) ?
85 +# $conf->{global}{conf} > 0 ? 'on' :
86 +# $conf->{global}{conf} < 0 ? 'off' : 'def' : 'def',
87 +# defined($conf->{global}{"default"}) ?
88 +# $conf->{global}{"default"} > 0 ? '+' :
89 +# $conf->{global}{"default"} < 0 ? '-' : ' ' : ' ',
90 +# defined($conf->{global}{conf}) ?
91 +# $conf->{global}{conf} > 0 ? '+' :
92 +# $conf->{global}{conf} < 0 ? '-' : ' ' : ' ',
93 +# $conf->{count});
94 +
95 + $outTxt .= sprintf ("%s [%s%s] %d\n", $flag,
96 defined($conf->{global}{conf}) ?
97 - $conf->{global}{conf} > 0 ? 'on' :
98 - $conf->{global}{conf} < 0 ? 'off' : 'def' : 'def',
99 + $conf->{global}{conf} > 0 ? '+' :
100 + $conf->{global}{conf} < 0 ? '-' : ' ' : ' ',
101 defined($conf->{global}{"default"}) ?
102 $conf->{global}{"default"} > 0 ? '+' :
103 $conf->{global}{"default"} < 0 ? '-' : ' ' : ' ',
104 - defined($conf->{global}{conf}) ?
105 - $conf->{global}{conf} > 0 ? '+' :
106 - $conf->{global}{conf} < 0 ? '-' : ' ' : ' ',
107 $conf->{count});
108
109 - # Print global description first (if available)
110 +# # Print global description first (if available)
111 if (defined($conf->{global}) && length($conf->{global}{descr})) {
112 - if ($conf->{global}{installed}) {
113 - $conf->{global}{masked} and $state = "M";
114 - $conf->{global}{masked} or $state = "G";
115 - } else {
116 - $conf->{global}{masked} and $state = "m";
117 - }
118 - $outTxt .= "[" . $conf->{global}{descr} . "] $state\n";
119 -
120 - # Then print the list of affected packages that have no own entry
121 +# deprecated: The output is updated to match the new data structure.
122 +# if ($conf->{global}{installed}) {
123 +# $conf->{global}{masked} and $state = "M";
124 +# $conf->{global}{masked} or $state = "G";
125 +# } else {
126 +# $conf->{global}{masked} and $state = "m";
127 +# }
128 +# $outTxt .= "[" . $conf->{global}{descr} . "] $state\n";
129 +# * @param[in] state '+','-',' ' for global, installed, forced, masked, package - in that order.
130 + $outTxt .= sprintf("\t%s\t ( ) [+%s%s%s ]\n",
131 + $conf->{global}{descr},
132 + $conf->{global}{installed} ? '+' : ' ',
133 + $conf->{global}{forced} ? '+' : ' ',
134 + $conf->{global}{masked} ? '+' : ' ');
135 +
136 +# deprecated: The output is updated to match the new data structure.
137 +# # Then print the list of affected packages that have no own entry
138 +# for my $afLst (@{$conf->{global}{affected}}) {
139 +# (defined($afLst) && length($afLst))
140 +# and $outTxt .= "($afLst) [Affected by global flag setting] $state\n";
141 +# }
142 for my $afLst (@{$conf->{global}{affected}}) {
143 (defined($afLst) && length($afLst))
144 - and $outTxt .= "($afLst) [Affected by global flag setting] $state\n";
145 + and $outTxt .= sprintf("\t%s\t (%s) [+ ]\n",
146 + "Affected by global flag setting",
147 + $afLst);
148 }
149 }
150 -
151 +
152 # Finally print the local description lines
153 for my $pkg (sort keys %{$conf->{"local"}}) {
154 - $state = "l";
155 - if ($conf->{"local"}{$pkg}{installed}) {
156 - $state = "L";
157 - if ($conf->{global}{masked}) {
158 - $conf->{"local"}{$pkg}{masked} > -1 and $state = "M";
159 - $conf->{"local"}{$pkg}{masked} < 0 and $state = "L";
160 - }
161 - } elsif ($conf->{global}{masked}) {
162 - $conf->{"local"}{$pkg}{masked} > -1 and $state = "m";
163 - }
164 - $outTxt .= sprintf("(%s) [%s] %s\n", $pkg, $conf->{"local"}{$pkg}{descr}, $state);
165 +# deprecated: The output is updated to match the new data structure.
166 +# $state = "l";
167 +# if ($conf->{"local"}{$pkg}{installed}) {
168 +# $state = "L";
169 +# if ($conf->{global}{masked}) {
170 +# $conf->{"local"}{$pkg}{masked} > -1 and $state = "M";
171 +# $conf->{"local"}{$pkg}{masked} < 0 and $state = "L";
172 +# }
173 +# } elsif ($conf->{global}{masked}) {
174 +# $conf->{"local"}{$pkg}{masked} > -1 and $state = "m";
175 +# }
176 +# $outTxt .= sprintf("(%s) [%s] %s\n", $pkg, $conf->{"local"}{$pkg}{descr}, $state);
177 + $outTxt .= sprintf("\t%s\t (%s) [ %s%s%s%s]\n",
178 + $conf->{"local"}{$pkg}{descr},
179 + $pkg,
180 + $conf->{"local"}{$pkg}{installed} > 0 ? '+' :
181 + $conf->{"local"}{$pkg}{installed} < 0 ? '-' : ' ',
182 + $conf->{"local"}{$pkg}{forced} > 0 ? '+' :
183 + $conf->{"local"}{$pkg}{forced} < 0 ? '-' : ' ',
184 + $conf->{"local"}{$pkg}{masked} > 0 ? '+' :
185 + $conf->{"local"}{$pkg}{masked} < 0 ? '-' : ' ',
186 + $conf->{"local"}{$pkg}{"package"} > 0 ? '+' :
187 + $conf->{"local"}{$pkg}{"package"} < 0 ? '-' : ' ');
188 }
189 }
190
191 @@ -162,7 +159,7 @@ sub flags_dialog {
192 # use descriptions. They cause problems unless the whole
193 # interface is changed to use wchar. Substitute with ISO:
194 $outTxt =~ tr/\x{2014}\x{201c}\x{201d}/\x2d\x22\x22/ ;
195 -
196 +
197 # Now let the interface know of the result
198 if (open my $fh, '>&=', $iwrite) {
199 binmode( $fh, ":encoding(ISO-8859-1)" );
200 @@ -190,54 +187,6 @@ sub flags_dialog {
201 return;
202 }
203
204 -# Deprecated, the funcionality is merged into Portage.pm.
205 -#
206 -## Build the global %use_descriptions hash.
207 -## Parsed files are:
208 -## 1. PORTDIR/profiles/use.desc
209 -## 2. PORTDIR/profiles/use.local.desc
210 -## No parameters accepted.
211 -## @todo : The local descriptions must be written in a different
212 -## way (how?) to allow the wanted filtering/distinction
213 -## between global/local flags.
214 -#sub read_use_descs {
215 -# my %_use_descriptions;
216 -# for my $dir(@Portage::portagedirs) {
217 -# for(Portage::noncomments "$dir/profiles/use.desc") {
218 -# my ($flag, $desc) = /^(.*?)\s+-\s+(.*)$/ or next;
219 -# $_use_descriptions{$flag}{$desc} = 1;
220 -# }
221 -# }
222 -# my %_use_local_descriptions;
223 -# for my $dir(@Portage::portagedirs) {
224 -# for(Portage::noncomments "$dir/profiles/use.local.desc") {
225 -# my ($pkg, $flag, $desc) = /^(.*?):(.*?)\s+-\s+(.*)$/ or next;
226 -# $_use_local_descriptions{$flag}{$desc}{$pkg} = 1;
227 -# }
228 -# }
229 -# # Record all global flags first, their description is printed first
230 -# # in the ncurses interface as well.
231 -# for my $key (sort keys %_use_descriptions) {
232 -# for my $desc (sort keys %{$_use_descriptions{$key}}) {
233 -# push @{$use_descriptions{$key}}, "[" . $desc . "] g";
234 -# }
235 -# }
236 -#
237 -# # Add local flags
238 -# for my $key (sort keys %_use_local_descriptions) {
239 -# for my $desc (sort keys %{$_use_local_descriptions{$key}}) {
240 -# my $flagPrefix = "l";
241 -# my @pkgs = ();
242 -# for my $pkg (sort keys %{$_use_local_descriptions{$key}{$desc}}) {
243 -# $flagPrefix = "L" if (Portage::have_package($pkg));
244 -# push @pkgs, $pkg;
245 -# }
246 -# local $"=", ";
247 -# push @{$use_descriptions{$key}}, sprintf("(%s) [%s] %s", "@pkgs", $desc, $flagPrefix);
248 -# }
249 -# }
250 -# return;
251 -#}
252
253 # Write given list of flags back to make.conf if
254 # the file has not been changed since reading it.