1 |
vapier 08/06/01 12:10:41 |
2 |
|
3 |
Added: 001_all_coreutils-gen-progress-bar.patch |
4 |
003_all_coreutils-gentoo-uname.patch |
5 |
004_all_coreutils-acl-xattr.patch |
6 |
030_all_coreutils-more-dir-colors.patch |
7 |
README.history |
8 |
Log: |
9 |
initial 6.12 patchset based on last 6.11 patchset |
10 |
|
11 |
Revision Changes Path |
12 |
1.1 src/patchsets/coreutils/6.12/001_all_coreutils-gen-progress-bar.patch |
13 |
|
14 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/001_all_coreutils-gen-progress-bar.patch?rev=1.1&view=markup |
15 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/001_all_coreutils-gen-progress-bar.patch?rev=1.1&content-type=text/plain |
16 |
|
17 |
Index: 001_all_coreutils-gen-progress-bar.patch |
18 |
=================================================================== |
19 |
Upstream has been contacted about this a few times ... |
20 |
|
21 |
they dont want progress bars in mv/cp: |
22 |
http://lists.gnu.org/archive/html/bug-coreutils/2003-08/msg00114.html |
23 |
http://lists.gnu.org/archive/html/bug-coreutils/2003-09/msg00083.html |
24 |
http://lists.gnu.org/archive/html/bug-coreutils/2003-09/msg00084.html |
25 |
|
26 |
but they don't seem to mind a general util ... add this to future patchset: |
27 |
http://lists.gnu.org/archive/html/bug-coreutils/2003-09/msg00101.html |
28 |
http://lists.gnu.org/archive/html/bug-coreutils/2004-02/msg00071.html |
29 |
|
30 |
--- coreutils/src/copy.c |
31 |
+++ coreutils/src/copy.c |
32 |
@@ -17,6 +17,8 @@ |
33 |
|
34 |
/* Extracted from cp.c and librarified by Jim Meyering. */ |
35 |
|
36 |
+/* Progress bar support added by Miika Pekkarinen. miipekk@××××.org */ |
37 |
+ |
38 |
#include <config.h> |
39 |
#include <stdio.h> |
40 |
#include <assert.h> |
41 |
@@ -29,6 +31,10 @@ |
42 |
# include <priv.h> |
43 |
#endif |
44 |
|
45 |
+#ifdef GWINSZ_IN_SYS_IOCTL |
46 |
+# include <sys/ioctl.h> |
47 |
+#endif |
48 |
+ |
49 |
#include "system.h" |
50 |
#include "acl.h" |
51 |
#include "backupfile.h" |
52 |
@@ -50,6 +56,9 @@ |
53 |
#include "utimens.h" |
54 |
#include "xreadlink.h" |
55 |
#include "yesno.h" |
56 |
+#include "xstrtol.h" |
57 |
+#include "human.h" |
58 |
+#include "quotearg.h" |
59 |
|
60 |
#ifndef HAVE_FCHOWN |
61 |
# define HAVE_FCHOWN false |
62 |
@@ -85,6 +92,8 @@ struct F_triple |
63 |
/* Initial size of the above hash table. */ |
64 |
#define DEST_INFO_INITIAL_CAPACITY 61 |
65 |
|
66 |
+#define SAMPLE_MAX 10 |
67 |
+ |
68 |
static bool copy_internal (char const *src_name, char const *dst_name, |
69 |
bool new_dst, dev_t device, |
70 |
struct dir_list *ancestors, |
71 |
@@ -191,6 +200,31 @@ copy_dir (char const *src_name_in, char |
72 |
#endif |
73 |
} |
74 |
|
75 |
+/* Shorten a string '/long path/long file' to 'long fi...' |
76 |
+ Also adds padding bytes to end of the string if necessary */ |
77 |
+char *shorten_name(const char *str, size_t max_width) |
78 |
+{ |
79 |
+ char *shortname; |
80 |
+ const char *filename; |
81 |
+ size_t len; |
82 |
+ |
83 |
+ filename = base_name (str); |
84 |
+ len = strlen(filename); |
85 |
+ shortname = (char *) xmalloc (max_width + 1); |
86 |
+ strncpy (shortname, filename, max_width); |
87 |
+ shortname[max_width] = '\0'; |
88 |
+ if (len > max_width) |
89 |
+ { |
90 |
+ memset(shortname + max_width - 3, '.', 3); |
91 |
+ } |
92 |
+ else |
93 |
+ { |
94 |
+ memset(shortname + len, ' ', max_width - len); |
95 |
+ } |
96 |
+ |
97 |
+ return shortname; |
98 |
+} |
99 |
+ |
100 |
/* Copy a regular file from SRC_NAME to DST_NAME. |
101 |
If the source file contains holes, copies holes and blocks of zeros |
102 |
in the source file as holes in the destination file. |
103 |
@@ -222,6 +287,19 @@ copy_reg (char const *src_name, char con |
104 |
struct stat sb; |
105 |
struct stat src_open_sb; |
106 |
bool return_val = true; |
107 |
+ time_t t_start; |
108 |
+ time_t t_last; |
109 |
+ time_t t_now; |
110 |
+ off_t last_bytes = 0; |
111 |
+ int progress_bar_printed = 0; |
112 |
+ char *shortname = NULL; |
113 |
+ off_t sample_window[SAMPLE_MAX]; |
114 |
+ off_t sample_sum = 0; |
115 |
+ int sample_count = 0; |
116 |
+ long int line_length = 0; |
117 |
+#ifdef TIOCGWINSZ |
118 |
+ struct winsize ws; |
119 |
+#endif |
120 |
|
121 |
source_desc = open (src_name, O_RDONLY | O_BINARY); |
122 |
if (source_desc < 0) |
123 |
@@ -326,6 +404,9 @@ copy_reg (char const *src_name, char con |
124 |
buf_alloc = xmalloc (buf_size + buf_alignment_slop); |
125 |
buf = ptr_align (buf_alloc, buf_alignment); |
126 |
|
127 |
+ time (&t_start); |
128 |
+ t_last = t_start; |
129 |
+ |
130 |
for (;;) |
131 |
{ |
132 |
word *wp = NULL; |
133 |
@@ -390,6 +471,110 @@ copy_reg (char const *src_name, char con |
134 |
if (n_read != buf_size && S_ISREG (src_open_sb.st_mode)) |
135 |
break; |
136 |
} |
137 |
+ |
138 |
+ time (&t_now); |
139 |
+ |
140 |
+ /* Progress bar stuff */ |
141 |
+ if (! x->pbar_show || t_now - t_start < x->pbar_delay) |
142 |
+ { |
143 |
+ continue; |
144 |
+ } |
145 |
+ |
146 |
+ if (! progress_bar_printed) |
147 |
+ { |
148 |
+ /* Column width check code copied from ls.c */ |
149 |
+ char const *p = getenv ("COLUMNS"); |
150 |
+ if (p && *p) |
151 |
+ { |
152 |
+ long int tmp_long; |
153 |
+ if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK |
154 |
+ && 0 < tmp_long && tmp_long <= INT_MAX) |
155 |
+ { |
156 |
+ line_length = tmp_long; |
157 |
+ } |
158 |
+ else |
159 |
+ { |
160 |
+ error (0, 0, |
161 |
+ _("ignoring invalid width in environment \ |
162 |
+ variable COLUMNS: %s"), |
163 |
+ quotearg (p)); |
164 |
+ } |
165 |
+ } |
166 |
+ |
167 |
+#ifdef TIOCGWINSZ |
168 |
+ if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &ws) != -1 && ws.ws_col != 0) |
169 |
+ { |
170 |
+ line_length = ws.ws_col; |
171 |
+ } |
172 |
+#endif |
173 |
+ if (line_length < 50) |
174 |
+ { |
175 |
+ continue; |
176 |
+ } |
177 |
+ |
178 |
+ /* Take a short filename for progress bar */ |
179 |
+ shortname = shorten_name(src_name, line_length - 48); |
180 |
+ progress_bar_printed = 1; |
181 |
+ } |
182 |
+ |
183 |
+ if (t_now == t_last) |
184 |
+ { |
185 |
+ continue; |
186 |
+ } |
187 |
+ |
188 |
+ if (sample_count == SAMPLE_MAX) |
189 |
+ { |
190 |
+ int i; |
191 |
+ |
192 |
+ sample_sum -= sample_window[0]; |
193 |
+ for (i = 0; i < SAMPLE_MAX - 1; i++) |
194 |
+ { |
195 |
+ sample_window[i] = sample_window[i + 1]; |
196 |
+ } |
197 |
+ } |
198 |
+ else |
199 |
+ { |
200 |
+ sample_count++; |
201 |
+ } |
202 |
+ |
203 |
+ { |
204 |
+ char str_size[LONGEST_HUMAN_READABLE + 1]; |
205 |
+ char str_speed[LONGEST_HUMAN_READABLE + 1]; |
206 |
+ char etabuf[64]; |
207 |
+ time_t t_temp; |
208 |
+ |
209 |
+ sample_window[sample_count - 1] = (n_read_total - last_bytes) / |
210 |
+ (t_now - t_last); |
211 |
+ sample_sum += sample_window[sample_count - 1]; |
212 |
+ |
213 |
+ /* Calculate the remaining time */ |
214 |
+ t_temp = (src_open_sb.st_size - n_read_total) / (sample_sum / sample_count); |
215 |
+ |
216 |
+ /* Don't print the progress bar if the estimated remaining |
217 |
+ time is low. */ |
218 |
+ if (progress_bar_printed == 1 && t_temp < x->pbar_min_est) |
219 |
+ { |
220 |
+ continue; |
221 |
+ } |
222 |
+ progress_bar_printed = 2; |
223 |
+ |
224 |
+ strftime(etabuf, sizeof etabuf, "%H:%M.%S", |
225 |
+ gmtime(&t_temp)); |
226 |
+ printf (_("%s | %3lu%% | %9s | %9s/s | ETA %s\r"), shortname, |
227 |
+ (unsigned long)(n_read_total * 100 / src_open_sb.st_size), |
228 |
+ human_readable(src_open_sb.st_size, str_size, human_autoscale|human_base_1024|human_space_before_unit|human_SI|human_B, 1, 1), |
229 |
+ human_readable(sample_sum / sample_count, str_speed, human_autoscale|human_base_1024|human_space_before_unit|human_SI|human_B, 1, 1), |
230 |
+ etabuf); |
231 |
+ fflush (stdout); |
232 |
+ t_last = t_now; |
233 |
+ last_bytes = n_read_total; |
234 |
+ } |
235 |
+ } |
236 |
+ |
237 |
+ /* Print a newline if progress bar is enabled and has been shown */ |
238 |
+ if (progress_bar_printed == 2) |
239 |
+ { |
240 |
+ printf ("%s | 100%%\n", shortname); |
241 |
} |
242 |
|
243 |
/* If the file ends with a `hole', we need to do something to record |
244 |
@@ -488,6 +676,11 @@ close_src_desc: |
245 |
return_val = false; |
246 |
} |
247 |
|
248 |
+ if (shortname != NULL) |
249 |
+ { |
250 |
+ free (shortname); |
251 |
+ } |
252 |
+ |
253 |
free (buf_alloc); |
254 |
return return_val; |
255 |
} |
256 |
--- coreutils/src/copy.h |
257 |
+++ coreutils/src/copy.h |
258 |
@@ -175,6 +175,16 @@ struct cp_options |
259 |
/* If true, display the names of the files before copying them. */ |
260 |
bool verbose; |
261 |
|
262 |
+ /* If true, display a progress bar when the following conditions are |
263 |
+ * met: |
264 |
+ - pbar_delay defines how many seconds to wait before considering to |
265 |
+ display the progress bar |
266 |
+ - pbar_min_est defines how many seconds estimated operation complete |
267 |
+ time should be at least to show the progress bar. */ |
268 |
+ bool pbar_show; |
269 |
+ int pbar_delay; |
270 |
+ int pbar_min_est; |
271 |
+ |
272 |
/* If true, stdin is a tty. */ |
273 |
bool stdin_tty; |
274 |
|
275 |
--- coreutils/src/cp.c |
276 |
+++ coreutils/src/cp.c |
277 |
@@ -81,6 +81,14 @@ enum |
278 |
/* Initial number of entries in the inode hash table. */ |
279 |
#define INITIAL_ENTRY_TAB_SIZE 70 |
280 |
|
281 |
+/* Initial settings for progress bar when it's enabled. |
282 |
+ PROGRESS_DELAY defines how many seconds to wait before even |
283 |
+ considering to display a proggress bar. |
284 |
+ PROGRESS_MIN_EST defines how many seconds estimated operation |
285 |
+ complete time should be at least to show the progress bar. */ |
286 |
+#define PROGRESS_DELAY 5 |
287 |
+#define PROGRESS_MIN_EST 5 |
288 |
+ |
289 |
/* The invocation name of this program. */ |
290 |
char *program_name; |
291 |
|
292 |
@@ -120,6 +128,7 @@ static struct option const long_opts[] = |
293 |
{"copy-contents", no_argument, NULL, COPY_CONTENTS_OPTION}, |
294 |
{"dereference", no_argument, NULL, 'L'}, |
295 |
{"force", no_argument, NULL, 'f'}, |
296 |
+ {"progress", no_argument, NULL, 'g'}, |
297 |
{"interactive", no_argument, NULL, 'i'}, |
298 |
{"link", no_argument, NULL, 'l'}, |
299 |
{"no-dereference", no_argument, NULL, 'P'}, |
300 |
@@ -176,6 +185,8 @@ Mandatory arguments to long options are |
301 |
fputs (_("\ |
302 |
-f, --force if an existing destination file cannot be\n\ |
303 |
opened, remove it and try again\n\ |
304 |
+ -g, --progress show a progress bar if operation is going to\n\ |
305 |
+ take a long time\n\ |
306 |
-i, --interactive prompt before overwrite\n\ |
307 |
-H follow command-line symbolic links\n\ |
308 |
"), stdout); |
309 |
@@ -705,6 +716,11 @@ cp_option_init (struct cp_options *x) |
310 |
|
311 |
x->update = false; |
312 |
x->verbose = false; |
313 |
+ |
314 |
+ x->pbar_show = false; |
315 |
+ x->pbar_delay = PROGRESS_DELAY; |
316 |
+ x->pbar_min_est = PROGRESS_MIN_EST; |
317 |
+ |
318 |
x->dest_info = NULL; |
319 |
x->src_info = NULL; |
320 |
} |
321 |
@@ -811,7 +827,7 @@ main (int argc, char **argv) |
322 |
we'll actually use backup_suffix_string. */ |
323 |
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); |
324 |
|
325 |
- while ((c = getopt_long (argc, argv, "abdfHilLprst:uvxPRS:T", |
326 |
+ while ((c = getopt_long (argc, argv, "abdfgHilLprst:uvxPRS:T", |
327 |
long_opts, NULL)) |
328 |
!= -1) |
329 |
{ |
330 |
@@ -871,6 +887,10 @@ main (int argc, char **argv) |
331 |
x.dereference = DEREF_NEVER; |
332 |
break; |
333 |
|
334 |
+ case 'g': |
335 |
+ x.pbar_show = true; |
336 |
+ break; |
337 |
+ |
338 |
case NO_PRESERVE_ATTRIBUTES_OPTION: |
339 |
decode_preserve_arg (optarg, &x, false); |
340 |
break; |
341 |
--- coreutils/src/mv.c |
342 |
+++ coreutils/src/mv.c |
343 |
@@ -45,6 +45,14 @@ |
344 |
/* Initial number of entries in the inode hash table. */ |
345 |
#define INITIAL_ENTRY_TAB_SIZE 70 |
346 |
|
347 |
+/* Initial settings for progress bar when it's enabled. |
348 |
+ PROGRESS_DELAY defines how many seconds to wait before even |
349 |
+ considering to display a proggress bar. |
350 |
+ PROGRESS_MIN_EST defines how many seconds estimated operation |
351 |
+ complete time should be at least to show the progress bar. */ |
352 |
+#define PROGRESS_DELAY 5 |
353 |
+#define PROGRESS_MIN_EST 5 |
354 |
+ |
355 |
/* For long options that have no equivalent short option, use a |
356 |
non-character as a pseudo short option, starting with CHAR_MAX + 1. */ |
357 |
enum |
358 |
@@ -75,6 +83,7 @@ static struct option const long_options[ |
359 |
{ |
360 |
{"backup", optional_argument, NULL, 'b'}, |
361 |
{"force", no_argument, NULL, 'f'}, |
362 |
+ {"progress", no_argument, NULL, 'g'}, |
363 |
{"interactive", no_argument, NULL, 'i'}, |
364 |
{"no-target-directory", no_argument, NULL, 'T'}, |
365 |
{"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03, |
366 |
@@ -104,6 +113,10 @@ rm_option_init (struct rm_options *x) |
367 |
|
368 |
x->verbose = false; |
369 |
|
370 |
+ x->pbar_show = false; |
371 |
+ x->pbar_delay = PROGRESS_DELAY; |
372 |
+ x->pbar_min_est = PROGRESS_MIN_EST; |
373 |
+ |
374 |
/* Since this program may well have to process additional command |
375 |
line arguments after any call to `rm', that function must preserve |
376 |
the initial working directory, in case one of those is a |
377 |
@@ -145,6 +158,10 @@ |
378 |
x->set_mode = false; |
379 |
x->mode = 0; |
380 |
x->stdin_tty = isatty (STDIN_FILENO); |
381 |
+ |
382 |
+ x->pbar_show = false; |
383 |
+ x->pbar_delay = PROGRESS_DELAY; |
384 |
+ x->pbar_min_est = PROGRESS_MIN_EST; |
385 |
|
386 |
x->verbose = false; |
387 |
x->dest_info = NULL; |
388 |
@@ -312,6 +325,8 @@ Mandatory arguments to long options are |
389 |
--backup[=CONTROL] make a backup of each existing destination file\n\ |
390 |
-b like --backup but does not accept an argument\n\ |
391 |
-f, --force do not prompt before overwriting\n\ |
392 |
+ -g, --progress show a progress bar if operation is going to\n\ |
393 |
+ take a long time\n\ |
394 |
-i, --interactive prompt before overwrite\n\ |
395 |
"), stdout); |
396 |
fputs (_("\ |
397 |
@@ -375,7 +393,7 @@ main (int argc, char **argv) |
398 |
we'll actually use backup_suffix_string. */ |
399 |
backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); |
400 |
|
401 |
- while ((c = getopt_long (argc, argv, "bfit:uvS:T", long_options, NULL)) |
402 |
+ while ((c = getopt_long (argc, argv, "bfgit:uvS:T", long_options, NULL)) |
403 |
!= -1) |
404 |
{ |
405 |
switch (c) |
406 |
@@ -388,6 +406,9 @@ main (int argc, char **argv) |
407 |
case 'f': |
408 |
x.interactive = I_ALWAYS_YES; |
409 |
break; |
410 |
+ case 'g': |
411 |
+ x.pbar_show = true; |
412 |
+ break; |
413 |
case 'i': |
414 |
x.interactive = I_ASK_USER; |
415 |
break; |
416 |
--- coreutils/src/remove.h |
417 |
+++ coreutils/src/remove.h |
418 |
@@ -48,6 +48,16 @@ struct rm_options |
419 |
/* If true, display the name of each file removed. */ |
420 |
bool verbose; |
421 |
|
422 |
+ /* If true, display a progress bar when the following conditions are |
423 |
+ * met: |
424 |
+ - pbar_delay defines how many seconds to wait before considering to |
425 |
+ display the progress bar |
426 |
+ - pbar_min_est defines how many seconds estimated operation complete |
427 |
+ time should be at least to show the progress bar. */ |
428 |
+ bool pbar_show; |
429 |
+ int pbar_delay; |
430 |
+ int pbar_min_est; |
431 |
+ |
432 |
/* If true, treat the failure by the rm function to restore the |
433 |
current working directory as a fatal error. I.e., if this field |
434 |
is true and the rm function cannot restore cwd, it must exit with |
435 |
|
436 |
|
437 |
|
438 |
1.1 src/patchsets/coreutils/6.12/003_all_coreutils-gentoo-uname.patch |
439 |
|
440 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/003_all_coreutils-gentoo-uname.patch?rev=1.1&view=markup |
441 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/003_all_coreutils-gentoo-uname.patch?rev=1.1&content-type=text/plain |
442 |
|
443 |
Index: 003_all_coreutils-gentoo-uname.patch |
444 |
=================================================================== |
445 |
On linux platforms, grok /proc/cpuinfo for the CPU/vendor info. |
446 |
|
447 |
Prob not suitable for upstream seeing as how it's 100% linux-specific |
448 |
http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html |
449 |
|
450 |
Patch originally by Carlos E. Gorges <carlos@×××××××××××××.br>, but |
451 |
heavily reworked to suck less. |
452 |
|
453 |
To add support for additional platforms, check out the show_cpuinfo() |
454 |
func in the linux/arch/<ARCH>/ source tree of the kernel. |
455 |
|
456 |
--- coreutils/src/uname.c |
457 |
+++ coreutils/src/uname.c |
458 |
@@ -51,6 +51,11 @@ |
459 |
# include <mach-o/arch.h> |
460 |
#endif |
461 |
|
462 |
+#if defined (__linux__) |
463 |
+# define USE_PROCINFO |
464 |
+# define UNAME_HARDWARE_PLATFORM |
465 |
+#endif |
466 |
+ |
467 |
#include "system.h" |
468 |
#include "error.h" |
469 |
#include "quote.h" |
470 |
@@ -138,6 +143,117 @@ |
471 |
exit (status); |
472 |
} |
473 |
|
474 |
+#if defined(USE_PROCINFO) |
475 |
+ |
476 |
+# if defined(__s390__) || defined(__s390x__) |
477 |
+# define CPUINFO_FILE "/proc/sysinfo" |
478 |
+# define CPUINFO_FORMAT "%64[^\t :]%*[ :]%256[^\n]%c" |
479 |
+# else |
480 |
+# define CPUINFO_FILE "/proc/cpuinfo" |
481 |
+# define CPUINFO_FORMAT "%64[^\t:]\t:%256[^\n]%c" |
482 |
+# endif |
483 |
+ |
484 |
+# define PROCINFO_PROCESSOR 0 |
485 |
+# define PROCINFO_HARDWARE_PLATFORM 1 |
486 |
+ |
487 |
+static void __eat_cpuinfo_space(char *buf) |
488 |
+{ |
489 |
+ /* first eat trailing space */ |
490 |
+ char *tmp = buf + strlen(buf) - 1; |
491 |
+ while (tmp > buf && isspace(*tmp)) |
492 |
+ *tmp-- = '\0'; |
493 |
+ /* then eat leading space */ |
494 |
+ tmp = buf; |
495 |
+ while (*tmp && isspace(*tmp)) |
496 |
+ tmp++; |
497 |
+ if (tmp != buf) |
498 |
+ memmove(buf, tmp, strlen(tmp)+1); |
499 |
+ /* finally collapse whitespace */ |
500 |
+ tmp = buf; |
501 |
+ while (tmp[0] && tmp[1]) { |
502 |
+ if (isspace(tmp[0]) && isspace(tmp[1])) { |
503 |
+ memmove(tmp, tmp+1, strlen(tmp)); |
504 |
+ continue; |
505 |
+ } |
506 |
+ ++tmp; |
507 |
+ } |
508 |
+} |
509 |
+ |
510 |
+static int __linux_procinfo (int x, char *fstr, size_t s) |
511 |
+{ |
512 |
+ FILE *fp; |
513 |
+ |
514 |
+ char *procinfo_keys[] = { |
515 |
+ /* --processor --hardware-platform */ |
516 |
+ #if defined(__alpha__) |
517 |
+ "cpu model", "system type" |
518 |
+ #elif defined(__arm__) |
519 |
+ "Processor", "Hardware" |
520 |
+ #elif defined(__avr32__) |
521 |
+ "processor", "cpu family" |
522 |
+ #elif defined(__bfin__) |
523 |
+ "CPU", "BOARD Name" |
524 |
+ #elif defined(__cris__) |
525 |
+ "cpu", "cpu model" |
526 |
+ #elif defined(__frv__) |
527 |
+ "CPU-Core", "System" |
528 |
+ #elif defined(__i386__) || defined(__x86_64__) |
529 |
+ "model name", "vendor_id" |
530 |
+ #elif defined(__ia64__) |
531 |
+ "family", "vendor" |
532 |
+ #elif defined(__hppa__) |
533 |
+ "cpu", "model" |
534 |
+ #elif defined(__m68k__) |
535 |
+ "CPU", "MMU" |
536 |
+ #elif defined(__mips__) |
537 |
+ "cpu model", "system type" |
538 |
+ #elif defined(__powerpc__) || defined(__powerpc64__) |
539 |
+ "cpu", "machine" |
540 |
+ #elif defined(__s390__) || defined(__s390x__) |
541 |
+ "Type", "Manufacturer" |
542 |
+ #elif defined(__sh__) |
543 |
+ "cpu type", "machine" |
544 |
+ #elif defined(sparc) || defined(__sparc__) |
545 |
+ "type", "cpu" |
546 |
+ #elif defined(__vax__) |
547 |
+ "cpu type", "cpu" |
548 |
+ #else |
549 |
+ "unknown", "unknown" |
550 |
+ #endif |
551 |
+ }; |
552 |
+ |
553 |
+ if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) { |
554 |
+ char key[65], value[257], eol, *ret = NULL; |
555 |
+ |
556 |
+ while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) { |
557 |
+ __eat_cpuinfo_space(key); |
558 |
+ if (!strcmp(key, procinfo_keys[x])) { |
559 |
+ __eat_cpuinfo_space(value); |
560 |
+ ret = value; |
561 |
+ break; |
562 |
+ } |
563 |
+ if (eol != '\n') { |
564 |
+ /* we need two fscanf's here in case the previous |
565 |
+ * length limit caused us to read right up to the |
566 |
+ * newline ... doing "%*[^\n]\n" wont eat the newline |
567 |
+ */ |
568 |
+ fscanf(fp, "%*[^\n]"); |
569 |
+ fscanf(fp, "\n"); |
570 |
+ } |
571 |
+ } |
572 |
+ fclose(fp); |
573 |
+ |
574 |
+ if (ret) { |
575 |
+ strncpy(fstr, ret, s); |
576 |
+ return 0; |
577 |
+ } |
578 |
+ } |
579 |
+ |
580 |
+ return -1; |
581 |
+} |
582 |
+ |
583 |
+#endif |
584 |
+ |
585 |
/* Print ELEMENT, preceded by a space if something has already been |
586 |
printed. */ |
587 |
|
588 |
@@ -250,10 +344,14 @@ main (int argc, char **argv) |
589 |
if (toprint & PRINT_PROCESSOR) |
590 |
{ |
591 |
char const *element = unknown; |
592 |
-#if HAVE_SYSINFO && defined SI_ARCHITECTURE |
593 |
+#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO) |
594 |
{ |
595 |
static char processor[257]; |
596 |
+#if defined(USE_PROCINFO) |
597 |
+ if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor)) |
598 |
+#else |
599 |
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) |
600 |
+#endif |
601 |
element = processor; |
602 |
} |
603 |
#endif |
604 |
@@ -306,9 +404,13 @@ main (int argc, char **argv) |
605 |
if (element == unknown) |
606 |
{ |
607 |
static char hardware_platform[257]; |
608 |
+#if defined(USE_PROCINFO) |
609 |
+ if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform)) |
610 |
+#else |
611 |
size_t s = sizeof hardware_platform; |
612 |
static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM }; |
613 |
if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0) |
614 |
+#endif |
615 |
element = hardware_platform; |
616 |
} |
617 |
#endif |
618 |
|
619 |
|
620 |
|
621 |
1.1 src/patchsets/coreutils/6.12/004_all_coreutils-acl-xattr.patch |
622 |
|
623 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/004_all_coreutils-acl-xattr.patch?rev=1.1&view=markup |
624 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/004_all_coreutils-acl-xattr.patch?rev=1.1&content-type=text/plain |
625 |
|
626 |
Index: 004_all_coreutils-acl-xattr.patch |
627 |
=================================================================== |
628 |
--- coreutils-6.9/configure.ac |
629 |
+++ coreutils-6.9/configure.ac |
630 |
@@ -249,6 +249,9 @@ |
631 |
|
632 |
cu_LIB_CHECK |
633 |
|
634 |
+# Extended attribute copying. |
635 |
+AC_FUNC_XATTR |
636 |
+ |
637 |
AM_GNU_GETTEXT([external], [need-formatstring-macros]) |
638 |
AM_GNU_GETTEXT_VERSION([0.15]) |
639 |
|
640 |
--- coreutils-6.9/doc/coreutils.texi |
641 |
+++ coreutils-6.9/doc/coreutils.texi |
642 |
@@ -6909,6 +6909,18 @@ |
643 |
directory in a different order). |
644 |
Equivalent to @option{-dpPR}. |
645 |
|
646 |
+@itemx @w{@kbd{--attributes}=@var{regex}} |
647 |
+@opindex --attributes |
648 |
+Preserve extended attributes whose names match the specified regular |
649 |
+expression. The default behavior or @command{cp} if no |
650 |
+@option{--attributes} option is given is to preserve all extended |
651 |
+attributes except file permissions. If @var{regex} is ``@samp{-}'', no |
652 |
+extended attributes are preserved. |
653 |
+ |
654 |
+This option does not affect the preservation of file permissions. |
655 |
+File permission preservation is controlled by the @option{-p} or |
656 |
+@option{--preserve=mode} options. |
657 |
+ |
658 |
@item -b |
659 |
@itemx @w{@kbd{--backup}[=@var{method}]} |
660 |
@opindex -b |
661 |
--- coreutils-6.9/m4/xattr.m4 |
662 |
+++ coreutils-6.9/m4/xattr.m4 |
663 |
@@ -0,0 +1,44 @@ |
664 |
+# xattr.m4 - check for Extended Attributes (Linux) |
665 |
+ |
666 |
+# Copyright (C) 2003 Free Software Foundation, Inc. |
667 |
+ |
668 |
+# This program is free software; you can redistribute it and/or modify |
669 |
+# it under the terms of the GNU General Public License as published by |
670 |
+# the Free Software Foundation; either version 2, or (at your option) |
671 |
+# any later version. |
672 |
+ |
673 |
+# This program is distributed in the hope that it will be useful, |
674 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
675 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
676 |
+# GNU General Public License for more details. |
677 |
+ |
678 |
+# You should have received a copy of the GNU General Public License |
679 |
+# along with this program; if not, write to the Free Software Foundation, |
680 |
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
681 |
+ |
682 |
+# Written by Andreas Gruenbacher. |
683 |
+ |
684 |
+AC_DEFUN([AC_FUNC_XATTR], |
685 |
+[ |
686 |
+ AC_ARG_ENABLE(xattr, |
687 |
+ [ --disable-xattr turn off support for extended attributes], |
688 |
+ use_xattr=$enableval, use_xattr=yes) |
689 |
+ |
690 |
+ if test "$use_xattr" = "yes"; then |
691 |
+ AC_CHECK_HEADERS(attr/error_context.h attr/libattr.h) |
692 |
+ if test "$ac_cv_header_attr_libattr_h" = yes \ |
693 |
+ && test "$ac_cv_header_attr_error_context_h" = yes; then |
694 |
+ use_xattr=1 |
695 |
+ else |
696 |
+ use_xattr=0 |
697 |
+ fi |
698 |
+ AC_DEFINE_UNQUOTED(USE_XATTR, $use_xattr, |
699 |
+ [Define if you want extended attribute support.]) |
700 |
+ xattr_saved_LIBS=$LIBS |
701 |
+ AC_SEARCH_LIBS(attr_copy_file, attr, |
702 |
+ [test "$ac_cv_search_attr_copy_file" = "none required" || LIB_XATTR=$ac_cv_search_attr_copy_file]) |
703 |
+ AC_SUBST(LIB_XATTR) |
704 |
+ AC_CHECK_FUNCS(attr_copy_file) |
705 |
+ LIBS=$xattr_saved_LIBS |
706 |
+ fi |
707 |
+]) |
708 |
--- coreutils-6.9/src/copy.c |
709 |
+++ coreutils-6.9/src/copy.c |
710 |
@@ -54,6 +54,13 @@ |
711 |
#include "xreadlink.h" |
712 |
#include "yesno.h" |
713 |
|
714 |
+#if USE_XATTR |
715 |
+# include "regex.h" |
716 |
+# include <stdarg.h> |
717 |
+# include <attr/error_context.h> |
718 |
+# include <attr/libattr.h> |
719 |
+#endif |
720 |
+ |
721 |
#ifndef HAVE_FCHOWN |
722 |
# define HAVE_FCHOWN false |
723 |
# define fchown(fd, uid, gid) (-1) |
724 |
@@ -119,6 +126,104 @@ |
725 |
return false; |
726 |
} |
727 |
|
728 |
+#if USE_XATTR |
729 |
+static void |
730 |
+copy_attr_error (struct error_context *ctx, const char *fmt, ...) |
731 |
+{ |
732 |
+ int err = errno; |
733 |
+ va_list ap; |
734 |
+ int len; |
735 |
+ char *buffer; |
736 |
+ |
737 |
+ /* There is no error function that takes a va_list argument, |
738 |
+ so we print the message in a buffer first. */ |
739 |
+ |
740 |
+ va_start (ap, fmt); |
741 |
+ len = vsnprintf (NULL, 0, fmt, ap); |
742 |
+ if (len > 0) |
743 |
+ { |
744 |
+ buffer = xmalloc (len + 1); |
745 |
+ vsnprintf (buffer, len + 1, fmt, ap); |
746 |
+ error (0, err, "%s", buffer); |
747 |
+ free (buffer); |
748 |
+ } |
749 |
+ va_end (ap); |
750 |
+} |
751 |
+ |
752 |
+static const char * |
753 |
+copy_attr_quote (struct error_context *ctx, const char *str) |
754 |
+{ |
755 |
+ return xstrdup (quote (str)); |
756 |
+} |
757 |
+ |
758 |
+static void |
759 |
+copy_attr_free (struct error_context *ctx, const char *str) |
760 |
+{ |
761 |
+ free ((void *) str); |
762 |
+} |
763 |
+ |
764 |
+struct copy_attr_context |
765 |
+ { |
766 |
+ struct error_context ctx; |
767 |
+ const char *re_pattern; |
768 |
+ struct re_pattern_buffer re_compiled; |
769 |
+ } copy_attr_ctx = { |
770 |
+ { copy_attr_error, |
771 |
+ copy_attr_quote, |
772 |
+ copy_attr_free } |
773 |
+ }; |
774 |
+ |
775 |
+static int |
776 |
+copy_attr_filter (const char *name, struct error_context *ctx) |
777 |
+{ |
778 |
+ struct copy_attr_context *copy_ctx = (struct copy_attr_context *) ctx; |
779 |
+ |
780 |
+ return (attr_copy_check_permissions (name, ctx) |
781 |
+ && copy_ctx->re_pattern != NULL |
782 |
+ && re_search (©_ctx->re_compiled, name, strlen (name), 0, |
783 |
+ strlen (name), NULL) >= 0); |
784 |
+} |
785 |
+#endif /* USE_XATTR */ |
786 |
+ |
787 |
+static bool |
788 |
+copy_extended_attributes (const char *src_path, const char *dst_path, |
789 |
+ const struct cp_options *x) |
790 |
+{ |
791 |
+#if USE_XATTR |
792 |
+ if (x->attr_pattern == NULL) |
793 |
+ return true; |
794 |
+ |
795 |
+ if (copy_attr_ctx.re_pattern != x->attr_pattern) |
796 |
+ { |
797 |
+ struct re_pattern_buffer *c = ©_attr_ctx.re_compiled; |
798 |
+ size_t len = strlen (x->attr_pattern); |
799 |
+ const char *err; |
800 |
+ |
801 |
+ free (c->fastmap); |
802 |
+ free (c->buffer); |
803 |
+ |
804 |
+ copy_attr_ctx.re_pattern = x->attr_pattern; |
805 |
+ c->allocated = 2 * len; |
806 |
+ c->buffer = xmalloc (c->allocated); |
807 |
+ c->fastmap = xmalloc (256); |
808 |
+ c->translate = 0; |
809 |
+ err = re_compile_pattern (x->attr_pattern, len, c); |
810 |
+ if (err) |
811 |
+ { |
812 |
+ free (c->fastmap); |
813 |
+ free (c->buffer); |
814 |
+ copy_attr_ctx.re_pattern = NULL; |
815 |
+ error (EXIT_FAILURE, 0, _("%s: invalid regular expression: %s"), |
816 |
+ x->attr_pattern, err); |
817 |
+ } |
818 |
+ } |
819 |
+ return attr_copy_file (src_path, dst_path, |
820 |
+ copy_attr_filter, ©_attr_ctx.ctx) == 0; |
821 |
+#else /* USE_XATTR */ |
822 |
+ return true; |
823 |
+#endif /* USE_XATTR */ |
824 |
+} |
825 |
+ |
826 |
/* Read the contents of the directory SRC_NAME_IN, and recursively |
827 |
copy the contents to DST_NAME_IN. NEW_DST is true if |
828 |
DST_NAME_IN is a directory that was created previously in the |
829 |
@@ -614,6 +614,9 @@ |
830 |
|
831 |
set_author (dst_name, dest_desc, src_sb); |
832 |
|
833 |
+ if (! copy_extended_attributes (src_name, dst_name, x)) |
834 |
+ return_val = false; |
835 |
+ |
836 |
if (x->preserve_mode || x->move_mode) |
837 |
{ |
838 |
if (copy_acl (src_name, source_desc, dst_name, dest_desc, |
839 |
@@ -1843,6 +1948,9 @@ |
840 |
|
841 |
set_author (dst_name, -1, &src_sb); |
842 |
|
843 |
+ if (! copy_extended_attributes (src_name, dst_name, x)) |
844 |
+ delayed_ok = false; |
845 |
+ |
846 |
if (x->preserve_mode || x->move_mode) |
847 |
{ |
848 |
if (copy_acl (src_name, -1, dst_name, -1, src_mode) != 0 |
849 |
--- coreutils-6.9/src/copy.h |
850 |
+++ coreutils-6.9/src/copy.h |
851 |
@@ -128,6 +128,10 @@ |
852 |
bool preserve_mode; |
853 |
bool preserve_timestamps; |
854 |
|
855 |
+ /* Regular expression pattern that specifies which extended attributes to |
856 |
+ copy. NULL stands for copying no extended attributes. */ |
857 |
+ const char *attr_pattern; |
858 |
+ |
859 |
/* Enabled for mv, and for cp by the --preserve=links option. |
860 |
If true, attempt to preserve in the destination files any |
861 |
logical hard links between the source files. If used with cp's |
862 |
--- coreutils-6.9/src/cp.c |
863 |
+++ coreutils-6.9/src/cp.c |
864 |
@@ -73,7 +73,8 @@ |
865 |
REPLY_OPTION, |
866 |
SPARSE_OPTION, |
867 |
STRIP_TRAILING_SLASHES_OPTION, |
868 |
- UNLINK_DEST_BEFORE_OPENING |
869 |
+ UNLINK_DEST_BEFORE_OPENING, |
870 |
+ PRESERVE_XATTRS_OPTION |
871 |
}; |
872 |
|
873 |
/* Initial number of entries in each hash table entry's table of inodes. */ |
874 |
@@ -130,6 +131,7 @@ |
875 |
{"parents", no_argument, NULL, PARENTS_OPTION}, |
876 |
{"path", no_argument, NULL, PARENTS_OPTION}, /* Deprecated. */ |
877 |
{"preserve", optional_argument, NULL, PRESERVE_ATTRIBUTES_OPTION}, |
878 |
+ {"attributes", required_argument, NULL, PRESERVE_XATTRS_OPTION}, |
879 |
{"recursive", no_argument, NULL, 'R'}, |
880 |
{"remove-destination", no_argument, NULL, UNLINK_DEST_BEFORE_OPENING}, |
881 |
{"reply", required_argument, NULL, REPLY_OPTION}, /* Deprecated 2005-07-03, |
882 |
@@ -220,6 +222,13 @@ |
883 |
-v, --verbose explain what is being done\n\ |
884 |
-x, --one-file-system stay on this file system\n\ |
885 |
"), stdout); |
886 |
+ fputs(_("\n\ |
887 |
+ --attributes=regex preserve extended attributes whose name\n\ |
888 |
+ matches the specified regular expression\n\ |
889 |
+ (defaults to preserving all extended\n\ |
890 |
+ attributes except file permissions;\n\ |
891 |
+ regex=`-' preserves no extended attributes).\n\ |
892 |
+"), stdout); |
893 |
fputs (HELP_OPTION_DESCRIPTION, stdout); |
894 |
fputs (VERSION_OPTION_DESCRIPTION, stdout); |
895 |
fputs (_("\ |
896 |
@@ -764,6 +773,8 @@ |
897 |
x->verbose = false; |
898 |
x->dest_info = NULL; |
899 |
x->src_info = NULL; |
900 |
+ |
901 |
+ x->attr_pattern = ""; /* all extended attributes */ |
902 |
} |
903 |
|
904 |
/* Given a string, ARG, containing a comma-separated list of arguments |
905 |
@@ -951,6 +962,13 @@ |
906 |
x.require_preserve = true; |
907 |
break; |
908 |
|
909 |
+ case PRESERVE_XATTRS_OPTION: |
910 |
+ if (strcmp (optarg, "-") == 0) |
911 |
+ x.attr_pattern = NULL; |
912 |
+ else |
913 |
+ x.attr_pattern = optarg; |
914 |
+ break; |
915 |
+ |
916 |
case PARENTS_OPTION: |
917 |
parents_option = true; |
918 |
break; |
919 |
--- coreutils-6.9/src/install.c |
920 |
+++ coreutils-6.9/src/install.c |
921 |
@@ -172,6 +172,8 @@ |
922 |
x->verbose = false; |
923 |
x->dest_info = NULL; |
924 |
x->src_info = NULL; |
925 |
+ |
926 |
+ x->attr_pattern = NULL; /* no extended attributes */ |
927 |
} |
928 |
|
929 |
/* FILE is the last operand of this command. Return true if FILE is a |
930 |
--- coreutils-6.9/src/Makefile.am |
931 |
+++ coreutils-6.9/src/Makefile.am |
932 |
@@ -107,9 +107,9 @@ |
933 |
dir_LDADD += $(LIB_ACL) |
934 |
ls_LDADD += $(LIB_ACL) |
935 |
vdir_LDADD += $(LIB_ACL) |
936 |
-cp_LDADD += $(LIB_ACL) |
937 |
-mv_LDADD += $(LIB_ACL) |
938 |
-ginstall_LDADD += $(LIB_ACL) |
939 |
+cp_LDADD += $(LIB_ACL) $(LIB_XATTR) |
940 |
+mv_LDADD += $(LIB_ACL) $(LIB_XATTR) |
941 |
+ginstall_LDADD += $(LIB_ACL) $(LIB_XATTR) |
942 |
|
943 |
stat_LDADD = $(LDADD) $(LIB_SELINUX) |
944 |
|
945 |
--- coreutils-6.9/src/mv.c |
946 |
+++ coreutils-6.9/src/mv.c |
947 |
@@ -138,6 +138,8 @@ |
948 |
x->verbose = false; |
949 |
x->dest_info = NULL; |
950 |
x->src_info = NULL; |
951 |
+ |
952 |
+ x->attr_pattern = ""; /* all extended attributes */ |
953 |
} |
954 |
|
955 |
/* FILE is the last operand of this command. Return true if FILE is a |
956 |
|
957 |
|
958 |
|
959 |
1.1 src/patchsets/coreutils/6.12/030_all_coreutils-more-dir-colors.patch |
960 |
|
961 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/030_all_coreutils-more-dir-colors.patch?rev=1.1&view=markup |
962 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/030_all_coreutils-more-dir-colors.patch?rev=1.1&content-type=text/plain |
963 |
|
964 |
Index: 030_all_coreutils-more-dir-colors.patch |
965 |
=================================================================== |
966 |
--- coreutils-6.7/src/dircolors.hin |
967 |
+++ coreutils-6.7/src/dircolors.hin |
968 |
@@ -5,6 +5,9 @@ |
969 |
|
970 |
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the |
971 |
# slackware version of dircolors) are recognized but ignored. |
972 |
+ |
973 |
+# You can copy this file to .dir_colors in your $HOME directory to override |
974 |
+# the system defaults. |
975 |
|
976 |
# Below, there should be one TERM entry for each termtype that is colorizable |
977 |
TERM Eterm |
978 |
@@ -66,7 +66,8 @@ |
979 |
DOOR 01;35 # door |
980 |
BLK 40;33;01 # block device driver |
981 |
CHR 40;33;01 # character device driver |
982 |
-ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file |
983 |
+ORPHAN 01;05;37;41 # orphaned syminks |
984 |
+MISSING 01;05;37;41 # ... and the files they point to |
985 |
SETUID 37;41 # file that is setuid (u+s) |
986 |
SETGID 30;43 # file that is setgid (g+s) |
987 |
STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w) |
988 |
@@ -125,6 +154,16 @@ |
989 |
.xwd 01;35 |
990 |
.yuv 01;35 |
991 |
|
992 |
+# Document files |
993 |
+.pdf 00;32 |
994 |
+.ps 00;32 |
995 |
+.txt 00;32 |
996 |
+.patch 00;32 |
997 |
+.diff 00;32 |
998 |
+.log 00;32 |
999 |
+.tex 00;32 |
1000 |
+.doc 00;32 |
1001 |
+ |
1002 |
# audio formats |
1003 |
.aac 00;36 |
1004 |
.au 00;36 |
1005 |
|
1006 |
|
1007 |
|
1008 |
1.1 src/patchsets/coreutils/6.12/README.history |
1009 |
|
1010 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/README.history?rev=1.1&view=markup |
1011 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/coreutils/6.12/README.history?rev=1.1&content-type=text/plain |
1012 |
|
1013 |
Index: README.history |
1014 |
=================================================================== |
1015 |
1.0 01.06.2008 |
1016 |
+ 001_all_coreutils-gen-progress-bar.patch |
1017 |
+ 003_all_coreutils-gentoo-uname.patch |
1018 |
+ 004_all_coreutils-acl-xattr.patch |
1019 |
+ 030_all_coreutils-more-dir-colors.patch |
1020 |
|
1021 |
|
1022 |
|
1023 |
-- |
1024 |
gentoo-commits@l.g.o mailing list |