Merging bugs 614946 and 615559 onto the production-0.8 branch. production-0.8 FIREFOX_4_0b8_BUILD1 FIREFOX_4_0b8_RELEASE
authorBen Hearsum <bhearsum@mozilla.com>
Tue, 07 Dec 2010 08:51:51 -0500
branchproduction-0.8
changeset 113 2f860bd9bc2ce712445405edbd32489fc9545da9
parent 110 fb22c62a98564e75b1bfdbf1743f426a8d81ac8c (current diff)
parent 112 c901b723778d97cbb46aeb9e414355073410ffb9 (diff)
child 117 040624a5e5f282714bcc065fb08dd7ebd00ba82d
push id45
push userbhearsum@mozilla.com
push dateTue, 07 Dec 2010 14:27:08 +0000
bugs614946, 615559
Merging bugs 614946 and 615559 onto the production-0.8 branch.
--- a/master/buildbot/process/builder.py
+++ b/master/buildbot/process/builder.py
@@ -386,16 +386,17 @@ class Builder(pb.Referenceable, service.
         self.nextBuild = setup.get('nextBuild')
         if self.nextBuild is not None and not callable(self.nextBuild):
             raise ValueError("nextBuild must be callable")
         self.buildHorizon = setup.get('buildHorizon')
         self.logHorizon = setup.get('logHorizon')
         self.eventHorizon = setup.get('eventHorizon')
         self.mergeRequests = setup.get('mergeRequests', True)
         self.properties = setup.get('properties', {})
+        self.category = setup.get('category', None)
 
         # build/wannabuild slots: Build objects move along this sequence
         self.building = []
         # old_building holds active builds that were stolen from a predecessor
         self.old_building = weakref.WeakKeyDictionary()
 
         # buildslaves which have connected but which are not yet available.
         # These are always in the ATTACHING state.
@@ -451,16 +452,19 @@ class Builder(pb.Referenceable, service.
         if setup.get('nextBuild') != self.nextBuild:
             diffs.append('nextBuild changed from %s to %s' % (self.nextBuild, setup.get('nextBuild')))
         if setup['buildHorizon'] != self.buildHorizon:
             diffs.append('buildHorizon changed from %s to %s' % (self.buildHorizon, setup['buildHorizon']))
         if setup['logHorizon'] != self.logHorizon:
             diffs.append('logHorizon changed from %s to %s' % (self.logHorizon, setup['logHorizon']))
         if setup['eventHorizon'] != self.eventHorizon:
             diffs.append('eventHorizon changed from %s to %s' % (self.eventHorizon, setup['eventHorizon']))
+        if setup['category'] != self.category:
+            diffs.append('category changed from %r to %r' % (self.category, setup['category']))
+
         return diffs
 
     def __repr__(self):
         return "<Builder '%r' at %d>" % (self.name, id(self))
 
     def triggerNewBuildCheck(self):
         self.botmaster.triggerNewBuildCheck()
 
@@ -610,16 +614,20 @@ class Builder(pb.Referenceable, service.
         it wants."""
 
         log.msg("consumeTheSoulOfYourPredecessor: %s feeding upon %s" %
                 (self, old))
         # all pending builds are stored in the DB, so we don't have to do
         # anything to claim them. The old builder will be stopService'd,
         # which should make sure they don't start any new work
 
+        # this is kind of silly, but the builder status doesn't get updated
+        # when the config changes, yet it stores the category.  So:
+        self.builder_status.category = self.category
+
         # old.building (i.e. builds which are still running) is not migrated
         # directly: it keeps track of builds which were in progress in the
         # old Builder. When those builds finish, the old Builder will be
         # notified, not us. However, since the old SlaveBuilder will point to
         # us, it is our maybeStartBuild() that will be triggered.
         if old.building:
             self.builder_status.setBigState("building")
         # however, we do grab a weakref to the active builds, so that our
--- a/master/buildbot/schedulers/basic.py
+++ b/master/buildbot/schedulers/basic.py
@@ -136,39 +136,44 @@ class Scheduler(base.BaseScheduler, base
             self.stableAt = most_recent + self.treeStableTimer
             if self.stableAt > now:
                 # Wake up one second late, to avoid waking up too early and
                 # looping a lot.
                 return self.stableAt + 1.0
 
         # ok, do a build
         self.stableAt = None
-        self._add_build_and_remove_changes(t, all_changes)
+        self._add_build_and_remove_changes(t, important, unimportant)
         return None
 
-    def _add_build_and_remove_changes(self, t, all_changes):
-        # all_changes is segregated into important and unimportant
+    def _add_build_and_remove_changes(self, t, important, unimportant):
+        # the changes are segregated into important and unimportant
         # changes, but we need it ordered earliest to latest, based
         # on change number, since the SourceStamp will be created
         # based on the final change.
-        all_changes.sort(key=lambda c : c.number)
+        all_changes = sorted(important + unimportant, key=lambda c : c.number)
 
         db = self.parent.db
         if self.treeStableTimer is None:
-            # each Change gets a separate build
-            for c in all_changes:
+            # each *important* Change gets a separate build.  Unimportant
+            # builds get ignored.
+            for c in sorted(important, key=lambda c : c.number):
                 ss = SourceStamp(changes=[c])
                 ssid = db.get_sourcestampid(ss, t)
                 self.create_buildset(ssid, "scheduler", t)
         else:
+            # if we had a treeStableTimer, then trigger a build for the
+            # whole pile - important or not.  There's at least one important
+            # change in the list, or we wouldn't have gotten here.
             ss = SourceStamp(changes=all_changes)
             ssid = db.get_sourcestampid(ss, t)
             self.create_buildset(ssid, "scheduler", t)
 
-        # and finally retire the changes from scheduler_changes
+        # and finally retire all of the changes from scheduler_changes, regardless
+        # of importance level
         changeids = [c.number for c in all_changes]
         db.scheduler_retire_changes(self.schedulerid, changeids, t)
 
     # the waterfall needs to know the next time we plan to trigger a build
     def getPendingBuildTimes(self):
         if self.stableAt and self.stableAt > util.now():
             return [ self.stableAt ]
         return []