1 |
commit: 7fc3cf2b4baddc8b98c994b8ee024330d8f29956 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Mar 1 16:36:28 2018 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 1 16:36:28 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7fc3cf2b |
7 |
|
8 |
scripts/rsync-generation/hashgen: report some stats |
9 |
|
10 |
scripts/rsync-generation/hashgen.c | 20 ++++++++++++++++++++ |
11 |
1 file changed, 20 insertions(+) |
12 |
|
13 |
diff --git a/scripts/rsync-generation/hashgen.c b/scripts/rsync-generation/hashgen.c |
14 |
index 56abd691a3..446299f92e 100644 |
15 |
--- a/scripts/rsync-generation/hashgen.c |
16 |
+++ b/scripts/rsync-generation/hashgen.c |
17 |
@@ -795,6 +795,10 @@ verify_gpg_sig(const char *path) |
18 |
return ret; |
19 |
} |
20 |
|
21 |
+static size_t checked_manifests = 0; |
22 |
+static size_t checked_files = 0; |
23 |
+static size_t failed_files = 0; |
24 |
+ |
25 |
static char |
26 |
verify_file(const char *dir, char *mfline, const char *mfest) |
27 |
{ |
28 |
@@ -849,11 +853,14 @@ verify_file(const char *dir, char *mfline, const char *mfest) |
29 |
return 1; |
30 |
} |
31 |
|
32 |
+ checked_files++; |
33 |
+ |
34 |
if (flen != fsize) { |
35 |
printf("%s:%s:\n- file size mismatch\n" |
36 |
" got: %zd\n" |
37 |
" expected: %lld\n", |
38 |
mfest, path, flen, fsize); |
39 |
+ failed_files++; |
40 |
return 1; |
41 |
} |
42 |
|
43 |
@@ -959,6 +966,7 @@ verify_file(const char *dir, char *mfline, const char *mfest) |
44 |
ret = 1; |
45 |
} |
46 |
|
47 |
+ failed_files += ret; |
48 |
return ret; |
49 |
} |
50 |
|
51 |
@@ -1295,6 +1303,7 @@ verify_manifest(const char *dir, const char *manifest) |
52 |
qsort(elems, elemslen, sizeof(elems[0]), compare_elems); |
53 |
snprintf(buf, sizeof(buf), "%s/%s", dir, manifest); |
54 |
ret = verify_dir(dir, elems, elemslen, 0, buf + 2); |
55 |
+ checked_manifests++; |
56 |
|
57 |
while (elemslen-- > 0) |
58 |
free(elems[elemslen]); |
59 |
@@ -1309,6 +1318,11 @@ process_dir_vrfy(const char *dir) |
60 |
char buf[8192]; |
61 |
int newhashes; |
62 |
char *ret = NULL; |
63 |
+ struct timeval startt; |
64 |
+ struct timeval finisht; |
65 |
+ double etime; |
66 |
+ |
67 |
+ gettimeofday(&startt, NULL); |
68 |
|
69 |
fprintf(stdout, "verifying %s...\n", dir); |
70 |
snprintf(buf, sizeof(buf), "%s/metadata/layout.conf", dir); |
71 |
@@ -1337,6 +1351,12 @@ process_dir_vrfy(const char *dir) |
72 |
if (verify_manifest(".\0", str_manifest) != 0) |
73 |
ret = "manifest verification failed"; |
74 |
|
75 |
+ gettimeofday(&finisht, NULL); |
76 |
+ |
77 |
+ etime = ((double)((finisht.tv_sec - startt.tv_sec) * 1000000 + |
78 |
+ finisht.tv_usec) - (double)startt.tv_usec) / 1000000.0; |
79 |
+ printf("checked %zd Manifests, %zd files, %zd failures in %.02fs\n", |
80 |
+ checked_manifests, checked_files, failed_files, etime); |
81 |
return ret; |
82 |
} |