OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
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 | 10 # copyright notice, this list of conditions and the following |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 elif line.startswith("#define V8_PATCH_LEVEL"): | 731 elif line.startswith("#define V8_PATCH_LEVEL"): |
732 line = re.sub("\d+$", self[prefix + "patch"], line) | 732 line = re.sub("\d+$", self[prefix + "patch"], line) |
733 elif (self[prefix + "candidate"] and | 733 elif (self[prefix + "candidate"] and |
734 line.startswith("#define V8_IS_CANDIDATE_VERSION")): | 734 line.startswith("#define V8_IS_CANDIDATE_VERSION")): |
735 line = re.sub("\d+$", self[prefix + "candidate"], line) | 735 line = re.sub("\d+$", self[prefix + "candidate"], line) |
736 output += "%s\n" % line | 736 output += "%s\n" % line |
737 TextToFile(output, version_file) | 737 TextToFile(output, version_file) |
738 | 738 |
739 | 739 |
740 class BootstrapStep(Step): | 740 class BootstrapStep(Step): |
741 MESSAGE = "Bootstrapping v8 checkout." | 741 MESSAGE = "Bootstrapping checkout and state." |
742 | 742 |
743 def RunStep(self): | 743 def RunStep(self): |
| 744 # Reserve state entry for json output. |
| 745 self['json_output'] = {} |
| 746 |
744 if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE): | 747 if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE): |
745 self.Die("Can't use v8 checkout with calling script as work checkout.") | 748 self.Die("Can't use v8 checkout with calling script as work checkout.") |
746 # Directory containing the working v8 checkout. | 749 # Directory containing the working v8 checkout. |
747 if not os.path.exists(self._options.work_dir): | 750 if not os.path.exists(self._options.work_dir): |
748 os.makedirs(self._options.work_dir) | 751 os.makedirs(self._options.work_dir) |
749 if not os.path.exists(self.default_cwd): | 752 if not os.path.exists(self.default_cwd): |
750 self.Command("fetch", "v8", cwd=self._options.work_dir) | 753 self.Command("fetch", "v8", cwd=self._options.work_dir) |
751 | 754 |
752 | 755 |
753 class UploadStep(Step): | 756 class UploadStep(Step): |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 return 1 | 864 return 1 |
862 | 865 |
863 state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"] | 866 state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"] |
864 if options.step == 0 and os.path.exists(state_file): | 867 if options.step == 0 and os.path.exists(state_file): |
865 os.remove(state_file) | 868 os.remove(state_file) |
866 | 869 |
867 steps = [] | 870 steps = [] |
868 for (number, step_class) in enumerate([BootstrapStep] + step_classes): | 871 for (number, step_class) in enumerate([BootstrapStep] + step_classes): |
869 steps.append(MakeStep(step_class, number, self._state, self._config, | 872 steps.append(MakeStep(step_class, number, self._state, self._config, |
870 options, self._side_effect_handler)) | 873 options, self._side_effect_handler)) |
871 step_summary = [] | 874 |
872 try: | 875 try: |
873 for step in steps[options.step:]: | 876 for step in steps[options.step:]: |
874 terminate = step.Run() | 877 if step.Run(): |
875 step_summary.append(step._text) | |
876 if terminate: | |
877 return 0 | 878 return 0 |
878 finally: | 879 finally: |
879 if options.json_output: | 880 if options.json_output: |
880 with open(options.json_output, "w") as f: | 881 with open(options.json_output, "w") as f: |
881 json.dump({"step_summary": step_summary}, f) | 882 json.dump(self._state['json_output'], f) |
882 | 883 |
883 return 0 | 884 return 0 |
884 | 885 |
885 def Run(self, args=None): | 886 def Run(self, args=None): |
886 return self.RunSteps(self._Steps(), args) | 887 return self.RunSteps(self._Steps(), args) |
OLD | NEW |