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

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

Issue 1002383002: Make release scripts more robust. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 months 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
« no previous file with comments | « no previous file | tools/release/test_scripts.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if (self._options.requires_editor and (not os.environ.get("EDITOR") or 531 if (self._options.requires_editor and (not os.environ.get("EDITOR") or
532 self.Command( 532 self.Command(
533 "which", os.environ["EDITOR"]) is None)): # pragma: no cover 533 "which", os.environ["EDITOR"]) is None)): # pragma: no cover
534 self.Die("Please set your EDITOR environment variable, you'll need it.") 534 self.Die("Please set your EDITOR environment variable, you'll need it.")
535 535
536 def CommonPrepare(self): 536 def CommonPrepare(self):
537 # Check for a clean workdir. 537 # Check for a clean workdir.
538 if not self.GitIsWorkdirClean(): # pragma: no cover 538 if not self.GitIsWorkdirClean(): # pragma: no cover
539 self.Die("Workspace is not clean. Please commit or undo your changes.") 539 self.Die("Workspace is not clean. Please commit or undo your changes.")
540 540
541 # Persist current branch. 541 # Checkout master in case the script was left on a work branch.
542 self["current_branch"] = self.GitCurrentBranch() 542 self.GitCheckout('origin/master')
543 543
544 # Fetch unfetched revisions. 544 # Fetch unfetched revisions.
545 self.vc.Fetch() 545 self.vc.Fetch()
546 546
547 def PrepareBranch(self): 547 def PrepareBranch(self):
548 # Delete the branch that will be created later if it exists already. 548 # Delete the branch that will be created later if it exists already.
549 self.DeleteBranch(self._config["BRANCHNAME"]) 549 self.DeleteBranch(self._config["BRANCHNAME"])
tandrii(chromium) 2015/03/15 10:50:17 this seems to be safer against weird branch names.
550 550
551 def CommonCleanup(self): 551 def CommonCleanup(self):
552 if ' ' in self["current_branch"]: 552 self.GitCheckout('origin/master')
553 self.GitCheckout('master') 553 self.GitDeleteBranch(self._config["BRANCHNAME"])
tandrii(chromium) 2015/03/15 10:50:18 seems inconsistent from above.
Michael Achenbach 2015/03/18 22:33:45 I don't follow. PrepareBranch is always called in
tandrii(chromium) 2015/03/25 23:12:01 I meant that I didn't quite understand why you cal
554 else:
555 self.GitCheckout(self["current_branch"])
556 if self._config["BRANCHNAME"] != self["current_branch"]:
557 self.GitDeleteBranch(self._config["BRANCHNAME"])
558 554
559 # Clean up all temporary files. 555 # Clean up all temporary files.
560 for f in glob.iglob("%s*" % self._config["PERSISTFILE_BASENAME"]): 556 for f in glob.iglob("%s*" % self._config["PERSISTFILE_BASENAME"]):
561 if os.path.isfile(f): 557 if os.path.isfile(f):
562 os.remove(f) 558 os.remove(f)
563 if os.path.isdir(f): 559 if os.path.isdir(f):
564 shutil.rmtree(f) 560 shutil.rmtree(f)
565 561
566 def ReadAndPersistVersion(self, prefix=""): 562 def ReadAndPersistVersion(self, prefix=""):
567 def ReadAndPersist(var_name, def_name): 563 def ReadAndPersist(var_name, def_name):
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 for (number, step_class) in enumerate([BootstrapStep] + step_classes): 872 for (number, step_class) in enumerate([BootstrapStep] + step_classes):
877 steps.append(MakeStep(step_class, number, self._state, self._config, 873 steps.append(MakeStep(step_class, number, self._state, self._config,
878 options, self._side_effect_handler)) 874 options, self._side_effect_handler))
879 for step in steps[options.step:]: 875 for step in steps[options.step:]:
880 if step.Run(): 876 if step.Run():
881 return 0 877 return 0
882 return 0 878 return 0
883 879
884 def Run(self, args=None): 880 def Run(self, args=None):
885 return self.RunSteps(self._Steps(), args) 881 return self.RunSteps(self._Steps(), args)
OLDNEW
« no previous file with comments | « no previous file | tools/release/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698