From 960792b9fd0e11b16efdc0b538231288b8727862 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 8 Oct 2012 19:01:45 -0700 Subject: [PATCH] _parse_uri_map: preserve order of URIs Returns a dict of tuples instead of a dict of sets. --- pym/portage/dbapi/porttree.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index dba0ef53d..a5945be59 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -1138,9 +1138,14 @@ def _parse_uri_map(cpv, metadata, use=None): uri_set = uri_map.get(distfile) if uri_set is None: - uri_set = set() + # Use OrderedDict to preserve order from SRC_URI + # while ensuring uniqueness. + uri_set = OrderedDict() uri_map[distfile] = uri_set - uri_set.add(uri) - uri = None + uri_set[uri] = True + + # Convert OrderedDicts to tuples. + for k, v in uri_map.items(): + uri_map[k] = tuple(v) return uri_map -- 2.26.2