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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 self.CommonPrepare() | 90 self.CommonPrepare() |
91 self.PrepareBranch() | 91 self.PrepareBranch() |
92 self.DeleteBranch(self.Config(TRUNKBRANCH)) | 92 self.DeleteBranch(self.Config(TRUNKBRANCH)) |
93 | 93 |
94 | 94 |
95 class FreshBranch(Step): | 95 class FreshBranch(Step): |
96 MESSAGE = "Create a fresh branch." | 96 MESSAGE = "Create a fresh branch." |
97 | 97 |
98 def RunStep(self): | 98 def RunStep(self): |
99 args = "checkout -b %s svn/bleeding_edge" % self.Config(BRANCHNAME) | 99 args = "checkout -b %s svn/bleeding_edge" % self.Config(BRANCHNAME) |
100 if self.Git(args) is None: | 100 self.Git(args) |
101 self.Die("Creating branch %s failed." % self.Config(BRANCHNAME)) | |
102 | 101 |
103 | 102 |
104 class DetectLastPush(Step): | 103 class DetectLastPush(Step): |
105 MESSAGE = "Detect commit ID of last push to trunk." | 104 MESSAGE = "Detect commit ID of last push to trunk." |
106 | 105 |
107 def RunStep(self): | 106 def RunStep(self): |
108 last_push_trunk = self._options.l or self.FindLastTrunkPush() | 107 last_push_trunk = self._options.l or self.FindLastTrunkPush() |
109 while True: | 108 while True: |
110 # Print assumed commit, circumventing git's pager. | 109 # Print assumed commit, circumventing git's pager. |
111 print self.Git("log -1 %s" % last_push_trunk) | 110 print self.Git("log -1 %s" % last_push_trunk) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 "Now working on version %s.%s.%s." % (self["new_major"], | 260 "Now working on version %s.%s.%s." % (self["new_major"], |
262 self["new_minor"], | 261 self["new_minor"], |
263 self["new_build"])) | 262 self["new_build"])) |
264 | 263 |
265 # Include optional TBR only in the git command. The persisted commit | 264 # Include optional TBR only in the git command. The persisted commit |
266 # message is used for finding the commit again later. | 265 # message is used for finding the commit again later. |
267 if self._options.tbr_commit: | 266 if self._options.tbr_commit: |
268 review = "\n\nTBR=%s" % self._options.reviewer | 267 review = "\n\nTBR=%s" % self._options.reviewer |
269 else: | 268 else: |
270 review = "" | 269 review = "" |
271 if self.Git("commit -a -m \"%s%s\"" | 270 self.Git("commit -a -m \"%s%s\"" % (self["prep_commit_msg"], review)) |
272 % (self["prep_commit_msg"], review)) is None: | |
273 self.Die("'git commit -a' failed.") | |
274 | 271 |
275 | 272 |
276 class CommitRepository(Step): | 273 class CommitRepository(Step): |
277 MESSAGE = "Commit to the repository." | 274 MESSAGE = "Commit to the repository." |
278 | 275 |
279 def RunStep(self): | 276 def RunStep(self): |
280 self.WaitForLGTM() | 277 self.WaitForLGTM() |
281 # Re-read the ChangeLog entry (to pick up possible changes). | 278 # Re-read the ChangeLog entry (to pick up possible changes). |
282 # FIXME(machenbach): This was hanging once with a broken pipe. | 279 # FIXME(machenbach): This was hanging once with a broken pipe. |
283 TextToFile(GetLastChangeLogEntries(self.Config(CHANGELOG_FILE)), | 280 TextToFile(GetLastChangeLogEntries(self.Config(CHANGELOG_FILE)), |
284 self.Config(CHANGELOG_ENTRY_FILE)) | 281 self.Config(CHANGELOG_ENTRY_FILE)) |
285 | 282 |
286 if self.Git("cl presubmit", "PRESUBMIT_TREE_CHECK=\"skip\"") is None: | 283 self.Git("cl presubmit", "PRESUBMIT_TREE_CHECK=\"skip\"") |
287 self.Die("'git cl presubmit' failed, please try again.") | 284 self.Git("cl dcommit -f --bypass-hooks", retry_on=lambda x: x is None) |
288 | |
289 if self.Git("cl dcommit -f --bypass-hooks", | |
290 retry_on=lambda x: x is None) is None: | |
291 self.Die("'git cl dcommit' failed, please try again.") | |
292 | 285 |
293 | 286 |
294 class StragglerCommits(Step): | 287 class StragglerCommits(Step): |
295 MESSAGE = ("Fetch straggler commits that sneaked in since this script was " | 288 MESSAGE = ("Fetch straggler commits that sneaked in since this script was " |
296 "started.") | 289 "started.") |
297 | 290 |
298 def RunStep(self): | 291 def RunStep(self): |
299 if self.Git("svn fetch") is None: | 292 self.Git("svn fetch") |
300 self.Die("'git svn fetch' failed.") | |
301 self.Git("checkout svn/bleeding_edge") | 293 self.Git("checkout svn/bleeding_edge") |
302 args = "log -1 --format=%%H --grep=\"%s\"" % self["prep_commit_msg"] | 294 args = "log -1 --format=%%H --grep=\"%s\"" % self["prep_commit_msg"] |
303 self["prepare_commit_hash"] = self.Git(args).strip() | 295 self["prepare_commit_hash"] = self.Git(args).strip() |
304 | 296 |
305 | 297 |
306 class SquashCommits(Step): | 298 class SquashCommits(Step): |
307 MESSAGE = "Squash commits into one." | 299 MESSAGE = "Squash commits into one." |
308 | 300 |
309 def RunStep(self): | 301 def RunStep(self): |
310 # Instead of relying on "git rebase -i", we'll just create a diff, because | 302 # Instead of relying on "git rebase -i", we'll just create a diff, because |
(...skipping 24 matching lines...) Expand all Loading... |
335 if not text: | 327 if not text: |
336 self.Die("Commit message editing failed.") | 328 self.Die("Commit message editing failed.") |
337 TextToFile(text, self.Config(COMMITMSG_FILE)) | 329 TextToFile(text, self.Config(COMMITMSG_FILE)) |
338 os.remove(self.Config(CHANGELOG_ENTRY_FILE)) | 330 os.remove(self.Config(CHANGELOG_ENTRY_FILE)) |
339 | 331 |
340 | 332 |
341 class NewBranch(Step): | 333 class NewBranch(Step): |
342 MESSAGE = "Create a new branch from trunk." | 334 MESSAGE = "Create a new branch from trunk." |
343 | 335 |
344 def RunStep(self): | 336 def RunStep(self): |
345 if self.Git("checkout -b %s svn/trunk" % self.Config(TRUNKBRANCH)) is None: | 337 self.Git("checkout -b %s svn/trunk" % self.Config(TRUNKBRANCH)) |
346 self.Die("Checking out a new branch '%s' failed." % | |
347 self.Config(TRUNKBRANCH)) | |
348 | 338 |
349 | 339 |
350 class ApplyChanges(Step): | 340 class ApplyChanges(Step): |
351 MESSAGE = "Apply squashed changes." | 341 MESSAGE = "Apply squashed changes." |
352 | 342 |
353 def RunStep(self): | 343 def RunStep(self): |
354 self.ApplyPatch(self.Config(PATCH_FILE)) | 344 self.ApplyPatch(self.Config(PATCH_FILE)) |
355 Command("rm", "-f %s*" % self.Config(PATCH_FILE)) | 345 Command("rm", "-f %s*" % self.Config(PATCH_FILE)) |
356 | 346 |
357 | 347 |
(...skipping 15 matching lines...) Expand all Loading... |
373 line = re.sub("\d+$", "0", line) | 363 line = re.sub("\d+$", "0", line) |
374 output += "%s\n" % line | 364 output += "%s\n" % line |
375 TextToFile(output, self.Config(VERSION_FILE)) | 365 TextToFile(output, self.Config(VERSION_FILE)) |
376 | 366 |
377 | 367 |
378 class CommitTrunk(Step): | 368 class CommitTrunk(Step): |
379 MESSAGE = "Commit to local trunk branch." | 369 MESSAGE = "Commit to local trunk branch." |
380 | 370 |
381 def RunStep(self): | 371 def RunStep(self): |
382 self.Git("add \"%s\"" % self.Config(VERSION_FILE)) | 372 self.Git("add \"%s\"" % self.Config(VERSION_FILE)) |
383 if self.Git("commit -F \"%s\"" % self.Config(COMMITMSG_FILE)) is None: | 373 self.Git("commit -F \"%s\"" % self.Config(COMMITMSG_FILE)) |
384 self.Die("'git commit' failed.") | |
385 Command("rm", "-f %s*" % self.Config(COMMITMSG_FILE)) | 374 Command("rm", "-f %s*" % self.Config(COMMITMSG_FILE)) |
386 | 375 |
387 | 376 |
388 class SanityCheck(Step): | 377 class SanityCheck(Step): |
389 MESSAGE = "Sanity check." | 378 MESSAGE = "Sanity check." |
390 | 379 |
391 def RunStep(self): | 380 def RunStep(self): |
392 if not self.Confirm("Please check if your local checkout is sane: Inspect " | 381 if not self.Confirm("Please check if your local checkout is sane: Inspect " |
393 "%s, compile, run tests. Do you want to commit this new trunk " | 382 "%s, compile, run tests. Do you want to commit this new trunk " |
394 "revision to the repository?" % self.Config(VERSION_FILE)): | 383 "revision to the repository?" % self.Config(VERSION_FILE)): |
(...skipping 21 matching lines...) Expand all Loading... |
416 self.DieNoManualMode("Can't prompt in forced mode.") | 405 self.DieNoManualMode("Can't prompt in forced mode.") |
417 while not self["trunk_revision"]: | 406 while not self["trunk_revision"]: |
418 print "> ", | 407 print "> ", |
419 self["trunk_revision"] = self.ReadLine() | 408 self["trunk_revision"] = self.ReadLine() |
420 | 409 |
421 | 410 |
422 class TagRevision(Step): | 411 class TagRevision(Step): |
423 MESSAGE = "Tag the new revision." | 412 MESSAGE = "Tag the new revision." |
424 | 413 |
425 def RunStep(self): | 414 def RunStep(self): |
426 if self.Git(("svn tag %s -m \"Tagging version %s\"" | 415 self.Git(("svn tag %s -m \"Tagging version %s\"" |
427 % (self["version"], self["version"])), | 416 % (self["version"], self["version"])), |
428 retry_on=lambda x: x is None) is None: | 417 retry_on=lambda x: x is None) |
429 self.Die("'git svn tag' failed.") | |
430 | 418 |
431 | 419 |
432 class CheckChromium(Step): | 420 class CheckChromium(Step): |
433 MESSAGE = "Ask for chromium checkout." | 421 MESSAGE = "Ask for chromium checkout." |
434 | 422 |
435 def Run(self): | 423 def Run(self): |
436 self["chrome_path"] = self._options.c | 424 self["chrome_path"] = self._options.c |
437 if not self["chrome_path"]: | 425 if not self["chrome_path"]: |
438 self.DieNoManualMode("Please specify the path to a Chromium checkout in " | 426 self.DieNoManualMode("Please specify the path to a Chromium checkout in " |
439 "forced mode.") | 427 "forced mode.") |
(...skipping 19 matching lines...) Expand all Loading... |
459 if not os.path.exists(self.Config(DEPS_FILE)): | 447 if not os.path.exists(self.Config(DEPS_FILE)): |
460 self.Die("DEPS file not present.") | 448 self.Die("DEPS file not present.") |
461 | 449 |
462 | 450 |
463 class UpdateChromiumCheckout(Step): | 451 class UpdateChromiumCheckout(Step): |
464 MESSAGE = "Update the checkout and create a new branch." | 452 MESSAGE = "Update the checkout and create a new branch." |
465 REQUIRES = "chrome_path" | 453 REQUIRES = "chrome_path" |
466 | 454 |
467 def RunStep(self): | 455 def RunStep(self): |
468 os.chdir(self["chrome_path"]) | 456 os.chdir(self["chrome_path"]) |
469 if self.Git("checkout master") is None: | 457 self.Git("checkout master") |
470 self.Die("'git checkout master' failed.") | 458 self.Git("pull") |
471 if self.Git("pull") is None: | 459 self.Git("checkout -b v8-roll-%s" % self["trunk_revision"]) |
472 self.Die("'git pull' failed, please try again.") | |
473 | |
474 args = "checkout -b v8-roll-%s" % self["trunk_revision"] | |
475 if self.Git(args) is None: | |
476 self.Die("Failed to checkout a new branch.") | |
477 | 460 |
478 | 461 |
479 class UploadCL(Step): | 462 class UploadCL(Step): |
480 MESSAGE = "Create and upload CL." | 463 MESSAGE = "Create and upload CL." |
481 REQUIRES = "chrome_path" | 464 REQUIRES = "chrome_path" |
482 | 465 |
483 def RunStep(self): | 466 def RunStep(self): |
484 os.chdir(self["chrome_path"]) | 467 os.chdir(self["chrome_path"]) |
485 | 468 |
486 # Patch DEPS file. | 469 # Patch DEPS file. |
487 deps = FileToText(self.Config(DEPS_FILE)) | 470 deps = FileToText(self.Config(DEPS_FILE)) |
488 deps = re.sub("(?<=\"v8_revision\": \")([0-9]+)(?=\")", | 471 deps = re.sub("(?<=\"v8_revision\": \")([0-9]+)(?=\")", |
489 self["trunk_revision"], | 472 self["trunk_revision"], |
490 deps) | 473 deps) |
491 TextToFile(deps, self.Config(DEPS_FILE)) | 474 TextToFile(deps, self.Config(DEPS_FILE)) |
492 | 475 |
493 if self._options.reviewer: | 476 if self._options.reviewer: |
494 print "Using account %s for review." % self._options.reviewer | 477 print "Using account %s for review." % self._options.reviewer |
495 rev = self._options.reviewer | 478 rev = self._options.reviewer |
496 else: | 479 else: |
497 print "Please enter the email address of a reviewer for the roll CL: ", | 480 print "Please enter the email address of a reviewer for the roll CL: ", |
498 self.DieNoManualMode("A reviewer must be specified in forced mode.") | 481 self.DieNoManualMode("A reviewer must be specified in forced mode.") |
499 rev = self.ReadLine() | 482 rev = self.ReadLine() |
500 args = ("commit -am \"Update V8 to version %s " | 483 self.Git("commit -am \"Update V8 to version %s " |
501 "(based on bleeding_edge revision r%s).\n\nTBR=%s\"" | 484 "(based on bleeding_edge revision r%s).\n\nTBR=%s\"" |
502 % (self["version"], self["svn_revision"], rev)) | 485 % (self["version"], self["svn_revision"], rev)) |
503 if self.Git(args) is None: | |
504 self.Die("'git commit' failed.") | |
505 author_option = self._options.author | 486 author_option = self._options.author |
506 author = " --email \"%s\"" % author_option if author_option else "" | 487 author = " --email \"%s\"" % author_option if author_option else "" |
507 force_flag = " -f" if self._options.force_upload else "" | 488 force_flag = " -f" if self._options.force_upload else "" |
508 if self.Git("cl upload%s --send-mail%s" % (author, force_flag), | 489 self.Git("cl upload%s --send-mail%s" % (author, force_flag), pipe=False) |
509 pipe=False) is None: | |
510 self.Die("'git cl upload' failed, please try again.") | |
511 print "CL uploaded." | 490 print "CL uploaded." |
512 | 491 |
513 | 492 |
514 class SwitchV8(Step): | 493 class SwitchV8(Step): |
515 MESSAGE = "Returning to V8 checkout." | 494 MESSAGE = "Returning to V8 checkout." |
516 REQUIRES = "chrome_path" | 495 REQUIRES = "chrome_path" |
517 | 496 |
518 def RunStep(self): | 497 def RunStep(self): |
519 os.chdir(self["v8_path"]) | 498 os.chdir(self["v8_path"]) |
520 | 499 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 def Main(): | 603 def Main(): |
625 parser = BuildOptions() | 604 parser = BuildOptions() |
626 (options, args) = parser.parse_args() | 605 (options, args) = parser.parse_args() |
627 if not ProcessOptions(options): | 606 if not ProcessOptions(options): |
628 parser.print_help() | 607 parser.print_help() |
629 return 1 | 608 return 1 |
630 RunPushToTrunk(CONFIG, PushToTrunkOptions(options)) | 609 RunPushToTrunk(CONFIG, PushToTrunkOptions(options)) |
631 | 610 |
632 if __name__ == "__main__": | 611 if __name__ == "__main__": |
633 sys.exit(Main()) | 612 sys.exit(Main()) |
OLD | NEW |