← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-stable-file-map-ordering into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-stable-file-map-ordering into launchpad:master.

Commit message:
Stabilize file map ordering when dispatching to builders

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398547
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-stable-file-map-ordering into launchpad:master.
diff --git a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
index 63b67a7..8fab8ae 100644
--- a/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/model/buildfarmjobbehaviour.py
@@ -9,6 +9,7 @@ __all__ = [
     'BuildFarmJobBehaviourBase',
     ]
 
+from collections import OrderedDict
 from datetime import datetime
 import gzip
 import logging
@@ -133,7 +134,7 @@ class BuildFarmJobBehaviourBase:
         chroot = pocket_chroot.chroot
         args["image_type"] = pocket_chroot.image_type.name.lower()
 
-        filename_to_sha1 = {}
+        filename_to_sha1 = OrderedDict()
         dl = []
         dl.append(self._slave.sendFileToSlave(
             logger=logger, url=chroot.http_url, sha1=chroot.content.sha1))
diff --git a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
index baf8884..dd3a313 100644
--- a/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
+++ b/lib/lp/buildmaster/tests/test_buildfarmjobbehaviour.py
@@ -7,6 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
 
 __metaclass__ = type
 
+from collections import OrderedDict
 from datetime import datetime
 import hashlib
 import os
@@ -164,11 +165,12 @@ class TestDispatchBuildToSlave(StatsMixin, TestCase):
     run_tests_with = AsynchronousDeferredRunTest
 
     def makeBehaviour(self, das):
-        files = {
-            'foo.dsc': {'url': 'http://host/foo.dsc', 'sha1': '0'},
-            'bar.tar': {
+        files = OrderedDict([
+            ('foo.dsc', {'url': 'http://host/foo.dsc', 'sha1': '0'}),
+            ('bar.tar', {
                 'url': 'http://host/bar.tar', 'sha1': '0',
-                'username': 'admin', 'password': 'sekrit'}}
+                'username': 'admin', 'password': 'sekrit'}),
+            ])
 
         behaviour = BuildFarmJobBehaviourBase(FakeBuildFarmJob())
         behaviour.composeBuildRequest = FakeMethod(
@@ -182,8 +184,8 @@ class TestDispatchBuildToSlave(StatsMixin, TestCase):
         expected_calls = [
             ('ensurepresent',
              'http://librarian.test/%s' % chroot_filename, '', ''),
-            ('ensurepresent', 'http://host/bar.tar', 'admin', 'sekrit'),
             ('ensurepresent', 'http://host/foo.dsc', '', ''),
+            ('ensurepresent', 'http://host/bar.tar', 'admin', 'sekrit'),
             ('build', 'PACKAGEBUILD-1', 'foobuild',
              hashlib.sha1(six.ensure_binary(chroot_filename)).hexdigest(),
              ['foo.dsc', 'bar.tar'],
diff --git a/lib/lp/soyuz/model/binarypackagebuildbehaviour.py b/lib/lp/soyuz/model/binarypackagebuildbehaviour.py
index afb1df9..3ff5603 100644
--- a/lib/lp/soyuz/model/binarypackagebuildbehaviour.py
+++ b/lib/lp/soyuz/model/binarypackagebuildbehaviour.py
@@ -9,6 +9,8 @@ __all__ = [
     'BinaryPackageBuildBehaviour',
     ]
 
+from collections import OrderedDict
+
 from twisted.internet import defer
 from zope.interface import implementer
 
@@ -71,7 +73,7 @@ class BinaryPackageBuildBehaviour(BuildFarmJobBehaviourBase):
                 makePoolPath(
                     self.build.source_package_release.sourcepackagename.name,
                     self.build.current_component.name))
-        filemap = {}
+        filemap = OrderedDict()
         for source_file in self.build.source_package_release.files:
             lfa = source_file.libraryfile
             if not self.build.archive.private: