Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: tools/release/common_includes.py

Issue 1463143004: [release] Add json output to release tools. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 = "Bootstapping v8 checkout." 741 MESSAGE = "Bootstrapping v8 checkout."
742 742
743 def RunStep(self): 743 def RunStep(self):
744 if os.path.realpath(self.default_cwd) == os.path.realpath(V8_BASE): 744 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.") 745 self.Die("Can't use v8 checkout with calling script as work checkout.")
746 # Directory containing the working v8 checkout. 746 # Directory containing the working v8 checkout.
747 if not os.path.exists(self._options.work_dir): 747 if not os.path.exists(self._options.work_dir):
748 os.makedirs(self._options.work_dir) 748 os.makedirs(self._options.work_dir)
749 if not os.path.exists(self.default_cwd): 749 if not os.path.exists(self.default_cwd):
750 self.Command("fetch", "v8", cwd=self._options.work_dir) 750 self.Command("fetch", "v8", cwd=self._options.work_dir)
751 751
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 831
832 def _Config(self): 832 def _Config(self):
833 return {} 833 return {}
834 834
835 def MakeOptions(self, args=None): 835 def MakeOptions(self, args=None):
836 parser = argparse.ArgumentParser(description=self._Description()) 836 parser = argparse.ArgumentParser(description=self._Description())
837 parser.add_argument("-a", "--author", default="", 837 parser.add_argument("-a", "--author", default="",
838 help="The author email used for rietveld.") 838 help="The author email used for rietveld.")
839 parser.add_argument("--dry-run", default=False, action="store_true", 839 parser.add_argument("--dry-run", default=False, action="store_true",
840 help="Perform only read-only actions.") 840 help="Perform only read-only actions.")
841 parser.add_argument("--json-output",
842 help="File to write results summary to.")
841 parser.add_argument("-r", "--reviewer", default="", 843 parser.add_argument("-r", "--reviewer", default="",
842 help="The account name to be used for reviews.") 844 help="The account name to be used for reviews.")
843 parser.add_argument("--sheriff", default=False, action="store_true", 845 parser.add_argument("--sheriff", default=False, action="store_true",
844 help=("Determine current sheriff to review CLs. On " 846 help=("Determine current sheriff to review CLs. On "
845 "success, this will overwrite the reviewer " 847 "success, this will overwrite the reviewer "
846 "option.")) 848 "option."))
847 parser.add_argument("-s", "--step", 849 parser.add_argument("-s", "--step",
848 help="Specify the step where to start work. Default: 0.", 850 help="Specify the step where to start work. Default: 0.",
849 default=0, type=int) 851 default=0, type=int)
850 parser.add_argument("--work-dir", 852 parser.add_argument("--work-dir",
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 return 1 891 return 1
890 892
891 state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"] 893 state_file = "%s-state.json" % self._config["PERSISTFILE_BASENAME"]
892 if options.step == 0 and os.path.exists(state_file): 894 if options.step == 0 and os.path.exists(state_file):
893 os.remove(state_file) 895 os.remove(state_file)
894 896
895 steps = [] 897 steps = []
896 for (number, step_class) in enumerate([BootstrapStep] + step_classes): 898 for (number, step_class) in enumerate([BootstrapStep] + step_classes):
897 steps.append(MakeStep(step_class, number, self._state, self._config, 899 steps.append(MakeStep(step_class, number, self._state, self._config,
898 options, self._side_effect_handler)) 900 options, self._side_effect_handler))
899 for step in steps[options.step:]: 901 step_summary = []
900 if step.Run(): 902 try:
901 return 0 903 for step in steps[options.step:]:
904 terminate = step.Run()
905 step_summary.append(step._text)
906 if terminate:
907 return 0
908 finally:
909 if options.json_output:
910 with open(options.json_output, "w") as f:
911 json.dump({"step_summary": step_summary}, f)
912
902 return 0 913 return 0
903 914
904 def Run(self, args=None): 915 def Run(self, args=None):
905 return self.RunSteps(self._Steps(), args) 916 return self.RunSteps(self._Steps(), args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698