Lines 88-98
Link Here
|
88 |
{ |
88 |
{ |
89 |
FILE *fp; |
89 |
FILE *fp; |
90 |
char cat[126], buf[2][BUFSIZ]; |
90 |
char cat[126], buf[2][BUFSIZ]; |
91 |
char *pkg, *p; |
91 |
char *pkg, *p, *q; |
92 |
char ep[BUFSIZ]; |
92 |
char ep[BUFSIZ]; |
93 |
unsigned long count, merge_time; |
93 |
unsigned long count, merge_time; |
94 |
time_t t[2]; |
94 |
time_t t[2]; |
95 |
depend_atom *atom; |
95 |
depend_atom *atom; |
|
|
96 |
unsigned int parallel_emerge; |
96 |
|
97 |
|
97 |
t[0] = t[1] = 0UL; |
98 |
t[0] = t[1] = 0UL; |
98 |
count = merge_time = 0; |
99 |
count = merge_time = 0; |
Lines 148-153
Link Here
|
148 |
matched = 1; |
149 |
matched = 1; |
149 |
|
150 |
|
150 |
if (matched) { |
151 |
if (matched) { |
|
|
152 |
parallel_emerge = 0; |
151 |
while ((fgets(buf[0], sizeof(buf[0]), fp)) != NULL) { |
153 |
while ((fgets(buf[0], sizeof(buf[0]), fp)) != NULL) { |
152 |
if ((p = strchr(buf[0], '\n')) != NULL) |
154 |
if ((p = strchr(buf[0], '\n')) != NULL) |
153 |
*p = 0; |
155 |
*p = 0; |
Lines 157-162
Link Here
|
157 |
t[1] = atol(buf[0]); |
159 |
t[1] = atol(buf[0]); |
158 |
strcpy(buf[1], p + 1); |
160 |
strcpy(buf[1], p + 1); |
159 |
rmspace(buf[1]); |
161 |
rmspace(buf[1]); |
|
|
162 |
|
163 |
if (strncmp(buf[1], "Started emerge on:", 18) == 0) { |
164 |
/* a parallel emerge was launched */ |
165 |
parallel_emerge++; |
166 |
continue; |
167 |
} |
168 |
|
169 |
if (strncmp(buf[1], "*** terminating.", 16) == 0) { |
170 |
if (parallel_emerge > 0) { |
171 |
/* a parallel emerge has finished */ |
172 |
parallel_emerge--; |
173 |
continue; |
174 |
} |
175 |
else /* the main emerge was stopped */ |
176 |
break; |
177 |
} |
178 |
|
179 |
/* |
180 |
* pay attention to malformed log files (when the end of an emerge process |
181 |
* is not indicated by the line '*** terminating'). We assume than the log is |
182 |
* malformed when we find a parallel emerge process which is trying to |
183 |
* emerge the same package |
184 |
*/ |
185 |
if (strncmp(buf[1], ">>> emerge (", 12) == 0 && parallel_emerge > 0) { |
186 |
if ((p = strchr(buf[1], ')')) == NULL || (q = strchr(ep, ')')) == NULL) |
187 |
continue; |
188 |
|
189 |
if (!strcmp(p,q)) { |
190 |
parallel_emerge--; |
191 |
/* update the main emerge reference data */ |
192 |
snprintf(ep, BUFSIZ, "completed %s", &buf[1][4]); |
193 |
continue; |
194 |
} |
195 |
} |
196 |
|
160 |
if ((strncmp(&buf[1][4], ep, BUFSIZ)) == 0) { |
197 |
if ((strncmp(&buf[1][4], ep, BUFSIZ)) == 0) { |
161 |
if (!average) { |
198 |
if (!average) { |
162 |
strcpy(buf[1], ""); |
199 |
strcpy(buf[1], ""); |