← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Fix marshalling of builder file maps over XML-RPC

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398648

XML-RPC has no standard representation of OrderedDict; but we only care about the ordering for our own tests, so just turn that into a plain dict.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-py3-stable-file-map-ordering into launchpad:master.
diff --git a/lib/lp/buildmaster/interactor.py b/lib/lp/buildmaster/interactor.py
index 5cb6cb2..c0afe10 100644
--- a/lib/lp/buildmaster/interactor.py
+++ b/lib/lp/buildmaster/interactor.py
@@ -8,7 +8,10 @@ __all__ = [
     'extract_vitals_from_db',
     ]
 
-from collections import namedtuple
+from collections import (
+    namedtuple,
+    OrderedDict,
+    )
 import logging
 import os.path
 import sys
@@ -315,6 +318,8 @@ class BuilderSlave(object):
         :param args: A dictionary of extra arguments. The contents depend on
             the build job type.
         """
+        if isinstance(filemap, OrderedDict):
+            filemap = dict(filemap)
         return self._with_timeout(self._server.callRemote(
             'build', buildid, builder_type, chroot_sha1, filemap, args))
 
diff --git a/lib/lp/buildmaster/tests/mock_slaves.py b/lib/lp/buildmaster/tests/mock_slaves.py
index 260980d..6fb0049 100644
--- a/lib/lp/buildmaster/tests/mock_slaves.py
+++ b/lib/lp/buildmaster/tests/mock_slaves.py
@@ -21,6 +21,7 @@ __all__ = [
     'WaitingSlave',
     ]
 
+from collections import OrderedDict
 import os
 import sys
 
@@ -360,5 +361,8 @@ class SlaveTestHelpers(fixtures.Fixture):
             'ogrecomponent': 'main',
             }
         return slave.build(
-            build_id, 'binarypackage', chroot_file, {'.dsc': dsc_file},
-            extra_args)
+            build_id, 'binarypackage', chroot_file,
+            # Although a single-element dict obviously has stable ordering,
+            # we use an OrderedDict anyway to test that BuilderSlave
+            # serializes it correctly over XML-RPC.
+            OrderedDict([('.dsc', dsc_file)]), extra_args)