summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-12 08:04:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-13 13:41:32 +0100
commitca824a976a131d0955f61cff3df9711efd10de63 (patch)
tree3259bcdb199b0de7f74e4ae115e400fc5bc14d4a
parentef4a7c30caa294969cd99222f80e1948cc24b2e5 (diff)
downloadpoky-ca824a976a131d0955f61cff3df9711efd10de63.tar.gz
bitbake: fetch: Use OrderedDict for url parameters
Without this, the dict can reorder causing sanity test failures. (Bitbake rev: ca8c91acc9396385834b266d4e8b84d917e5e298) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py5
-rw-r--r--bitbake/lib/bb/tests/fetch.py11
2 files changed, 9 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 600e2161fe..7d2f3504c8 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -32,6 +32,7 @@ import signal
32import logging 32import logging
33import urllib 33import urllib
34import urlparse 34import urlparse
35import collections
35import bb.persist_data, bb.utils 36import bb.persist_data, bb.utils
36import bb.checksum 37import bb.checksum
37from bb import data 38from bb import data
@@ -297,7 +298,7 @@ class URI(object):
297 if self.query else '') 298 if self.query else '')
298 299
299 def _param_str_split(self, string, elmdelim, kvdelim="="): 300 def _param_str_split(self, string, elmdelim, kvdelim="="):
300 ret = {} 301 ret = collections.OrderedDict()
301 for k, v in [x.split(kvdelim, 1) for x in string.split(elmdelim)]: 302 for k, v in [x.split(kvdelim, 1) for x in string.split(elmdelim)]:
302 ret[k] = v 303 ret[k] = v
303 return ret 304 return ret
@@ -390,7 +391,7 @@ def decodeurl(url):
390 user = '' 391 user = ''
391 pswd = '' 392 pswd = ''
392 393
393 p = {} 394 p = collections.OrderedDict()
394 if parm: 395 if parm:
395 for s in parm.split(';'): 396 for s in parm.split(';'):
396 if s: 397 if s:
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index cba783f5ab..5ff156ccdd 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -22,6 +22,7 @@
22import unittest 22import unittest
23import tempfile 23import tempfile
24import subprocess 24import subprocess
25import collections
25import os 26import os
26from bb.fetch2 import URI 27from bb.fetch2 import URI
27from bb.fetch2 import FetchMethod 28from bb.fetch2 import FetchMethod
@@ -133,10 +134,10 @@ class URITest(unittest.TestCase):
133 'userinfo': 'anoncvs:anonymous', 134 'userinfo': 'anoncvs:anonymous',
134 'username': 'anoncvs', 135 'username': 'anoncvs',
135 'password': 'anonymous', 136 'password': 'anonymous',
136 'params': { 137 'params': collections.OrderedDict([
137 'tag': 'V0-99-81', 138 ('tag', 'V0-99-81'),
138 'module': 'familiar/dist/ipkg' 139 ('module', 'familiar/dist/ipkg')
139 }, 140 ]),
140 'query': {}, 141 'query': {},
141 'relative': False 142 'relative': False
142 }, 143 },
@@ -660,7 +661,7 @@ class URLHandle(unittest.TestCase):
660 datatable = { 661 datatable = {
661 "http://www.google.com/index.html" : ('http', 'www.google.com', '/index.html', '', '', {}), 662 "http://www.google.com/index.html" : ('http', 'www.google.com', '/index.html', '', '', {}),
662 "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'}), 663 "cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'}),
663 "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', {'tag': 'V0-99-81', 'module': 'familiar/dist/ipkg'}), 664 "cvs://anoncvs:anonymous@cvs.handhelds.org/cvs;tag=V0-99-81;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', 'anonymous', collections.OrderedDict([('tag', 'V0-99-81'), ('module', 'familiar/dist/ipkg')])),
664 "git://git.openembedded.org/bitbake;branch=@foo" : ('git', 'git.openembedded.org', '/bitbake', '', '', {'branch': '@foo'}), 665 "git://git.openembedded.org/bitbake;branch=@foo" : ('git', 'git.openembedded.org', '/bitbake', '', '', {'branch': '@foo'}),
665 "file://somelocation;someparam=1": ('file', '', 'somelocation', '', '', {'someparam': '1'}), 666 "file://somelocation;someparam=1": ('file', '', 'somelocation', '', '', {'someparam': '1'}),
666 } 667 }