OLD | NEW |
1 # Copyright (c) 2009, Google Inc. All rights reserved. | 1 # Copyright (c) 2009, Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 self._parse_last_build_cell(builder, status_cells[1]) | 267 self._parse_last_build_cell(builder, status_cells[1]) |
268 self._parse_current_build_cell(builder, status_cells[2]) | 268 self._parse_current_build_cell(builder, status_cells[2]) |
269 return builder | 269 return builder |
270 | 270 |
271 def _matches_regexps(self, builder_name, name_regexps): | 271 def _matches_regexps(self, builder_name, name_regexps): |
272 for name_regexp in name_regexps: | 272 for name_regexp in name_regexps: |
273 if re.match(name_regexp, builder_name): | 273 if re.match(name_regexp, builder_name): |
274 return True | 274 return True |
275 return False | 275 return False |
276 | 276 |
277 # FIXME: This method needs to die, but is used by a unit test at the moment. | |
278 def _builder_statuses_with_names_matching_regexps(self, builder_statuses, na
me_regexps): | |
279 return [builder for builder in builder_statuses if self._matches_regexps
(builder["name"], name_regexps)] | |
280 | |
281 # FIXME: These _fetch methods should move to a networking class. | 277 # FIXME: These _fetch methods should move to a networking class. |
282 def _fetch_build_dictionary(self, builder, build_number): | 278 def _fetch_build_dictionary(self, builder, build_number): |
283 # Note: filter=1 will remove None and {} and '', which cuts noise but ca
n | 279 # Note: filter=1 will remove None and {} and '', which cuts noise but ca
n |
284 # cause keys to be missing which you might otherwise expect. | 280 # cause keys to be missing which you might otherwise expect. |
285 # FIXME: The bot sends a *huge* amount of data for each request, we shou
ld | 281 # FIXME: The bot sends a *huge* amount of data for each request, we shou
ld |
286 # find a way to reduce the response size further. | 282 # find a way to reduce the response size further. |
287 json_url = "%s/json/builders/%s/builds/%s?filter=1" % (self.buildbot_url
, urllib.quote(builder.name()), build_number) | 283 json_url = "%s/json/builders/%s/builds/%s?filter=1" % (self.buildbot_url
, urllib.quote(builder.name()), build_number) |
288 try: | 284 try: |
289 return json.load(urllib2.urlopen(json_url)) | 285 return json.load(urllib2.urlopen(json_url)) |
290 except urllib2.URLError, err: | 286 except urllib2.URLError, err: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 | 391 |
396 builders_succeeded_in_past = set() | 392 builders_succeeded_in_past = set() |
397 for past_revision in revisions_in_order[i:]: | 393 for past_revision in revisions_in_order[i:]: |
398 if not revision_statuses[past_revision]: | 394 if not revision_statuses[past_revision]: |
399 break | 395 break |
400 builders_succeeded_in_past = builders_succeeded_in_past.union(re
vision_statuses[past_revision]) | 396 builders_succeeded_in_past = builders_succeeded_in_past.union(re
vision_statuses[past_revision]) |
401 | 397 |
402 if len(builders_succeeded_in_future) == len(builder_revisions) and l
en(builders_succeeded_in_past) == len(builder_revisions): | 398 if len(builders_succeeded_in_future) == len(builder_revisions) and l
en(builders_succeeded_in_past) == len(builder_revisions): |
403 return revision | 399 return revision |
404 return None | 400 return None |
OLD | NEW |