Changeset 50105 in webkit


Ignore:
Timestamp:
Oct 26, 2009 3:34:19 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-10-23 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

bugzilla-tool commit-queue does not notice modifications to committers.py
https://bugs.webkit.org/show_bug.cgi?id=30084

  • Scripts/bugzilla-tool:
    • Make commit-queue re-exec itself instead of using while(1).
    • Add a --is-relaunch parameter to commit-queue to bypass initialization on re-launch.
    • Add a _next_patch() method which calls exec() (and could eventually call update-webkit too).
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r50104 r50105  
     12009-10-23  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        bugzilla-tool commit-queue does not notice modifications to committers.py
     6        https://bugs.webkit.org/show_bug.cgi?id=30084
     7
     8        * Scripts/bugzilla-tool:
     9         - Make commit-queue re-exec itself instead of using while(1).
     10         - Add a --is-relaunch parameter to commit-queue to bypass initialization on re-launch.
     11         - Add a _next_patch() method which calls exec() (and could eventually call update-webkit too).
     12
    1132009-10-22  Eric Seidel  <eric@webkit.org>
    214
  • trunk/WebKitTools/Scripts/bugzilla-tool

    r50104 r50105  
    650650    def __init__(self):
    651651        options = [
     652            make_option("--is-relaunch", action="store_true", dest="is_relaunch", default=False, help="Internal: Used by the queue to indicate that it's relaunching itself."),
    652653            make_option("--no-confirm", action="store_false", dest="confirm", default=True, help="Do not ask the user for confirmation before running the queue.  Dangerous!"),
    653654            make_option("--status-host", action="store", type="string", dest="status_host", default=StatusBot.default_host, help="Do not ask the user for confirmation before running the queue.  Dangerous!"),
     
    681682        return "%s Sleeping until %s (%s)." % (message, wake_time.strftime(cls.log_date_format), cls.sleep_duration_text)
    682683
    683     @classmethod
    684     def _sleep(cls, message):
    685         log(cls._sleep_message(message))
    686         time.sleep(cls.seconds_to_sleep)
     684    def _sleep(self, message):
     685        log(self._sleep_message(message))
     686        time.sleep(self.seconds_to_sleep)
     687        self._next_patch()
    687688
    688689    def _update_status_and_sleep(self, message):
     
    691692        log(status_message)
    692693        time.sleep(self.seconds_to_sleep)
     694        self._next_patch()
     695
     696    def _next_patch(self):
     697        # Re-exec this script to catch any updates to the script.
     698        # Make sure that the re-execed commit-queue does not wait for the user.
     699        args = sys.argv[:]
     700        if args.count("--is-relaunch") == 0:
     701            args.append("--is-relaunch")
     702        os.execvp(sys.argv[0], args)
    693703
    694704    @staticmethod
     
    711721
    712722    def execute(self, options, args, tool):
    713         log("CAUTION: commit-queue will discard all local changes in %s" % tool.scm().checkout_root)
    714         if options.confirm:
    715             response = raw_input("Are you sure?  Type 'yes' to continue: ")
    716             if (response != 'yes'):
    717                 error("User declined.")
     723        if not options.is_relaunch:
     724            log("CAUTION: commit-queue will discard all local changes in %s" % tool.scm().checkout_root)
     725            if options.confirm:
     726                response = raw_input("Are you sure?  Type 'yes' to continue: ")
     727                if (response != 'yes'):
     728                    error("User declined.")
    718729
    719730        queue_log = self._add_log_to_output_tee(self.queue_log_path)
    720         log("Running WebKit Commit Queue. %s" % datetime.now().strftime(self.log_date_format))
     731        if not options.is_relaunch:
     732            log("Running WebKit Commit Queue. %s" % datetime.now().strftime(self.log_date_format))
    721733
    722734        self.status_bot = StatusBot(host=options.status_host)
    723735
    724         while (True):
    725             # Either of these calls could throw URLError which shouldn't stop the queue.
    726             # We catch all exceptions just in case.
    727             try:
    728                 # Fetch patches instead of just bug ids to that we validate reviewer/committer flags on every patch.
    729                 patches = tool.bugs.fetch_patches_from_commit_queue(reject_invalid_patches=True)
    730                 if not len(patches):
    731                     self._update_status_and_sleep("Empty queue.")
    732                     continue
    733                 patch_ids = map(lambda patch: patch['id'], patches)
    734                 first_bug_id = patches[0]['bug_id']
    735                 log("%s in commit queue [%s]" % (pluralize('patch', len(patches)), ", ".join(patch_ids)))
    736 
    737                 red_builders_names = tool.buildbot.red_core_builders_names()
    738                 if red_builders_names:
    739                     red_builders_names = map(lambda name: '"%s"' % name, red_builders_names) # Add quotes around the names.
    740                     self._update_status_and_sleep("Builders [%s] are red. See http://build.webkit.org." % ", ".join(red_builders_names))
    741                     continue
    742 
    743                 self.status_bot.update_status("Landing patches from bug %s." % first_bug_id, bug_id=first_bug_id)
    744             except Exception, e:
    745                 # Don't try tell the status bot, in case telling it causes an exception.
    746                 self._sleep("Exception while checking queue and bots: %s." % e)
    747                 continue
    748 
    749             # Try to land patches on the first bug in the queue before looping
    750             bug_log_path = os.path.join(self.bug_logs_directory, "%s.log" % first_bug_id)
    751             bug_log = self._add_log_to_output_tee(bug_log_path)
    752             bugzilla_tool_path = __file__ # re-execute this script
    753             bugzilla_tool_args = [bugzilla_tool_path, 'land-patches', '--force-clean', '--commit-queue', '--quiet', first_bug_id]
    754             try:
    755                 WebKitLandingScripts.run_and_throw_if_fail(bugzilla_tool_args)
    756             except ScriptError, e:
    757                 # Unexpected failure!  Mark the patch as commit-queue- and comment in the bug.
    758                 # exit(2) is a special exit code we use to indicate that the error was already handled by land-patches and we should keep looping anyway.
    759                 if e.exit_code != 2:
    760                     tool.bugs.reject_patch_from_commit_queue(patch['id'], "Unexpected failure when landing patch!  Please file a bug against bugzilla-tool.\n%s" % e.message_with_output())
    761             self._remove_log_from_output_tee(bug_log)
    762 
    763         log("Finished WebKit Commit Queue. %s" % datetime.now().strftime(self.log_date_format))
    764         self._remove_log_from_output_tee(queue_log)
     736        # Either of these calls could throw URLError which shouldn't stop the queue.
     737        # We catch all exceptions just in case.
     738        try:
     739            # Fetch patches instead of just bug ids to that we validate reviewer/committer flags on every patch.
     740            patches = tool.bugs.fetch_patches_from_commit_queue(reject_invalid_patches=True)
     741            if not len(patches):
     742                self._update_status_and_sleep("Empty queue.")
     743            patch_ids = map(lambda patch: patch['id'], patches)
     744            first_bug_id = patches[0]['bug_id']
     745            log("%s in commit queue [%s]" % (pluralize('patch', len(patches)), ", ".join(patch_ids)))
     746
     747            red_builders_names = tool.buildbot.red_core_builders_names()
     748            if red_builders_names:
     749                red_builders_names = map(lambda name: '"%s"' % name, red_builders_names) # Add quotes around the names.
     750                self._update_status_and_sleep("Builders [%s] are red. See http://build.webkit.org." % ", ".join(red_builders_names))
     751
     752            self.status_bot.update_status("Landing patches from bug %s." % first_bug_id, bug_id=first_bug_id)
     753        except Exception, e:
     754            # Don't try tell the status bot, in case telling it causes an exception.
     755            self._sleep("Exception while checking queue and bots: %s." % e)
     756
     757        # Try to land patches on the first bug in the queue before looping
     758        bug_log_path = os.path.join(self.bug_logs_directory, "%s.log" % first_bug_id)
     759        bug_log = self._add_log_to_output_tee(bug_log_path)
     760        bugzilla_tool_path = __file__ # re-execute this script
     761        bugzilla_tool_args = [bugzilla_tool_path, 'land-patches', '--force-clean', '--commit-queue', '--quiet', first_bug_id]
     762        try:
     763            WebKitLandingScripts.run_and_throw_if_fail(bugzilla_tool_args)
     764        except ScriptError, e:
     765            # Unexpected failure!  Mark the patch as commit-queue- and comment in the bug.
     766            # exit(2) is a special exit code we use to indicate that the error was already handled by land-patches and we should keep looping anyway.
     767            if e.exit_code != 2:
     768                tool.bugs.reject_patch_from_commit_queue(patch['id'], "Unexpected failure when landing patch!  Please file a bug against bugzilla-tool.\n%s" % e.message_with_output())
     769        self._remove_log_from_output_tee(bug_log)
     770        # self._remove_log_from_output_tee(queue_log) # implicit in the exec()
     771        self._next_patch()
    765772
    766773
Note: See TracChangeset for help on using the changeset viewer.